Changeset 165534 in webkit


Ignore:
Timestamp:
Mar 13, 2014, 8:41:42 AM (11 years ago)
Author:
Antti Koivisto
Message:

Ensure that layout milestones complete in all cases
https://bugs.webkit.org/show_bug.cgi?id=130101

Reviewed by Darin Adler.

Milestones fail to complete in some testing scenarios.

  • dom/Document.cpp:

(WebCore::Document::setParsing):

Check if we need to fire layout milestones if parsing finishes without pending layout.
Parsing status affects whether the document is considered non-empty and that affects
layout milestones.

Remove explicit layout scheduling here, layout timer will be active already if there
is a layout pending

  • page/FrameView.cpp:

(WebCore::FrameView::performPostLayoutTasks):
(WebCore::FrameView::firePaintRelatedMilestonesIfNeeded):

Renamed for consistency

(WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):

Factor layout milestone firing into a function.

  • page/FrameView.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r165521 r165534  
     12014-03-13  Antti Koivisto  <antti@apple.com>
     2
     3        Ensure that layout milestones complete in all cases
     4        https://bugs.webkit.org/show_bug.cgi?id=130101
     5       
     6        Reviewed by Darin Adler.
     7       
     8        Milestones fail to complete in some testing scenarios.
     9
     10        * dom/Document.cpp:
     11        (WebCore::Document::setParsing):
     12       
     13            Check if we need to fire layout milestones if parsing finishes without pending layout.
     14            Parsing status affects whether the document is considered non-empty and that affects
     15            layout milestones.
     16
     17            Remove explicit layout scheduling here, layout timer will be active already if there
     18            is a layout pending
     19
     20        * page/FrameView.cpp:
     21        (WebCore::FrameView::performPostLayoutTasks):
     22        (WebCore::FrameView::firePaintRelatedMilestonesIfNeeded):
     23       
     24            Renamed for consistency
     25
     26        (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
     27       
     28            Factor layout milestone firing into a function.
     29
     30        * page/FrameView.h:
     31
    1322014-03-12  Brian Burg  <bburg@apple.com>
    233
  • trunk/Source/WebCore/dom/Document.cpp

    r165103 r165534  
    24872487        m_sharedObjectPool = std::make_unique<DocumentSharedObjectPool>();
    24882488
    2489     if (!m_bParsing && view())
    2490         view()->scheduleRelayout();
     2489    if (!m_bParsing && view() && !view()->needsLayout())
     2490        view()->fireLayoutRelatedMilestonesIfNeeded();
    24912491
    24922492#ifdef INSTRUMENT_LAYOUT_SCHEDULING
  • trunk/Source/WebCore/page/FrameView.cpp

    r165484 r165534  
    26362636    frame().selection().updateAndRevealSelection();
    26372637
    2638     LayoutMilestones requestedMilestones = 0;
    2639     LayoutMilestones milestonesAchieved = 0;
    2640     Page* page = frame().page();
    2641     if (page)
    2642         requestedMilestones = page->requestedLayoutMilestones();
    2643 
    2644     if (m_nestedLayoutCount <= 1 && frame().document()->documentElement()) {
    2645         if (m_firstLayoutCallbackPending) {
    2646             m_firstLayoutCallbackPending = false;
    2647             frame().loader().didFirstLayout();
    2648             if (requestedMilestones & DidFirstLayout)
    2649                 milestonesAchieved |= DidFirstLayout;
    2650             if (frame().isMainFrame())
    2651                 page->startCountingRelevantRepaintedObjects();
    2652         }
    2653         updateIsVisuallyNonEmpty();
    2654 
    2655         // If the layout was done with pending sheets, we are not in fact visually non-empty yet.
    2656         if (m_isVisuallyNonEmpty && !frame().document()->didLayoutWithPendingStylesheets() && m_firstVisuallyNonEmptyLayoutCallbackPending) {
    2657             m_firstVisuallyNonEmptyLayoutCallbackPending = false;
    2658             if (requestedMilestones & DidFirstVisuallyNonEmptyLayout)
    2659                 milestonesAchieved |= DidFirstVisuallyNonEmptyLayout;
    2660         }
    2661     }
     2638    if (m_nestedLayoutCount <= 1 && frame().document()->documentElement())
     2639        fireLayoutRelatedMilestonesIfNeeded();
    26622640
    26632641#if PLATFORM(IOS)
     
    26692647#endif
    26702648
    2671     if (milestonesAchieved && frame().isMainFrame())
    2672         frame().loader().didLayout(milestonesAchieved);
    2673 
    26742649#if ENABLE(FONT_LOAD_EVENTS)
    26752650    if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled())
     
    26922667    }
    26932668
    2694     if (page) {
    2695         if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
     2669    if (auto* page = frame().page()) {
     2670        if (auto* scrollingCoordinator = page->scrollingCoordinator())
    26962671            scrollingCoordinator->frameViewLayoutUpdated(this);
    26972672    }
     
    35573532        InspectorInstrumentation::didPaint(renderView, p, rect);
    35583533        // FIXME: should probably not fire milestones for snapshot painting. https://bugs.webkit.org/show_bug.cgi?id=117623
    3559         firePaintRelatedMilestones();
     3534        firePaintRelatedMilestonesIfNeeded();
    35603535    }
    35613536}
     
    41484123}
    41494124
    4150 void FrameView::firePaintRelatedMilestones()
     4125void FrameView::fireLayoutRelatedMilestonesIfNeeded()
     4126{
     4127    LayoutMilestones requestedMilestones = 0;
     4128    LayoutMilestones milestonesAchieved = 0;
     4129    Page* page = frame().page();
     4130    if (page)
     4131        requestedMilestones = page->requestedLayoutMilestones();
     4132
     4133    if (m_firstLayoutCallbackPending) {
     4134        m_firstLayoutCallbackPending = false;
     4135        frame().loader().didFirstLayout();
     4136        if (requestedMilestones & DidFirstLayout)
     4137            milestonesAchieved |= DidFirstLayout;
     4138        if (frame().isMainFrame())
     4139            page->startCountingRelevantRepaintedObjects();
     4140    }
     4141    updateIsVisuallyNonEmpty();
     4142
     4143    // If the layout was done with pending sheets, we are not in fact visually non-empty yet.
     4144    if (m_isVisuallyNonEmpty && !frame().document()->didLayoutWithPendingStylesheets() && m_firstVisuallyNonEmptyLayoutCallbackPending) {
     4145        m_firstVisuallyNonEmptyLayoutCallbackPending = false;
     4146        if (requestedMilestones & DidFirstVisuallyNonEmptyLayout)
     4147            milestonesAchieved |= DidFirstVisuallyNonEmptyLayout;
     4148    }
     4149
     4150    if (milestonesAchieved && frame().isMainFrame())
     4151        frame().loader().didLayout(milestonesAchieved);
     4152}
     4153
     4154void FrameView::firePaintRelatedMilestonesIfNeeded()
    41514155{
    41524156    Page* page = frame().page();
  • trunk/Source/WebCore/page/FrameView.h

    r165484 r165534  
    432432
    433433    void addPaintPendingMilestones(LayoutMilestones);
    434     void firePaintRelatedMilestones();
     434    void firePaintRelatedMilestonesIfNeeded();
     435    void fireLayoutRelatedMilestonesIfNeeded();
    435436    LayoutMilestones milestonesPendingPaint() const { return m_milestonesPendingPaint; }
    436437
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r165484 r165534  
    37563756        return;
    37573757
    3758     m_renderView.frameView().firePaintRelatedMilestones();
     3758    m_renderView.frameView().firePaintRelatedMilestonesIfNeeded();
    37593759}
    37603760
Note: See TracChangeset for help on using the changeset viewer.