Title: [273220] trunk/Source/WebCore
Revision
273220
Author
[email protected]
Date
2021-02-21 11:07:33 -0800 (Sun, 21 Feb 2021)

Log Message

[Paint Timing] Return early from contentful paint check when no contentful pixels/characters at all
https://bugs.webkit.org/show_bug.cgi?id=222245

Reviewed by Simon Fraser.

Bail from recursive contenful-paint check if there are no pixels/text characters in the entire document.

Covered by existing tests, an optimization only.

* dom/Document.cpp:
(WebCore::Document::enqueuePaintTimingEntryIfNeeded):
* page/FrameView.cpp:
(WebCore::FrameView::hasContenfulDescendants const):
* page/FrameView.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273219 => 273220)


--- trunk/Source/WebCore/ChangeLog	2021-02-21 17:20:47 UTC (rev 273219)
+++ trunk/Source/WebCore/ChangeLog	2021-02-21 19:07:33 UTC (rev 273220)
@@ -1,3 +1,20 @@
+2021-02-21  Noam Rosenthal  <[email protected]>
+
+        [Paint Timing] Return early from contentful paint check when no contentful pixels/characters at all
+        https://bugs.webkit.org/show_bug.cgi?id=222245
+
+        Reviewed by Simon Fraser.
+
+        Bail from recursive contenful-paint check if there are no pixels/text characters in the entire document.
+        
+        Covered by existing tests, an optimization only.
+
+        * dom/Document.cpp:
+        (WebCore::Document::enqueuePaintTimingEntryIfNeeded):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::hasContenfulDescendants const):
+        * page/FrameView.h:
+
 2021-02-21  Martin Robinson  <[email protected]>
 
         Small improvements to r273073

Modified: trunk/Source/WebCore/dom/Document.cpp (273219 => 273220)


--- trunk/Source/WebCore/dom/Document.cpp	2021-02-21 17:20:47 UTC (rev 273219)
+++ trunk/Source/WebCore/dom/Document.cpp	2021-02-21 19:07:33 UTC (rev 273220)
@@ -3244,6 +3244,9 @@
     if (!view()->isVisuallyNonEmpty() || view()->needsLayout())
         return;
 
+    if (!view()->hasContenfulDescendants())
+        return;
+
     if (!ContentfulPaintChecker::qualifiesForContentfulPaint(*view()))
         return;
 

Modified: trunk/Source/WebCore/page/FrameView.cpp (273219 => 273220)


--- trunk/Source/WebCore/page/FrameView.cpp	2021-02-21 17:20:47 UTC (rev 273219)
+++ trunk/Source/WebCore/page/FrameView.cpp	2021-02-21 19:07:33 UTC (rev 273220)
@@ -4616,6 +4616,11 @@
         frame().loader().didReachVisuallyNonEmptyState();
 }
 
+bool FrameView::hasContenfulDescendants() const
+{
+    return m_visuallyNonEmptyCharacterCount || m_visuallyNonEmptyPixelCount;
+}
+
 bool FrameView::isViewForDocumentInFrame() const
 {
     RenderView* renderView = this->renderView();

Modified: trunk/Source/WebCore/page/FrameView.h (273219 => 273220)


--- trunk/Source/WebCore/page/FrameView.h	2021-02-21 17:20:47 UTC (rev 273219)
+++ trunk/Source/WebCore/page/FrameView.h	2021-02-21 19:07:33 UTC (rev 273220)
@@ -413,6 +413,7 @@
     void incrementVisuallyNonEmptyCharacterCount(const String&);
     void incrementVisuallyNonEmptyPixelCount(const IntSize&);
     bool isVisuallyNonEmpty() const { return m_contentQualifiesAsVisuallyNonEmpty; }
+    bool hasContenfulDescendants() const;
     void checkAndDispatchDidReachVisuallyNonEmptyState();
 
     WEBCORE_EXPORT void enableFixedWidthAutoSizeMode(bool enable, const IntSize& minSize);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to