Title: [151403] trunk/Source/WebKit2
Revision
151403
Author
[email protected]
Date
2013-06-10 14:32:35 -0700 (Mon, 10 Jun 2013)

Log Message

-[WKView _updateWindowAndViewFrames] should avoid updating the view frame in window coordinates if we don't have plugins
https://bugs.webkit.org/show_bug.cgi?id=117420
<rdar://problem/14073034>

Reviewed by Tim Horton.

If plug-ins are disabled there's no need for the web process to know about the view frame in window coordinates so only
send it when plug-ins are enabled. In addition, if accessibility is disabled we don't need to send a message at all.

* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::preferencesDidChange):
Call through to -[WKView _preferencesDidChange].

* UIProcess/API/mac/WKView.mm:
(-[WKView _updateWindowAndViewFrames]):
Don't compute viewFrameInWindowCoordinates or accessibilityPosition unless they're required. If neither are required,
don't even send a message to the web process.

(-[WKView _preferencesDidChange]):
Update _needsViewFrameInWindowCoordinates and call -[WKView _updateWindowAndViewFrames] if needed.

(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
Set _needsViewFrameInWindowCoordinates based on whether plug-ins are enabled or not.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::preferencesDidChange):
Call the page client.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (151402 => 151403)


--- trunk/Source/WebKit2/ChangeLog	2013-06-10 21:23:45 UTC (rev 151402)
+++ trunk/Source/WebKit2/ChangeLog	2013-06-10 21:32:35 UTC (rev 151403)
@@ -1,3 +1,34 @@
+2013-06-10  Anders Carlsson  <[email protected]>
+
+        -[WKView _updateWindowAndViewFrames] should avoid updating the view frame in window coordinates if we don't have plugins
+        https://bugs.webkit.org/show_bug.cgi?id=117420
+        <rdar://problem/14073034>
+
+        Reviewed by Tim Horton.
+
+        If plug-ins are disabled there's no need for the web process to know about the view frame in window coordinates so only
+        send it when plug-ins are enabled. In addition, if accessibility is disabled we don't need to send a message at all.
+
+        * UIProcess/API/mac/PageClientImpl.h:
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::preferencesDidChange):
+        Call through to -[WKView _preferencesDidChange].
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _updateWindowAndViewFrames]):
+        Don't compute viewFrameInWindowCoordinates or accessibilityPosition unless they're required. If neither are required,
+        don't even send a message to the web process.
+
+        (-[WKView _preferencesDidChange]):
+        Update _needsViewFrameInWindowCoordinates and call -[WKView _updateWindowAndViewFrames] if needed.
+
+        (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
+        Set _needsViewFrameInWindowCoordinates based on whether plug-ins are enabled or not.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::preferencesDidChange):
+        Call the page client.
+
 2013-06-10  Bear Travis  <[email protected]>
 
         [CSS Shapes][CSS Exclusions] Split CSS Exclusions and CSS Shapes code

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (151402 => 151403)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2013-06-10 21:23:45 UTC (rev 151402)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2013-06-10 21:32:35 UTC (rev 151403)
@@ -68,6 +68,7 @@
     virtual void processDidCrash();
     virtual void pageClosed();
     virtual void didRelaunchProcess();
+    virtual void preferencesDidChange() OVERRIDE;
     virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
     virtual void setCursor(const WebCore::Cursor&);
     virtual void setCursorHiddenUntilMouseMoves(bool);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (151402 => 151403)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2013-06-10 21:23:45 UTC (rev 151402)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2013-06-10 21:32:35 UTC (rev 151403)
@@ -258,6 +258,11 @@
     [m_wkView _didRelaunchProcess];
 }
 
+void PageClientImpl::preferencesDidChange()
+{
+    [m_wkView _preferencesDidChange];
+}
+
 void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip)
 {
     [m_wkView _toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)];

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (151402 => 151403)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-06-10 21:23:45 UTC (rev 151402)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-06-10 21:32:35 UTC (rev 151403)
@@ -62,7 +62,9 @@
 #import "WebEventFactory.h"
 #import "WebFullScreenManagerProxy.h"
 #import "WebPage.h"
+#import "WebPageGroup.h"
 #import "WebPageProxy.h"
+#import "WebPreferences.h"
 #import "WebProcessProxy.h"
 #import "WebSystemInterface.h"
 #import <QuartzCore/QuartzCore.h>
@@ -216,6 +218,7 @@
 
     BOOL _viewInWindowChangeWasDeferred;
 
+    BOOL _needsViewFrameInWindowCoordinates;
     BOOL _didScheduleWindowAndViewFrameUpdate;
 
     // Whether the containing window of the WKView has a valid backing store.
@@ -466,13 +469,21 @@
     _data->_didScheduleWindowAndViewFrameUpdate = YES;
 
     dispatch_async(dispatch_get_main_queue(), ^{
-        NSRect viewFrameInWindowCoordinates = [self convertRect:[self frame] toView:nil];
-        NSPoint accessibilityPosition = NSMakePoint(0, 0);
+        _data->_didScheduleWindowAndViewFrameUpdate = NO;
+
+        if (!_data->_needsViewFrameInWindowCoordinates && !WebCore::AXObjectCache::accessibilityEnabled())
+            return;
+
+        NSRect viewFrameInWindowCoordinates = NSZeroRect;
+        NSPoint accessibilityPosition = NSZeroPoint;
+
+        if (_data->_needsViewFrameInWindowCoordinates)
+            viewFrameInWindowCoordinates = [self convertRect:self.frame toView:nil];
+
         if (WebCore::AXObjectCache::accessibilityEnabled())
             accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
 
         _data->_page->windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
-        _data->_didScheduleWindowAndViewFrameUpdate = NO;
     });
 }
 
@@ -2424,6 +2435,18 @@
     [self _accessibilityRegisterUIProcessTokens];
 }
 
+- (void)_preferencesDidChange
+{
+    BOOL needsViewFrameInWindowCoordinates = _data->_page->pageGroup()->preferences()->pluginsEnabled();
+
+    if (!!needsViewFrameInWindowCoordinates == !!_data->_needsViewFrameInWindowCoordinates)
+        return;
+
+    _data->_needsViewFrameInWindowCoordinates = needsViewFrameInWindowCoordinates;
+    if ([self window])
+        [self _updateWindowAndViewFrames];
+}
+
 - (void)_setCursor:(NSCursor *)cursor
 {
     if ([NSCursor currentCursor] == cursor)
@@ -3127,6 +3150,7 @@
     _data->_windowOcclusionDetectionEnabled = YES;
 #endif
 
+    _data->_needsViewFrameInWindowCoordinates = _data->_page->pageGroup()->preferences()->pluginsEnabled();
     _data->_frameOrigin = NSZeroPoint;
     _data->_contentAnchor = WKContentAnchorTopLeft;
     

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (151402 => 151403)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2013-06-10 21:23:45 UTC (rev 151402)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2013-06-10 21:32:35 UTC (rev 151403)
@@ -55,6 +55,7 @@
 - (void)_processDidCrash;
 - (void)_pageClosed;
 - (void)_didRelaunchProcess;
+- (void)_preferencesDidChange;
 - (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip;
 - (void)_setCursor:(NSCursor *)cursor;
 - (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState;

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (151402 => 151403)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2013-06-10 21:23:45 UTC (rev 151402)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2013-06-10 21:32:35 UTC (rev 151403)
@@ -112,6 +112,8 @@
     virtual void didRelaunchProcess() = 0;
     virtual void pageClosed() = 0;
 
+    virtual void preferencesDidChange() = 0;
+
     virtual void toolTipChanged(const String&, const String&) = 0;
 
 #if USE(TILED_BACKING_STORE)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (151402 => 151403)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-06-10 21:23:45 UTC (rev 151402)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-06-10 21:32:35 UTC (rev 151403)
@@ -2145,6 +2145,8 @@
 
     m_process->pagePreferencesChanged(this);
 
+    m_pageClient->preferencesDidChange();
+
     // FIXME: It probably makes more sense to send individual preference changes.
     // However, WebKitTestRunner depends on getting a preference change notification
     // even if nothing changed in UI process, so that overrides get removed.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to