Title: [273327] trunk/Source/WebKit
Revision
273327
Author
[email protected]
Date
2021-02-23 11:55:26 -0800 (Tue, 23 Feb 2021)

Log Message

[CoordinatedGraphics] The whole content is unnecessarily repainted by animations in non-AC mode pages
https://bugs.webkit.org/show_bug.cgi?id=221391

Reviewed by Carlos Garcia Campos.

When triggerRenderingUpdate was called back, it added the whole
view area into the dirty region to repaint in non-AC mode pages.
This caused a problem that the whole content was unnecessarily
repainted by animations in non-AC mode pages.

Call scheduleDisplay instead of setNeedsDisplay in
triggerRenderingUpdate.

However, if the dirty region is empty, display() exited early. If
triggerRenderingUpdate is called back,
DrawingAreaCoordinatedGraphics::display should be called to ensure
WebPage::updateRendering() called even if m_dirtyRegion is empty.

Added a new flag m_scheduledWhileWaitingForDidUpdate.

* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::triggerRenderingUpdate):
Call scheduleDisplay() instead of setNeedsDisplay().
(WebKit::DrawingAreaCoordinatedGraphics::didUpdate):
(WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay): Don't
return early even if m_dirtyRegion is empty.
(WebKit::DrawingAreaCoordinatedGraphics::display()): Ditto.
(WebKit::DrawingAreaCoordinatedGraphics::display(UpdateInfo&)):
Return early if m_dirtyRegion is empty.
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
Added m_scheduledWhileWaitingForDidUpdate.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (273326 => 273327)


--- trunk/Source/WebKit/ChangeLog	2021-02-23 19:46:18 UTC (rev 273326)
+++ trunk/Source/WebKit/ChangeLog	2021-02-23 19:55:26 UTC (rev 273327)
@@ -1,3 +1,37 @@
+2021-02-23  Fujii Hironori  <[email protected]>
+
+        [CoordinatedGraphics] The whole content is unnecessarily repainted by animations in non-AC mode pages
+        https://bugs.webkit.org/show_bug.cgi?id=221391
+
+        Reviewed by Carlos Garcia Campos.
+
+        When triggerRenderingUpdate was called back, it added the whole
+        view area into the dirty region to repaint in non-AC mode pages.
+        This caused a problem that the whole content was unnecessarily
+        repainted by animations in non-AC mode pages.
+
+        Call scheduleDisplay instead of setNeedsDisplay in
+        triggerRenderingUpdate.
+
+        However, if the dirty region is empty, display() exited early. If
+        triggerRenderingUpdate is called back,
+        DrawingAreaCoordinatedGraphics::display should be called to ensure
+        WebPage::updateRendering() called even if m_dirtyRegion is empty.
+
+        Added a new flag m_scheduledWhileWaitingForDidUpdate.
+
+        * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
+        (WebKit::DrawingAreaCoordinatedGraphics::triggerRenderingUpdate):
+        Call scheduleDisplay() instead of setNeedsDisplay().
+        (WebKit::DrawingAreaCoordinatedGraphics::didUpdate):
+        (WebKit::DrawingAreaCoordinatedGraphics::scheduleDisplay): Don't
+        return early even if m_dirtyRegion is empty.
+        (WebKit::DrawingAreaCoordinatedGraphics::display()): Ditto.
+        (WebKit::DrawingAreaCoordinatedGraphics::display(UpdateInfo&)):
+        Return early if m_dirtyRegion is empty.
+        * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h:
+        Added m_scheduledWhileWaitingForDidUpdate.
+
 2021-02-23  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r273304.

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp (273326 => 273327)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp	2021-02-23 19:46:18 UTC (rev 273326)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp	2021-02-23 19:55:26 UTC (rev 273327)
@@ -356,7 +356,7 @@
     if (m_layerTreeHost)
         m_layerTreeHost->scheduleLayerFlush();
     else
-        setNeedsDisplay();
+        scheduleDisplay();
 }
 
 #if USE(COORDINATED_GRAPHICS)
@@ -473,6 +473,10 @@
 
     m_isWaitingForDidUpdate = false;
 
+    if (!m_scheduledWhileWaitingForDidUpdate)
+        return;
+    m_scheduledWhileWaitingForDidUpdate = false;
+
     // Display if needed. We call displayTimerFired here since it will throttle updates to 60fps.
     displayTimerFired();
 }
@@ -677,15 +681,14 @@
 {
     ASSERT(!m_layerTreeHost);
 
-    if (m_isWaitingForDidUpdate)
+    if (m_isWaitingForDidUpdate) {
+        m_scheduledWhileWaitingForDidUpdate = true;
         return;
+    }
 
     if (m_isPaintingSuspended)
         return;
 
-    if (m_dirtyRegion.isEmpty())
-        return;
-
     if (m_displayTimer.isActive())
         return;
 
@@ -709,9 +712,6 @@
     if (m_isPaintingSuspended)
         return;
 
-    if (m_dirtyRegion.isEmpty())
-        return;
-
     if (m_shouldSendDidUpdateBackingStoreState) {
         sendDidUpdateBackingStoreState();
         return;
@@ -720,6 +720,9 @@
     UpdateInfo updateInfo;
     display(updateInfo);
 
+    if (updateInfo.updateRectBounds.isEmpty())
+        return;
+
     if (m_layerTreeHost) {
         // The call to update caused layout which turned on accelerated compositing.
         // Don't send an Update message in this case.
@@ -728,6 +731,7 @@
 
     send(Messages::DrawingAreaProxy::Update(m_backingStoreStateID, updateInfo));
     m_isWaitingForDidUpdate = true;
+    m_scheduledWhileWaitingForDidUpdate = false;
 }
 
 static bool shouldPaintBoundsRect(const IntRect& bounds, const Vector<IntRect, 1>& rects)
@@ -755,7 +759,6 @@
 {
     ASSERT(!m_isPaintingSuspended);
     ASSERT(!m_layerTreeHost);
-    ASSERT(!m_webPage.size().isEmpty());
 
     m_webPage.updateRendering();
     m_webPage.finalizeRenderingUpdate({ });
@@ -766,6 +769,9 @@
     if (m_layerTreeHost)
         return;
 
+    if (m_dirtyRegion.isEmpty())
+        return;
+
     updateInfo.viewSize = m_webPage.size();
     updateInfo.deviceScaleFactor = m_webPage.corePage()->deviceScaleFactor();
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h (273326 => 273327)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h	2021-02-23 19:46:18 UTC (rev 273326)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h	2021-02-23 19:55:26 UTC (rev 273327)
@@ -143,6 +143,7 @@
     // Whether we're waiting for a DidUpdate message. Used for throttling paints so that the 
     // web process won't paint more frequent than the UI process can handle.
     bool m_isWaitingForDidUpdate { false };
+    bool m_scheduledWhileWaitingForDidUpdate { false };
 
     bool m_alwaysUseCompositing { false };
     bool m_supportsAsyncScrolling { true };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to