* Mono.Mozilla/WebBrowser.cs: Do delayed resizing, when the resize happens
authorAndreia Gaita <avidigal@novell.com>
Sun, 23 Nov 2008 15:21:19 +0000 (15:21 -0000)
committerAndreia Gaita <avidigal@novell.com>
Sun, 23 Nov 2008 15:21:19 +0000 (15:21 -0000)
before a window is created. Fix the window getter so it gets the top content
window if no window is focused.

2008-11-23  Andreia Gaita <shana@jitted.com>

svn path=/trunk/mcs/; revision=119745

mcs/class/Mono.WebBrowser/ChangeLog
mcs/class/Mono.WebBrowser/Mono.Mozilla/WebBrowser.cs

index 1a4d7d655f5e851ecd3f5daea70095b5830c84dc..7884a1df29b65a89d7dca5f4ce5ecb8c857ef0e1 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-23  Andreia Gaita <shana@jitted.com>
+
+       * Mono.Mozilla/WebBrowser.cs: Do delayed resizing, when the resize happens 
+       before a window is created. Fix the window getter so it gets the top content
+       window if no window is focused.
+
 2008-11-23  Andreia Gaita <shana@jitted.com>
 
        * Mono.Mozilla/Callback.cs: Send NS_BINDING_ABORTED code for a cancelled request.
index aaae0d89a7c36f2306351af34a4265fe097ee241..41a603a1eee3d020e78f84a6cf1b809ba567cbb7 100644 (file)
@@ -56,6 +56,10 @@ namespace Mono.Mozilla
                bool streamingMode;
                
                internal Hashtable documents;
+
+               int width;
+               int height;
+               bool isDirty;
                
                public WebBrowser (Platform platform)
                {
@@ -76,6 +80,10 @@ namespace Mono.Mozilla
                                if (!creating && !created) {
                                        creating = true;
                                        created = Base.Create (this);
+                                       if (created && isDirty) {
+                                               isDirty = false;
+                                               Base.Resize (this, width, height);
+                                       }
                                }
                                return created;
                        }
@@ -104,7 +112,10 @@ namespace Mono.Mozilla
                                        nsIWebBrowserFocus webBrowserFocus = (nsIWebBrowserFocus) (navigation.navigation);
                                        nsIDOMWindow window;
                                        webBrowserFocus.getFocusedWindow (out window);
-                                       return new DOM.Window (this, window) as IWindow;
+                                       if (window == null)
+                                               ((nsIWebBrowser) navigation.navigation).getContentDOMWindow (out window);
+                                       if (window != null)
+                                               return new DOM.Window (this, window) as IWindow;
                                }
                                return null;
                        }
@@ -284,6 +295,9 @@ namespace Mono.Mozilla
 
                public void Resize (int width, int height)
                {
+                       this.width = width;
+                       this.height = height;
+                       isDirty = true;
                        if (!created) return;
                        Base.Resize (this, width, height);                      
                }