REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 16:38:57 +0000 (16:38 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Mar 2019 16:38:57 +0000 (16:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196126
rdar://problem/49095791

Reviewed by Antti Koivisto.

The scrolling tree doesn't have an accurate picture of the main view's scroll position
during pinch-zooming, so don't have it apply layer positions if a transient zoom is
in progress.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
(WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):

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

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

index 4844455..50a38be 100644 (file)
@@ -1,3 +1,20 @@
+2019-03-22  Simon Fraser  <simon.fraser@apple.com>
+
+        REGRESSION (r242687): Flicker when pinch-zooming pages in macOS Safari
+        https://bugs.webkit.org/show_bug.cgi?id=196126
+        rdar://problem/49095791
+
+        Reviewed by Antti Koivisto.
+
+        The scrolling tree doesn't have an accurate picture of the main view's scroll position
+        during pinch-zooming, so don't have it apply layer positions if a transient zoom is
+        in progress.
+
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
+        (WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):
+
 2019-03-22  Antti Koivisto  <antti@apple.com>
 
         Handle UI side hit testing for ScrollPositioningBehavior::Stationary positioned nodes
index 58bda64..9762fc0 100644 (file)
@@ -88,7 +88,8 @@ private:
 
     bool dispatchDidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone>) override;
 
-    void flushLayers();
+    enum class FlushType { Normal, TransientZoom };
+    void flushLayers(FlushType = FlushType::Normal);
 
     // Message handlers.
     void updateGeometry(const WebCore::IntSize& viewSize, bool flushSynchronously, const WTF::MachSendRight& fencePort) override;
index fe72854..8a440f8 100644 (file)
@@ -451,7 +451,7 @@ void TiledCoreAnimationDrawingArea::addTransactionCallbackID(CallbackID callback
     scheduleCompositingLayerFlush();
 }
 
-void TiledCoreAnimationDrawingArea::flushLayers()
+void TiledCoreAnimationDrawingArea::flushLayers(FlushType flushType)
 {
     if (layerTreeStateIsFrozen())
         return;
@@ -493,7 +493,8 @@ void TiledCoreAnimationDrawingArea::flushLayers()
 #if ENABLE(ASYNC_SCROLLING)
         if (auto* scrollingCoordinator = m_webPage.corePage()->scrollingCoordinator()) {
             scrollingCoordinator->commitTreeStateIfNeeded();
-            scrollingCoordinator->applyScrollingTreeLayerPositions();
+            if (flushType == FlushType::TransientZoom)
+                scrollingCoordinator->applyScrollingTreeLayerPositions();
         }
 #endif
 
@@ -923,7 +924,7 @@ void TiledCoreAnimationDrawingArea::applyTransientZoomToPage(double scale, Float
     unscrolledOrigin.moveBy(-unobscuredContentRect.location());
     m_webPage.scalePage(scale / m_webPage.viewScaleFactor(), roundedIntPoint(-unscrolledOrigin));
     m_transientZoomScale = 1;
-    flushLayers();
+    flushLayers(FlushType::TransientZoom);
 }
 
 void TiledCoreAnimationDrawingArea::addFence(const MachSendRight& fencePort)