Unify hasTouchScrollableOverflow/needsCompositedScrolling concepts
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 May 2017 18:49:30 +0000 (18:49 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 May 2017 18:49:30 +0000 (18:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171974

Patch by Frederic Wang <fwang@igalia.com> on 2017-05-11
Reviewed by Simon Fraser.

This commit moves the following pattern in a single RenderLayer::usesAcceleratedScrolling function:
#if PLATFORM(IOS)
...hasTouchScrollableOverflow()...
#else
...needsCompositedScrolling()...
#endif

No new tests, behavior unchanged.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::usesAcceleratedScrolling): Introduce helper function.
* rendering/RenderLayer.h: Declare the function.
* rendering/RenderLayerBacking.cpp:
(WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling): Use the new function.
(WebCore::RenderLayerBacking::updateConfiguration): Ditto.
* rendering/RenderLayerCompositor.cpp:
(WebCore::useCoordinatedScrollingForLayer): Ditto.

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

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp

index 9a97635..990ad54 100644 (file)
@@ -1,3 +1,28 @@
+2017-05-11  Frederic Wang  <fwang@igalia.com>
+
+        Unify hasTouchScrollableOverflow/needsCompositedScrolling concepts
+        https://bugs.webkit.org/show_bug.cgi?id=171974
+
+        Reviewed by Simon Fraser.
+
+        This commit moves the following pattern in a single RenderLayer::usesAcceleratedScrolling function:
+        #if PLATFORM(IOS)
+        ...hasTouchScrollableOverflow()...
+        #else
+        ...needsCompositedScrolling()...
+        #endif
+
+        No new tests, behavior unchanged.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::usesAcceleratedScrolling): Introduce helper function.
+        * rendering/RenderLayer.h: Declare the function.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling): Use the new function.
+        (WebCore::RenderLayerBacking::updateConfiguration): Ditto.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::useCoordinatedScrollingForLayer): Ditto.
+
 2017-05-11  Romain Bellessort  <romain.bellessort@crf.canon.fr>
 
         [Readable Streams API] Implement ReadableStreamBYOBReader cancel()
index 0238252..9ce224f 100644 (file)
@@ -2188,6 +2188,15 @@ bool RenderLayer::handleTouchEvent(const PlatformTouchEvent& touchEvent)
 #endif
 #endif // PLATFORM(IOS)
 
+bool RenderLayer::usesAcceleratedScrolling() const
+{
+#if PLATFORM(IOS)
+    return hasTouchScrollableOverflow();
+#else
+    return needsCompositedScrolling();
+#endif
+}
+
 #if ENABLE(IOS_TOUCH_EVENTS)
 void RenderLayer::registerAsTouchEventListenerForScrolling()
 {
index b9e5e3e..0725b3a 100644 (file)
@@ -265,6 +265,7 @@ public:
     bool hasAcceleratedTouchScrolling() const { return false; }
     bool hasTouchScrollableOverflow() const { return false; }
 #endif
+    bool usesAcceleratedScrolling() const;
 
     int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
     int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
index 13c423d..399825e 100644 (file)
@@ -546,17 +546,10 @@ void RenderLayerBacking::updateCustomAppearance(const RenderStyle& style)
         m_graphicsLayer->setCustomAppearance(GraphicsLayer::NoCustomAppearance);
 }
 
-// FIXME: the hasAcceleratedTouchScrolling()/needsCompositedScrolling() concepts need to be merged.
 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer& layer)
 {
     for (RenderLayer* curr = &layer; curr; curr = curr->parent()) {
-        if (curr->hasTransform()
-#if PLATFORM(IOS)
-            || curr->hasTouchScrollableOverflow()
-#else
-            || curr->needsCompositedScrolling()
-#endif
-            )
+        if (curr->hasTransform() || curr->usesAcceleratedScrolling())
             return true;
     }
 
@@ -682,12 +675,8 @@ bool RenderLayerBacking::updateConfiguration()
     bool needsDescendantsClippingLayer = compositor().clipsCompositingDescendants(m_owningLayer);
 
     if (!renderer().view().needsLayout()) {
-        bool usesCompositedScrolling;
-#if PLATFORM(IOS)
-        usesCompositedScrolling = m_owningLayer.hasTouchScrollableOverflow();
-#else
-        usesCompositedScrolling = m_owningLayer.needsCompositedScrolling();
-#endif
+        bool usesCompositedScrolling = m_owningLayer.usesAcceleratedScrolling();
+
         // Our scrolling layer will clip.
         if (usesCompositedScrolling)
             needsDescendantsClippingLayer = false;
index 9d39ca0..21f6d51 100644 (file)
@@ -2723,11 +2723,7 @@ static bool useCoordinatedScrollingForLayer(RenderView& view, const RenderLayer&
     if (layer.isRootLayer() && view.frameView().frame().isMainFrame())
         return true;
 
-#if PLATFORM(IOS)
-    return layer.hasTouchScrollableOverflow();
-#else
-    return layer.needsCompositedScrolling();
-#endif
+    return layer.usesAcceleratedScrolling();
 }
 
 bool RenderLayerCompositor::requiresCompositingForPosition(RenderLayerModelObject& renderer, const RenderLayer& layer, RenderLayer::ViewportConstrainedNotCompositedReason* viewportConstrainedNotCompositedReason) const