Title: [265289] trunk
Revision
265289
Author
[email protected]
Date
2020-08-05 09:36:43 -0700 (Wed, 05 Aug 2020)

Log Message

Update event regions only once per frame
https://bugs.webkit.org/show_bug.cgi?id=215132
<rdar://problem/66533779>

Reviewed by Darin Adler.

Source/WebCore:

Event regions (for touch-action, editable areas etc) were updated as part of
compositing updates, but we only need their output once per rendering update, so
move their computation out of RenderLayerCompositor::updateBackingAndHierarchy()
and into a new RenderLayer tree walk that is called from Page::doAfterUpdateRendering().

RenderLayerBacking stores a dirty bit to track when regions need to be updated.

Reduces the amount of time spent in rendering updates when scrolling on facebook.com
on iPad, which has lots of discontiguous touch-action regions.

* dom/Document.cpp:
(WebCore::Document::updateEventRegions):
* dom/Document.h:
* page/Frame.cpp:
(WebCore::Frame::layerTreeAsText const):
* page/Page.cpp:
(WebCore::Page::doAfterUpdateRendering):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::maintainsEventRegion const):
(WebCore::RenderLayerBacking::updateEventRegion):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateEventRegions):
(WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
* rendering/RenderLayerCompositor.h:

LayoutTests:

Tests that dispatch mouseWheel events in a way that tests event regions need to wait
now for a rendering update. `await UIHelper.animationFrame()` is not enough, because
the function resumes inside a microtask at the end of the requestAnimationFrame callback,
which is before we've completed the rest of the rendering update, and thus before
the event regions have been updated.

In addition, `await UIHelper.animationFrame()` followed by eventSender calls to issue
wheel events actually trigger Page::updateRendering() re-entrancy, via the
WKBundlePageForceRepaint() in EventSendingController::mouseScrollByWithWheelAndMomentumPhases().

To fix this, add and use UIHelper.renderingUpdate(), which waits for a rAF and uses a setTimeout()
to get past the end of the current rendering update.

* fast/scrolling/mac/absolute-in-overflow-scroll-dynamic-expected.html:
* fast/scrolling/mac/absolute-in-overflow-scroll-dynamic.html:
* fast/scrolling/mac/absolute-in-overflow-scroll.html:
* fast/scrolling/mac/async-scroll-overflow-hidden-on-one-axis.html:
* fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html:
* fast/scrolling/mac/async-scroll-overflow-top-inset.html:
* fast/scrolling/mac/async-scroll-overflow.html:
* fast/scrolling/mac/clip-path-hit-test.html:
* fast/scrolling/mac/move-node-in-overflow-scroll.html:
* fast/scrolling/mac/overflow-scrolled-document.html:
* fast/scrolling/mac/overflow-zoomed-document.html:
* fast/scrolling/mac/overlapped-overflow-scroll.html:
* resources/ui-helper.js:
(window.UIHelper.async renderingUpdate):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (265288 => 265289)


--- trunk/LayoutTests/ChangeLog	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/ChangeLog	2020-08-05 16:36:43 UTC (rev 265289)
@@ -1,3 +1,39 @@
+2020-08-04  Simon Fraser  <[email protected]>
+
+        Update event regions only once per frame
+        https://bugs.webkit.org/show_bug.cgi?id=215132
+        <rdar://problem/66533779>
+
+        Reviewed by Darin Adler.
+
+        Tests that dispatch mouseWheel events in a way that tests event regions need to wait
+        now for a rendering update. `await UIHelper.animationFrame()` is not enough, because
+        the function resumes inside a microtask at the end of the requestAnimationFrame callback,
+        which is before we've completed the rest of the rendering update, and thus before
+        the event regions have been updated.
+        
+        In addition, `await UIHelper.animationFrame()` followed by eventSender calls to issue
+        wheel events actually trigger Page::updateRendering() re-entrancy, via the
+        WKBundlePageForceRepaint() in EventSendingController::mouseScrollByWithWheelAndMomentumPhases().
+
+        To fix this, add and use UIHelper.renderingUpdate(), which waits for a rAF and uses a setTimeout()
+        to get past the end of the current rendering update.
+
+        * fast/scrolling/mac/absolute-in-overflow-scroll-dynamic-expected.html:
+        * fast/scrolling/mac/absolute-in-overflow-scroll-dynamic.html:
+        * fast/scrolling/mac/absolute-in-overflow-scroll.html:
+        * fast/scrolling/mac/async-scroll-overflow-hidden-on-one-axis.html:
+        * fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html:
+        * fast/scrolling/mac/async-scroll-overflow-top-inset.html:
+        * fast/scrolling/mac/async-scroll-overflow.html:
+        * fast/scrolling/mac/clip-path-hit-test.html:
+        * fast/scrolling/mac/move-node-in-overflow-scroll.html:
+        * fast/scrolling/mac/overflow-scrolled-document.html:
+        * fast/scrolling/mac/overflow-zoomed-document.html:
+        * fast/scrolling/mac/overlapped-overflow-scroll.html:
+        * resources/ui-helper.js:
+        (window.UIHelper.async renderingUpdate):
+
 2020-08-05  Youenn Fablet  <[email protected]>
 
         [ macOS wk2 ] webrtc/datachannel/gather-candidates-networkprocess-crash.html is a flaky timeout

Modified: trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll-dynamic-expected.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll-dynamic-expected.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll-dynamic-expected.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -37,6 +37,7 @@
     <script>
         async function scrollOverContent()
         {
+            await UIHelper.renderingUpdate();
             await UIHelper.mouseWheelScrollAt(50, 50);
         }
 

Modified: trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll-dynamic.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll-dynamic.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll-dynamic.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -41,6 +41,7 @@
     <script>
         async function scrollOverContent()
         {
+            await UIHelper.renderingUpdate();
             await UIHelper.mouseWheelScrollAt(50, 50);
         }
 

Modified: trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/absolute-in-overflow-scroll.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -47,7 +47,7 @@
             scroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             overflowScrollEventCount = 0;
             windowScrollEventCount = 0;

Modified: trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-hidden-on-one-axis.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-hidden-on-one-axis.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-hidden-on-one-axis.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -49,7 +49,7 @@
             verticalScroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             horizontalScrollerEventCount = 0;
             verticalScrollerEventCount = 0;

Modified: trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-rtl-zoomed.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -40,7 +40,7 @@
             scroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             overflowScrollEventCount = 0;
             windowScrollEventCount = 0;

Modified: trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-top-inset.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-top-inset.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow-top-inset.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -39,7 +39,7 @@
             scroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             overflowScrollEventCount = 0;
             windowScrollEventCount = 0;

Modified: trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/async-scroll-overflow.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -36,7 +36,7 @@
             scroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             overflowScrollEventCount = 0;
             windowScrollEventCount = 0;

Modified: trunk/LayoutTests/fast/scrolling/mac/clip-path-hit-test.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/clip-path-hit-test.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/clip-path-hit-test.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -36,7 +36,7 @@
             scroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             overflowScrollEventCount = 0;
             windowScrollEventCount = 0;

Modified: trunk/LayoutTests/fast/scrolling/mac/move-node-in-overflow-scroll.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/move-node-in-overflow-scroll.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/move-node-in-overflow-scroll.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -45,7 +45,7 @@
             scroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             overflowScrollEventCount = 0;
             windowScrollEventCount = 0;

Modified: trunk/LayoutTests/fast/scrolling/mac/overflow-scrolled-document.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/overflow-scrolled-document.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-scrolled-document.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -36,7 +36,7 @@
             scroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             overflowScrollEventCount = 0;
             windowScrollEventCount = 0;

Modified: trunk/LayoutTests/fast/scrolling/mac/overflow-zoomed-document.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/overflow-zoomed-document.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-zoomed-document.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -36,7 +36,7 @@
             scroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             overflowScrollEventCount = 0;
             windowScrollEventCount = 0;

Modified: trunk/LayoutTests/fast/scrolling/mac/overlapped-overflow-scroll.html (265288 => 265289)


--- trunk/LayoutTests/fast/scrolling/mac/overlapped-overflow-scroll.html	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/fast/scrolling/mac/overlapped-overflow-scroll.html	2020-08-05 16:36:43 UTC (rev 265289)
@@ -47,7 +47,7 @@
             scroller.scrollTop = 0;
             
             // Wait for scroll events to fire.
-            await UIHelper.animationFrame();
+            await UIHelper.renderingUpdate();
 
             overflowScrollEventCount = 0;
             windowScrollEventCount = 0;

Modified: trunk/LayoutTests/resources/ui-helper.js (265288 => 265289)


--- trunk/LayoutTests/resources/ui-helper.js	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/LayoutTests/resources/ui-helper.js	2020-08-05 16:36:43 UTC (rev 265289)
@@ -87,6 +87,12 @@
         return new Promise(requestAnimationFrame);
     }
 
+    static async renderingUpdate()
+    {
+        await UIHelper.animationFrame();
+        await UIHelper.delayFor(0);
+    }
+
     static async waitForCondition(conditionFunc)
     {
         while (!conditionFunc()) {

Modified: trunk/Source/WebCore/ChangeLog (265288 => 265289)


--- trunk/Source/WebCore/ChangeLog	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/ChangeLog	2020-08-05 16:36:43 UTC (rev 265289)
@@ -1,3 +1,39 @@
+2020-08-04  Simon Fraser  <[email protected]>
+
+        Update event regions only once per frame
+        https://bugs.webkit.org/show_bug.cgi?id=215132
+        <rdar://problem/66533779>
+
+        Reviewed by Darin Adler.
+
+        Event regions (for touch-action, editable areas etc) were updated as part of
+        compositing updates, but we only need their output once per rendering update, so
+        move their computation out of RenderLayerCompositor::updateBackingAndHierarchy() 
+        and into a new RenderLayer tree walk that is called from Page::doAfterUpdateRendering().
+
+        RenderLayerBacking stores a dirty bit to track when regions need to be updated.
+
+        Reduces the amount of time spent in rendering updates when scrolling on facebook.com
+        on iPad, which has lots of discontiguous touch-action regions.
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateEventRegions):
+        * dom/Document.h:
+        * page/Frame.cpp:
+        (WebCore::Frame::layerTreeAsText const):
+        * page/Page.cpp:
+        (WebCore::Page::doAfterUpdateRendering):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects const):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::maintainsEventRegion const):
+        (WebCore::RenderLayerBacking::updateEventRegion):
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateEventRegions):
+        (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
+        * rendering/RenderLayerCompositor.h:
+
 2020-08-05  Adrian Perez de Castro  <[email protected]>
 
         Unreviewed non-unified build fix.

Modified: trunk/Source/WebCore/dom/Document.cpp (265288 => 265289)


--- trunk/Source/WebCore/dom/Document.cpp	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/dom/Document.cpp	2020-08-05 16:36:43 UTC (rev 265289)
@@ -4287,6 +4287,15 @@
         m_activeElement = m_activeElement->parentElement();
 }
 
+void Document::updateEventRegions()
+{
+    // FIXME: Move updateTouchEventRegions() here, but it should only happen for the top document.
+    if (auto* view = renderView()) {
+        if (view->usesCompositing())
+            view->compositor().updateEventRegions();
+    }
+}
+
 void Document::invalidateEventRegionsForFrame(HTMLFrameOwnerElement& element)
 {
     auto* renderer = element.renderer();

Modified: trunk/Source/WebCore/dom/Document.h (265288 => 265289)


--- trunk/Source/WebCore/dom/Document.h	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/dom/Document.h	2020-08-05 16:36:43 UTC (rev 265289)
@@ -1131,6 +1131,8 @@
 
     WEBCORE_EXPORT String displayStringModifiedByEncoding(const String&) const;
 
+    void updateEventRegions();
+
     void invalidateRenderingDependentRegions();
     void invalidateEventRegionsForFrame(HTMLFrameOwnerElement&);
 

Modified: trunk/Source/WebCore/page/Frame.cpp (265288 => 265289)


--- trunk/Source/WebCore/page/Frame.cpp	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/page/Frame.cpp	2020-08-05 16:36:43 UTC (rev 265289)
@@ -899,6 +899,13 @@
     if (!contentRenderer())
         return { };
 
+    contentRenderer()->compositor().updateEventRegions();
+
+    for (auto* child = mainFrame().tree().firstRenderedChild(); child; child = child->tree().traverseNextRendered()) {
+        if (auto* renderer = child->contentRenderer())
+            renderer->compositor().updateEventRegions();
+    }
+
     return contentRenderer()->compositor().layerTreeAsText(flags);
 }
 

Modified: trunk/Source/WebCore/page/Page.cpp (265288 => 265289)


--- trunk/Source/WebCore/page/Page.cpp	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/page/Page.cpp	2020-08-05 16:36:43 UTC (rev 265289)
@@ -1549,6 +1549,9 @@
     if (RefPtr<Document> document = mainFrame().document())
         document->updateTouchEventRegions();
 #endif
+    forEachDocument([] (Document& document) {
+        document.updateEventRegions();
+    });
 
     DebugPageOverlays::doAfterUpdateRendering(*this);
 

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (265288 => 265289)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-08-05 16:36:43 UTC (rev 265289)
@@ -7049,7 +7049,7 @@
 
     LOG_WITH_STREAM(EventRegions, stream << this << " invalidateEventRegion for reason " << reason << " invalidating in compositing layer " << compositingLayer);
 
-    compositingLayer->setNeedsCompositingConfigurationUpdate();
+    compositingLayer->backing()->setNeedsEventRegionUpdate();
 
     if (reason == EventRegionInvalidationReason::NonCompositedFrame) {
         auto& view = renderer().view();

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (265288 => 265289)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2020-08-05 16:36:43 UTC (rev 265289)
@@ -1708,6 +1708,7 @@
         return true;
 #endif
 #if ENABLE(EDITABLE_REGION)
+    LOG_WITH_STREAM(EventRegions, stream << "RenderLayerBacking: " << this << " maintainsEventRegion - mayHaveEditableElements: " << renderer().document().mayHaveEditableElements() << " shouldBuildEditableRegion: " << renderer().page().shouldBuildEditableRegion());
     if (renderer().document().mayHaveEditableElements() && renderer().page().shouldBuildEditableRegion())
         return true;
 #endif
@@ -1727,10 +1728,13 @@
 
 void RenderLayerBacking::updateEventRegion()
 {
+    LOG_WITH_STREAM(EventRegions, stream << m_owningLayer << " " << this << " updateEventRegion (needs update: " << needsEventRegionUpdate() << ", maintainsEventRegion: " << maintainsEventRegion() << ")");
+
     if (!maintainsEventRegion())
         return;
 
-    LOG_WITH_STREAM(EventRegions, stream << "RenderLayerBacking " << *this << " updateEventRegion");
+    if (!needsEventRegionUpdate())
+        return;
 
     TraceScope scope(ComputeEventRegionsStart, ComputeEventRegionsEnd);
 
@@ -1778,6 +1782,8 @@
         updateEventRegionForLayer(*m_foregroundLayer);
 
     renderer().view().setNeedsEventRegionUpdateForNonCompositedFrame(false);
+    
+    setNeedsEventRegionUpdate(false);
 }
 #endif
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (265288 => 265289)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2020-08-05 16:36:43 UTC (rev 265289)
@@ -204,6 +204,9 @@
 #if ENABLE(ASYNC_SCROLLING)
     bool maintainsEventRegion() const;
     void updateEventRegion();
+    
+    bool needsEventRegionUpdate() const { return m_needsEventRegionUpdate; }
+    void setNeedsEventRegionUpdate(bool needsUpdate = true) { m_needsEventRegionUpdate = needsUpdate; }
 #endif
 
     void updateAfterWidgetResize();
@@ -434,6 +437,9 @@
     bool m_requiresBackgroundLayer { false };
     bool m_hasSubpixelRounding { false };
     bool m_paintsSubpixelAntialiasedText { false }; // This is for logging only.
+#if ENABLE(ASYNC_SCROLLING)
+    bool m_needsEventRegionUpdate { true };
+#endif
 };
 
 enum CanvasCompositingStrategy {

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (265288 => 265289)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2020-08-05 16:36:43 UTC (rev 265289)
@@ -699,6 +699,24 @@
     m_updateCompositingLayersTimer.stop();
 }
 
+template<typename ApplyFunctionType>
+void RenderLayerCompositor::applyToCompositedLayerIncludingDescendants(RenderLayer& layer, const ApplyFunctionType& function)
+{
+    if (layer.isComposited())
+        function(layer);
+    for (auto* childLayer = layer.firstChild(); childLayer; childLayer = childLayer->nextSibling())
+        applyToCompositedLayerIncludingDescendants(*childLayer, function);
+}
+
+void RenderLayerCompositor::updateEventRegions()
+{
+#if ENABLE(ASYNC_SCROLLING)
+    applyToCompositedLayerIncludingDescendants(*m_renderView.layer(), [](auto& layer) {
+        layer.backing()->updateEventRegion();
+    });
+#endif
+}
+
 static Optional<ScrollingNodeID> frameHostingNodeForFrame(Frame& frame)
 {
     if (!frame.document() || !frame.view())
@@ -1276,13 +1294,6 @@
         } else if (layer.needsScrollingTreeUpdate())
             scrollingNodeChanges.add(ScrollingNodeChangeFlags::LayerGeometry);
 
-#if ENABLE(ASYNC_SCROLLING)
-        // This needs to happen after any geometry update.
-        // FIXME: Use separate bit for event region invalidation.
-        if (layerNeedsUpdate || layer.needsCompositingConfigurationUpdate())
-            layerBacking->updateEventRegion();
-#endif
-
         if (auto* reflection = layer.reflectionLayer()) {
             if (auto* reflectionBacking = reflection->backing()) {
                 reflectionBacking->updateCompositedBounds();
@@ -2358,15 +2369,6 @@
     }
 }
 
-template<typename ApplyFunctionType>
-void RenderLayerCompositor::applyToCompositedLayerIncludingDescendants(RenderLayer& layer, const ApplyFunctionType& function)
-{
-    if (layer.isComposited())
-        function(layer);
-    for (auto* childLayer = layer.firstChild(); childLayer; childLayer = childLayer->nextSibling())
-        applyToCompositedLayerIncludingDescendants(*childLayer, function);
-}
-
 void RenderLayerCompositor::invalidateEventRegionForAllLayers()
 {
     applyToCompositedLayerIncludingDescendants(*m_renderView.layer(), [](auto& layer) {

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (265288 => 265289)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2020-08-05 16:11:59 UTC (rev 265288)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2020-08-05 16:36:43 UTC (rev 265289)
@@ -196,6 +196,9 @@
     // This is used to cancel any pending update timers when the document goes into back/forward cache.
     void cancelCompositingLayerUpdate();
 
+    // Update event regions, which only needs to happen once per rendering update.
+    void updateEventRegions();
+
     enum class LayoutUpToDate {
         Yes, No
     };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to