Changeset 240539 in webkit


Ignore:
Timestamp:
Jan 25, 2019 7:38:57 PM (5 years ago)
Author:
Wenson Hsieh
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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r240537 r240539  
     12019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Document::updateMainArticleElementAfterLayout() should be a no-op when no client depends on knowing the main article element
     4        https://bugs.webkit.org/show_bug.cgi?id=193843
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * dom/Document.cpp:
     9        (WebCore::Document::updateMainArticleElementAfterLayout):
     10
     11        This function currently does a bit of wasted work after every layout, on clients that don't listen to the
     12        "significant rendered text" layout milestone and therefore don't need to guess the main article element. Simply
     13        don't bother keeping the main article element up to date in this scenario by bailing from
     14        FrameView::updateHasReachedSignificantRenderedTextThreshold if the client doesn't care about the significant
     15        rendered text milestone.
     16
     17        * page/FrameView.cpp:
     18        (WebCore::FrameView::updateHasReachedSignificantRenderedTextThreshold):
     19
    1202019-01-25  Jer Noble  <jer.noble@apple.com>
    221
  • trunk/Source/WebCore/dom/Document.cpp

    r240315 r240539  
    83748374void Document::updateMainArticleElementAfterLayout()
    83758375{
     8376    ASSERT(page() && page()->requestedLayoutMilestones().contains(DidRenderSignificantAmountOfText));
     8377
    83768378    // If there are too many article elements on the page, don't consider any one of them to be "main content".
    83778379    const unsigned maxNumberOfArticlesBeforeIgnoringMainContentArticle = 10;
  • trunk/Source/WebCore/page/FrameView.cpp

    r240519 r240539  
    44194419        return;
    44204420
     4421    auto* page = frame().page();
     4422    if (!page || !page->requestedLayoutMilestones().contains(DidRenderSignificantAmountOfText))
     4423        return;
     4424
    44214425    auto* document = frame().document();
    44224426    if (!document)
Note: See TracChangeset for help on using the changeset viewer.