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

Log Message

Document::updateMainArticleElementAfterLayout() should be a no-op when no client depends on knowing the main article element
https://bugs.webkit.org/show_bug.cgi?id=193843

Reviewed by Zalan Bujtas.

* dom/Document.cpp:
(WebCore::Document::updateMainArticleElementAfterLayout):

This function currently does a bit of wasted work after every layout, on clients that don't listen to the
"significant rendered text" layout milestone and therefore don't need to guess the main article element. Simply
don't bother keeping the main article element up to date in this scenario by bailing from
FrameView::updateHasReachedSignificantRenderedTextThreshold if the client doesn't care about the significant
rendered text milestone.

* page/FrameView.cpp:
(WebCore::FrameView::updateHasReachedSignificantRenderedTextThreshold):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240538 => 240539)


--- trunk/Source/WebCore/ChangeLog	2019-01-26 03:24:03 UTC (rev 240538)
+++ trunk/Source/WebCore/ChangeLog	2019-01-26 03:38:57 UTC (rev 240539)
@@ -1,3 +1,22 @@
+2019-01-25  Wenson Hsieh  <[email protected]>
+
+        Document::updateMainArticleElementAfterLayout() should be a no-op when no client depends on knowing the main article element
+        https://bugs.webkit.org/show_bug.cgi?id=193843
+
+        Reviewed by Zalan Bujtas.
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateMainArticleElementAfterLayout):
+
+        This function currently does a bit of wasted work after every layout, on clients that don't listen to the
+        "significant rendered text" layout milestone and therefore don't need to guess the main article element. Simply
+        don't bother keeping the main article element up to date in this scenario by bailing from
+        FrameView::updateHasReachedSignificantRenderedTextThreshold if the client doesn't care about the significant
+        rendered text milestone.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateHasReachedSignificantRenderedTextThreshold):
+
 2019-01-25  Jer Noble  <[email protected]>
 
         <video> elements not in the DOM should be allowed to AirPlay

Modified: trunk/Source/WebCore/dom/Document.cpp (240538 => 240539)


--- trunk/Source/WebCore/dom/Document.cpp	2019-01-26 03:24:03 UTC (rev 240538)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-01-26 03:38:57 UTC (rev 240539)
@@ -8373,6 +8373,8 @@
 
 void Document::updateMainArticleElementAfterLayout()
 {
+    ASSERT(page() && page()->requestedLayoutMilestones().contains(DidRenderSignificantAmountOfText));
+
     // If there are too many article elements on the page, don't consider any one of them to be "main content".
     const unsigned maxNumberOfArticlesBeforeIgnoringMainContentArticle = 10;
 

Modified: trunk/Source/WebCore/page/FrameView.cpp (240538 => 240539)


--- trunk/Source/WebCore/page/FrameView.cpp	2019-01-26 03:24:03 UTC (rev 240538)
+++ trunk/Source/WebCore/page/FrameView.cpp	2019-01-26 03:38:57 UTC (rev 240539)
@@ -4418,6 +4418,10 @@
     if (m_hasReachedSignificantRenderedTextThreshold)
         return;
 
+    auto* page = frame().page();
+    if (!page || !page->requestedLayoutMilestones().contains(DidRenderSignificantAmountOfText))
+        return;
+
     auto* document = frame().document();
     if (!document)
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to