Make WebKit2 remember the height of the Web Inspector when it is docked.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Jan 2012 08:42:55 +0000 (08:42 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Jan 2012 08:42:55 +0000 (08:42 +0000)
https://webkit.org/b/76769

Reviewed by Dan Bernstein.

* Shared/WebPreferencesStore.h: Added InspectorAttachedHeight.
* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::setAttachedWindowHeight): Call WebPreferencesStore::setInspectorAttachedHeight.
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformAttach): Set the height of the inspector's WKView to inspectorAttachedHeight.
(WebKit::WebInspectorProxy::platformSetAttachedWindowHeight): Remove unneeded setNeedsDisplay: calls.

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesStore.h
Source/WebKit2/UIProcess/WebInspectorProxy.cpp
Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm

index 69e5b57..b11cffc 100644 (file)
@@ -1,3 +1,18 @@
+2012-01-21  Timothy Hatcher  <timothy@apple.com>
+
+        Make WebKit2 remember the height of the Web Inspector when it is docked.
+
+        https://webkit.org/b/76769
+
+        Reviewed by Dan Bernstein.
+
+        * Shared/WebPreferencesStore.h: Added InspectorAttachedHeight.
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::setAttachedWindowHeight): Call WebPreferencesStore::setInspectorAttachedHeight.
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::platformAttach): Set the height of the inspector's WKView to inspectorAttachedHeight.
+        (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight): Remove unneeded setNeedsDisplay: calls.
+
 2012-01-20  Viatcheslav Ostapenko  <ostapenko.viatcheslav@nokia.com>
 
         [Qt] [WK2] Division by zero error in QtViewportInteractionEngine::setItemRectVisible
index 21da281..531e181 100644 (file)
@@ -129,6 +129,7 @@ namespace WebKit {
     macro(DeviceHeight, deviceHeight, UInt32, uint32_t, 854) \
     macro(PDFDisplayMode, pdfDisplayMode, UInt32, uint32_t, 1) \
     macro(EditableLinkBehavior, editableLinkBehavior, UInt32, uint32_t, WebCore::EditableLinkNeverLive) \
+    macro(InspectorAttachedHeight, inspectorAttachedHeight, UInt32, uint32_t, 300) \
     \
 
 #if PLATFORM(WIN)
index a7057e0..825420a 100644 (file)
@@ -148,6 +148,7 @@ void WebInspectorProxy::detach()
 
 void WebInspectorProxy::setAttachedWindowHeight(unsigned height)
 {
+    inspectorPageGroup()->preferences()->setInspectorAttachedHeight(height);
     platformSetAttachedWindowHeight(height);
 }
 
index 26410bc..d43a2ac 100644 (file)
@@ -32,7 +32,9 @@
 #import "WebContext.h"
 #import "WKInspectorMac.h"
 #import "WKViewPrivate.h"
+#import "WebPageGroup.h"
 #import "WebPageProxy.h"
+#import "WebPreferences.h"
 #import "WebProcessProxy.h"
 #import <WebKitSystemInterface.h>
 #import <WebCore/InspectorFrontendClientLocal.h>
@@ -207,6 +209,10 @@ void WebInspectorProxy::platformAttach()
 
     [m_inspectorView.get() removeFromSuperview];
 
+    // The inspector view shares the width and the left starting point of the inspected view.
+    NSRect inspectedViewFrame = [inspectedView frame];
+    [m_inspectorView.get() setFrame:NSMakeRect(NSMinX(inspectedViewFrame), 0, NSWidth(inspectedViewFrame), inspectorPageGroup()->preferences()->inspectorAttachedHeight())];
+
     [[inspectedView superview] addSubview:m_inspectorView.get() positioned:NSWindowBelow relativeTo:inspectedView];
 
     [m_inspectorWindow.get() orderOut:nil];
@@ -249,9 +255,6 @@ void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned height)
     [m_inspectorView.get() setFrame:NSMakeRect(NSMinX(inspectedViewFrame), 0.0, NSWidth(inspectedViewFrame), height)];
 
     inspectedViewFrameDidChange();
-
-    [m_inspectorView.get() setNeedsDisplay:YES];
-    [inspectedView setNeedsDisplay:YES];
 }
 
 String WebInspectorProxy::inspectorPageURL() const