Fix <rdar://5698502> Inspector window reverts to default position/size unexp...
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2008 21:08:15 +0000 (21:08 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2008 21:08:15 +0000 (21:08 +0000)
         Reviewed by Hyatt.

         * WebInspectorClient.cpp:
         (defaultWindowRect): Added.
         (WebInspectorClient::createPage):
             - Use defaultWindowRect() to set the initial size/position of the
               Inspector window.
             - Pass the Inspector window's client rect to
               IWebView::initWithFrame so that the WebView will be initially
               sized to fill the window.
         (WebInspectorClient::showWindow): Don't move/resize the window back to
         the defaults every time this method is called.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29747 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/win/ChangeLog
WebKit/win/WebInspectorClient.cpp

index 496d2f3..99fd636 100644 (file)
@@ -1,5 +1,22 @@
 2008-01-23  Adam Roben  <aroben@apple.com>
 
+        Fix <rdar://5698502> Inspector window reverts to default position/size unexpectedly
+
+        Reviewed by Hyatt.
+
+        * WebInspectorClient.cpp:
+        (defaultWindowRect): Added.
+        (WebInspectorClient::createPage):
+            - Use defaultWindowRect() to set the initial size/position of the
+              Inspector window.
+            - Pass the Inspector window's client rect to
+              IWebView::initWithFrame so that the WebView will be initially
+              sized to fill the window.
+        (WebInspectorClient::showWindow): Don't move/resize the window back to
+        the defaults every time this method is called.
+
+2008-01-23  Adam Roben  <aroben@apple.com>
+
         Fix <rdar://5700620> REGRESSION (r28190): "Open frame in new tab" instead of "Open link in new tab" @ digg.com
 
         Test: fast/events/contextmenu-scrolled-page-with-frame.html
index bc71d7d..a1917c5 100644 (file)
@@ -57,6 +57,12 @@ static LPCTSTR kWebInspectorPointerProp = TEXT("WebInspectorPointer");
 
 static const unsigned defaultAttachedHeight = 300;
 
+static const IntRect& defaultWindowRect()
+{
+    static IntRect rect(60, 200, 750, 650);
+    return rect;
+}
+
 WebInspectorClient::WebInspectorClient(WebView* webView)
     : m_inspectedWebView(webView)
     , m_hwnd(0)
@@ -95,8 +101,9 @@ Page* WebInspectorClient::createPage()
     registerWindowClass();
 
     m_hwnd = ::CreateWindowEx(0, kWebInspectorWindowClassName, 0, WS_OVERLAPPEDWINDOW,
-                              0, 0, 0, 0,
-                              0, 0, 0, 0);
+        defaultWindowRect().x(), defaultWindowRect().y(), defaultWindowRect().width(), defaultWindowRect().height(),
+        0, 0, 0, 0);
+
     if (!m_hwnd)
         return 0;
 
@@ -107,7 +114,8 @@ Page* WebInspectorClient::createPage()
     if (FAILED(m_webView->setHostWindow((OLE_HANDLE)(ULONG64)m_hwnd)))
         return 0;
 
-    RECT rect = {0};
+    RECT rect;
+    GetClientRect(m_hwnd, &rect);
     if (FAILED(m_webView->initWithFrame(rect, 0, 0)))
         return 0;
 
@@ -146,7 +154,7 @@ void WebInspectorClient::showWindow()
         return;
 
     updateWindowTitle();
-    ::SetWindowPos(m_hwnd, HWND_TOP, 60, 200, 750, 650, SWP_SHOWWINDOW);
+    ::SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
     m_inspectedWebView->page()->inspectorController()->setWindowVisible(true);
 }