⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 248364 in webkit


Ignore:
Timestamp:
Aug 7, 2019, 7:23:54 AM (7 years ago)
Author:
Alan Bujtas
Message:

[LFC] Introduce Layout::Phase class
https://bugs.webkit.org/show_bug.cgi?id=200473
<rdar://problem/53996061>

Reviewed by Antti Koivisto.

It helps to check whether we could run certain actions like layout while constructing the tree.

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • layout/LayoutState.h:
  • layout/floats/FloatingContext.cpp:
  • layout/inlineformatting/InlineLine.cpp:
  • layout/layouttree/LayoutBox.cpp:

(WebCore::Layout::Box::establishesFormattingContext const):
(WebCore::Layout::Box::containingBlock const):
(WebCore::Layout::Box::formattingContextRoot const):

  • layout/layouttree/LayoutTreeBuilder.cpp:

(WebCore::Layout::TreeBuilder::createLayoutTree):

Location:
trunk/Source/WebCore
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r248362 r248364  
     12019-08-07  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Introduce Layout::Phase class
     4        https://bugs.webkit.org/show_bug.cgi?id=200473
     5        <rdar://problem/53996061>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        It helps to check whether we could run certain actions like layout while constructing the tree.
     10
     11        * Sources.txt:
     12        * WebCore.xcodeproj/project.pbxproj:
     13        * layout/LayoutState.h:
     14        * layout/floats/FloatingContext.cpp:
     15        * layout/inlineformatting/InlineLine.cpp:
     16        * layout/layouttree/LayoutBox.cpp:
     17        (WebCore::Layout::Box::establishesFormattingContext const):
     18        (WebCore::Layout::Box::containingBlock const):
     19        (WebCore::Layout::Box::formattingContextRoot const):
     20        * layout/layouttree/LayoutTreeBuilder.cpp:
     21        (WebCore::Layout::TreeBuilder::createLayoutTree):
     22
    1232019-08-07  Chris Lord  <clord@igalia.com>
    224
  • trunk/Source/WebCore/Sources.txt

    r248310 r248364  
    13861386layout/FormattingContextQuirks.cpp
    13871387layout/FormattingState.cpp
     1388layout/LayoutPhase.cpp
    13881389layout/LayoutState.cpp
    13891390layout/Verification.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r248310 r248364  
    91359135                6F3E1F5F2136141700A65A08 /* FloatBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FloatBox.cpp; sourceTree = "<group>"; };
    91369136                6F3E1F612136141700A65A08 /* FloatBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FloatBox.h; sourceTree = "<group>"; };
     9137                6F4A5BD522F9F16B00A80F25 /* LayoutPhase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutPhase.cpp; sourceTree = "<group>"; };
    91379138                6F73918C2106CEDD006AF262 /* LayoutUnits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutUnits.h; sourceTree = "<group>"; };
    91389139                6F7CA3C4208C2956002F29AB /* LayoutState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutState.h; sourceTree = "<group>"; };
     
    91859186                6FE7CFA02177EEF1005B1573 /* InlineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineItem.h; sourceTree = "<group>"; };
    91869187                6FE9F09222211035004C5082 /* ContentChangeObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentChangeObserver.cpp; sourceTree = "<group>"; };
     9188                6FEFE81D22F9D22A00114927 /* LayoutPhase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutPhase.h; sourceTree = "<group>"; };
    91879189                6FFDC43E212EFF1600A9CA91 /* FloatAvoider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatAvoider.cpp; sourceTree = "<group>"; };
    91889190                6FFDC440212EFF1600A9CA91 /* FloatAvoider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatAvoider.h; sourceTree = "<group>"; };
     
    1635116353                                115CFA74208AFE30001E6991 /* FormattingState.h */,
    1635216354                                115F7805209CBCBD00739C13 /* Invalidation.h */,
     16355                                6F4A5BD522F9F16B00A80F25 /* LayoutPhase.cpp */,
     16356                                6FEFE81D22F9D22A00114927 /* LayoutPhase.h */,
    1635316357                                6F7CA3C5208C2956002F29AB /* LayoutState.cpp */,
    1635416358                                6F7CA3C4208C2956002F29AB /* LayoutState.h */,
  • trunk/Source/WebCore/layout/LayoutState.cpp

    r248290 r248364  
    3939#include "LayoutBox.h"
    4040#include "LayoutContainer.h"
     41#include "LayoutPhase.h"
    4142#include "LayoutTreeBuilder.h"
    4243#include "RenderView.h"
     
    7273void LayoutState::updateLayout()
    7374{
     75    PhaseScope scope(Phase::Type::Layout);
     76
    7477    ASSERT(!m_formattingContextRootListForLayout.isEmpty());
    7578    for (auto* layoutRoot : m_formattingContextRootListForLayout)
     
    9598void LayoutState::styleChanged(const Box& layoutBox, StyleDiff styleDiff)
    9699{
     100    PhaseScope scope(Phase::Type::Invalidation);
     101
    97102    auto& formattingState = formattingStateForBox(layoutBox);
    98103    const Container* invalidationRoot = nullptr;
  • trunk/Source/WebCore/layout/LayoutState.h

    r248290 r248364  
    3737namespace WebCore {
    3838
    39 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    4039class RenderView;
    41 #endif
    4240
    4341namespace Display {
  • trunk/Source/WebCore/layout/floats/FloatingContext.cpp

    r245776 r248364  
    3232#include "FloatAvoider.h"
    3333#include "FloatBox.h"
     34#include "FormattingContext.h"
    3435#include "LayoutBox.h"
    3536#include "LayoutContainer.h"
  • trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp

    r248200 r248364  
    2929#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    3030
     31#include "InlineFormattingContext.h"
     32#include "TextUtil.h"
    3133#include <wtf/IsoMallocInlines.h>
    3234
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp

    r248200 r248364  
    3030
    3131#include "LayoutContainer.h"
     32#include "LayoutPhase.h"
    3233#include "RenderStyle.h"
    3334#include <wtf/IsoMallocInlines.h>
     
    6667bool Box::establishesFormattingContext() const
    6768{
     69    // We need the final tree structure to tell whether a box establishes a certain formatting context.
     70    ASSERT(!Phase::isInTreeBuilding());
    6871    return establishesBlockFormattingContext() || establishesInlineFormattingContext() || establishesTableFormattingContext();
    6972}
     
    178181const Container* Box::containingBlock() const
    179182{
     183    // Finding the containing block by traversing the tree during tree construction could provide incorrect result.
     184    ASSERT(!Phase::isInTreeBuilding());
    180185    // The containing block in which the root element lives is a rectangle called the initial containing block.
    181186    // For other elements, if the element's position is 'relative' or 'static', the containing block is formed by the
     
    211216const Container& Box::formattingContextRoot() const
    212217{
     218    // Finding the context root by traversing the tree during tree construction could provide incorrect result.
     219    ASSERT(!Phase::isInTreeBuilding());
    213220    // We should never need to ask this question on the ICB.
    214221    ASSERT(!isInitialContainingBlock());
  • trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

    r248290 r248364  
    3636#include "LayoutContainer.h"
    3737#include "LayoutDescendantIterator.h"
     38#include "LayoutPhase.h"
    3839#include "LayoutState.h"
    3940#include "RenderBlock.h"
     
    7071std::unique_ptr<Container> TreeBuilder::createLayoutTree(const RenderView& renderView)
    7172{
     73    PhaseScope scope(Phase::Type::TreeBuilding);
     74
    7275    auto style = RenderStyle::clone(renderView.style());
    7376    style.setLogicalWidth(Length(renderView.width(), Fixed));
Note: See TracChangeset for help on using the changeset viewer.