WebKit2 View Gestures (Zoom): Document size changes during zoom gesture cause erratic...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 May 2014 19:15:21 +0000 (19:15 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 May 2014 19:15:21 +0000 (19:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132944
<rdar://problem/15769454>

Reviewed by Simon Fraser.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
If a layer flush occurs and we have an active transient zoom,
re-apply the transient zoom to the relevant platform layers, because
WebCore might have overwritten the relevant layer properties.

(WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):
Reset m_transientZoomScale before flushLayers() so that we don't
re-apply the transient zoom when we're actually trying to commit it.

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

index 4ef2eb1..a35d8bc 100644 (file)
@@ -1,3 +1,21 @@
+2014-05-15  Tim Horton  <timothy_horton@apple.com>
+
+        WebKit2 View Gestures (Zoom): Document size changes during zoom gesture cause erratic scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=132944
+        <rdar://problem/15769454>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
+        If a layer flush occurs and we have an active transient zoom,
+        re-apply the transient zoom to the relevant platform layers, because
+        WebCore might have overwritten the relevant layer properties.
+
+        (WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):
+        Reset m_transientZoomScale before flushLayers() so that we don't
+        re-apply the transient zoom when we're actually trying to commit it.
+
 2014-05-15  Alex Christensen  <achristensen@webkit.org>
 
         Add pointer lock to features without enabling it.
index 38b19ce..162168f 100644 (file)
@@ -281,6 +281,11 @@ bool TiledCoreAnimationDrawingArea::flushLayers()
 
     bool returnValue = m_webPage->corePage()->mainFrame().view()->flushCompositingStateIncludingSubframes();
 
+    // If we have an active transient zoom, we want the zoom to win over any changes
+    // that WebCore makes to the relevant layers, so re-apply our changes after flushing.
+    if (m_transientZoomScale != 1)
+        adjustTransientZoom(m_transientZoomScale, m_transientZoomOrigin);
+
     [pool drain];
     return returnValue;
 }
@@ -638,9 +643,8 @@ void TiledCoreAnimationDrawingArea::applyTransientZoomToPage(double scale, Float
     FloatRect unobscuredContentRect = m_webPage->mainFrameView()->unobscuredContentRectIncludingScrollbars();
     unscrolledOrigin.moveBy(-unobscuredContentRect.location());
     m_webPage->scalePage(scale, roundedIntPoint(-unscrolledOrigin));
-    flushLayers();
-
     m_transientZoomScale = 1;
+    flushLayers();
 }
 
 void TiledCoreAnimationDrawingArea::setRootLayerTransform(const TransformationMatrix& transform)