Title: [238715] trunk/Source
Revision
238715
Author
[email protected]
Date
2018-11-29 16:55:56 -0800 (Thu, 29 Nov 2018)

Log Message

Add an internal feature flag to enable async overflow scrolling
https://bugs.webkit.org/show_bug.cgi?id=192184

Reviewed by Tim Horton.

Add a new internal feature flag that will enable async overflow-scrolling for
most overflow:scroll elements. Defaults to off.
Source/WebCore:

Make the "UseAcceleratedTouchScrolling" terminology in RenderLayer etc be more generic,
and refer to async overflow scrolling.

* page/Settings.yaml:
* rendering/RenderLayer.cpp:
(WebCore::canCreateStackingContext): Remove a line which is not necessary, since -webkit-overflow-scrolling: touch
already triggers non-auto z-index via code in StyleResolver::adjustRenderStyle().
(WebCore::RenderLayer::canUseCompositedScrolling const):
(WebCore::RenderLayer::hasCompositedScrollableOverflow const):
(WebCore::RenderLayer::handleTouchEvent):
(WebCore::RenderLayer::usesAsyncScrolling const):
(WebCore::RenderLayer::updateScrollInfoAfterLayout):
(WebCore::RenderLayer::showsOverflowControls const):
(WebCore::RenderLayer::calculateClipRects const):
(WebCore::RenderLayer::canUseAcceleratedTouchScrolling const): Deleted.
(WebCore::RenderLayer::hasTouchScrollableOverflow const): Deleted.
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForOverflowScrolling const):
(WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer const):
(WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):

Source/WebKit:

* Shared/WebPreferences.yaml:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238714 => 238715)


--- trunk/Source/WebCore/ChangeLog	2018-11-30 00:54:28 UTC (rev 238714)
+++ trunk/Source/WebCore/ChangeLog	2018-11-30 00:55:56 UTC (rev 238715)
@@ -1,3 +1,39 @@
+2018-11-29  Simon Fraser  <[email protected]>
+
+        Add an internal feature flag to enable async overflow scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=192184
+
+        Reviewed by Tim Horton.
+
+        Add a new internal feature flag that will enable async overflow-scrolling for
+        most overflow:scroll elements. Defaults to off.
+        
+        Make the "UseAcceleratedTouchScrolling" terminology in RenderLayer etc be more generic,
+        and refer to async overflow scrolling.
+
+        * page/Settings.yaml:
+        * rendering/RenderLayer.cpp:
+        (WebCore::canCreateStackingContext): Remove a line which is not necessary, since -webkit-overflow-scrolling: touch
+        already triggers non-auto z-index via code in StyleResolver::adjustRenderStyle().
+        (WebCore::RenderLayer::canUseCompositedScrolling const):
+        (WebCore::RenderLayer::hasCompositedScrollableOverflow const):
+        (WebCore::RenderLayer::handleTouchEvent):
+        (WebCore::RenderLayer::usesAsyncScrolling const):
+        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
+        (WebCore::RenderLayer::showsOverflowControls const):
+        (WebCore::RenderLayer::calculateClipRects const):
+        (WebCore::RenderLayer::canUseAcceleratedTouchScrolling const): Deleted.
+        (WebCore::RenderLayer::hasTouchScrollableOverflow const): Deleted.
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
+        (WebCore::RenderLayerBacking::updateConfiguration):
+        (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect const):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForOverflowScrolling const):
+        (WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer const):
+        (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
+
 2018-11-29  Andy Estes  <[email protected]>
 
         [Cocoa] Add some WKA extension points

Modified: trunk/Source/WebCore/page/Settings.yaml (238714 => 238715)


--- trunk/Source/WebCore/page/Settings.yaml	2018-11-30 00:54:28 UTC (rev 238714)
+++ trunk/Source/WebCore/page/Settings.yaml	2018-11-30 00:55:56 UTC (rev 238715)
@@ -342,27 +342,39 @@
 
 diagnosticLoggingEnabled:
   initial: false
+
 delegatesPageScaling:
   initial: false
+
 plugInSnapshottingEnabled:
   initial: false
+
 snapshotAllPlugIns:
   initial: false
+
 autostartOriginPlugInSnapshottingEnabled:
   initial: true
+
 primaryPlugInSnapshotDetectionEnabled:
   initial: true
+
 maximumPlugInSnapshotAttempts:
   type: unsigned
   initial: 20
+
 frameFlattening:
   type: FrameFlattening
   initial: FrameFlattening::Disabled
   onChange: setNeedsRelayoutAllFrames
+
 asyncFrameScrollingEnabled:
   initial: false
   onChange: setNeedsRelayoutAllFrames
 
+asyncOverflowScrollingEnabled:
+  initial: false
+  onChange: setNeedsRelayoutAllFrames
+
 webSecurityEnabled:
   initial: true
 spatialNavigationEnabled:

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (238714 => 238715)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-11-30 00:54:28 UTC (rev 238714)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-11-30 00:55:56 UTC (rev 238715)
@@ -544,9 +544,6 @@
         || renderer.hasReflection()
         || renderer.style().hasIsolation()
         || !renderer.style().hasAutoZIndex()
-#if PLATFORM(IOS_FAMILY)
-        || layer.canUseAcceleratedTouchScrolling()
-#endif
         || (renderer.style().willChange() && renderer.style().willChange()->canCreateStackingContext());
 }
 
@@ -2171,8 +2168,11 @@
     return toLayoutSize(convertToLayerCoords(ancestorLayer, LayoutPoint(), adjustForColumns));
 }
 
-bool RenderLayer::canUseAcceleratedTouchScrolling() const
+bool RenderLayer::canUseCompositedScrolling() const
 {
+    if (renderer().settings().asyncOverflowScrollingEnabled())
+        return scrollsOverflow();
+
 #if PLATFORM(IOS_FAMILY) && ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
     return scrollsOverflow() && (renderer().style().useTouchOverflowScrolling() || renderer().settings().alwaysUseAcceleratedOverflowScroll());
 #else
@@ -2180,9 +2180,9 @@
 #endif
 }
 
-bool RenderLayer::hasTouchScrollableOverflow() const
+bool RenderLayer::hasCompositedScrollableOverflow() const
 {
-    return canUseAcceleratedTouchScrolling() && (hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
+    return canUseCompositedScrolling() && (hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
 }
 
 #if ENABLE(IOS_TOUCH_EVENTS)
@@ -2189,7 +2189,7 @@
 bool RenderLayer::handleTouchEvent(const PlatformTouchEvent& touchEvent)
 {
     // If we have accelerated scrolling, let the scrolling be handled outside of WebKit.
-    if (hasTouchScrollableOverflow())
+    if (hasCompositedScrollableOverflow())
         return false;
 
     return ScrollableArea::handleTouchEvent(touchEvent);
@@ -2223,7 +2223,7 @@
 // FIXME: this is only valid after we've made layers.
 bool RenderLayer::usesAsyncScrolling() const
 {
-    return canUseAcceleratedTouchScrolling() && usesCompositedScrolling();
+    return usesCompositedScrolling();
 }
 
 static inline int adjustedScrollDelta(int beginningDelta)
@@ -3585,7 +3585,7 @@
     }
 
 #if PLATFORM(IOS_FAMILY)
-    if (canUseAcceleratedTouchScrolling())
+    if (canUseCompositedScrolling())
         setNeedsPostLayoutCompositingUpdate();
 #endif
 
@@ -3614,9 +3614,8 @@
 bool RenderLayer::showsOverflowControls() const
 {
 #if PLATFORM(IOS_FAMILY)
-    // Don't render (custom) scrollbars if we have accelerated scrolling.
-    if (canUseAcceleratedTouchScrolling())
-        return false;
+    // On iOS, the scrollbars are made in the UI process.
+    return !canUseCompositedScrolling();
 #endif
 
     return true;
@@ -6408,7 +6407,7 @@
 
 #if ENABLE(IOS_TOUCH_EVENTS)
     if (addedOrRemoved) {
-        if (isScrollable && !canUseAcceleratedTouchScrolling())
+        if (isScrollable && !canUseCompositedScrolling())
             registerAsTouchEventListenerForScrolling();
         else {
             // We only need the touch listener for unaccelerated overflow scrolling, so if we became

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (238714 => 238715)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2018-11-30 00:54:28 UTC (rev 238714)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2018-11-30 00:55:56 UTC (rev 238715)
@@ -464,9 +464,9 @@
 #endif
 
     // Returns true when the layer could do touch scrolling, but doesn't look at whether there is actually scrollable overflow.
-    bool canUseAcceleratedTouchScrolling() const;
+    bool canUseCompositedScrolling() const;
     // Returns true when there is actually scrollable overflow (requires layout to be up-to-date).
-    bool hasTouchScrollableOverflow() const;
+    bool hasCompositedScrollableOverflow() const;
 
     int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
     int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (238714 => 238715)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2018-11-30 00:54:28 UTC (rev 238714)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2018-11-30 00:55:56 UTC (rev 238715)
@@ -560,7 +560,7 @@
 static bool layerOrAncestorIsTransformedOrUsingCompositedScrolling(RenderLayer& layer)
 {
     for (auto* curr = &layer; curr; curr = curr->parent()) {
-        if (curr->hasTransform() || curr->hasTouchScrollableOverflow())
+        if (curr->hasTransform() || curr->hasCompositedScrollableOverflow())
             return true;
     }
 
@@ -702,7 +702,7 @@
     
     // This requires descendants to have been updated.
     bool needsDescendantsClippingLayer = compositor().clipsCompositingDescendants(m_owningLayer);
-    bool usesCompositedScrolling = m_owningLayer.hasTouchScrollableOverflow();
+    bool usesCompositedScrolling = m_owningLayer.hasCompositedScrollableOverflow();
 
     // Our scrolling layer will clip.
     if (usesCompositedScrolling)
@@ -947,7 +947,7 @@
     }
 
 #if PLATFORM(IOS_FAMILY)
-    if (compositedAncestor->hasTouchScrollableOverflow()) {
+    if (compositedAncestor->hasCompositedScrollableOverflow()) {
         LayoutRect ancestorCompositedBounds = ancestorBackingLayer->compositedBounds();
         auto& renderBox = downcast<RenderBox>(compositedAncestor->renderer());
         LayoutRect paddingBox(renderBox.borderLeft(), renderBox.borderTop(), renderBox.width() - renderBox.borderLeft() - renderBox.borderRight(), renderBox.height() - renderBox.borderTop() - renderBox.borderBottom());

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (238714 => 238715)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-11-30 00:54:28 UTC (rev 238714)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-11-30 00:55:56 UTC (rev 238715)
@@ -2709,8 +2709,7 @@
 
 bool RenderLayerCompositor::requiresCompositingForOverflowScrolling(const RenderLayer& layer, RequiresCompositingData& queryData) const
 {
-#if PLATFORM(IOS_FAMILY)
-    if (!layer.canUseAcceleratedTouchScrolling())
+    if (!layer.canUseCompositedScrolling())
         return false;
 
     if (queryData.layoutUpToDate == LayoutUpToDate::No) {
@@ -2718,12 +2717,7 @@
         return layer.isComposited();
     }
 
-    return layer.hasTouchScrollableOverflow();
-#else
-    UNUSED_PARAM(layer);
-    UNUSED_PARAM(queryData);
-    return false;
-#endif
+    return layer.hasCompositedScrollableOverflow();
 }
 
 // FIXME: why doesn't this handle the clipping cases?
@@ -2781,7 +2775,7 @@
     auto* enclosingOverflowLayer = layer.enclosingOverflowClipLayer(ExcludeSelf);
 
 #if PLATFORM(IOS_FAMILY)
-    if (enclosingOverflowLayer && enclosingOverflowLayer->hasTouchScrollableOverflow()) {
+    if (enclosingOverflowLayer && enclosingOverflowLayer->hasCompositedScrollableOverflow()) {
         if (enclosingAcceleratedOverflowLayer)
             *enclosingAcceleratedOverflowLayer = enclosingOverflowLayer;
         return true;
@@ -2846,7 +2840,10 @@
     if (layer.isRenderViewLayer() && hasCoordinatedScrolling())
         return true;
 
-    return layer.hasTouchScrollableOverflow();
+#if PLATFORM(IOS_FAMILY)
+    return layer.hasCompositedScrollableOverflow();
+#endif
+    return false; // FIXME: Fix for composited scrolling on other platforms.
 }
 
 bool RenderLayerCompositor::isRunningTransformAnimation(RenderLayerModelObject& renderer) const

Modified: trunk/Source/WebKit/ChangeLog (238714 => 238715)


--- trunk/Source/WebKit/ChangeLog	2018-11-30 00:54:28 UTC (rev 238714)
+++ trunk/Source/WebKit/ChangeLog	2018-11-30 00:55:56 UTC (rev 238715)
@@ -1,3 +1,15 @@
+2018-11-29  Simon Fraser  <[email protected]>
+
+        Add an internal feature flag to enable async overflow scrolling
+        https://bugs.webkit.org/show_bug.cgi?id=192184
+
+        Reviewed by Tim Horton.
+
+        Add a new internal feature flag that will enable async overflow-scrolling for
+        most overflow:scroll elements. Defaults to off.
+
+        * Shared/WebPreferences.yaml:
+
 2018-11-29  Andy Estes  <[email protected]>
 
         [Cocoa] Add some WKA extension points

Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (238714 => 238715)


--- trunk/Source/WebKit/Shared/WebPreferences.yaml	2018-11-30 00:54:28 UTC (rev 238714)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml	2018-11-30 00:55:56 UTC (rev 238715)
@@ -1387,9 +1387,16 @@
   type: bool
   defaultValue: false
   humanReadableName: "Async Frame Scrolling"
-  humanReadableDescription: "Perform frame scrolling in a dedicated thread or process"
+  humanReadableDescription: "Perform frame scrolling off the main thread"
   category: internal
 
+AsyncOverflowScrollingEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "Async Overflow Scrolling"
+  humanReadableDescription: "Perform overflow scrolling off the main thread"
+  category: internal
+
 FetchAPIKeepAliveEnabled:
   type: bool
   defaultValue: false
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to