Changeset 252912 in webkit


Ignore:
Timestamp:
Nov 27, 2019 1:41:57 PM (4 years ago)
Author:
Alan Bujtas
Message:

[LFC] Run layout on the root when InvalidationState is empty.
https://bugs.webkit.org/show_bug.cgi?id=204651
<rdar://problem/57509616>

Reviewed by Antti Koivisto.

InvalidationState captures style/tree mutation related changes. An empty InvalidationState indicates that the horizontal constraint changed
and we need to initiate a layout on the ICB (and the layout logic will propagate the damage down on the tree).

  • layout/LayoutContext.cpp:

(WebCore::Layout::LayoutContext::layout):

  • layout/RenderBlockFlowLineLayout.cpp:

(WebCore::Layout::RenderBlockFlowLineLayout::layout):

  • layout/layouttree/LayoutTreeBuilder.cpp:

(WebCore::Layout::printLayoutTreeForLiveDocuments):

  • page/FrameViewLayoutContext.cpp:

(WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252911 r252912  
     12019-11-27  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Run layout on the root when InvalidationState is empty.
     4        https://bugs.webkit.org/show_bug.cgi?id=204651
     5        <rdar://problem/57509616>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        InvalidationState captures style/tree mutation related changes. An empty InvalidationState indicates that the horizontal constraint changed
     10        and we need to initiate a layout on the ICB (and the layout logic will propagate the damage down on the tree).
     11
     12        * layout/LayoutContext.cpp:
     13        (WebCore::Layout::LayoutContext::layout):
     14        * layout/RenderBlockFlowLineLayout.cpp:
     15        (WebCore::Layout::RenderBlockFlowLineLayout::layout):
     16        * layout/layouttree/LayoutTreeBuilder.cpp:
     17        (WebCore::Layout::printLayoutTreeForLiveDocuments):
     18        * page/FrameViewLayoutContext.cpp:
     19        (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext):
     20
    1212019-11-27  Antoine Quint  <graouts@apple.com>
    222
  • trunk/Source/WebCore/layout/LayoutContext.cpp

    r252866 r252912  
    6060{
    6161    PhaseScope scope(Phase::Type::Layout);
    62 
    63     auto& formattingContextRootsForLayout = invalidationState.formattingContextRoots();
    64     if (formattingContextRootsForLayout.computesEmpty())
    65         return;
    66 
    6762    // Set the geometry on the root.
    6863    // Note that we never layout the root box. It has to have an already computed geometry (in case of ICB, it's the view geometry).
     
    7873    displayBox.setContentBoxHeight(rootContentBoxSize.height());
    7974    displayBox.setContentBoxWidth(rootContentBoxSize.width());
     75
     76    auto& formattingContextRootsForLayout = invalidationState.formattingContextRoots();
     77    // When invalidation is empty, we assume constraint mutation and start running layout on the context root. Layout logic should be able to figure out the damage.
     78    if (formattingContextRootsForLayout.computesEmpty())
     79        return layoutFormattingContextSubtree(m_layoutState.root(), invalidationState);
     80
    8081    for (auto& formattingContextRoot : formattingContextRootsForLayout)
    8182        layoutFormattingContextSubtree(formattingContextRoot, invalidationState);
  • trunk/Source/WebCore/layout/RenderBlockFlowLineLayout.cpp

    r252893 r252912  
    7575
    7676    auto& rootContainer = m_layoutState->root();
    77 
    78     if (!rootContainer.firstChild())
    79         return;
    80 
    81     InvalidationState invalidationState;
    82     // FIXME: Find some better way to do this.
    83     invalidationState.markNeedsUpdate(*rootContainer.firstChild());
    84 
    85     LayoutContext layoutContext(*m_layoutState);
     77    auto layoutContext = LayoutContext { *m_layoutState };
     78    auto invalidationState = InvalidationState { };
    8679    layoutContext.layout(m_flow.contentSize(), invalidationState);
    8780
  • trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

    r252893 r252912  
    451451        auto& layoutRoot = layoutState.root();
    452452        auto invalidationState = InvalidationState { };
    453         auto invalidationContext = InvalidationContext { invalidationState };
    454         invalidationContext.styleChanged(*layoutRoot.firstChild(), StyleDifference::Layout);
    455 
    456453        LayoutContext(layoutState).layout(renderView.size(), invalidationState);
    457454        showLayoutTree(layoutRoot, &layoutState);
  • trunk/Source/WebCore/page/FrameViewLayoutContext.cpp

    r252866 r252912  
    6262        return;
    6363
     64    // FrameView::setContentsSize temporary disables layout.
     65    if (m_disableSetNeedsLayoutCount)
     66        return;
     67
    6468    auto& renderView = *this->renderView();
    6569    if (!m_layoutTreeContent) {
     
    7377    // FIXME: This is not the real invalidation yet.
    7478    auto invalidationState = Layout::InvalidationState { };
    75     auto invalidationContext = Layout::InvalidationContext { invalidationState };
    76 
    77     // FrameView::setContentsSize temporary disables layout.
    78     if (!m_disableSetNeedsLayoutCount)
    79         invalidationContext.styleChanged(*m_layoutState->root().firstChild(), StyleDifference::Layout);
    80 
    8179    auto layoutContext = Layout::LayoutContext { *m_layoutState };
    8280    layoutContext.layout(view().layoutSize(), invalidationState);
Note: See TracChangeset for help on using the changeset viewer.