REGRESSION (r244182) [WK1]: Page updates should always scheduleCompositingLayerFlush...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Jun 2019 05:19:56 +0000 (05:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Jun 2019 05:19:56 +0000 (05:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198664

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-06-07
Reviewed by Simon Fraser.

Source/WebCore:

Because WK1 is a single process, scheduleCompositingLayerFlush() has to
be called immediately when layers' update is needed. Otherwise no content
will be drawn for the current frame. Doing this will get smooth scrolling
back to WK1.

RenderingUpdateScheduler now has three different scheduling methods:

1. scheduleTimedRenderingUpdate(): This is a two-steps scheduling method.
   DisplayRefreshMonitor has to fire before scheduleCompositingLayerFlush()
   is called. This is used by rAF, WebAnimations and intersection and
   resize observers.

2. scheduleImmediateRenderingUpdate(): This is a one-step scheduling method.
   layerTreeAsText() calls this method because it has to process the rendering
   update within the current frame.

3. scheduleRenderingUpdate(): RenderLayerCompositor::scheduleLayerFlush()
   calls this function to decide either immediately flush layers or wait
   for the next timed frame. scheduleImmediateRenderingUpdate() will be
   called for WK1. scheduleTimedRenderingUpdate() will be called for WK2.

* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::scheduleAnimationResolution):
* dom/Document.cpp:
(WebCore::Document::scheduleTimedRenderingUpdate):
(WebCore::Document::scheduleInitialIntersectionObservationUpdate):
(WebCore::Document::updateResizeObservations):
(WebCore::Document::scheduleRenderingUpdate): Deleted.
* dom/Document.h:
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::scheduleAnimation):
* page/ChromeClient.h:
* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::didChangeViewExposedRect):
(WebCore::PageOverlayController::notifyFlushRequired):
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate):
(WebCore::RenderingUpdateScheduler::displayRefreshFired):
(WebCore::RenderingUpdateScheduler::scheduleImmediateRenderingUpdate):
(WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
(WebCore::RenderingUpdateScheduler::scheduleCompositingLayerFlush): Deleted.
* page/RenderingUpdateScheduler.h:
* page/ResizeObserver.cpp:
(WebCore::ResizeObserver::observe):
* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerTreeAsText):

Source/WebKitLegacy/mac:

WK1 has to skip using DisplayRefreshMonitor when layers need to be updated.

* WebCoreSupport/WebChromeClient.h:
(WebChromeClient::needsImmediateScheduleCompositingLayerFlush):

Tools:

Delete repeated entries which were submitted by mistake.

* Tracing/SystemTracePoints.plist:

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

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/animation/DocumentTimeline.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/ScriptedAnimationController.cpp
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/PageOverlayController.cpp
Source/WebCore/page/RenderingUpdateScheduler.cpp
Source/WebCore/page/RenderingUpdateScheduler.h
Source/WebCore/page/ResizeObserver.cpp
Source/WebCore/page/mac/ServicesOverlayController.mm
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.h
Tools/ChangeLog
Tools/Tracing/SystemTracePoints.plist

index 2c72d6f..3f2b878 100644 (file)
@@ -1,3 +1,59 @@
+2019-06-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        REGRESSION (r244182) [WK1]: Page updates should always scheduleCompositingLayerFlush() immediately
+        https://bugs.webkit.org/show_bug.cgi?id=198664
+
+        Reviewed by Simon Fraser.
+
+        Because WK1 is a single process, scheduleCompositingLayerFlush() has to 
+        be called immediately when layers' update is needed. Otherwise no content
+        will be drawn for the current frame. Doing this will get smooth scrolling
+        back to WK1.
+
+        RenderingUpdateScheduler now has three different scheduling methods:
+
+        1. scheduleTimedRenderingUpdate(): This is a two-steps scheduling method.
+           DisplayRefreshMonitor has to fire before scheduleCompositingLayerFlush()
+           is called. This is used by rAF, WebAnimations and intersection and
+           resize observers.
+
+        2. scheduleImmediateRenderingUpdate(): This is a one-step scheduling method.
+           layerTreeAsText() calls this method because it has to process the rendering
+           update within the current frame.
+
+        3. scheduleRenderingUpdate(): RenderLayerCompositor::scheduleLayerFlush()
+           calls this function to decide either immediately flush layers or wait
+           for the next timed frame. scheduleImmediateRenderingUpdate() will be
+           called for WK1. scheduleTimedRenderingUpdate() will be called for WK2.
+
+        * animation/DocumentTimeline.cpp:
+        (WebCore::DocumentTimeline::scheduleAnimationResolution):
+        * dom/Document.cpp:
+        (WebCore::Document::scheduleTimedRenderingUpdate):
+        (WebCore::Document::scheduleInitialIntersectionObservationUpdate):
+        (WebCore::Document::updateResizeObservations):
+        (WebCore::Document::scheduleRenderingUpdate): Deleted.
+        * dom/Document.h:
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::scheduleAnimation):
+        * page/ChromeClient.h:
+        * page/PageOverlayController.cpp:
+        (WebCore::PageOverlayController::didChangeViewExposedRect):
+        (WebCore::PageOverlayController::notifyFlushRequired):
+        * page/RenderingUpdateScheduler.cpp:
+        (WebCore::RenderingUpdateScheduler::scheduleTimedRenderingUpdate):
+        (WebCore::RenderingUpdateScheduler::displayRefreshFired):
+        (WebCore::RenderingUpdateScheduler::scheduleImmediateRenderingUpdate):
+        (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
+        (WebCore::RenderingUpdateScheduler::scheduleCompositingLayerFlush): Deleted.
+        * page/RenderingUpdateScheduler.h:
+        * page/ResizeObserver.cpp:
+        (WebCore::ResizeObserver::observe):
+        * page/mac/ServicesOverlayController.mm:
+        (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::layerTreeAsText):
+
 2019-06-07  Megan Gardner  <megan_gardner@apple.com>
 
         Extend quirks to emulate bold/italic/underline in hidden editable areas
index bbdd391..c995b46 100644 (file)
@@ -318,7 +318,7 @@ void DocumentTimeline::scheduleAnimationResolution()
     if (!m_document || !m_document->page())
         return;
     
-    m_document->page()->renderingUpdateScheduler().scheduleRenderingUpdate();
+    m_document->page()->renderingUpdateScheduler().scheduleTimedRenderingUpdate();
     m_animationResolutionScheduled = true;
 }
 
index 58b6d6a..6519391 100644 (file)
@@ -540,7 +540,7 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig
 #endif
 #if ENABLE(INTERSECTION_OBSERVER)
     , m_intersectionObserversNotifyTimer(*this, &Document::notifyIntersectionObserversTimerFired)
-    , m_intersectionObserversInitialUpdateTimer(*this, &Document::scheduleRenderingUpdate)
+    , m_intersectionObserversInitialUpdateTimer(*this, &Document::scheduleTimedRenderingUpdate)
 #endif
     , m_loadEventDelayTimer(*this, &Document::loadEventDelayTimerFired)
 #if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
@@ -7292,10 +7292,10 @@ void Document::removeAppearanceDependentPicture(HTMLPictureElement& picture)
     m_appearanceDependentPictures.remove(&picture);
 }
 
-void Document::scheduleRenderingUpdate()
+void Document::scheduleTimedRenderingUpdate()
 {
     if (auto page = this->page())
-        page->renderingUpdateScheduler().scheduleRenderingUpdate();
+        page->renderingUpdateScheduler().scheduleTimedRenderingUpdate();
 }
 
 #if ENABLE(INTERSECTION_OBSERVER)
@@ -7523,7 +7523,7 @@ void Document::notifyIntersectionObserversTimerFired()
 void Document::scheduleInitialIntersectionObservationUpdate()
 {
     if (m_readyState == Complete)
-        scheduleRenderingUpdate();
+        scheduleTimedRenderingUpdate();
     else if (!m_intersectionObserversInitialUpdateTimer.isActive())
         m_intersectionObserversInitialUpdateTimer.startOneShot(intersectionObserversInitialUpdateDelay);
 }
@@ -7605,7 +7605,7 @@ void Document::updateResizeObservations(Page& page)
         getParserLocation(url, line, column);
         reportException("ResizeObserver loop completed with undelivered notifications.", line, column, url, nullptr, nullptr);
         // Starting a new schedule the next round of notify.
-        scheduleRenderingUpdate();
+        scheduleTimedRenderingUpdate();
     }
 }
 #endif
index 29f730e..ea9c81b 100644 (file)
@@ -1380,7 +1380,7 @@ public:
     void addAppearanceDependentPicture(HTMLPictureElement&);
     void removeAppearanceDependentPicture(HTMLPictureElement&);
 
-    void scheduleRenderingUpdate();
+    void scheduleTimedRenderingUpdate();
 
 #if ENABLE(INTERSECTION_OBSERVER)
     void addIntersectionObserver(IntersectionObserver&);
index 4718a92..c7d6d3a 100644 (file)
@@ -256,7 +256,7 @@ void ScriptedAnimationController::scheduleAnimation()
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     if (!m_isUsingTimer && !isThrottled()) {
         if (auto* page = this->page()) {
-            page->renderingUpdateScheduler().scheduleRenderingUpdate();
+            page->renderingUpdateScheduler().scheduleTimedRenderingUpdate();
             return;
         }
 
index ad70588..c66b1a7 100644 (file)
@@ -320,6 +320,7 @@ public:
     // Sets a flag to specify that the view needs to be updated, so we need
     // to do an eager layout before the drawing.
     virtual void scheduleCompositingLayerFlush() = 0;
+    virtual bool needsImmediateRenderingUpdate() const { return false; }
     // Returns whether or not the client can render the composited layer,
     // regardless of the settings.
     virtual bool allowsAcceleratedCompositing() const { return true; }
index 0c03315..53f6e37 100644 (file)
@@ -318,7 +318,7 @@ void PageOverlayController::didChangeDeviceScaleFactor()
 
 void PageOverlayController::didChangeViewExposedRect()
 {
-    m_page.renderingUpdateScheduler().scheduleRenderingUpdate();
+    m_page.renderingUpdateScheduler().scheduleTimedRenderingUpdate();
 }
 
 void PageOverlayController::didScrollFrame(Frame& frame)
@@ -412,7 +412,7 @@ float PageOverlayController::deviceScaleFactor() const
 
 void PageOverlayController::notifyFlushRequired(const GraphicsLayer*)
 {
-    m_page.renderingUpdateScheduler().scheduleRenderingUpdate();
+    m_page.renderingUpdateScheduler().scheduleTimedRenderingUpdate();
 }
 
 void PageOverlayController::didChangeOverlayFrame(PageOverlay& overlay)
index 02083b8..56a011c 100644 (file)
@@ -42,14 +42,14 @@ RenderingUpdateScheduler::RenderingUpdateScheduler(Page& page)
 #endif
 }
 
-void RenderingUpdateScheduler::scheduleRenderingUpdate()
+void RenderingUpdateScheduler::scheduleTimedRenderingUpdate()
 {
     if (isScheduled())
         return;
 
     // Optimize the case when an invisible page wants just to schedule layer flush.
     if (!m_page.isVisible()) {
-        scheduleCompositingLayerFlush();
+        scheduleImmediateRenderingUpdate();
         return;
     }
 
@@ -102,12 +102,20 @@ void RenderingUpdateScheduler::displayRefreshFired()
     tracePoint(TriggerRenderingUpdate);
 
     clearScheduled();
-    scheduleCompositingLayerFlush();
+    scheduleImmediateRenderingUpdate();
 }
 
-void RenderingUpdateScheduler::scheduleCompositingLayerFlush()
+void RenderingUpdateScheduler::scheduleImmediateRenderingUpdate()
 {
     m_page.chrome().client().scheduleCompositingLayerFlush();
 }
 
+void RenderingUpdateScheduler::scheduleRenderingUpdate()
+{
+    if (m_page.chrome().client().needsImmediateRenderingUpdate())
+        scheduleImmediateRenderingUpdate();
+    else
+        scheduleTimedRenderingUpdate();
+}
+
 }
index 879a2ad..fade62f 100644 (file)
@@ -46,8 +46,9 @@ public:
     }
 
     RenderingUpdateScheduler(Page&);
+    void scheduleTimedRenderingUpdate();
+    void scheduleImmediateRenderingUpdate();
     void scheduleRenderingUpdate();
-    void scheduleCompositingLayerFlush();
 
 private:
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
index b9bd9bd..cbe5168 100644 (file)
@@ -73,7 +73,7 @@ void ResizeObserver::observe(Element& target)
 
     if (m_document) {
         m_document->addResizeObserver(*this);
-        m_document->scheduleRenderingUpdate();
+        m_document->scheduleTimedRenderingUpdate();
     }
 }
 
index 22b65d9..4ebf518 100644 (file)
@@ -121,7 +121,7 @@ void ServicesOverlayController::Highlight::notifyFlushRequired(const GraphicsLay
     if (!m_controller)
         return;
 
-    m_controller->page().renderingUpdateScheduler().scheduleRenderingUpdate();
+    m_controller->page().renderingUpdateScheduler().scheduleTimedRenderingUpdate();
 }
 
 void ServicesOverlayController::Highlight::paintContents(const GraphicsLayer*, GraphicsContext& graphicsContext, OptionSet<GraphicsLayerPaintingPhase>, const FloatRect&, GraphicsLayerPaintBehavior)
index 1eafb8e..f633f32 100644 (file)
@@ -2061,7 +2061,7 @@ String RenderLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
         return String();
 
     flushPendingLayerChanges(true);
-    page().renderingUpdateScheduler().scheduleCompositingLayerFlush();
+    page().renderingUpdateScheduler().scheduleImmediateRenderingUpdate();
 
     LayerTreeAsTextBehavior layerTreeBehavior = LayerTreeAsTextBehaviorNormal;
     if (flags & LayerTreeFlagsIncludeDebugInfo)
index e8d0993..c4334a9 100644 (file)
@@ -1 +1,13 @@
+2019-06-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        REGRESSION (r244182) [WK1]: Page updates should always scheduleCompositingLayerFlush() immediately
+        https://bugs.webkit.org/show_bug.cgi?id=198664
+
+        Reviewed by Simon Fraser.
+
+        WK1 has to skip using DisplayRefreshMonitor when layers need to be updated.
+
+        * WebCoreSupport/WebChromeClient.h:
+        (WebChromeClient::needsImmediateScheduleCompositingLayerFlush):
+
 == Rolled over to ChangeLog-2019-06-05 ==
index 7e0a625..4cbd904 100644 (file)
@@ -176,6 +176,7 @@ private:
     void attachViewOverlayGraphicsLayer(WebCore::GraphicsLayer*) final;
     void setNeedsOneShotDrawingSynchronization() final;
     void scheduleCompositingLayerFlush() final;
+    bool needsImmediateRenderingUpdate() const final { return true; }
 
     CompositingTriggerFlags allowedCompositingTriggers() const final
     {
index 71cef12..589c812 100644 (file)
@@ -1,3 +1,14 @@
+2019-06-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+        REGRESSION (r244182) [WK1]: Page updates should always scheduleCompositingLayerFlush() immediately
+        https://bugs.webkit.org/show_bug.cgi?id=198664
+
+        Reviewed by Simon Fraser.
+
+        Delete repeated entries which were submitted by mistake.
+
+        * Tracing/SystemTracePoints.plist:
+
 2019-06-07  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Allow clients to vend custom -inputView and -inputAccessoryView by overriding WKWebView methods
index ad28156..b44dc43 100644 (file)
              </dict>
              <dict>
                  <key>Name</key>
-                 <string>Schedule rendering update</string>
-                 <key>Type</key>
-                 <string>Impulse</string>
-                 <key>Component</key>
-                 <string>47</string>
-                 <key>Code</key>
-                 <string>5028</string>
-             </dict>
-             <dict>
-                 <key>Name</key>
-                 <string>Trigger rendering update</string>
-                 <key>Type</key>
-                 <string>Impulse</string>
-                 <key>Component</key>
-                 <string>47</string>
-                 <key>Code</key>
-                 <string>5029</string>
-             </dict>
-             <dict>
-                 <key>Name</key>
-                 <string>Rendering update</string>
-                 <key>Type</key>
-                 <string>Interval</string>
-                 <key>Component</key>
-                 <string>47</string>
-                 <key>CodeBegin</key>
-                 <string>5030</string>
-                 <key>CodeEnd</key>
-                 <string>5031</string>
-             </dict>
-             <dict>
-                 <key>Name</key>
                  <string>Paint WebHTMLView</string>
                  <key>Type</key>
                  <string>Interval</string>