Title: [240495] trunk/Source/WebCore
Revision
240495
Author
[email protected]
Date
2019-01-25 12:38:59 -0800 (Fri, 25 Jan 2019)

Log Message

Remove FrameView::m_firstVisuallyNonEmptyLayoutCallbackPending
https://bugs.webkit.org/show_bug.cgi?id=193835

Reviewed by Simon Fraser.

Currently updateIsVisuallyNonEmpty() is called from fireLayoutRelatedMilestonesIfNeeded() and from the incrementVisually*() functions.
By calling it from incrementVisually*() and setting the m_isVisuallyNonEmpty flag to true early does not have any impact on when the milestone is fired.
The milestone firing, as part of the post-layout tasks is triggered by a subsequent layout.
However having multiple callers of updateIsVisuallyNonEmpty() requires an extra boolen (m_firstVisuallyNonEmptyLayoutCallbackPending) to maintain.
Also calling updateIsVisuallyNonEmpty() repeatedly could be costly (with the current threshold of 200 characters, I don't think it is though).

This patch removes m_firstVisuallyNonEmptyLayoutCallbackPending and moves the logic from updateIsVisuallyNonEmpty() to fireLayoutRelatedMilestonesIfNeeded().

* page/FrameView.cpp:
(WebCore::FrameView::resetLayoutMilestones):
(WebCore::FrameView::loadProgressingStatusChanged):
(WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount):
(WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
(WebCore::FrameView::updateIsVisuallyNonEmpty): Deleted.
* page/FrameView.h:
(WebCore::FrameView::incrementVisuallyNonEmptyPixelCount):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240494 => 240495)


--- trunk/Source/WebCore/ChangeLog	2019-01-25 20:24:14 UTC (rev 240494)
+++ trunk/Source/WebCore/ChangeLog	2019-01-25 20:38:59 UTC (rev 240495)
@@ -1,3 +1,27 @@
+2019-01-25  Zalan Bujtas  <[email protected]>
+
+        Remove FrameView::m_firstVisuallyNonEmptyLayoutCallbackPending
+        https://bugs.webkit.org/show_bug.cgi?id=193835
+
+        Reviewed by Simon Fraser.
+
+        Currently updateIsVisuallyNonEmpty() is called from fireLayoutRelatedMilestonesIfNeeded() and from the incrementVisually*() functions.
+        By calling it from incrementVisually*() and setting the m_isVisuallyNonEmpty flag to true early does not have any impact on when the milestone is fired.
+        The milestone firing, as part of the post-layout tasks is triggered by a subsequent layout.
+        However having multiple callers of updateIsVisuallyNonEmpty() requires an extra boolen (m_firstVisuallyNonEmptyLayoutCallbackPending) to maintain.
+        Also calling updateIsVisuallyNonEmpty() repeatedly could be costly (with the current threshold of 200 characters, I don't think it is though).
+
+        This patch removes m_firstVisuallyNonEmptyLayoutCallbackPending and moves the logic from updateIsVisuallyNonEmpty() to fireLayoutRelatedMilestonesIfNeeded().
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::resetLayoutMilestones):
+        (WebCore::FrameView::loadProgressingStatusChanged):
+        (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount):
+        (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
+        (WebCore::FrameView::updateIsVisuallyNonEmpty): Deleted.
+        * page/FrameView.h:
+        (WebCore::FrameView::incrementVisuallyNonEmptyPixelCount):
+
 2019-01-25  David Kilzer  <[email protected]>
 
         Move soft-linking of Lookup.framework out of LookupSPI.h

Modified: trunk/Source/WebCore/page/FrameView.cpp (240494 => 240495)


--- trunk/Source/WebCore/page/FrameView.cpp	2019-01-25 20:24:14 UTC (rev 240494)
+++ trunk/Source/WebCore/page/FrameView.cpp	2019-01-25 20:38:59 UTC (rev 240495)
@@ -293,7 +293,6 @@
 {
     m_firstLayoutCallbackPending = false;
     m_isVisuallyNonEmpty = false;
-    m_firstVisuallyNonEmptyLayoutCallbackPending = true;
     m_significantRenderedTextMilestonePending = true;
     m_renderedSignificantAmountOfText = false;
     m_visuallyNonEmptyCharacterCount = 0;
@@ -2851,8 +2850,7 @@
 
 void FrameView::loadProgressingStatusChanged()
 {
-    auto hasPendingVisuallyNonEmptyCallback = m_firstVisuallyNonEmptyLayoutCallbackPending && !m_isVisuallyNonEmpty;
-    if (hasPendingVisuallyNonEmptyCallback && frame().loader().isComplete())
+    if (!m_isVisuallyNonEmpty && frame().loader().isComplete())
         fireLayoutRelatedMilestonesIfNeeded();
     updateLayerFlushThrottling();
     adjustTiledBackingCoverage();
@@ -4389,7 +4387,7 @@
 
 void FrameView::incrementVisuallyNonEmptyCharacterCount(const String& inlineText)
 {
-    if (m_isVisuallyNonEmpty && m_renderedSignificantAmountOfText)
+    if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold && m_renderedSignificantAmountOfText)
         return;
 
     ++m_textRendererCountForVisuallyNonEmptyCharacters;
@@ -4405,9 +4403,6 @@
     };
     m_visuallyNonEmptyCharacterCount += nonWhitespaceLength(inlineText);
 
-    if (!m_isVisuallyNonEmpty && m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
-        updateIsVisuallyNonEmpty();
-
     if (!m_renderedSignificantAmountOfText)
         updateSignificantRenderedTextMilestoneIfNeeded();
 }
@@ -4520,16 +4515,6 @@
     m_renderedSignificantAmountOfText = true;
 }
 
-void FrameView::updateIsVisuallyNonEmpty()
-{
-    if (m_isVisuallyNonEmpty)
-        return;
-    if (!qualifiesAsVisuallyNonEmpty())
-        return;
-    m_isVisuallyNonEmpty = true;
-    adjustTiledBackingCoverage();
-}
-
 bool FrameView::isViewForDocumentInFrame() const
 {
     RenderView* renderView = this->renderView();
@@ -5151,14 +5136,11 @@
         if (frame().isMainFrame())
             page->startCountingRelevantRepaintedObjects();
     }
-    updateIsVisuallyNonEmpty();
     updateSignificantRenderedTextMilestoneIfNeeded();
 
-    // If the layout was done with pending sheets, we are not in fact visually non-empty yet.
-    if (m_isVisuallyNonEmpty && m_firstVisuallyNonEmptyLayoutCallbackPending) {
-        m_firstVisuallyNonEmptyLayoutCallbackPending = false;
+    if (!m_isVisuallyNonEmpty && qualifiesAsVisuallyNonEmpty()) {
+        m_isVisuallyNonEmpty = true;
         addPaintPendingMilestones(DidFirstMeaningfulPaint);
-
         if (requestedMilestones & DidFirstVisuallyNonEmptyLayout)
             milestonesAchieved.add(DidFirstVisuallyNonEmptyLayout);
     }

Modified: trunk/Source/WebCore/page/FrameView.h (240494 => 240495)


--- trunk/Source/WebCore/page/FrameView.h	2019-01-25 20:24:14 UTC (rev 240494)
+++ trunk/Source/WebCore/page/FrameView.h	2019-01-25 20:38:59 UTC (rev 240495)
@@ -878,10 +878,9 @@
     OptionSet<PaintBehavior> m_paintBehavior;
     bool m_isPainting;
 
-    unsigned m_visuallyNonEmptyCharacterCount;
-    unsigned m_visuallyNonEmptyPixelCount;
-    bool m_isVisuallyNonEmpty;
-    bool m_firstVisuallyNonEmptyLayoutCallbackPending;
+    bool m_isVisuallyNonEmpty { false };
+    unsigned m_visuallyNonEmptyCharacterCount { 0 };
+    unsigned m_visuallyNonEmptyPixelCount { 0 };
 
     unsigned m_textRendererCountForVisuallyNonEmptyCharacters { 0 };
     bool m_renderedSignificantAmountOfText;
@@ -952,12 +951,9 @@
 
 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
 {
-    if (m_isVisuallyNonEmpty)
+    if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
         return;
     m_visuallyNonEmptyPixelCount += size.width() * size.height();
-    if (m_visuallyNonEmptyPixelCount <= visualPixelThreshold)
-        return;
-    updateIsVisuallyNonEmpty();
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to