Title: [151344] trunk/Source/WebKit2
Revision
151344
Author
[email protected]
Date
2013-06-07 17:11:34 -0700 (Fri, 07 Jun 2013)

Log Message

Coalesce multiple calls to WebPageProxy::windowAndViewFramesChanged
https://bugs.webkit.org/show_bug.cgi?id=117364
<rdar://problem/14042099>

Reviewed by Geoffrey Garen.

-[WKView _updateWindowAndViewFrames] can be called many times per run loop iteration so coalesce calls
to WebPageProxy::windowAndViewFrames using dispatch_async.

* UIProcess/API/mac/WKView.mm:
(-[WKView _updateWindowAndViewFrames]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (151343 => 151344)


--- trunk/Source/WebKit2/ChangeLog	2013-06-08 00:05:52 UTC (rev 151343)
+++ trunk/Source/WebKit2/ChangeLog	2013-06-08 00:11:34 UTC (rev 151344)
@@ -1,3 +1,17 @@
+2013-06-07  Anders Carlsson  <[email protected]>
+
+        Coalesce multiple calls to WebPageProxy::windowAndViewFramesChanged
+        https://bugs.webkit.org/show_bug.cgi?id=117364
+        <rdar://problem/14042099>
+
+        Reviewed by Geoffrey Garen.
+
+        -[WKView _updateWindowAndViewFrames] can be called many times per run loop iteration so coalesce calls
+        to WebPageProxy::windowAndViewFrames using dispatch_async.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _updateWindowAndViewFrames]):
+
 2013-06-07  Thomas Deniau  <[email protected]>
 
         Reproducible crash with triple-finger-tap "define word" gesture on a Netflix video

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


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-06-08 00:05:52 UTC (rev 151343)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-06-08 00:11:34 UTC (rev 151344)
@@ -216,6 +216,8 @@
 
     BOOL _viewInWindowChangeWasDeferred;
 
+    BOOL _didScheduleWindowAndViewFrameUpdate;
+
     // Whether the containing window of the WKView has a valid backing store.
     // The window server invalidates the backing store whenever the window is resized or minimized.
     // We use this flag to determine when we need to paint the background (white or clear)
@@ -455,14 +457,23 @@
 
 - (void)_updateWindowAndViewFrames
 {
-    NSRect viewFrameInWindowCoordinates = [self convertRect:[self frame] toView:nil];
-    NSPoint accessibilityPosition = NSMakePoint(0, 0);
-    if (WebCore::AXObjectCache::accessibilityEnabled())
-        accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
-    
-    _data->_page->windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
     if (_data->_clipsToVisibleRect)
         [self _updateViewExposedRect];
+
+    if (_data->_didScheduleWindowAndViewFrameUpdate)
+        return;
+
+    _data->_didScheduleWindowAndViewFrameUpdate = YES;
+
+    dispatch_async(dispatch_get_main_queue(), ^{
+        NSRect viewFrameInWindowCoordinates = [self convertRect:[self frame] toView:nil];
+        NSPoint accessibilityPosition = NSMakePoint(0, 0);
+        if (WebCore::AXObjectCache::accessibilityEnabled())
+            accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
+
+        _data->_page->windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
+        _data->_didScheduleWindowAndViewFrameUpdate = NO;
+    });
 }
 
 - (void)renewGState
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to