From 314c44dc552d840720773e9d5725bb741e5fc1a7 Mon Sep 17 00:00:00 2001 From: "timothy@apple.com" Date: Sat, 21 Jan 2012 08:42:55 +0000 Subject: [PATCH] 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. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105571 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit2/ChangeLog | 15 +++++++++++++++ Source/WebKit2/Shared/WebPreferencesStore.h | 1 + Source/WebKit2/UIProcess/WebInspectorProxy.cpp | 1 + Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm | 9 ++++++--- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 69e5b57..b11cffc 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,18 @@ +2012-01-21 Timothy Hatcher + + 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 [Qt] [WK2] Division by zero error in QtViewportInteractionEngine::setItemRectVisible diff --git a/Source/WebKit2/Shared/WebPreferencesStore.h b/Source/WebKit2/Shared/WebPreferencesStore.h index 21da281..531e181 100644 --- a/Source/WebKit2/Shared/WebPreferencesStore.h +++ b/Source/WebKit2/Shared/WebPreferencesStore.h @@ -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) diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp index a7057e0..825420a 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp @@ -148,6 +148,7 @@ void WebInspectorProxy::detach() void WebInspectorProxy::setAttachedWindowHeight(unsigned height) { + inspectorPageGroup()->preferences()->setInspectorAttachedHeight(height); platformSetAttachedWindowHeight(height); } diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm index 26410bc..d43a2ac 100644 --- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm @@ -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 #import @@ -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 -- 2.7.4