Title: [260643] trunk/Source
Revision
260643
Author
[email protected]
Date
2020-04-24 08:03:22 -0700 (Fri, 24 Apr 2020)

Log Message

Move some post-renderingUpdate code into WebCore
https://bugs.webkit.org/show_bug.cgi?id=210952

Reviewed by Antti Koivisto.

Factor some code called by the various DrawingArea subclasses into Page::finalizeRenderingUpdate(),
with some flags to control behavior that differs between drawing areas.

ScrollingCoordinator::commitTreeStateIfNeeded() is a no-op for RemoteScrollingCoordinator so
it's fine to always call it.

Source/WebCore:

* page/Page.cpp:
(WebCore::Page::passiveTouchEventListenerRectsForTesting):
(WebCore::Page::finalizeRenderingUpdate):
* page/Page.h:

Source/WebKit:

* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updateRendering):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::finalizeRenderingUpdate):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updateRendering):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (260642 => 260643)


--- trunk/Source/WebCore/ChangeLog	2020-04-24 14:57:32 UTC (rev 260642)
+++ trunk/Source/WebCore/ChangeLog	2020-04-24 15:03:22 UTC (rev 260643)
@@ -1,3 +1,21 @@
+2020-04-24  Simon Fraser  <[email protected]>
+
+        Move some post-renderingUpdate code into WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=210952
+
+        Reviewed by Antti Koivisto.
+
+        Factor some code called by the various DrawingArea subclasses into Page::finalizeRenderingUpdate(),
+        with some flags to control behavior that differs between drawing areas.
+
+        ScrollingCoordinator::commitTreeStateIfNeeded() is a no-op for RemoteScrollingCoordinator so
+        it's fine to always call it.
+
+        * page/Page.cpp:
+        (WebCore::Page::passiveTouchEventListenerRectsForTesting):
+        (WebCore::Page::finalizeRenderingUpdate):
+        * page/Page.h:
+
 2020-04-24  Adrian Perez de Castro  <[email protected]>
 
         Add missing HTMLNames:: namespace prefix to usage of liTag object

Modified: trunk/Source/WebCore/page/Page.cpp (260642 => 260643)


--- trunk/Source/WebCore/page/Page.cpp	2020-04-24 14:57:32 UTC (rev 260642)
+++ trunk/Source/WebCore/page/Page.cpp	2020-04-24 15:03:22 UTC (rev 260643)
@@ -516,7 +516,7 @@
     }
 
     Vector<IntRect> rects;
-    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+    if (auto* scrollingCoordinator = this->scrollingCoordinator())
         rects.appendVector(scrollingCoordinator->absoluteEventTrackingRegions().asynchronousDispatchRegion.rects());
 
     Vector<FloatQuad> quads(rects.size());
@@ -1422,6 +1422,26 @@
 #endif
 }
 
+void Page::finalizeRenderingUpdate(OptionSet<FinalizeRenderingUpdateFlags> flags)
+{
+    auto* view = mainFrame().view();
+    if (!view)
+        return;
+
+    if (flags.contains(FinalizeRenderingUpdateFlags::InvalidateImagesWithAsyncDecodes))
+        view->invalidateImagesWithAsyncDecodes();
+
+    view->flushCompositingStateIncludingSubframes();
+
+#if ENABLE(ASYNC_SCROLLING)
+    if (auto* scrollingCoordinator = this->scrollingCoordinator()) {
+        scrollingCoordinator->commitTreeStateIfNeeded();
+        if (flags.contains(FinalizeRenderingUpdateFlags::ApplyScrollingTreeLayerPositions))
+            scrollingCoordinator->applyScrollingTreeLayerPositions();
+    }
+#endif
+}
+
 void Page::suspendScriptedAnimations()
 {
     m_scriptedAnimationsSuspended = true;

Modified: trunk/Source/WebCore/page/Page.h (260642 => 260643)


--- trunk/Source/WebCore/page/Page.h	2020-04-24 14:57:32 UTC (rev 260642)
+++ trunk/Source/WebCore/page/Page.h	2020-04-24 15:03:22 UTC (rev 260643)
@@ -164,6 +164,11 @@
     Conservative, // Used in low memory situations.
 };
 
+enum class FinalizeRenderingUpdateFlags : uint8_t {
+    ApplyScrollingTreeLayerPositions    = 1 << 0,
+    InvalidateImagesWithAsyncDecodes    = 1 << 1,
+};
+
 class Page : public Supplementable<Page>, public CanMakeWeakPtr<Page> {
     WTF_MAKE_NONCOPYABLE(Page);
     WTF_MAKE_FAST_ALLOCATED;
@@ -481,6 +486,8 @@
     WEBCORE_EXPORT void layoutIfNeeded();
     WEBCORE_EXPORT void updateRendering();
     
+    WEBCORE_EXPORT void finalizeRenderingUpdate(OptionSet<FinalizeRenderingUpdateFlags>);
+    
     WEBCORE_EXPORT void scheduleRenderingUpdate();
     void scheduleTimedRenderingUpdate();
 

Modified: trunk/Source/WebKit/ChangeLog (260642 => 260643)


--- trunk/Source/WebKit/ChangeLog	2020-04-24 14:57:32 UTC (rev 260642)
+++ trunk/Source/WebKit/ChangeLog	2020-04-24 15:03:22 UTC (rev 260643)
@@ -1,3 +1,24 @@
+2020-04-24  Simon Fraser  <[email protected]>
+
+        Move some post-renderingUpdate code into WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=210952
+
+        Reviewed by Antti Koivisto.
+
+        Factor some code called by the various DrawingArea subclasses into Page::finalizeRenderingUpdate(),
+        with some flags to control behavior that differs between drawing areas.
+
+        ScrollingCoordinator::commitTreeStateIfNeeded() is a no-op for RemoteScrollingCoordinator so
+        it's fine to always call it.
+
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::updateRendering):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::finalizeRenderingUpdate):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::updateRendering):
+
 2020-04-24  Chris Dumez  <[email protected]>
 
         [iOS] Stop using legacy BKSApplicationStateMonitor

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm (260642 => 260643)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm	2020-04-24 14:57:32 UTC (rev 260642)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm	2020-04-24 15:03:22 UTC (rev 260643)
@@ -338,10 +338,11 @@
 
     addCommitHandlers();
 
+    OptionSet<FinalizeRenderingUpdateFlags> flags;
     if (m_nextRenderingUpdateRequiresSynchronousImageDecoding)
-        m_webPage.mainFrameView()->invalidateImagesWithAsyncDecodes();
+        flags.add(FinalizeRenderingUpdateFlags::InvalidateImagesWithAsyncDecodes);
 
-    m_webPage.mainFrameView()->flushCompositingStateIncludingSubframes();
+    m_webPage.finalizeRenderingUpdate(flags);
 
     // Because our view-relative overlay root layer is not attached to the FrameView's GraphicsLayer tree, we need to flush it manually.
     if (m_viewOverlayRootLayer)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (260642 => 260643)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-04-24 14:57:32 UTC (rev 260642)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-04-24 15:03:22 UTC (rev 260643)
@@ -3812,6 +3812,11 @@
     m_page->updateRendering();
 }
 
+void WebPage::finalizeRenderingUpdate(OptionSet<FinalizeRenderingUpdateFlags> flags)
+{
+    m_page->finalizeRenderingUpdate(flags);
+}
+
 WebInspector* WebPage::inspector(LazyCreationPolicy behavior)
 {
     if (m_isClosed)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (260642 => 260643)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-04-24 14:57:32 UTC (rev 260642)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-04-24 15:03:22 UTC (rev 260643)
@@ -351,6 +351,7 @@
 
     void layoutIfNeeded();
     void updateRendering();
+    void finalizeRenderingUpdate(OptionSet<WebCore::FinalizeRenderingUpdateFlags>);
 
     enum class LazyCreationPolicy { UseExistingOnly, CreateIfNeeded };
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (260642 => 260643)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2020-04-24 14:57:32 UTC (rev 260642)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2020-04-24 15:03:22 UTC (rev 260643)
@@ -475,17 +475,13 @@
             m_viewOverlayRootLayer->flushCompositingState(visibleRect);
 
         addCommitHandlers();
-        
-        bool didFlushAllFrames = m_webPage.mainFrameView()->flushCompositingStateIncludingSubframes();
 
-#if ENABLE(ASYNC_SCROLLING)
-        if (auto* scrollingCoordinator = m_webPage.corePage()->scrollingCoordinator()) {
-            scrollingCoordinator->commitTreeStateIfNeeded();
-            if (flushType == UpdateRenderingType::Normal)
-                scrollingCoordinator->applyScrollingTreeLayerPositions();
-        }
-#endif
+        OptionSet<FinalizeRenderingUpdateFlags> flags;
+        if (flushType == UpdateRenderingType::Normal)
+            flags.add(FinalizeRenderingUpdateFlags::ApplyScrollingTreeLayerPositions);
 
+        m_webPage.finalizeRenderingUpdate(flags);
+
         // If we have an active transient zoom, we want the zoom to win over any changes
         // that WebCore makes to the relevant layers, so re-apply our changes after flushing.
         if (m_transientZoomScale != 1)
@@ -496,10 +492,8 @@
             m_pendingCallbackIDs.clear();
         }
 
-        if (didFlushAllFrames) {
-            sendDidFirstLayerFlushIfNeeded();
-            invalidateRenderingUpdateRunLoopObserver();
-        }
+        sendDidFirstLayerFlushIfNeeded();
+        invalidateRenderingUpdateRunLoopObserver();
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to