Title: [224617] trunk/Source/WebCore
Revision
224617
Author
simon.fra...@apple.com
Date
2017-11-08 21:27:22 -0800 (Wed, 08 Nov 2017)

Log Message

Cordova: elements with tag position:fixed disappears (flickering) when a long content is scrolling and appears again when the scroll is finished.
https://bugs.webkit.org/show_bug.cgi?id=178066

Reviewed by Tim Horton.

In UIWebView, we were failing to call setIsViewportConstrained() on layers for position:fixed,
causing us to detach their backing store sometimes on page scrolling.

Fix by hoisting the call to RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole()
up the stack into code that runs for both UIWebView and WKWebView. This required moving some of
the sanity check code up out of updateScrollCoordinatedLayer() into the caller.

Not testable because the bug only manifested in UIWebView.

* rendering/RenderLayerCompositor.cpp:
(WebCore::canCoordinateScrollingForLayer):
(WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224616 => 224617)


--- trunk/Source/WebCore/ChangeLog	2017-11-09 04:57:38 UTC (rev 224616)
+++ trunk/Source/WebCore/ChangeLog	2017-11-09 05:27:22 UTC (rev 224617)
@@ -1,3 +1,24 @@
+2017-11-08  Simon Fraser  <simon.fra...@apple.com>
+
+        Cordova: elements with tag position:fixed disappears (flickering) when a long content is scrolling and appears again when the scroll is finished.
+        https://bugs.webkit.org/show_bug.cgi?id=178066
+
+        Reviewed by Tim Horton.
+
+        In UIWebView, we were failing to call setIsViewportConstrained() on layers for position:fixed,
+        causing us to detach their backing store sometimes on page scrolling.
+        
+        Fix by hoisting the call to RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole()
+        up the stack into code that runs for both UIWebView and WKWebView. This required moving some of
+        the sanity check code up out of updateScrollCoordinatedLayer() into the caller.
+
+        Not testable because the bug only manifested in UIWebView.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::canCoordinateScrollingForLayer):
+        (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
+        (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
+
 2017-11-08  Zalan Bujtas  <za...@apple.com>
 
         [LayoutState cleanup] Move RenderMultiColumnFlow::computeLineGridPaginationOrigin to LayoutState

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (224616 => 224617)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2017-11-09 04:57:38 UTC (rev 224616)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2017-11-09 05:27:22 UTC (rev 224617)
@@ -3506,6 +3506,11 @@
         rootLayer->noteDeviceOrPageScaleFactorChangedIncludingDescendants();
 }
 
+static bool canCoordinateScrollingForLayer(const RenderLayer& layer)
+{
+    return (layer.isRenderViewLayer() || layer.parent()) && layer.isComposited();
+}
+
 void RenderLayerCompositor::updateScrollCoordinatedStatus(RenderLayer& layer, OptionSet<ScrollingNodeChangeFlags> changes)
 {
     LayerScrollCoordinationRoles coordinationRoles = 0;
@@ -3515,7 +3520,10 @@
     if (useCoordinatedScrollingForLayer(layer))
         coordinationRoles |= Scrolling;
 
-    if (coordinationRoles) {
+    if (layer.isComposited())
+        layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(coordinationRoles & ViewportConstrained);
+
+    if (coordinationRoles && canCoordinateScrollingForLayer(layer)) {
         if (m_scrollCoordinatedLayers.add(&layer).isNewEntry)
             m_subframeScrollLayersNeedReattach = true;
 
@@ -3721,20 +3729,13 @@
 
 void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, LayerScrollCoordinationRoles reasons, OptionSet<ScrollingNodeChangeFlags> changes)
 {
-    auto* scrollingCoordinator = this->scrollingCoordinator();
-    if (!scrollingCoordinator || !scrollingCoordinator->coordinatesScrollingForFrameView(m_renderView.frameView()))
-        return;
-
     bool isRenderViewLayer = layer.isRenderViewLayer();
 
-    if (!layer.parent() && !isRenderViewLayer)
-        return;
-
     ASSERT(m_scrollCoordinatedLayers.contains(&layer));
     ASSERT(layer.isComposited());
 
-    auto* backing = layer.backing();
-    if (!backing)
+    auto* scrollingCoordinator = this->scrollingCoordinator();
+    if (!scrollingCoordinator || !scrollingCoordinator->coordinatesScrollingForFrameView(m_renderView.frameView()))
         return;
 
     if (!m_renderView.frame().isMainFrame()) {
@@ -3751,6 +3752,8 @@
     if (!parentNodeID && !isRenderViewLayer)
         return;
 
+    auto* backing = layer.backing();
+
     // Always call this even if the backing is already attached because the parent may have changed.
     // If a node plays both roles, fixed/sticky is always the ancestor node of scrolling.
     if (reasons & ViewportConstrained) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to