[LFC] Rename LayoutContext to LayoutState
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2018 13:37:58 +0000 (13:37 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2018 13:37:58 +0000 (13:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191080

Reviewed by Antti Koivisto.

LayoutContext naming was a bit misleading since none of the other *FormattingContext classes (BlockFormattingContext etc) hold states.
(LayoutContext.cpp -> LayoutFormattingState.cpp because LayoutState.cpp name is already taken.)

Now the current state is as follows:

LayoutState has
1. Layout tree
2. State content for each formatting subtrees
3. Display tree

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
(WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
(WebCore::Layout::FormattingContext::computeBorderAndPadding const):
(WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
(WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
(WebCore::Layout::FormattingContext::mapBoxToAncestor):
(WebCore::Layout::FormattingContext::mapTopLeftToAncestor):
(WebCore::Layout::FormattingContext::mapCoordinateToAncestor):
(WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
* layout/FormattingContext.h:
(WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
(WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::complicatedCases):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
(WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::contentHeightForFormattingContextRoot):
(WebCore::Layout::FormattingContext::Geometry::computedMaxHeight):
(WebCore::Layout::FormattingContext::Geometry::computedMinHeight):
(WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
(WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
(WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::complicatedCases):
(WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
(WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
(WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
(WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::computedBorder):
(WebCore::Layout::FormattingContext::Geometry::computedPadding):
(WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
(WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
* layout/FormattingState.cpp:
(WebCore::Layout::FormattingState::FormattingState):
* layout/FormattingState.h:
(WebCore::Layout::FormattingState::setInstrinsicWidthConstraints):
(WebCore::Layout::FormattingState::instrinsicWidthConstraints const):
* layout/LayoutFormattingState.cpp: Renamed from Source/WebCore/layout/LayoutContext.cpp.
(WebCore::Layout::LayoutState::LayoutState):
(WebCore::Layout::LayoutState::initializeRoot):
(WebCore::Layout::LayoutState::updateLayout):
(WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
(WebCore::Layout::LayoutState::displayBoxForLayoutBox const):
(WebCore::Layout::LayoutState::styleChanged):
(WebCore::Layout::LayoutState::markNeedsUpdate):
(WebCore::Layout::LayoutState::formattingStateForBox const):
(WebCore::Layout::LayoutState::establishedFormattingState const):
(WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
(WebCore::Layout::LayoutState::formattingContext const):
* layout/LayoutFormattingState.h: Renamed from Source/WebCore/layout/LayoutContext.h.
(WebCore::Layout::LayoutState::setInQuirksMode):
(WebCore::Layout::LayoutState::hasDisplayBox const):
(WebCore::Layout::LayoutState::inQuirksMode const):
* layout/Verification.cpp:
(WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
(WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
(WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
(WebCore::Layout::verifyAndOutputSubtree):
(WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
(WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const): Deleted.
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layout const):
(WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
(WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
(WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const):
(WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const):
(WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForFormattingRootIfNeeded const):
(WebCore::Layout::hasPrecomputedMarginTop):
(WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
(WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
(WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
(WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const):
(WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
(WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
* layout/blockformatting/BlockFormattingContext.h:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::isStretchedToInitialContainingBlock):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints):
(WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginTop):
* layout/blockformatting/BlockFormattingState.cpp:
(WebCore::Layout::BlockFormattingState::BlockFormattingState):
* layout/blockformatting/BlockFormattingState.h:
* layout/blockformatting/BlockInvalidation.cpp:
(WebCore::Layout::computeUpdateType):
(WebCore::Layout::computeUpdateTypeForAncestor):
(WebCore::Layout::BlockInvalidation::invalidate):
* layout/blockformatting/BlockInvalidation.h:
* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::isMarginTopCollapsedWithParent):
(WebCore::Layout::isMarginBottomCollapsedThrough):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopFromFirstChild):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginTop):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginTop):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBottom):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginTop):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBottom):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBottomFromLastChild):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBottom):
* layout/displaytree/DisplayBox.h:
* layout/floats/FloatAvoider.cpp:
(WebCore::Layout::FloatAvoider::FloatAvoider):
* layout/floats/FloatAvoider.h:
* layout/floats/FloatBox.cpp:
(WebCore::Layout::FloatBox::FloatBox):
* layout/floats/FloatBox.h:
* layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::positionForFloat const):
(WebCore::Layout::FloatingContext::positionForFloatAvoiding const):
(WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
* layout/floats/FloatingContext.h:
(WebCore::Layout::FloatingContext::layoutState const):
(WebCore::Layout::FloatingContext::layoutContext const): Deleted.
* layout/floats/FloatingState.cpp:
(WebCore::Layout::FloatingState::FloatItem::FloatItem):
(WebCore::Layout::FloatingState::FloatingState):
(WebCore::Layout::FloatingState::constraints const):
* layout/floats/FloatingState.h:
(WebCore::Layout::FloatingState::create):
(WebCore::Layout::FloatingState::layoutState const):
(WebCore::Layout::FloatingState::layoutContext const): Deleted.
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layout const):
(WebCore::Layout::InlineFormattingContext::initializeNewLine const):
(WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
(WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
(WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForInlineBox const):
(WebCore::Layout::InlineFormattingContext::computeFloatPosition const):
(WebCore::Layout::InlineFormattingContext::computeStaticPosition const):
(WebCore::Layout::InlineFormattingContext::computeInFlowPositionedPosition const):
(WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
(WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
* layout/inlineformatting/InlineFormattingState.cpp:
(WebCore::Layout::InlineFormattingState::InlineFormattingState):
* layout/inlineformatting/InlineFormattingState.h:
* layout/inlineformatting/InlineInvalidation.cpp:
(WebCore::Layout::InlineInvalidation::invalidate):
* layout/inlineformatting/InlineInvalidation.h:
* layout/inlineformatting/InlineLineBreaker.cpp:
(WebCore::Layout::InlineLineBreaker::InlineLineBreaker):
(WebCore::Layout::InlineLineBreaker::runWidth const):
* layout/inlineformatting/InlineLineBreaker.h:
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::outputInlineRuns):
(WebCore::Layout::outputLayoutTree):
(WebCore::Layout::showLayoutTree):
* layout/layouttree/LayoutTreeBuilder.h:
* page/FrameViewLayoutContext.cpp:
(WebCore::layoutUsingFormattingContext):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237631 268f45cc-cd09-0410-ab3c-d52691b4dbfc

40 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/layout/FormattingContext.cpp
Source/WebCore/layout/FormattingContext.h
Source/WebCore/layout/FormattingContextGeometry.cpp
Source/WebCore/layout/FormattingState.cpp
Source/WebCore/layout/FormattingState.h
Source/WebCore/layout/LayoutFormattingState.cpp [moved from Source/WebCore/layout/LayoutContext.cpp with 87% similarity]
Source/WebCore/layout/LayoutFormattingState.h [moved from Source/WebCore/layout/LayoutContext.h with 88% similarity]
Source/WebCore/layout/Verification.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
Source/WebCore/layout/blockformatting/BlockFormattingContext.h
Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
Source/WebCore/layout/blockformatting/BlockFormattingState.cpp
Source/WebCore/layout/blockformatting/BlockFormattingState.h
Source/WebCore/layout/blockformatting/BlockInvalidation.cpp
Source/WebCore/layout/blockformatting/BlockInvalidation.h
Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp
Source/WebCore/layout/displaytree/DisplayBox.h
Source/WebCore/layout/floats/FloatAvoider.cpp
Source/WebCore/layout/floats/FloatAvoider.h
Source/WebCore/layout/floats/FloatBox.cpp
Source/WebCore/layout/floats/FloatBox.h
Source/WebCore/layout/floats/FloatingContext.cpp
Source/WebCore/layout/floats/FloatingContext.h
Source/WebCore/layout/floats/FloatingState.cpp
Source/WebCore/layout/floats/FloatingState.h
Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
Source/WebCore/layout/inlineformatting/InlineFormattingContext.h
Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp
Source/WebCore/layout/inlineformatting/InlineFormattingState.h
Source/WebCore/layout/inlineformatting/InlineInvalidation.cpp
Source/WebCore/layout/inlineformatting/InlineInvalidation.h
Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp
Source/WebCore/layout/inlineformatting/InlineLineBreaker.h
Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
Source/WebCore/layout/layouttree/LayoutTreeBuilder.h
Source/WebCore/page/FrameViewLayoutContext.cpp

index 1ca4df2..c257f72 100644 (file)
@@ -1,3 +1,206 @@
+2018-10-31  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC] Rename LayoutContext to LayoutState
+        https://bugs.webkit.org/show_bug.cgi?id=191080
+
+        Reviewed by Antti Koivisto.
+
+        LayoutContext naming was a bit misleading since none of the other *FormattingContext classes (BlockFormattingContext etc) hold states.
+        (LayoutContext.cpp -> LayoutFormattingState.cpp because LayoutState.cpp name is already taken.)
+
+        Now the current state is as follows:
+
+        LayoutState has
+        1. Layout tree
+        2. State content for each formatting subtrees
+        3. Display tree
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
+        (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
+        (WebCore::Layout::FormattingContext::computeBorderAndPadding const):
+        (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
+        (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
+        (WebCore::Layout::FormattingContext::mapBoxToAncestor):
+        (WebCore::Layout::FormattingContext::mapTopLeftToAncestor):
+        (WebCore::Layout::FormattingContext::mapCoordinateToAncestor):
+        (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
+        * layout/FormattingContext.h:
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::contentHeightForFormattingContextRoot):
+        (WebCore::Layout::FormattingContext::Geometry::computedMaxHeight):
+        (WebCore::Layout::FormattingContext::Geometry::computedMinHeight):
+        (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
+        (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
+        (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
+        (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
+        (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
+        (WebCore::Layout::FormattingContext::Geometry::computedBorder):
+        (WebCore::Layout::FormattingContext::Geometry::computedPadding):
+        (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
+        (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
+        * layout/FormattingState.cpp:
+        (WebCore::Layout::FormattingState::FormattingState):
+        * layout/FormattingState.h:
+        (WebCore::Layout::FormattingState::setInstrinsicWidthConstraints):
+        (WebCore::Layout::FormattingState::instrinsicWidthConstraints const):
+        * layout/LayoutFormattingState.cpp: Renamed from Source/WebCore/layout/LayoutContext.cpp.
+        (WebCore::Layout::LayoutState::LayoutState):
+        (WebCore::Layout::LayoutState::initializeRoot):
+        (WebCore::Layout::LayoutState::updateLayout):
+        (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
+        (WebCore::Layout::LayoutState::displayBoxForLayoutBox const):
+        (WebCore::Layout::LayoutState::styleChanged):
+        (WebCore::Layout::LayoutState::markNeedsUpdate):
+        (WebCore::Layout::LayoutState::formattingStateForBox const):
+        (WebCore::Layout::LayoutState::establishedFormattingState const):
+        (WebCore::Layout::LayoutState::createFormattingStateForFormattingRootIfNeeded):
+        (WebCore::Layout::LayoutState::formattingContext const):
+        * layout/LayoutFormattingState.h: Renamed from Source/WebCore/layout/LayoutContext.h.
+        (WebCore::Layout::LayoutState::setInQuirksMode):
+        (WebCore::Layout::LayoutState::hasDisplayBox const):
+        (WebCore::Layout::LayoutState::inQuirksMode const):
+        * layout/Verification.cpp:
+        (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
+        (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
+        (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
+        (WebCore::Layout::verifyAndOutputSubtree):
+        (WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
+        (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const): Deleted.
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::layout const):
+        (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
+        (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
+        (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const):
+        (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const):
+        (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForFormattingRootIfNeeded const):
+        (WebCore::Layout::hasPrecomputedMarginTop):
+        (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
+        (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
+        (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
+        (WebCore::Layout::BlockFormattingContext::computeInFlowPositionedPosition const):
+        (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
+        (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
+        (WebCore::Layout::BlockFormattingContext::instrinsicWidthConstraints const):
+        * layout/blockformatting/BlockFormattingContext.h:
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::isStretchedToInitialContainingBlock):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints):
+        (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginTop):
+        * layout/blockformatting/BlockFormattingState.cpp:
+        (WebCore::Layout::BlockFormattingState::BlockFormattingState):
+        * layout/blockformatting/BlockFormattingState.h:
+        * layout/blockformatting/BlockInvalidation.cpp:
+        (WebCore::Layout::computeUpdateType):
+        (WebCore::Layout::computeUpdateTypeForAncestor):
+        (WebCore::Layout::BlockInvalidation::invalidate):
+        * layout/blockformatting/BlockInvalidation.h:
+        * layout/blockformatting/BlockMarginCollapse.cpp:
+        (WebCore::Layout::isMarginTopCollapsedWithParent):
+        (WebCore::Layout::isMarginBottomCollapsedThrough):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopFromFirstChild):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginTop):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginTop):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBottom):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginTop):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBottom):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBottomFromLastChild):
+        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBottom):
+        * layout/displaytree/DisplayBox.h:
+        * layout/floats/FloatAvoider.cpp:
+        (WebCore::Layout::FloatAvoider::FloatAvoider):
+        * layout/floats/FloatAvoider.h:
+        * layout/floats/FloatBox.cpp:
+        (WebCore::Layout::FloatBox::FloatBox):
+        * layout/floats/FloatBox.h:
+        * layout/floats/FloatingContext.cpp:
+        (WebCore::Layout::FloatingContext::positionForFloat const):
+        (WebCore::Layout::FloatingContext::positionForFloatAvoiding const):
+        (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
+        * layout/floats/FloatingContext.h:
+        (WebCore::Layout::FloatingContext::layoutState const):
+        (WebCore::Layout::FloatingContext::layoutContext const): Deleted.
+        * layout/floats/FloatingState.cpp:
+        (WebCore::Layout::FloatingState::FloatItem::FloatItem):
+        (WebCore::Layout::FloatingState::FloatingState):
+        (WebCore::Layout::FloatingState::constraints const):
+        * layout/floats/FloatingState.h:
+        (WebCore::Layout::FloatingState::create):
+        (WebCore::Layout::FloatingState::layoutState const):
+        (WebCore::Layout::FloatingState::layoutContext const): Deleted.
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::layout const):
+        (WebCore::Layout::InlineFormattingContext::initializeNewLine const):
+        (WebCore::Layout::InlineFormattingContext::layoutInlineContent const):
+        (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
+        (WebCore::Layout::InlineFormattingContext::computeWidthAndHeightForInlineBox const):
+        (WebCore::Layout::InlineFormattingContext::computeFloatPosition const):
+        (WebCore::Layout::InlineFormattingContext::computeStaticPosition const):
+        (WebCore::Layout::InlineFormattingContext::computeInFlowPositionedPosition const):
+        (WebCore::Layout::InlineFormattingContext::instrinsicWidthConstraints const):
+        * layout/inlineformatting/InlineFormattingContext.h:
+        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+        (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
+        (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin):
+        * layout/inlineformatting/InlineFormattingState.cpp:
+        (WebCore::Layout::InlineFormattingState::InlineFormattingState):
+        * layout/inlineformatting/InlineFormattingState.h:
+        * layout/inlineformatting/InlineInvalidation.cpp:
+        (WebCore::Layout::InlineInvalidation::invalidate):
+        * layout/inlineformatting/InlineInvalidation.h:
+        * layout/inlineformatting/InlineLineBreaker.cpp:
+        (WebCore::Layout::InlineLineBreaker::InlineLineBreaker):
+        (WebCore::Layout::InlineLineBreaker::runWidth const):
+        * layout/inlineformatting/InlineLineBreaker.h:
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::outputInlineRuns):
+        (WebCore::Layout::outputLayoutTree):
+        (WebCore::Layout::showLayoutTree):
+        * layout/layouttree/LayoutTreeBuilder.h:
+        * page/FrameViewLayoutContext.cpp:
+        (WebCore::layoutUsingFormattingContext):
+
 2018-10-30  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [Cocoa] Attachment dropped from one web view to another is missing its file wrapper
index 14b4b9f..e5d35fe 100644 (file)
@@ -1249,7 +1249,7 @@ inspector/agents/worker/WorkerRuntimeAgent.cpp
 layout/FormattingContext.cpp
 layout/FormattingContextGeometry.cpp
 layout/FormattingState.cpp
-layout/LayoutContext.cpp
+layout/LayoutFormattingState.cpp
 layout/Verification.cpp
 layout/blockformatting/BlockFormattingContext.cpp
 layout/blockformatting/BlockFormattingContextGeometry.cpp
index c7850e3..14e3408 100644 (file)
                6F222B761AB52D8A0094651A /* WebGLVertexArrayObjectBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6F222B751AB52D8A0094651A /* WebGLVertexArrayObjectBase.cpp */; };
                6F3E1F622136142000A65A08 /* FloatBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F3E1F612136141700A65A08 /* FloatBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6F5217C72177F5A7006583BB /* InlineRunProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F5217C42177F5A6006583BB /* InlineRunProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               6F7CA3C6208C2957002F29AB /* LayoutContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F7CA3C4208C2956002F29AB /* LayoutContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               6F7CA3C6208C2957002F29AB /* LayoutFormattingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F7CA3C4208C2956002F29AB /* LayoutFormattingState.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6F7CA3CA208C2B2E002F29AB /* InlineFormattingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F7CA3C8208C2B2E002F29AB /* InlineFormattingContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6F995A151A70756200A735F4 /* WebGLSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6F995A131A70756200A735F4 /* WebGLSync.cpp */; };
                6F995A161A70756200A735F4 /* WebGLSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F995A141A70756200A735F4 /* WebGLSync.h */; };
                6F5217C42177F5A6006583BB /* InlineRunProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineRunProvider.h; sourceTree = "<group>"; };
                6F5217C62177F5A6006583BB /* InlineRunProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineRunProvider.cpp; sourceTree = "<group>"; };
                6F73918C2106CEDD006AF262 /* LayoutUnits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutUnits.h; sourceTree = "<group>"; };
-               6F7CA3C4208C2956002F29AB /* LayoutContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutContext.h; sourceTree = "<group>"; };
-               6F7CA3C5208C2956002F29AB /* LayoutContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutContext.cpp; sourceTree = "<group>"; };
+               6F7CA3C4208C2956002F29AB /* LayoutFormattingState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutFormattingState.h; sourceTree = "<group>"; };
+               6F7CA3C5208C2956002F29AB /* LayoutFormattingState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutFormattingState.cpp; sourceTree = "<group>"; };
                6F7CA3C8208C2B2E002F29AB /* InlineFormattingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InlineFormattingContext.h; sourceTree = "<group>"; };
                6F7CA3C9208C2B2E002F29AB /* InlineFormattingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InlineFormattingContext.cpp; sourceTree = "<group>"; };
                6F995A091A7070E600A735F4 /* WebGLQuery.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLQuery.idl; sourceTree = "<group>"; };
                                115CFA75208AFE30001E6991 /* FormattingState.cpp */,
                                115CFA74208AFE30001E6991 /* FormattingState.h */,
                                115F7805209CBCBD00739C13 /* Invalidation.h */,
-                               6F7CA3C5208C2956002F29AB /* LayoutContext.cpp */,
-                               6F7CA3C4208C2956002F29AB /* LayoutContext.h */,
+                               6F7CA3C5208C2956002F29AB /* LayoutFormattingState.cpp */,
+                               6F7CA3C4208C2956002F29AB /* LayoutFormattingState.h */,
                                6F73918C2106CEDD006AF262 /* LayoutUnits.h */,
                                11FF02D520BA3C810083F25B /* Verification.cpp */,
                        );
                                115CFA97208B952B001E6991 /* LayoutBox.h in Headers */,
                                11310CF620BA4A560065A8D0 /* LayoutChildIterator.h in Headers */,
                                1199FA46208E35A3002358CC /* LayoutContainer.h in Headers */,
-                               6F7CA3C6208C2957002F29AB /* LayoutContext.h in Headers */,
                                11310CF520BA4A4C0065A8D0 /* LayoutDescendantIterator.h in Headers */,
+                               6F7CA3C6208C2957002F29AB /* LayoutFormattingState.h in Headers */,
                                1199FA53208E38D3002358CC /* LayoutInlineBox.h in Headers */,
                                1199FA4F208E3899002358CC /* LayoutInlineContainer.h in Headers */,
                                11310CF420BA4A3D0065A8D0 /* LayoutIterator.h in Headers */,
index 76835f1..3f01e05 100644 (file)
@@ -31,8 +31,8 @@
 #include "DisplayBox.h"
 #include "LayoutBox.h"
 #include "LayoutContainer.h"
-#include "LayoutContext.h"
 #include "LayoutDescendantIterator.h"
+#include "LayoutFormattingState.h"
 #include "Logging.h"
 #include <wtf/IsoMallocInlines.h>
 #include <wtf/text/TextStream.h>
@@ -51,14 +51,14 @@ FormattingContext::~FormattingContext()
 {
 }
 
-void FormattingContext::computeOutOfFlowHorizontalGeometry(LayoutContext& layoutContext, const Box& layoutBox) const
+void FormattingContext::computeOutOfFlowHorizontalGeometry(LayoutState& layoutState, const Box& layoutBox) const
 {
     auto compute = [&](std::optional<LayoutUnit> usedWidth) {
-        return Geometry::outOfFlowHorizontalGeometry(layoutContext, *this, layoutBox, usedWidth);
+        return Geometry::outOfFlowHorizontalGeometry(layoutState, *this, layoutBox, usedWidth);
     };
 
     auto horizontalGeometry = compute({ });
-    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
+    auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
 
     if (auto maxWidth = Geometry::computedValueIfNotAuto(layoutBox.style().logicalMaxWidth(), containingBlockWidth)) {
         auto maxHorizontalGeometry = compute(maxWidth);
@@ -72,33 +72,33 @@ void FormattingContext::computeOutOfFlowHorizontalGeometry(LayoutContext& layout
             horizontalGeometry = minHorizontalGeometry;
     }
 
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     displayBox.setLeft(horizontalGeometry.left + horizontalGeometry.widthAndMargin.margin.left);
     displayBox.setContentBoxWidth(horizontalGeometry.widthAndMargin.width);
     displayBox.setHorizontalMargin(horizontalGeometry.widthAndMargin.margin);
     displayBox.setHorizontalNonComputedMargin(horizontalGeometry.widthAndMargin.nonComputedMargin);
 }
 
-void FormattingContext::computeOutOfFlowVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox) const
+void FormattingContext::computeOutOfFlowVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox) const
 {
     auto compute = [&](std::optional<LayoutUnit> usedHeight) {
-        return Geometry::outOfFlowVerticalGeometry(layoutContext, layoutBox, usedHeight);
+        return Geometry::outOfFlowVerticalGeometry(layoutState, layoutBox, usedHeight);
     };
 
     auto verticalGeometry = compute({ });
-    if (auto maxHeight = Geometry::computedMaxHeight(layoutContext, layoutBox)) {
+    if (auto maxHeight = Geometry::computedMaxHeight(layoutState, layoutBox)) {
         auto maxVerticalGeometry = compute(maxHeight);
         if (verticalGeometry.heightAndMargin.height > maxVerticalGeometry.heightAndMargin.height)
             verticalGeometry = maxVerticalGeometry;
     }
 
-    if (auto minHeight = Geometry::computedMinHeight(layoutContext, layoutBox)) {
+    if (auto minHeight = Geometry::computedMinHeight(layoutState, layoutBox)) {
         auto minVerticalGeometry = compute(minHeight);
         if (verticalGeometry.heightAndMargin.height < minVerticalGeometry.heightAndMargin.height)
             verticalGeometry = minVerticalGeometry;
     }
 
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     displayBox.setTop(verticalGeometry.top + verticalGeometry.heightAndMargin.margin.top);
     displayBox.setContentBoxHeight(verticalGeometry.heightAndMargin.height);
     ASSERT(!verticalGeometry.heightAndMargin.collapsedMargin);
@@ -106,29 +106,29 @@ void FormattingContext::computeOutOfFlowVerticalGeometry(const LayoutContext& la
     displayBox.setVerticalNonCollapsedMargin(verticalGeometry.heightAndMargin.margin);
 }
 
-void FormattingContext::computeBorderAndPadding(const LayoutContext& layoutContext, const Box& layoutBox) const
+void FormattingContext::computeBorderAndPadding(const LayoutState& layoutState, const Box& layoutBox) const
 {
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
-    displayBox.setBorder(Geometry::computedBorder(layoutContext, layoutBox));
-    displayBox.setPadding(Geometry::computedPadding(layoutContext, layoutBox));
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
+    displayBox.setBorder(Geometry::computedBorder(layoutState, layoutBox));
+    displayBox.setPadding(Geometry::computedPadding(layoutState, layoutBox));
 }
 
-void FormattingContext::placeInFlowPositionedChildren(const LayoutContext& layoutContext, const Container& container) const
+void FormattingContext::placeInFlowPositionedChildren(const LayoutState& layoutState, const Container& container) const
 {
     // If this container also establishes a formatting context, then positioning already has happend in that the formatting context.
     if (container.establishesFormattingContext() && &container != &root())
         return;
 
-    LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: move in-flow positioned children -> context: " << &layoutContext << " parent: " << &container);
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: move in-flow positioned children -> context: " << &layoutState << " parent: " << &container);
     for (auto& layoutBox : childrenOfType<Box>(container)) {
         if (!layoutBox.isInFlowPositioned())
             continue;
-        computeInFlowPositionedPosition(layoutContext, layoutBox);
+        computeInFlowPositionedPosition(layoutState, layoutBox);
     }
-    LOG_WITH_STREAM(FormattingContextLayout, stream << "End: move in-flow positioned children -> context: " << &layoutContext << " parent: " << &container);
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "End: move in-flow positioned children -> context: " << &layoutState << " parent: " << &container);
 }
 
-void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext, const Box& layoutBox) const
+void FormattingContext::layoutOutOfFlowDescendants(LayoutState& layoutState, const Box& layoutBox) const
 {
     // Initial containing block by definition is a containing block.
     if (!layoutBox.isPositioned() && !layoutBox.isInitialContainingBlock())
@@ -141,36 +141,36 @@ void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext,
     if (!container.hasChild())
         return;
 
-    LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: layout out-of-flow descendants -> context: " << &layoutContext << " root: " << &root());
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: layout out-of-flow descendants -> context: " << &layoutState << " root: " << &root());
 
     for (auto& outOfFlowBox : container.outOfFlowDescendants()) {
         auto& layoutBox = *outOfFlowBox;
 
         ASSERT(layoutBox.establishesFormattingContext());
-        auto formattingContext = layoutContext.formattingContext(layoutBox);
+        auto formattingContext = layoutState.formattingContext(layoutBox);
 
-        computeBorderAndPadding(layoutContext, layoutBox);
-        computeOutOfFlowHorizontalGeometry(layoutContext, layoutBox);
+        computeBorderAndPadding(layoutState, layoutBox);
+        computeOutOfFlowHorizontalGeometry(layoutState, layoutBox);
 
-        auto& formattingState = layoutContext.createFormattingStateForFormattingRootIfNeeded(layoutBox);
-        formattingContext->layout(layoutContext, formattingState);
+        auto& formattingState = layoutState.createFormattingStateForFormattingRootIfNeeded(layoutBox);
+        formattingContext->layout(layoutState, formattingState);
 
-        computeOutOfFlowVerticalGeometry(layoutContext, layoutBox);
-        layoutOutOfFlowDescendants(layoutContext, layoutBox);
+        computeOutOfFlowVerticalGeometry(layoutState, layoutBox);
+        layoutOutOfFlowDescendants(layoutState, layoutBox);
     }
-    LOG_WITH_STREAM(FormattingContextLayout, stream << "End: layout out-of-flow descendants -> context: " << &layoutContext << " root: " << &root());
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "End: layout out-of-flow descendants -> context: " << &layoutState << " root: " << &root());
 }
 
-Display::Box FormattingContext::mapBoxToAncestor(const LayoutContext& layoutContext, const Box& layoutBox, const Container& ancestor)
+Display::Box FormattingContext::mapBoxToAncestor(const LayoutState& layoutState, const Box& layoutBox, const Container& ancestor)
 {
     ASSERT(layoutBox.isDescendantOf(ancestor));
 
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     auto topLeft = displayBox.topLeft();
 
     auto* containingBlock = layoutBox.containingBlock();
     for (; containingBlock && containingBlock != &ancestor; containingBlock = containingBlock->containingBlock())
-        topLeft.moveBy(layoutContext.displayBoxForLayoutBox(*containingBlock).topLeft());
+        topLeft.moveBy(layoutState.displayBoxForLayoutBox(*containingBlock).topLeft());
 
     if (!containingBlock) {
         ASSERT_NOT_REACHED();
@@ -182,18 +182,18 @@ Display::Box FormattingContext::mapBoxToAncestor(const LayoutContext& layoutCont
     return mappedDisplayBox;
 }
 
-Position FormattingContext::mapTopLeftToAncestor(const LayoutContext& layoutContext, const Box& layoutBox, const Container& ancestor)
+Position FormattingContext::mapTopLeftToAncestor(const LayoutState& layoutState, const Box& layoutBox, const Container& ancestor)
 {
     ASSERT(layoutBox.isDescendantOf(ancestor));
-    return mapCoordinateToAncestor(layoutContext, layoutContext.displayBoxForLayoutBox(layoutBox).topLeft(), *layoutBox.containingBlock(), ancestor);
+    return mapCoordinateToAncestor(layoutState, layoutState.displayBoxForLayoutBox(layoutBox).topLeft(), *layoutBox.containingBlock(), ancestor);
 }
 
-Position FormattingContext::mapCoordinateToAncestor(const LayoutContext& layoutContext, Position position, const Container& containingBlock, const Container& ancestor)
+Position FormattingContext::mapCoordinateToAncestor(const LayoutState& layoutState, Position position, const Container& containingBlock, const Container& ancestor)
 {
     auto mappedPosition = position;
     auto* container = &containingBlock;
     for (; container && container != &ancestor; container = container->containingBlock())
-        mappedPosition.moveBy(layoutContext.displayBoxForLayoutBox(*container).topLeft());
+        mappedPosition.moveBy(layoutState.displayBoxForLayoutBox(*container).topLeft());
 
     if (!container) {
         ASSERT_NOT_REACHED();
@@ -204,7 +204,7 @@ Position FormattingContext::mapCoordinateToAncestor(const LayoutContext& layoutC
 }
 
 #ifndef NDEBUG
-void FormattingContext::validateGeometryConstraintsAfterLayout(const LayoutContext& layoutContext) const
+void FormattingContext::validateGeometryConstraintsAfterLayout(const LayoutState& layoutState) const
 {
     if (!is<Container>(root()))
         return;
@@ -213,8 +213,8 @@ void FormattingContext::validateGeometryConstraintsAfterLayout(const LayoutConte
     for (auto& layoutBox : descendantsOfType<Box>(formattingContextRoot)) {
         if (&layoutBox.formattingContextRoot() != &formattingContextRoot)
             continue;
-        auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock());
-        auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+        auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock());
+        auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
 
         // 10.3.3 Block-level, non-replaced elements in normal flow
         // 10.3.7 Absolutely positioned, non-replaced elements
index 138ef4b..4195c93 100644 (file)
@@ -42,7 +42,7 @@ namespace Layout {
 class Box;
 class Container;
 class FormattingState;
-class LayoutContext;
+class LayoutState;
 
 class FormattingContext {
     WTF_MAKE_ISO_ALLOCATED(FormattingContext);
@@ -50,80 +50,80 @@ public:
     FormattingContext(const Box& formattingContextRoot);
     virtual ~FormattingContext();
 
-    virtual void layout(LayoutContext&, FormattingState&) const = 0;
-    void layoutOutOfFlowDescendants(LayoutContext&, const Box&) const;
+    virtual void layout(LayoutState&, FormattingState&) const = 0;
+    void layoutOutOfFlowDescendants(LayoutState&, const Box&) const;
 
     struct InstrinsicWidthConstraints {
         LayoutUnit minimum;
         LayoutUnit maximum;
     };
-    virtual InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&) const = 0;
+    virtual InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutState&, const Box&) const = 0;
 
-    static Display::Box mapBoxToAncestor(const LayoutContext&, const Box&, const Container& ancestor);
-    static Position mapTopLeftToAncestor(const LayoutContext&, const Box&, const Container& ancestor);
-    static Position mapCoordinateToAncestor(const LayoutContext&, Position, const Container& containingBlock, const Container& ancestor);
+    static Display::Box mapBoxToAncestor(const LayoutState&, const Box&, const Container& ancestor);
+    static Position mapTopLeftToAncestor(const LayoutState&, const Box&, const Container& ancestor);
+    static Position mapCoordinateToAncestor(const LayoutState&, Position, const Container& containingBlock, const Container& ancestor);
 
 protected:
     using LayoutQueue = Vector<const Box*>;
 
     const Box& root() const { return *m_root; }
 
-    virtual void computeStaticPosition(const LayoutContext&, const Box&) const = 0;
-    virtual void computeInFlowPositionedPosition(const LayoutContext&, const Box&) const = 0;
+    virtual void computeStaticPosition(const LayoutState&, const Box&) const = 0;
+    virtual void computeInFlowPositionedPosition(const LayoutState&, const Box&) const = 0;
 
-    void computeBorderAndPadding(const LayoutContext&, const Box&) const;
+    void computeBorderAndPadding(const LayoutState&, const Box&) const;
 
-    void placeInFlowPositionedChildren(const LayoutContext&, const Container&) const;
+    void placeInFlowPositionedChildren(const LayoutState&, const Container&) const;
 
 #ifndef NDEBUG
-    virtual void validateGeometryConstraintsAfterLayout(const LayoutContext&) const;
+    virtual void validateGeometryConstraintsAfterLayout(const LayoutState&) const;
 #endif
 
     // This class implements generic positioning and sizing.
     class Geometry {
     public:
-        static VerticalGeometry outOfFlowVerticalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static HorizontalGeometry outOfFlowHorizontalGeometry(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static VerticalGeometry outOfFlowVerticalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+        static HorizontalGeometry outOfFlowHorizontalGeometry(LayoutState&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
-        static HeightAndMargin floatingHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static WidthAndMargin floatingWidthAndMargin(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static HeightAndMargin floatingHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+        static WidthAndMargin floatingWidthAndMargin(LayoutState&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
-        static HeightAndMargin inlineReplacedHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static WidthAndMargin inlineReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { }, 
+        static HeightAndMargin inlineReplacedHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+        static WidthAndMargin inlineReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { }, 
             std::optional<LayoutUnit> precomputedMarginLeft = { }, std::optional<LayoutUnit> precomputedMarginRight = { });
 
-        static HeightAndMargin complicatedCases(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+        static HeightAndMargin complicatedCases(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
 
-        static Edges computedBorder(const LayoutContext&, const Box&);
-        static std::optional<Edges> computedPadding(const LayoutContext&, const Box&);
+        static Edges computedBorder(const LayoutState&, const Box&);
+        static std::optional<Edges> computedPadding(const LayoutState&, const Box&);
 
-        static HorizontalEdges computedNonCollapsedHorizontalMarginValue(const LayoutContext&, const Box&);
-        static VerticalEdges computedNonCollapsedVerticalMarginValue(const LayoutContext&, const Box&);
+        static HorizontalEdges computedNonCollapsedHorizontalMarginValue(const LayoutState&, const Box&);
+        static VerticalEdges computedNonCollapsedVerticalMarginValue(const LayoutState&, const Box&);
 
         static std::optional<LayoutUnit> computedValueIfNotAuto(const Length& geometryProperty, LayoutUnit containingBlockWidth);
         static std::optional<LayoutUnit> fixedValue(const Length& geometryProperty);
 
-        static std::optional<LayoutUnit> computedMinHeight(const LayoutContext&, const Box&);
-        static std::optional<LayoutUnit> computedMaxHeight(const LayoutContext&, const Box&);
+        static std::optional<LayoutUnit> computedMinHeight(const LayoutState&, const Box&);
+        static std::optional<LayoutUnit> computedMaxHeight(const LayoutState&, const Box&);
 
     private:
-        static VerticalGeometry outOfFlowReplacedVerticalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static HorizontalGeometry outOfFlowReplacedHorizontalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static VerticalGeometry outOfFlowReplacedVerticalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+        static HorizontalGeometry outOfFlowReplacedHorizontalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
-        static VerticalGeometry outOfFlowNonReplacedVerticalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static HorizontalGeometry outOfFlowNonReplacedHorizontalGeometry(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static VerticalGeometry outOfFlowNonReplacedVerticalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+        static HorizontalGeometry outOfFlowNonReplacedHorizontalGeometry(LayoutState&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
-        static HeightAndMargin floatingReplacedHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static WidthAndMargin floatingReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static HeightAndMargin floatingReplacedHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+        static WidthAndMargin floatingReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
-        static WidthAndMargin floatingNonReplacedWidthAndMargin(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static WidthAndMargin floatingNonReplacedWidthAndMargin(LayoutState&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
-        static LayoutUnit shrinkToFitWidth(LayoutContext&, const FormattingContext&, const Box&);
+        static LayoutUnit shrinkToFitWidth(LayoutState&, const FormattingContext&, const Box&);
     };
 
 private:
-    void computeOutOfFlowVerticalGeometry(const LayoutContext&, const Box&) const;
-    void computeOutOfFlowHorizontalGeometry(LayoutContext&, const Box&) const;
+    void computeOutOfFlowVerticalGeometry(const LayoutState&, const Box&) const;
+    void computeOutOfFlowHorizontalGeometry(LayoutState&, const Box&) const;
 
     WeakPtr<const Box> m_root;
 };
index e49f77b..c27f2a2 100644 (file)
@@ -34,7 +34,7 @@
 namespace WebCore {
 namespace Layout {
 
-static LayoutUnit contentHeightForFormattingContextRoot(const LayoutContext& layoutContext, const Box& layoutBox)
+static LayoutUnit contentHeightForFormattingContextRoot(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.style().logicalHeight().isAuto() && (layoutBox.establishesFormattingContext() || layoutBox.isDocumentBox()));
 
@@ -54,8 +54,8 @@ static LayoutUnit contentHeightForFormattingContextRoot(const LayoutContext& lay
     if (formattingRootContainer.establishesInlineFormattingContext())
         return 0;
 
-    auto& firstDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.firstInFlowChild());
-    auto& lastDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.lastInFlowChild());
+    auto& firstDisplayBox = layoutState.displayBoxForLayoutBox(*formattingRootContainer.firstInFlowChild());
+    auto& lastDisplayBox = layoutState.displayBoxForLayoutBox(*formattingRootContainer.lastInFlowChild());
     auto top = firstDisplayBox.rectWithMargin().top();
     auto bottom = lastDisplayBox.rectWithMargin().bottom();
 
@@ -66,7 +66,7 @@ static LayoutUnit contentHeightForFormattingContextRoot(const LayoutContext& lay
         formattingContextRoot = &layoutBox.formattingContextRoot();
     }
 
-    auto floatsBottom = layoutContext.establishedFormattingState(*formattingContextRoot).floatingState().bottom(*formattingContextRoot);
+    auto floatsBottom = layoutState.establishedFormattingState(*formattingContextRoot).floatingState().bottom(*formattingContextRoot);
     if (floatsBottom)
         bottom = std::max(*floatsBottom, bottom);
 
@@ -97,7 +97,7 @@ std::optional<LayoutUnit> FormattingContext::Geometry::fixedValue(const Length&
 // Specifies a percentage for determining the used value. The percentage is calculated with respect to the height of the generated box's containing block.
 // If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned,
 // the percentage value is treated as '0' (for 'min-height') or 'none' (for 'max-height').
-std::optional<LayoutUnit> FormattingContext::Geometry::computedMaxHeight(const LayoutContext& layoutContext, const Box& layoutBox)
+std::optional<LayoutUnit> FormattingContext::Geometry::computedMaxHeight(const LayoutState& layoutState, const Box& layoutBox)
 {
     auto maxHeight = layoutBox.style().logicalMaxHeight();
     if (maxHeight.isUndefined() || maxHeight.isAuto())
@@ -112,7 +112,7 @@ std::optional<LayoutUnit> FormattingContext::Geometry::computedMaxHeight(const L
         containingBlockHeightValue = { height.value() };
     else if (layoutBox.isOutOfFlowPositioned()) {
         // Containing block's height is already computed.
-        containingBlockHeightValue = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).height();
+        containingBlockHeightValue = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).height();
     }
 
     if (containingBlockHeightValue)
@@ -121,7 +121,7 @@ std::optional<LayoutUnit> FormattingContext::Geometry::computedMaxHeight(const L
     return { };
 }
 
-std::optional<LayoutUnit> FormattingContext::Geometry::computedMinHeight(const LayoutContext& layoutContext, const Box& layoutBox)
+std::optional<LayoutUnit> FormattingContext::Geometry::computedMinHeight(const LayoutState& layoutState, const Box& layoutBox)
 {
     auto minHeight = layoutBox.style().logicalMinHeight();
     if (minHeight.isUndefined() || minHeight.isAuto())
@@ -136,7 +136,7 @@ std::optional<LayoutUnit> FormattingContext::Geometry::computedMinHeight(const L
         containingBlockHeightValue = { height.value() };
     else if (layoutBox.isOutOfFlowPositioned()) {
         // Containing block's height is already computed.
-        containingBlockHeightValue = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).height();
+        containingBlockHeightValue = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).height();
     }
 
     if (containingBlockHeightValue)
@@ -145,7 +145,7 @@ std::optional<LayoutUnit> FormattingContext::Geometry::computedMinHeight(const L
     return { 0 };
 }
 
-static LayoutUnit staticVerticalPositionForOutOfFlowPositioned(const LayoutContext& layoutContext, const Box& layoutBox)
+static LayoutUnit staticVerticalPositionForOutOfFlowPositioned(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned());
 
@@ -159,17 +159,17 @@ static LayoutUnit staticVerticalPositionForOutOfFlowPositioned(const LayoutConte
     LayoutUnit top;
     if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) {
         // Add sibling offset
-        auto& previousInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*previousInFlowSibling);
+        auto& previousInFlowDisplayBox = layoutState.displayBoxForLayoutBox(*previousInFlowSibling);
         top += previousInFlowDisplayBox.bottom() + previousInFlowDisplayBox.nonCollapsedMarginBottom();
     } else {
         ASSERT(layoutBox.parent());
-        top = layoutContext.displayBoxForLayoutBox(*layoutBox.parent()).contentBoxTop();
+        top = layoutState.displayBoxForLayoutBox(*layoutBox.parent()).contentBoxTop();
     }
 
     // Resolve top all the way up to the containing block.
     auto* containingBlock = layoutBox.containingBlock();
     for (auto* container = layoutBox.parent(); container != containingBlock; container = container->containingBlock()) {
-        auto& displayBox = layoutContext.displayBoxForLayoutBox(*container);
+        auto& displayBox = layoutState.displayBoxForLayoutBox(*container);
         // Display::Box::top is the border box top position in its containing block's coordinate system.
         top += displayBox.top();
         ASSERT(!container->isPositioned());
@@ -178,19 +178,19 @@ static LayoutUnit staticVerticalPositionForOutOfFlowPositioned(const LayoutConte
     return top;
 }
 
-static LayoutUnit staticHorizontalPositionForOutOfFlowPositioned(const LayoutContext& layoutContext, const Box& layoutBox)
+static LayoutUnit staticHorizontalPositionForOutOfFlowPositioned(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned());
     // See staticVerticalPositionForOutOfFlowPositioned for the definition of the static position.
 
     // Start with this box's border box offset from the parent's border box.
     ASSERT(layoutBox.parent());
-    auto left = layoutContext.displayBoxForLayoutBox(*layoutBox.parent()).contentBoxLeft();
+    auto left = layoutState.displayBoxForLayoutBox(*layoutBox.parent()).contentBoxLeft();
 
     // Resolve left all the way up to the containing block.
     auto* containingBlock = layoutBox.containingBlock();
     for (auto* container = layoutBox.parent(); container != containingBlock; container = container->containingBlock()) {
-        auto& displayBox = layoutContext.displayBoxForLayoutBox(*container);
+        auto& displayBox = layoutState.displayBoxForLayoutBox(*container);
         // Display::Box::left is the border box left position in its containing block's coordinate system.
         left += displayBox.left();
         ASSERT(!container->isPositioned());
@@ -199,7 +199,7 @@ static LayoutUnit staticHorizontalPositionForOutOfFlowPositioned(const LayoutCon
     return left;
 }
 
-LayoutUnit FormattingContext::Geometry::shrinkToFitWidth(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox)
+LayoutUnit FormattingContext::Geometry::shrinkToFitWidth(LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox)
 {
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width] -> shrink to fit -> unsupported -> width(" << LayoutUnit { } << "px) layoutBox: " << &layoutBox << ")");
     // Calculation of the shrink-to-fit width is similar to calculating the width of a table cell using the automatic table layout algorithm.
@@ -209,12 +209,12 @@ LayoutUnit FormattingContext::Geometry::shrinkToFitWidth(LayoutContext& layoutCo
     // 'padding-left', 'padding-right', 'border-right-width', 'margin-right', and the widths of any relevant scroll bars.
 
     // Then the shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width).
-    auto availableWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).width();
-    auto instrinsicWidthConstraints = formattingContext.instrinsicWidthConstraints(layoutContext, layoutBox);
+    auto availableWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).width();
+    auto instrinsicWidthConstraints = formattingContext.instrinsicWidthConstraints(layoutState, layoutBox);
     return std::min(std::max(instrinsicWidthConstraints.minimum, availableWidth), instrinsicWidthConstraints.maximum);
 }
 
-VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
+VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced());
 
@@ -243,8 +243,8 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet
     // 6. 'bottom' is 'auto', 'top' and 'height' are not 'auto', then set 'auto' values for 'margin-top' and 'margin-bottom' to 0 and solve for 'bottom'
 
     auto& style = layoutBox.style();
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
-    auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock());
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
+    auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock());
     auto containingBlockHeight = containingBlockDisplayBox.height();
     auto containingBlockWidth = containingBlockDisplayBox.width();
 
@@ -259,7 +259,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet
     auto borderBottom = displayBox.borderBottom();
 
     if (!top && !height && !bottom)
-        top = staticVerticalPositionForOutOfFlowPositioned(layoutContext, layoutBox);
+        top = staticVerticalPositionForOutOfFlowPositioned(layoutState, layoutBox);
 
     if (top && height && bottom) {
         if (!marginTop && !marginBottom) {
@@ -277,7 +277,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet
 
     if (!top && !height && bottom) {
         // #1
-        height = contentHeightForFormattingContextRoot(layoutContext, layoutBox);
+        height = contentHeightForFormattingContextRoot(layoutState, layoutBox);
         marginTop = marginTop.value_or(0);
         marginBottom = marginBottom.value_or(0);
         top = containingBlockHeight - (*marginTop + borderTop + paddingTop + *height + paddingBottom + borderBottom + *marginBottom + *bottom); 
@@ -285,7 +285,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet
 
     if (!top && !bottom && height) {
         // #2
-        top = staticVerticalPositionForOutOfFlowPositioned(layoutContext, layoutBox);
+        top = staticVerticalPositionForOutOfFlowPositioned(layoutState, layoutBox);
         marginTop = marginTop.value_or(0);
         marginBottom = marginBottom.value_or(0);
         bottom = containingBlockHeight - (*top + *marginTop + borderTop + paddingTop + *height + paddingBottom + borderBottom + *marginBottom); 
@@ -293,7 +293,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet
 
     if (!height && !bottom && top) {
         // #3
-        height = contentHeightForFormattingContextRoot(layoutContext, layoutBox);
+        height = contentHeightForFormattingContextRoot(layoutState, layoutBox);
         marginTop = marginTop.value_or(0);
         marginBottom = marginBottom.value_or(0);
         bottom = containingBlockHeight - (*top + *marginTop + borderTop + paddingTop + *height + paddingBottom + borderBottom + *marginBottom); 
@@ -330,7 +330,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet
     return { *top, *bottom, { *height, { *marginTop, *marginBottom }, { } } };
 }
 
-HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced());
     
@@ -361,9 +361,9 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe
     // 6. 'right' is 'auto', 'left' and 'width' are not 'auto', then solve for 'right'
 
     auto& style = layoutBox.style();
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     auto& containingBlock = *layoutBox.containingBlock();
-    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock).contentBoxWidth();
+    auto containingBlockWidth = layoutState.displayBoxForLayoutBox(containingBlock).contentBoxWidth();
     auto isLeftToRightDirection = containingBlock.style().isLeftToRightDirection();
     
     auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth);
@@ -385,7 +385,7 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe
         marginLeft = marginLeft.value_or(0);
         marginRight = marginRight.value_or(0);
 
-        auto staticHorizontalPosition = staticHorizontalPositionForOutOfFlowPositioned(layoutContext, layoutBox);
+        auto staticHorizontalPosition = staticHorizontalPositionForOutOfFlowPositioned(layoutState, layoutBox);
         if (isLeftToRightDirection)
             left = staticHorizontalPosition;
         else
@@ -439,11 +439,11 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe
 
     if (!left && !width && right) {
         // #1
-        width = shrinkToFitWidth(layoutContext, formattingContext, layoutBox);
+        width = shrinkToFitWidth(layoutState, formattingContext, layoutBox);
         left = containingBlockWidth - (*marginLeft + borderLeft + paddingLeft + *width + paddingRight  + borderRight + *marginRight + *right);
     } else if (!left && !right && width) {
         // #2
-        auto staticHorizontalPosition = staticHorizontalPositionForOutOfFlowPositioned(layoutContext, layoutBox);
+        auto staticHorizontalPosition = staticHorizontalPositionForOutOfFlowPositioned(layoutState, layoutBox);
         if (isLeftToRightDirection) {
             left = staticHorizontalPosition;
             right = containingBlockWidth - (*left + *marginLeft + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginRight);
@@ -453,7 +453,7 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe
         }
     } else if (!width && !right && left) {
         // #3
-        width = shrinkToFitWidth(layoutContext, formattingContext, layoutBox);
+        width = shrinkToFitWidth(layoutState, formattingContext, layoutBox);
         right = containingBlockWidth - (*left + *marginLeft + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginRight);
     } else if (!left && width && right) {
         // #4
@@ -476,7 +476,7 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe
     return { *left, *right, { *width, { *marginLeft, *marginRight }, { nonComputedMarginLeft, nonComputedMarginRight } } };
 }
 
-VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
+VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced());
 
@@ -491,14 +491,14 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(
     // 5. If at this point the values are over-constrained, ignore the value for 'bottom' and solve for that value.
 
     auto& style = layoutBox.style();
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
-    auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock());
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
+    auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock());
     auto containingBlockHeight = containingBlockDisplayBox.height();
     auto containingBlockWidth = containingBlockDisplayBox.width();
 
     auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
     auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth);
-    auto height = inlineReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight).height;
+    auto height = inlineReplacedHeightAndMargin(layoutState, layoutBox, usedHeight).height;
     auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth);
     auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth);
     auto paddingTop = displayBox.paddingTop().value_or(0);
@@ -508,7 +508,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(
 
     if (!top && !bottom) {
         // #1
-        top = staticVerticalPositionForOutOfFlowPositioned(layoutContext, layoutBox);
+        top = staticVerticalPositionForOutOfFlowPositioned(layoutState, layoutBox);
     }
 
     if (!bottom) {
@@ -545,7 +545,7 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(
     return { *top, *bottom, { height, { *marginTop, *marginBottom }, { } } };
 }
 
-HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced());
 
@@ -564,9 +564,9 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome
     //   'right' (in case 'direction' is 'ltr') and solve for that value.
 
     auto& style = layoutBox.style();
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     auto& containingBlock = *layoutBox.containingBlock();
-    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock).contentBoxWidth();
+    auto containingBlockWidth = layoutState.displayBoxForLayoutBox(containingBlock).contentBoxWidth();
     auto isLeftToRightDirection = containingBlock.style().isLeftToRightDirection();
 
     auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth);
@@ -575,7 +575,7 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome
     auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth);
     auto nonComputedMarginLeft = marginLeft.value_or(0);
     auto nonComputedMarginRight = marginRight.value_or(0);
-    auto width = inlineReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth).width;
+    auto width = inlineReplacedWidthAndMargin(layoutState, layoutBox, usedWidth).width;
     auto paddingLeft = displayBox.paddingLeft().value_or(0);
     auto paddingRight = displayBox.paddingRight().value_or(0);
     auto borderLeft = displayBox.borderLeft();
@@ -583,7 +583,7 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome
 
     if (!left && !right) {
         // #1
-        auto staticHorizontalPosition = staticHorizontalPositionForOutOfFlowPositioned(layoutContext, layoutBox);
+        auto staticHorizontalPosition = staticHorizontalPositionForOutOfFlowPositioned(layoutState, layoutBox);
         if (isLeftToRightDirection)
             left = staticHorizontalPosition;
         else
@@ -643,7 +643,7 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome
     return { *left, *right, { width, { *marginLeft, *marginRight }, { nonComputedMarginLeft, nonComputedMarginRight } } };
 }
 
-HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
+HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
 {
     ASSERT(!layoutBox.replaced());
     // TODO: Use complicated-case for document renderer for now (see BlockFormattingContext::Geometry::inFlowHeightAndMargin).
@@ -660,7 +660,7 @@ HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutContex
 
     auto& style = layoutBox.style();
     auto& containingBlock = *layoutBox.containingBlock();
-    auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(containingBlock);
+    auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(containingBlock);
     auto containingBlockWidth = containingBlockDisplayBox.contentBoxWidth();
 
     auto height = fixedValue(usedHeight ? Length { usedHeight.value(), Fixed } : style.logicalHeight());
@@ -673,7 +673,7 @@ HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutContex
     // #2
     if (!height) {
         if (style.logicalHeight().isAuto())
-            height = contentHeightForFormattingContextRoot(layoutContext, layoutBox);
+            height = contentHeightForFormattingContextRoot(layoutState, layoutBox);
         else
             ASSERT_NOT_IMPLEMENTED_YET();
     }
@@ -686,7 +686,7 @@ HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutContex
     return HeightAndMargin { *height, { *marginTop, *marginBottom }, { } };
 }
 
-WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced());
 
@@ -696,30 +696,30 @@ WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(La
     // 2. If 'width' is computed as 'auto', the used value is the "shrink-to-fit" width.
 
     auto& containingBlock = *layoutBox.containingBlock();
-    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock).contentBoxWidth();
+    auto containingBlockWidth = layoutState.displayBoxForLayoutBox(containingBlock).contentBoxWidth();
 
     // #1
-    auto margin = computedNonCollapsedHorizontalMarginValue(layoutContext, layoutBox);
+    auto margin = computedNonCollapsedHorizontalMarginValue(layoutState, layoutBox);
     // #2
     auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : layoutBox.style().logicalWidth(), containingBlockWidth);
     if (!width)
-        width = shrinkToFitWidth(layoutContext, formattingContext, layoutBox);
+        width = shrinkToFitWidth(layoutState, formattingContext, layoutBox);
 
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> floating non-replaced -> width(" << *width << "px) margin(" << margin.left << "px, " << margin.right << "px) -> layoutBox(" << &layoutBox << ")");
     return WidthAndMargin { *width, margin, margin };
 }
 
-HeightAndMargin FormattingContext::Geometry::floatingReplacedHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
+HeightAndMargin FormattingContext::Geometry::floatingReplacedHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
 {
     ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced());
 
     // 10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block'
     // replaced elements in normal flow and floating replaced elements
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating replaced -> redirected to inline replaced");
-    return inlineReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight);
+    return inlineReplacedHeightAndMargin(layoutState, layoutBox, usedHeight);
 }
 
-WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced());
 
@@ -727,49 +727,49 @@ WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(const
     //
     // 1. If 'margin-left' or 'margin-right' are computed as 'auto', their used value is '0'.
     // 2. The used value of 'width' is determined as for inline replaced elements.
-    auto margin = computedNonCollapsedHorizontalMarginValue(layoutContext, layoutBox);
+    auto margin = computedNonCollapsedHorizontalMarginValue(layoutState, layoutBox);
 
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating replaced -> redirected to inline replaced");
-    return inlineReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth, margin.left, margin.right);
+    return inlineReplacedWidthAndMargin(layoutState, layoutBox, usedWidth, margin.left, margin.right);
 }
 
-VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
+VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned());
 
     if (!layoutBox.replaced())
-        return outOfFlowNonReplacedVerticalGeometry(layoutContext, layoutBox, usedHeight);
-    return outOfFlowReplacedVerticalGeometry(layoutContext, layoutBox, usedHeight);
+        return outOfFlowNonReplacedVerticalGeometry(layoutState, layoutBox, usedHeight);
+    return outOfFlowReplacedVerticalGeometry(layoutState, layoutBox, usedHeight);
 }
 
-HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isOutOfFlowPositioned());
 
     if (!layoutBox.replaced())
-        return outOfFlowNonReplacedHorizontalGeometry(layoutContext, formattingContext, layoutBox, usedWidth);
-    return outOfFlowReplacedHorizontalGeometry(layoutContext, layoutBox, usedWidth);
+        return outOfFlowNonReplacedHorizontalGeometry(layoutState, formattingContext, layoutBox, usedWidth);
+    return outOfFlowReplacedHorizontalGeometry(layoutState, layoutBox, usedWidth);
 }
 
-HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
+HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
 {
     ASSERT(layoutBox.isFloatingPositioned());
 
     if (!layoutBox.replaced())
-        return complicatedCases(layoutContext, layoutBox, usedHeight);
-    return floatingReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight);
+        return complicatedCases(layoutState, layoutBox, usedHeight);
+    return floatingReplacedHeightAndMargin(layoutState, layoutBox, usedHeight);
 }
 
-WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutState& layoutState, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isFloatingPositioned());
 
     if (!layoutBox.replaced())
-        return floatingNonReplacedWidthAndMargin(layoutContext, formattingContext, layoutBox, usedWidth);
-    return floatingReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth);
+        return floatingNonReplacedWidthAndMargin(layoutState, formattingContext, layoutBox, usedWidth);
+    return floatingReplacedWidthAndMargin(layoutState, layoutBox, usedWidth);
 }
 
-HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
+HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
 {
     ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced());
 
@@ -784,7 +784,7 @@ HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const
     //    the height of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width.
 
     // #1
-    auto margin = computedNonCollapsedVerticalMarginValue(layoutContext, layoutBox);
+    auto margin = computedNonCollapsedVerticalMarginValue(layoutState, layoutBox);
 
     auto& style = layoutBox.style();
     auto replaced = layoutBox.replaced();
@@ -801,7 +801,7 @@ HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const
         height = replaced->intrinsicHeight();
     } else if (heightIsAuto && replaced->hasIntrinsicRatio()) {
         // #3
-        auto usedWidth = layoutContext.displayBoxForLayoutBox(layoutBox).width();
+        auto usedWidth = layoutState.displayBoxForLayoutBox(layoutBox).width();
         height = usedWidth / replaced->intrinsicRatio();
     } else if (heightIsAuto && replaced->hasIntrinsicHeight()) {
         // #4
@@ -817,7 +817,7 @@ HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const
     return { *height, margin, { } };
 }
 
-WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox,
+WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox,
     std::optional<LayoutUnit> usedWidth, std::optional<LayoutUnit> precomputedMarginLeft, std::optional<LayoutUnit> precomputedMarginRight)
 {
     ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced());
@@ -842,7 +842,7 @@ WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const L
     //    If 300px is too wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.
 
     auto& style = layoutBox.style();
-    auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock());
+    auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock());
     auto containingBlockWidth = containingBlockDisplayBox.width();
 
     auto computeMarginRight = [&]() {
@@ -898,7 +898,7 @@ WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const L
     return { *width, { marginLeft, marginRight }, { nonComputedMarginLeft, nonComputedMarginRight } };
 }
 
-Edges FormattingContext::Geometry::computedBorder(const LayoutContext&, const Box& layoutBox)
+Edges FormattingContext::Geometry::computedBorder(const LayoutState&, const Box& layoutBox)
 {
     auto& style = layoutBox.style();
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Border] -> layoutBox: " << &layoutBox);
@@ -908,13 +908,13 @@ Edges FormattingContext::Geometry::computedBorder(const LayoutContext&, const Bo
     };
 }
 
-std::optional<Edges> FormattingContext::Geometry::computedPadding(const LayoutContext& layoutContext, const Box& layoutBox)
+std::optional<Edges> FormattingContext::Geometry::computedPadding(const LayoutState& layoutState, const Box& layoutBox)
 {
     if (!layoutBox.isPaddingApplicable())
         return std::nullopt;
 
     auto& style = layoutBox.style();
-    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
+    auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Padding] -> layoutBox: " << &layoutBox);
     return Edges {
         { valueForLength(style.paddingLeft(), containingBlockWidth), valueForLength(style.paddingRight(), containingBlockWidth) },
@@ -922,10 +922,10 @@ std::optional<Edges> FormattingContext::Geometry::computedPadding(const LayoutCo
     };
 }
 
-HorizontalEdges FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue(const LayoutContext& layoutContext, const Box& layoutBox)
+HorizontalEdges FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue(const LayoutState& layoutState, const Box& layoutBox)
 {
     auto& style = layoutBox.style();
-    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
+    auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
 
     auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth).value_or(LayoutUnit { 0 });
     auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth).value_or(LayoutUnit { 0 });
@@ -934,10 +934,10 @@ HorizontalEdges FormattingContext::Geometry::computedNonCollapsedHorizontalMargi
     return { marginLeft, marginRight };
 }
 
-VerticalEdges FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue(const LayoutContext& layoutContext, const Box& layoutBox)
+VerticalEdges FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue(const LayoutState& layoutState, const Box& layoutBox)
 {
     auto& style = layoutBox.style();
-    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
+    auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
 
     auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(LayoutUnit { 0 });
     auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(LayoutUnit { 0 });
index d4e738f..0cd0acb 100644 (file)
@@ -35,8 +35,8 @@ namespace Layout {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(FormattingState);
 
-FormattingState::FormattingState(Ref<FloatingState>&& floatingState, Type type, const LayoutContext& layoutContext)
-    : m_layoutContext(layoutContext)
+FormattingState::FormattingState(Ref<FloatingState>&& floatingState, Type type, const LayoutState& layoutState)
+    : m_layoutState(layoutState)
     , m_floatingState(WTFMove(floatingState))
     , m_type(type)
 {
index 880b452..0a39723 100644 (file)
@@ -30,7 +30,7 @@
 #include "FloatingState.h"
 #include "FormattingContext.h"
 #include "LayoutBox.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include "LayoutUnit.h"
 #include <wtf/IsoMalloc.h>
 
@@ -60,9 +60,9 @@ public:
 
 protected:
     enum class Type { Block, Inline };
-    FormattingState(Ref<FloatingState>&&, Type, const LayoutContext&);
+    FormattingState(Ref<FloatingState>&&, Type, const LayoutState&);
 
-    const LayoutContext& m_layoutContext;
+    const LayoutState& m_layoutState;
 
 private:
     Ref<FloatingState> m_floatingState;
@@ -73,7 +73,7 @@ private:
 inline void FormattingState::setInstrinsicWidthConstraints(const Box& layoutBox, FormattingContext::InstrinsicWidthConstraints instrinsicWidthConstraints)
 {
     ASSERT(!m_instrinsicWidthConstraints.contains(&layoutBox));
-    ASSERT(&m_layoutContext.formattingStateForBox(layoutBox) == this);
+    ASSERT(&m_layoutState.formattingStateForBox(layoutBox) == this);
     m_instrinsicWidthConstraints.set(&layoutBox, instrinsicWidthConstraints);
 }
 
@@ -84,7 +84,7 @@ inline void FormattingState::clearInstrinsicWidthConstraints(const Box& layoutBo
 
 inline std::optional<FormattingContext::InstrinsicWidthConstraints> FormattingState::instrinsicWidthConstraints(const Box& layoutBox) const
 {
-    ASSERT(&m_layoutContext.formattingStateForBox(layoutBox) == this);
+    ASSERT(&m_layoutState.formattingStateForBox(layoutBox) == this);
     auto iterator = m_instrinsicWidthConstraints.find(&layoutBox);
     if (iterator == m_instrinsicWidthConstraints.end())
         return { };
similarity index 87%
rename from Source/WebCore/layout/LayoutContext.cpp
rename to Source/WebCore/layout/LayoutFormattingState.cpp
index 4996a7d..5fa0186 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
 namespace WebCore {
 namespace Layout {
 
-WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutContext);
+WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutState);
 
-LayoutContext::LayoutContext()
+LayoutState::LayoutState()
 {
 }
 
-void LayoutContext::initializeRoot(const Container& root, const LayoutSize& containerSize)
+void LayoutState::initializeRoot(const Container& root, const LayoutSize& containerSize)
 {
     ASSERT(root.establishesFormattingContext());
 
@@ -70,7 +70,7 @@ void LayoutContext::initializeRoot(const Container& root, const LayoutSize& cont
     m_formattingContextRootListForLayout.add(&root);
 }
 
-void LayoutContext::updateLayout()
+void LayoutState::updateLayout()
 {
     ASSERT(!m_formattingContextRootListForLayout.isEmpty());
     for (auto* layoutRoot : m_formattingContextRootListForLayout)
@@ -78,7 +78,7 @@ void LayoutContext::updateLayout()
     m_formattingContextRootListForLayout.clear();
 }
 
-void LayoutContext::layoutFormattingContextSubtree(const Box& layoutRoot)
+void LayoutState::layoutFormattingContextSubtree(const Box& layoutRoot)
 {
     RELEASE_ASSERT(layoutRoot.establishesFormattingContext());
     auto formattingContext = this->formattingContext(layoutRoot);
@@ -87,14 +87,14 @@ void LayoutContext::layoutFormattingContextSubtree(const Box& layoutRoot)
     formattingContext->layoutOutOfFlowDescendants(*this, layoutRoot);
 }
 
-Display::Box& LayoutContext::displayBoxForLayoutBox(const Box& layoutBox) const
+Display::Box& LayoutState::displayBoxForLayoutBox(const Box& layoutBox) const
 {
     return *m_layoutToDisplayBox.ensure(&layoutBox, [&layoutBox] {
         return std::make_unique<Display::Box>(layoutBox.style());
     }).iterator->value;
 }
 
-void LayoutContext::styleChanged(const Box& layoutBox, StyleDiff styleDiff)
+void LayoutState::styleChanged(const Box& layoutBox, StyleDiff styleDiff)
 {
     auto& formattingState = formattingStateForBox(layoutBox);
     const Container* invalidationRoot = nullptr;
@@ -108,25 +108,25 @@ void LayoutContext::styleChanged(const Box& layoutBox, StyleDiff styleDiff)
     m_formattingContextRootListForLayout.addVoid(invalidationRoot);
 }
 
-void LayoutContext::markNeedsUpdate(const Box&, OptionSet<UpdateType>)
+void LayoutState::markNeedsUpdate(const Box&, OptionSet<UpdateType>)
 {
 }
 
-FormattingState& LayoutContext::formattingStateForBox(const Box& layoutBox) const
+FormattingState& LayoutState::formattingStateForBox(const Box& layoutBox) const
 {
     auto& root = layoutBox.formattingContextRoot();
     RELEASE_ASSERT(m_formattingStates.contains(&root));
     return *m_formattingStates.get(&root);
 }
 
-FormattingState& LayoutContext::establishedFormattingState(const Box& formattingRoot) const
+FormattingState& LayoutState::establishedFormattingState(const Box& formattingRoot) const
 {
     ASSERT(formattingRoot.establishesFormattingContext());
     RELEASE_ASSERT(m_formattingStates.contains(&formattingRoot));
     return *m_formattingStates.get(&formattingRoot);
 }
 
-FormattingState& LayoutContext::createFormattingStateForFormattingRootIfNeeded(const Box& formattingRoot)
+FormattingState& LayoutState::createFormattingStateForFormattingRootIfNeeded(const Box& formattingRoot)
 {
     ASSERT(formattingRoot.establishesFormattingContext());
 
@@ -156,7 +156,7 @@ FormattingState& LayoutContext::createFormattingStateForFormattingRootIfNeeded(c
     CRASH();
 }
 
-std::unique_ptr<FormattingContext> LayoutContext::formattingContext(const Box& formattingContextRoot) const
+std::unique_ptr<FormattingContext> LayoutState::formattingContext(const Box& formattingContextRoot) const
 {
     if (formattingContextRoot.establishesInlineFormattingContext())
         return std::make_unique<InlineFormattingContext>(formattingContextRoot);
similarity index 88%
rename from Source/WebCore/layout/LayoutContext.h
rename to Source/WebCore/layout/LayoutFormattingState.h
index c5875ec..4674b61 100644 (file)
@@ -50,16 +50,16 @@ class Box;
 class Container;
 class FormattingState;
 
-// LayoutContext is the entry point for layout. It takes a (formatting root)container which acts as the root of the layout context.
-// LayoutContext::layout() generates the display tree for the root container's subtree (it does not run layout on the root though).
+// LayoutState is the entry point for layout. It takes a (formatting root)container which acts as the root of the layout context.
+// LayoutState::layout() generates the display tree for the root container's subtree (it does not run layout on the root though).
 // Note, while the root container is suppposed to be the entry point for the initial layout, it does not necessarily need to be the entry point of any
 // subsequent layouts (subtree layout). A non-initial, subtree layout could be initiated on multiple formatting contexts.
 // Each formatting context has an entry point for layout, which potenitally means multiple entry points per layout frame.
-// LayoutContext also holds the formatting states. They cache formatting context specific data to enable performant incremental layouts.
-class LayoutContext {
-    WTF_MAKE_ISO_ALLOCATED(LayoutContext);
+// LayoutState also holds the formatting states. They cache formatting context specific data to enable performant incremental layouts.
+class LayoutState {
+    WTF_MAKE_ISO_ALLOCATED(LayoutState);
 public:
-    LayoutContext();
+    LayoutState();
 
     void initializeRoot(const Container&, const LayoutSize&);
     void updateLayout();
index ee0e094..0bba97b 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
@@ -48,7 +48,7 @@ static bool areEssentiallyEqual(float a, LayoutUnit b)
     return ::abs(a - b.toFloat()) <= 4 * LayoutUnit::epsilon();
 }
 
-static bool outputMismatchingSimpleLineInformationIfNeeded(TextStream& stream, const LayoutContext& layoutContext, const RenderBlockFlow& blockFlow, const Container& inlineFormattingRoot)
+static bool outputMismatchingSimpleLineInformationIfNeeded(TextStream& stream, const LayoutState& layoutState, const RenderBlockFlow& blockFlow, const Container& inlineFormattingRoot)
 {
     auto* lineLayoutData = blockFlow.simpleLineLayout();
     if (!lineLayoutData) {
@@ -56,7 +56,7 @@ static bool outputMismatchingSimpleLineInformationIfNeeded(TextStream& stream, c
         return true;
     }
 
-    auto& inlineFormattingState = layoutContext.establishedFormattingState(inlineFormattingRoot);
+    auto& inlineFormattingState = layoutState.establishedFormattingState(inlineFormattingRoot);
     ASSERT(is<InlineFormattingState>(inlineFormattingState));
     auto& inlineRunList = downcast<InlineFormattingState>(inlineFormattingState).inlineRuns();
 
@@ -94,9 +94,9 @@ static bool checkForMatchingTextRuns(const InlineRun& inlineRun, float logicalLe
     return areEssentiallyEqual(logicalLeft, inlineRun.logicalLeft()) && areEssentiallyEqual(logicalRight, inlineRun.logicalRight()) && start == inlineRun.textContext()->start() && (end == (inlineRun.textContext()->start() + inlineRun.textContext()->length()));
 }
 
-static bool outputMismatchingComplexLineInformationIfNeeded(TextStream& stream, const LayoutContext& layoutContext, const RenderBlockFlow& blockFlow, const Container& inlineFormattingRoot)
+static bool outputMismatchingComplexLineInformationIfNeeded(TextStream& stream, const LayoutState& layoutState, const RenderBlockFlow& blockFlow, const Container& inlineFormattingRoot)
 {
-    auto& inlineFormattingState = layoutContext.establishedFormattingState(inlineFormattingRoot);
+    auto& inlineFormattingState = layoutState.establishedFormattingState(inlineFormattingRoot);
     ASSERT(is<InlineFormattingState>(inlineFormattingState));
     auto& inlineRunList = downcast<InlineFormattingState>(inlineFormattingState).inlineRuns();
 
@@ -178,7 +178,7 @@ static bool outputMismatchingComplexLineInformationIfNeeded(TextStream& stream,
     return mismatched;
 }
 
-static bool outputMismatchingBlockBoxInformationIfNeeded(TextStream& stream, const LayoutContext& context, const RenderBox& renderer, const Box& layoutBox)
+static bool outputMismatchingBlockBoxInformationIfNeeded(TextStream& stream, const LayoutState& context, const RenderBox& renderer, const Box& layoutBox)
 {
     bool firstMismatchingRect = true;
     auto outputRect = [&] (const String& prefix, const LayoutRect& rendererRect, const LayoutRect& layoutRect) {
@@ -240,7 +240,7 @@ static bool outputMismatchingBlockBoxInformationIfNeeded(TextStream& stream, con
     return false;
 }
 
-static bool verifyAndOutputSubtree(TextStream& stream, const LayoutContext& context, const RenderBox& renderer, const Box& layoutBox)
+static bool verifyAndOutputSubtree(TextStream& stream, const LayoutState& context, const RenderBox& renderer, const Box& layoutBox)
 {
     auto mismtachingGeometry = outputMismatchingBlockBoxInformationIfNeeded(stream, context, renderer, layoutBox);
 
@@ -280,7 +280,7 @@ static bool verifyAndOutputSubtree(TextStream& stream, const LayoutContext& cont
     return mismtachingGeometry;
 }
 
-void LayoutContext::verifyAndOutputMismatchingLayoutTree(const RenderView& renderView) const
+void LayoutState::verifyAndOutputMismatchingLayoutTree(const RenderView& renderView) const
 {
     TextStream stream;
     auto mismatchingGeometry = verifyAndOutputSubtree(stream, *this, renderView, *m_root.get());
index 2e8a007..7ec2467 100644 (file)
@@ -34,7 +34,7 @@
 #include "FloatingState.h"
 #include "LayoutBox.h"
 #include "LayoutContainer.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include "Logging.h"
 #include <wtf/IsoMallocInlines.h>
 #include <wtf/text/TextStream.h>
@@ -49,7 +49,7 @@ BlockFormattingContext::BlockFormattingContext(const Box& formattingContextRoot)
 {
 }
 
-void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingState& formattingState) const
+void BlockFormattingContext::layout(LayoutState& layoutState, FormattingState& formattingState) const
 {
     // 9.4.1 Block formatting contexts
     // In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block.
@@ -58,7 +58,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat
     if (!is<Container>(root()))
         return;
 
-    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> block formatting context -> layout context(" << &layoutContext << ") formatting root(" << &root() << ")");
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> block formatting context -> layout context(" << &layoutState << ") formatting root(" << &root() << ")");
 
     auto& formattingRoot = downcast<Container>(root());
     LayoutQueue layoutQueue;
@@ -77,7 +77,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat
             auto& layoutBox = *layoutQueue.last();
 
             if (layoutBox.establishesFormattingContext()) {
-                layoutFormattingContextRoot(layoutContext, floatingContext, formattingState, layoutBox);
+                layoutFormattingContextRoot(layoutState, floatingContext, formattingState, layoutBox);
                 layoutQueue.removeLast();
                 // Since this box is a formatting context root, it takes care of its entire subtree.
                 // Continue with next sibling if exists.
@@ -88,9 +88,9 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat
             }
 
             LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Position][Border][Padding][Width][Margin] -> for layoutBox(" << &layoutBox << ")");
-            computeStaticPosition(layoutContext, layoutBox);
-            computeBorderAndPadding(layoutContext, layoutBox);
-            computeWidthAndMargin(layoutContext, layoutBox);
+            computeStaticPosition(layoutState, layoutBox);
+            computeBorderAndPadding(layoutState, layoutBox);
+            computeWidthAndMargin(layoutState, layoutBox);
             if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild())
                 break;
             layoutQueue.append(downcast<Container>(layoutBox).firstInFlowOrFloatingChild());
@@ -104,15 +104,15 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat
             LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Height][Margin] -> for layoutBox(" << &layoutBox << ")");
             // Formatting root boxes are special-cased and they don't come here.
             ASSERT(!layoutBox.establishesFormattingContext());
-            computeHeightAndMargin(layoutContext, layoutBox);
+            computeHeightAndMargin(layoutState, layoutBox);
             // Finalize position with clearance.
             if (layoutBox.hasFloatClear())
-                computeVerticalPositionForFloatClear(layoutContext, floatingContext, layoutBox);
+                computeVerticalPositionForFloatClear(layoutState, floatingContext, layoutBox);
             if (!is<Container>(layoutBox))
                 continue;
             auto& container = downcast<Container>(layoutBox);
             // Move in-flow positioned children to their final position.
-            placeInFlowPositionedChildren(layoutContext, container);
+            placeInFlowPositionedChildren(layoutState, container);
             if (auto* nextSibling = container.nextInFlowOrFloatingSibling()) {
                 layoutQueue.append(nextSibling);
                 break;
@@ -120,56 +120,56 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat
         }
     }
     // Place the inflow positioned children.
-    placeInFlowPositionedChildren(layoutContext, formattingRoot);
-    LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> block formatting context -> layout context(" << &layoutContext << ") formatting root(" << &root() << ")");
+    placeInFlowPositionedChildren(layoutState, formattingRoot);
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> block formatting context -> layout context(" << &layoutState << ") formatting root(" << &root() << ")");
 }
 
-void BlockFormattingContext::layoutFormattingContextRoot(LayoutContext& layoutContext, FloatingContext& floatingContext, FormattingState&, const Box& layoutBox) const
+void BlockFormattingContext::layoutFormattingContextRoot(LayoutState& layoutState, FloatingContext& floatingContext, FormattingState&, const Box& layoutBox) const
 {
     // Start laying out this formatting root in the formatting contenxt it lives in.
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Position][Border][Padding][Width][Margin] -> for layoutBox(" << &layoutBox << ")");
-    computeStaticPosition(layoutContext, layoutBox);
-    computeBorderAndPadding(layoutContext, layoutBox);
-    computeWidthAndMargin(layoutContext, layoutBox);
+    computeStaticPosition(layoutState, layoutBox);
+    computeBorderAndPadding(layoutState, layoutBox);
+    computeWidthAndMargin(layoutState, layoutBox);
 
-    precomputeVerticalPositionForFormattingRootIfNeeded(layoutContext, layoutBox);
+    precomputeVerticalPositionForFormattingRootIfNeeded(layoutState, layoutBox);
     // Swich over to the new formatting context (the one that the root creates).
-    auto formattingContext = layoutContext.formattingContext(layoutBox);
-    auto& formattingState = layoutContext.createFormattingStateForFormattingRootIfNeeded(layoutBox);
-    formattingContext->layout(layoutContext, formattingState);
+    auto formattingContext = layoutState.formattingContext(layoutBox);
+    auto& formattingState = layoutState.createFormattingStateForFormattingRootIfNeeded(layoutBox);
+    formattingContext->layout(layoutState, formattingState);
 
     // Come back and finalize the root's geometry.
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Height][Margin] -> for layoutBox(" << &layoutBox << ")");
-    computeHeightAndMargin(layoutContext, layoutBox);
+    computeHeightAndMargin(layoutState, layoutBox);
 
     // Float related final positioning.
     if (layoutBox.isFloatingPositioned()) {
-        computeFloatingPosition(layoutContext, floatingContext, layoutBox);
+        computeFloatingPosition(layoutState, floatingContext, layoutBox);
         floatingContext.floatingState().append(layoutBox);
     } else if (layoutBox.hasFloatClear())
-        computeVerticalPositionForFloatClear(layoutContext, floatingContext, layoutBox);
+        computeVerticalPositionForFloatClear(layoutState, floatingContext, layoutBox);
     else if (layoutBox.establishesBlockFormattingContext())
-        computePositionToAvoidFloats(layoutContext, floatingContext, layoutBox);
+        computePositionToAvoidFloats(layoutState, floatingContext, layoutBox);
 
     // Now that we computed the root's height, we can go back and layout the out-of-flow descedants (if any).
-    formattingContext->layoutOutOfFlowDescendants(layoutContext, layoutBox);
+    formattingContext->layoutOutOfFlowDescendants(layoutState, layoutBox);
 }
 
-void BlockFormattingContext::computeStaticPosition(const LayoutContext& layoutContext, const Box& layoutBox) const
+void BlockFormattingContext::computeStaticPosition(const LayoutState& layoutState, const Box& layoutBox) const
 {
-    layoutContext.displayBoxForLayoutBox(layoutBox).setTopLeft(Geometry::staticPosition(layoutContext, layoutBox));
+    layoutState.displayBoxForLayoutBox(layoutBox).setTopLeft(Geometry::staticPosition(layoutState, layoutBox));
 }
 
-void BlockFormattingContext::computeEstimatedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox) const
+void BlockFormattingContext::computeEstimatedMarginTop(const LayoutState& layoutState, const Box& layoutBox) const
 {
-    auto estimatedMarginTop = Geometry::estimatedMarginTop(layoutContext, layoutBox);
+    auto estimatedMarginTop = Geometry::estimatedMarginTop(layoutState, layoutBox);
 
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     displayBox.setEstimatedMarginTop(estimatedMarginTop);
     displayBox.moveVertically(estimatedMarginTop);
 }
 
-void BlockFormattingContext::computeEstimatedMarginTopForAncestors(const LayoutContext& layoutContext, const Box& layoutBox) const
+void BlockFormattingContext::computeEstimatedMarginTopForAncestors(const LayoutState& layoutState, const Box& layoutBox) const
 {
     // We only need to estimate margin top for float related layout (formatting context roots avoid floats).
     ASSERT(layoutBox.isFloatingPositioned() || layoutBox.hasFloatClear() || layoutBox.establishesBlockFormattingContext() || layoutBox.establishesInlineFormattingContext());
@@ -185,37 +185,37 @@ void BlockFormattingContext::computeEstimatedMarginTopForAncestors(const LayoutC
     // The idea here is that as long as we don't cross the block formatting context boundary, we should be able to pre-compute the final top margin.
 
     for (auto* ancestor = layoutBox.containingBlock(); ancestor && !ancestor->establishesBlockFormattingContext(); ancestor = ancestor->containingBlock()) {
-        auto& displayBox = layoutContext.displayBoxForLayoutBox(*ancestor);
+        auto& displayBox = layoutState.displayBoxForLayoutBox(*ancestor);
         // FIXME: with incremental layout, we might actually have a valid (non-estimated) margin top as well.
         if (displayBox.estimatedMarginTop())
             return;
 
-        computeEstimatedMarginTop(layoutContext, *ancestor);
+        computeEstimatedMarginTop(layoutState, *ancestor);
     }
 }
 
-void BlockFormattingContext::precomputeVerticalPositionForFormattingRootIfNeeded(const LayoutContext& layoutContext, const Box& layoutBox) const
+void BlockFormattingContext::precomputeVerticalPositionForFormattingRootIfNeeded(const LayoutState& layoutState, const Box& layoutBox) const
 {
     ASSERT(layoutBox.establishesFormattingContext());
 
     auto avoidsFloats = layoutBox.isFloatingPositioned() || layoutBox.establishesBlockFormattingContext() || layoutBox.hasFloatClear();
     if (avoidsFloats)
-        computeEstimatedMarginTopForAncestors(layoutContext, layoutBox);
+        computeEstimatedMarginTopForAncestors(layoutState, layoutBox);
 
     // If the inline formatting root is also the root for the floats (happens when the root box also establishes a block formatting context)
     // the floats are in the coordinate system of this root. No need to find the final vertical position.
     auto inlineContextInheritsFloats = layoutBox.establishesInlineFormattingContext() && !layoutBox.establishesBlockFormattingContext();
     if (inlineContextInheritsFloats) {
-        computeEstimatedMarginTop(layoutContext, layoutBox);
-        computeEstimatedMarginTopForAncestors(layoutContext, layoutBox);
+        computeEstimatedMarginTop(layoutState, layoutBox);
+        computeEstimatedMarginTopForAncestors(layoutState, layoutBox);
     }
 }
 
 #ifndef NDEBUG
-static bool hasPrecomputedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox)
+static bool hasPrecomputedMarginTop(const LayoutState& layoutState, const Box& layoutBox)
 {
     for (auto* ancestor = layoutBox.containingBlock(); ancestor && !ancestor->establishesBlockFormattingContext(); ancestor = ancestor->containingBlock()) {
-        if (layoutContext.displayBoxForLayoutBox(*ancestor).estimatedMarginTop())
+        if (layoutState.displayBoxForLayoutBox(*ancestor).estimatedMarginTop())
             continue;
         return false;
     }
@@ -223,38 +223,38 @@ static bool hasPrecomputedMarginTop(const LayoutContext& layoutContext, const Bo
 }
 #endif
 
-void BlockFormattingContext::computeFloatingPosition(const LayoutContext& layoutContext, const FloatingContext& floatingContext, const Box& layoutBox) const
+void BlockFormattingContext::computeFloatingPosition(const LayoutState& layoutState, const FloatingContext& floatingContext, const Box& layoutBox) const
 {
     ASSERT(layoutBox.isFloatingPositioned());
-    ASSERT(hasPrecomputedMarginTop(layoutContext, layoutBox));
+    ASSERT(hasPrecomputedMarginTop(layoutState, layoutBox));
 
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     // 8.3.1 Collapsing margins
     // In block formatting context margins between a floated box and any other box do not collapse.
     // Adjust the static position by using the previous inflow box's non-collapsed margin.
     if (auto* previousInFlowBox = layoutBox.previousInFlowSibling()) {
-        auto& previousDisplayBox = layoutContext.displayBoxForLayoutBox(*previousInFlowBox);
+        auto& previousDisplayBox = layoutState.displayBoxForLayoutBox(*previousInFlowBox);
         displayBox.moveVertically(previousDisplayBox.nonCollapsedMarginBottom() - previousDisplayBox.marginBottom());
     }
     displayBox.setTopLeft(floatingContext.positionForFloat(layoutBox));
 }
 
-void BlockFormattingContext::computePositionToAvoidFloats(const LayoutContext& layoutContext, const FloatingContext& floatingContext, const Box& layoutBox) const
+void BlockFormattingContext::computePositionToAvoidFloats(const LayoutState& layoutState, const FloatingContext& floatingContext, const Box& layoutBox) const
 {
     // Formatting context roots avoid floats.
     ASSERT(layoutBox.establishesBlockFormattingContext());
     ASSERT(!layoutBox.isFloatingPositioned());
     ASSERT(!layoutBox.hasFloatClear());
-    ASSERT(hasPrecomputedMarginTop(layoutContext, layoutBox));
+    ASSERT(hasPrecomputedMarginTop(layoutState, layoutBox));
 
     if (floatingContext.floatingState().isEmpty())
         return;
 
     if (auto adjustedPosition = floatingContext.positionForFloatAvoiding(layoutBox))
-        layoutContext.displayBoxForLayoutBox(layoutBox).setTopLeft(*adjustedPosition);
+        layoutState.displayBoxForLayoutBox(layoutBox).setTopLeft(*adjustedPosition);
 }
 
-void BlockFormattingContext::computeVerticalPositionForFloatClear(const LayoutContext& layoutContext, const FloatingContext& floatingContext, const Box& layoutBox) const
+void BlockFormattingContext::computeVerticalPositionForFloatClear(const LayoutState& layoutState, const FloatingContext& floatingContext, const Box& layoutBox) const
 {
     ASSERT(layoutBox.hasFloatClear());
     if (floatingContext.floatingState().isEmpty())
@@ -262,34 +262,34 @@ void BlockFormattingContext::computeVerticalPositionForFloatClear(const LayoutCo
 
     // For formatting roots, we already precomputed final position.
     if (!layoutBox.establishesFormattingContext())
-        computeEstimatedMarginTopForAncestors(layoutContext, layoutBox);
-    ASSERT(hasPrecomputedMarginTop(layoutContext, layoutBox));
+        computeEstimatedMarginTopForAncestors(layoutState, layoutBox);
+    ASSERT(hasPrecomputedMarginTop(layoutState, layoutBox));
 
     if (auto verticalPositionWithClearance = floatingContext.verticalPositionWithClearance(layoutBox))
-        layoutContext.displayBoxForLayoutBox(layoutBox).setTop(*verticalPositionWithClearance);
+        layoutState.displayBoxForLayoutBox(layoutBox).setTop(*verticalPositionWithClearance);
 }
 
-void BlockFormattingContext::computeInFlowPositionedPosition(const LayoutContext& layoutContext, const Box& layoutBox) const
+void BlockFormattingContext::computeInFlowPositionedPosition(const LayoutState& layoutState, const Box& layoutBox) const
 {
-    layoutContext.displayBoxForLayoutBox(layoutBox).setTopLeft(Geometry::inFlowPositionedPosition(layoutContext, layoutBox));
+    layoutState.displayBoxForLayoutBox(layoutBox).setTopLeft(Geometry::inFlowPositionedPosition(layoutState, layoutBox));
 }
 
-void BlockFormattingContext::computeWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox) const
+void BlockFormattingContext::computeWidthAndMargin(LayoutState& layoutState, const Box& layoutBox) const
 {
     auto compute = [&](std::optional<LayoutUnit> usedWidth) -> WidthAndMargin {
 
         if (layoutBox.isInFlow())
-            return Geometry::inFlowWidthAndMargin(layoutContext, layoutBox, usedWidth);
+            return Geometry::inFlowWidthAndMargin(layoutState, layoutBox, usedWidth);
 
         if (layoutBox.isFloatingPositioned())
-            return Geometry::floatingWidthAndMargin(layoutContext, *this, layoutBox, usedWidth);
+            return Geometry::floatingWidthAndMargin(layoutState, *this, layoutBox, usedWidth);
 
         ASSERT_NOT_REACHED();
         return { };
     };
 
     auto widthAndMargin = compute({ });
-    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
+    auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
 
     if (auto maxWidth = Geometry::computedValueIfNotAuto(layoutBox.style().logicalMaxWidth(), containingBlockWidth)) {
         auto maxWidthAndMargin = compute(maxWidth);
@@ -303,41 +303,41 @@ void BlockFormattingContext::computeWidthAndMargin(LayoutContext& layoutContext,
             widthAndMargin = minWidthAndMargin;
     }
 
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     displayBox.setContentBoxWidth(widthAndMargin.width);
     displayBox.moveHorizontally(widthAndMargin.margin.left);
     displayBox.setHorizontalMargin(widthAndMargin.margin);
     displayBox.setHorizontalNonComputedMargin(widthAndMargin.nonComputedMargin);
 }
 
-void BlockFormattingContext::computeHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox) const
+void BlockFormattingContext::computeHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox) const
 {
     auto compute = [&](std::optional<LayoutUnit> usedHeight) -> HeightAndMargin {
 
         if (layoutBox.isInFlow())
-            return Geometry::inFlowHeightAndMargin(layoutContext, layoutBox, usedHeight);
+            return Geometry::inFlowHeightAndMargin(layoutState, layoutBox, usedHeight);
 
         if (layoutBox.isFloatingPositioned())
-            return Geometry::floatingHeightAndMargin(layoutContext, layoutBox, usedHeight);
+            return Geometry::floatingHeightAndMargin(layoutState, layoutBox, usedHeight);
 
         ASSERT_NOT_REACHED();
         return { };
     };
 
     auto heightAndMargin = compute({ });
-    if (auto maxHeight = Geometry::computedMaxHeight(layoutContext, layoutBox)) {
+    if (auto maxHeight = Geometry::computedMaxHeight(layoutState, layoutBox)) {
         auto maxHeightAndMargin = compute(maxHeight);
         if (heightAndMargin.height > maxHeightAndMargin.height)
             heightAndMargin = maxHeightAndMargin;
     }
 
-    if (auto minHeight = Geometry::computedMinHeight(layoutContext, layoutBox)) {
+    if (auto minHeight = Geometry::computedMinHeight(layoutState, layoutBox)) {
         auto minHeightAndMargin = compute(minHeight);
         if (heightAndMargin.height < minHeightAndMargin.height)
             heightAndMargin = minHeightAndMargin;
     }
 
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     displayBox.setContentBoxHeight(heightAndMargin.height);
     displayBox.setVerticalNonCollapsedMargin(heightAndMargin.margin);
     displayBox.setVerticalMargin(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin));
@@ -347,16 +347,16 @@ void BlockFormattingContext::computeHeightAndMargin(const LayoutContext& layoutC
         displayBox.moveVertically(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin).top);
 }
 
-FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::instrinsicWidthConstraints(LayoutContext& layoutContext, const Box& layoutBox) const
+FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::instrinsicWidthConstraints(LayoutState& layoutState, const Box& layoutBox) const
 {
-    auto& formattingState = layoutContext.formattingStateForBox(layoutBox);
+    auto& formattingState = layoutState.formattingStateForBox(layoutBox);
     ASSERT(formattingState.isBlockFormattingState());
     if (auto instrinsicWidthConstraints = formattingState.instrinsicWidthConstraints(layoutBox))
         return *instrinsicWidthConstraints;
 
     // Can we just compute them without checking the children?
     if (!Geometry::instrinsicWidthConstraintsNeedChildrenWidth(layoutBox)) {
-        auto instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutContext, layoutBox);
+        auto instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutState, layoutBox);
         formattingState.setInstrinsicWidthConstraints(layoutBox, instrinsicWidthConstraints);
         return instrinsicWidthConstraints;
     }
@@ -372,7 +372,7 @@ FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::instrinsic
     if (auto* firstChild = downcast<Container>(layoutBox).firstInFlowOrFloatingChild())
         queue.append(firstChild);
 
-    auto& formattingStateForChildren = layoutBox.establishesFormattingContext() ? layoutContext.createFormattingStateForFormattingRootIfNeeded(layoutBox) : formattingState;
+    auto& formattingStateForChildren = layoutBox.establishesFormattingContext() ? layoutState.createFormattingStateForFormattingRootIfNeeded(layoutBox) : formattingState;
     while (!queue.isEmpty()) {
         while (true) {
             auto& childBox = *queue.last(); 
@@ -380,10 +380,10 @@ FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::instrinsic
             auto instrinsicWidthConstraints = formattingStateForChildren.instrinsicWidthConstraints(childBox);
             // Can we just compute them without checking the children?
             if (!instrinsicWidthConstraints && !Geometry::instrinsicWidthConstraintsNeedChildrenWidth(childBox))
-                instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutContext, childBox);
+                instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutState, childBox);
             // Is it a formatting context root?
             if (!instrinsicWidthConstraints && childBox.establishesFormattingContext())
-                instrinsicWidthConstraints = layoutContext.formattingContext(childBox)->instrinsicWidthConstraints(layoutContext, childBox);
+                instrinsicWidthConstraints = layoutState.formattingContext(childBox)->instrinsicWidthConstraints(layoutState, childBox);
             // Go to the next sibling (and skip the descendants) if this box's min/max width is computed.
             if (instrinsicWidthConstraints) {
                 formattingStateForChildren.setInstrinsicWidthConstraints(childBox, *instrinsicWidthConstraints); 
@@ -403,7 +403,7 @@ FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::instrinsic
         // Compute min/max intrinsic width bottom up.
         while (!queue.isEmpty()) {
             auto& childBox = *queue.takeLast();
-            formattingStateForChildren.setInstrinsicWidthConstraints(childBox, Geometry::instrinsicWidthConstraints(layoutContext, childBox)); 
+            formattingStateForChildren.setInstrinsicWidthConstraints(childBox, Geometry::instrinsicWidthConstraints(layoutState, childBox)); 
             // Move over to the next sibling or take the next box in the queue.
             if (!is<Container>(childBox) || !downcast<Container>(childBox).nextInFlowOrFloatingSibling())
                 continue;
@@ -411,7 +411,7 @@ FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::instrinsic
         }
     }
 
-    auto instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutContext, layoutBox);
+    auto instrinsicWidthConstraints = Geometry::instrinsicWidthConstraints(layoutState, layoutBox);
     formattingState.setInstrinsicWidthConstraints(layoutBox, instrinsicWidthConstraints); 
     return instrinsicWidthConstraints;
 }
index 84aade8..9bd35ec 100644 (file)
@@ -47,66 +47,66 @@ class BlockFormattingContext : public FormattingContext {
 public:
     BlockFormattingContext(const Box& formattingContextRoot);
 
-    void layout(LayoutContext&, FormattingState&) const override;
+    void layout(LayoutState&, FormattingState&) const override;
 
 private:
-    void layoutFormattingContextRoot(LayoutContext&, FloatingContext&, FormattingState&, const Box&) const;
+    void layoutFormattingContextRoot(LayoutState&, FloatingContext&, FormattingState&, const Box&) const;
 
-    void computeWidthAndMargin(LayoutContext&, const Box&) const;
-    void computeHeightAndMargin(const LayoutContext&, const Box&) const;
+    void computeWidthAndMargin(LayoutState&, const Box&) const;
+    void computeHeightAndMargin(const LayoutState&, const Box&) const;
 
-    void computeStaticPosition(const LayoutContext&, const Box&) const override;
-    void computeFloatingPosition(const LayoutContext&, const FloatingContext&, const Box&) const;
-    void computePositionToAvoidFloats(const LayoutContext&, const FloatingContext&, const Box&) const;
-    void computeVerticalPositionForFloatClear(const LayoutContext&, const FloatingContext&, const Box&) const;
+    void computeStaticPosition(const LayoutState&, const Box&) const override;
+    void computeFloatingPosition(const LayoutState&, const FloatingContext&, const Box&) const;
+    void computePositionToAvoidFloats(const LayoutState&, const FloatingContext&, const Box&) const;
+    void computeVerticalPositionForFloatClear(const LayoutState&, const FloatingContext&, const Box&) const;
 
-    void computeInFlowPositionedPosition(const LayoutContext&, const Box&) const override;
-    void computeEstimatedMarginTopForAncestors(const LayoutContext&, const Box&) const;
-    void computeEstimatedMarginTop(const LayoutContext&, const Box&) const;
+    void computeInFlowPositionedPosition(const LayoutState&, const Box&) const override;
+    void computeEstimatedMarginTopForAncestors(const LayoutState&, const Box&) const;
+    void computeEstimatedMarginTop(const LayoutState&, const Box&) const;
 
-    void precomputeVerticalPositionForFormattingRootIfNeeded(const LayoutContext&, const Box&) const;
+    void precomputeVerticalPositionForFormattingRootIfNeeded(const LayoutState&, const Box&) const;
 
-    InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&) const override;
+    InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutState&, const Box&) const override;
 
     // This class implements positioning and sizing for boxes participating in a block formatting context.
     class Geometry : public FormattingContext::Geometry {
     public:
-        static HeightAndMargin inFlowHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static WidthAndMargin inFlowWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static HeightAndMargin inFlowHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+        static WidthAndMargin inFlowWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
 
-        static Position staticPosition(const LayoutContext&, const Box&);
-        static Position inFlowPositionedPosition(const LayoutContext&, const Box&);
+        static Position staticPosition(const LayoutState&, const Box&);
+        static Position inFlowPositionedPosition(const LayoutState&, const Box&);
 
         static bool instrinsicWidthConstraintsNeedChildrenWidth(const Box&);
-        static InstrinsicWidthConstraints instrinsicWidthConstraints(const LayoutContext&, const Box&);
+        static InstrinsicWidthConstraints instrinsicWidthConstraints(const LayoutState&, const Box&);
 
-        static LayoutUnit estimatedMarginTop(const LayoutContext&, const Box&);
+        static LayoutUnit estimatedMarginTop(const LayoutState&, const Box&);
 
     private:
         // This class implements margin collapsing for block formatting context.
         class MarginCollapse {
         public:
-            static LayoutUnit marginTop(const LayoutContext&, const Box&);
-            static LayoutUnit marginBottom(const LayoutContext&, const Box&);
+            static LayoutUnit marginTop(const LayoutState&, const Box&);
+            static LayoutUnit marginBottom(const LayoutState&, const Box&);
 
-            static bool isMarginBottomCollapsedWithParent(const LayoutContext&, const Box&);
+            static bool isMarginBottomCollapsedWithParent(const LayoutState&, const Box&);
             static bool isMarginTopCollapsedWithParentMarginBottom(const Box&);
 
         private:
-            static LayoutUnit collapsedMarginBottomFromLastChild(const LayoutContext&, const Box&);
-            static LayoutUnit nonCollapsedMarginBottom(const LayoutContext&, const Box&);
+            static LayoutUnit collapsedMarginBottomFromLastChild(const LayoutState&, const Box&);
+            static LayoutUnit nonCollapsedMarginBottom(const LayoutState&, const Box&);
 
-            static LayoutUnit computedNonCollapsedMarginTop(const LayoutContext&, const Box&);
-            static LayoutUnit computedNonCollapsedMarginBottom(const LayoutContext&, const Box&);
+            static LayoutUnit computedNonCollapsedMarginTop(const LayoutState&, const Box&);
+            static LayoutUnit computedNonCollapsedMarginBottom(const LayoutState&, const Box&);
 
-            static LayoutUnit collapsedMarginTopFromFirstChild(const LayoutContext&, const Box&);
-            static LayoutUnit nonCollapsedMarginTop(const LayoutContext&, const Box&);
+            static LayoutUnit collapsedMarginTopFromFirstChild(const LayoutState&, const Box&);
+            static LayoutUnit nonCollapsedMarginTop(const LayoutState&, const Box&);
         };
 
-        static HeightAndMargin inFlowNonReplacedHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
-        static WidthAndMargin inFlowNonReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
-        static WidthAndMargin inFlowReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
-        static Position staticPositionForOutOfFlowPositioned(const LayoutContext&, const Box&);
+        static HeightAndMargin inFlowNonReplacedHeightAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+        static WidthAndMargin inFlowNonReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static WidthAndMargin inFlowReplacedWidthAndMargin(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+        static Position staticPositionForOutOfFlowPositioned(const LayoutState&, const Box&);
     };
 };
 
index fc72f90..6d602b5 100644 (file)
@@ -45,11 +45,11 @@ static const Container& initialContainingBlock(const Box& layoutBox)
     return *containingBlock;
 }
 
-static bool isStretchedToInitialContainingBlock(const LayoutContext& layoutContext, const Box& layoutBox)
+static bool isStretchedToInitialContainingBlock(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isInFlow());
     // In quirks mode, body and html stretch to the viewport.
-    if (!layoutContext.inQuirksMode())
+    if (!layoutState.inQuirksMode())
         return false;
 
     if (!layoutBox.isDocumentBox() && !layoutBox.isBodyBox())
@@ -78,7 +78,7 @@ static WidthAndMargin stretchWidthToInitialContainingBlock(WidthAndMargin widthA
     return widthAndMargin;
 }
 
-HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
+HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
 {
     ASSERT(layoutBox.isInFlow() && !layoutBox.replaced());
     ASSERT(layoutBox.isOverflowVisible());
@@ -99,12 +99,12 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg
         // and relatively positioned boxes are considered without their offset). Note that the child box may be an anonymous block box.
 
         auto& style = layoutBox.style();
-        auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
-        auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+        auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
+        auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
 
         VerticalEdges nonCollapsedMargin = { computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(0),
             computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(0) }; 
-        VerticalEdges collapsedMargin = { MarginCollapse::marginTop(layoutContext, layoutBox), MarginCollapse::marginBottom(layoutContext, layoutBox) };
+        VerticalEdges collapsedMargin = { MarginCollapse::marginTop(layoutState, layoutBox), MarginCollapse::marginBottom(layoutState, layoutBox) };
         auto borderAndPaddingTop = displayBox.borderTop() + displayBox.paddingTop().value_or(0);
         
         auto height = usedHeight ? Length { usedHeight.value(), Fixed } : style.logicalHeight();
@@ -122,15 +122,15 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg
         // 1. the bottom edge of the last line box, if the box establishes a inline formatting context with one or more lines
         if (layoutBox.establishesInlineFormattingContext()) {
             // This is temp and will be replaced by the correct display box once inline runs move over to the display tree.
-            auto& lastInlineRun = downcast<InlineFormattingState>(layoutContext.establishedFormattingState(layoutBox)).inlineRuns().last();
+            auto& lastInlineRun = downcast<InlineFormattingState>(layoutState.establishedFormattingState(layoutBox)).inlineRuns().last();
             return { lastInlineRun.logicalBottom(), nonCollapsedMargin, collapsedMargin };
         }
 
         // 2. the bottom edge of the bottom (possibly collapsed) margin of its last in-flow child, if the child's bottom margin...
         auto* lastInFlowChild = downcast<Container>(layoutBox).lastInFlowChild();
         ASSERT(lastInFlowChild);
-        if (!MarginCollapse::isMarginBottomCollapsedWithParent(layoutContext, *lastInFlowChild)) {
-            auto& lastInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*lastInFlowChild);
+        if (!MarginCollapse::isMarginBottomCollapsedWithParent(layoutState, *lastInFlowChild)) {
+            auto& lastInFlowDisplayBox = layoutState.displayBoxForLayoutBox(*lastInFlowChild);
             return { lastInFlowDisplayBox.bottom() + lastInFlowDisplayBox.marginBottom() - borderAndPaddingTop, nonCollapsedMargin, collapsedMargin };
         }
 
@@ -139,7 +139,7 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg
         while (inFlowChild && MarginCollapse::isMarginTopCollapsedWithParentMarginBottom(*inFlowChild))
             inFlowChild = inFlowChild->previousInFlowSibling();
         if (inFlowChild) {
-            auto& inFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*inFlowChild);
+            auto& inFlowDisplayBox = layoutState.displayBoxForLayoutBox(*inFlowChild);
             return { inFlowDisplayBox.top() + inFlowDisplayBox.borderBox().height() - borderAndPaddingTop, nonCollapsedMargin, collapsedMargin };
         }
 
@@ -153,7 +153,7 @@ HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMarg
     return heightAndMargin;
 }
 
-WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isInFlow() && !layoutBox.replaced());
 
@@ -182,8 +182,8 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin
 
         auto& style = layoutBox.style();
         auto* containingBlock = layoutBox.containingBlock();
-        auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*containingBlock).contentBoxWidth();
-        auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+        auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*containingBlock).contentBoxWidth();
+        auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
 
         auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth);
         auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth);
@@ -241,19 +241,19 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin
     };
 
     auto widthAndMargin = compute();
-    if (!isStretchedToInitialContainingBlock(layoutContext, layoutBox)) {
+    if (!isStretchedToInitialContainingBlock(layoutState, layoutBox)) {
         LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")");
         return widthAndMargin;
     }
 
-    auto initialContainingBlockWidth = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxWidth();
+    auto initialContainingBlockWidth = layoutState.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxWidth();
     widthAndMargin = stretchWidthToInitialContainingBlock(widthAndMargin, initialContainingBlockWidth);
 
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> streched to viewport-> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")");
     return widthAndMargin;
 }
 
-WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isInFlow() && layoutBox.replaced());
 
@@ -263,15 +263,15 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(co
     // 2. Then the rules for non-replaced block-level elements are applied to determine the margins.
 
     // #1
-    auto width = inlineReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth).width;
+    auto width = inlineReplacedWidthAndMargin(layoutState, layoutBox, usedWidth).width;
     // #2
-    auto nonReplacedWidthAndMargin = inFlowNonReplacedWidthAndMargin(layoutContext, layoutBox, width);
+    auto nonReplacedWidthAndMargin = inFlowNonReplacedWidthAndMargin(layoutState, layoutBox, width);
 
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow replaced -> width(" << width << "px) margin(" << nonReplacedWidthAndMargin.margin.left << "px, " << nonReplacedWidthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")");
     return { width, nonReplacedWidthAndMargin.margin, nonReplacedWidthAndMargin.nonComputedMargin };
 }
 
-Position BlockFormattingContext::Geometry::staticPosition(const LayoutContext& layoutContext, const Box& layoutBox)
+Position BlockFormattingContext::Geometry::staticPosition(const LayoutState& layoutState, const Box& layoutBox)
 {
     // https://www.w3.org/TR/CSS22/visuren.html#block-formatting
     // In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block.
@@ -280,9 +280,9 @@ Position BlockFormattingContext::Geometry::staticPosition(const LayoutContext& l
     // In a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch).
 
     LayoutUnit top;
-    auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock());
+    auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock());
     if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) {
-        auto& previousInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*previousInFlowSibling);
+        auto& previousInFlowDisplayBox = layoutState.displayBoxForLayoutBox(*previousInFlowSibling);
         top = previousInFlowDisplayBox.bottom() + previousInFlowDisplayBox.marginBottom();
     } else
         top = containingBlockDisplayBox.contentBoxTop();
@@ -292,7 +292,7 @@ Position BlockFormattingContext::Geometry::staticPosition(const LayoutContext& l
     return { left, top };
 }
 
-Position BlockFormattingContext::Geometry::inFlowPositionedPosition(const LayoutContext& layoutContext, const Box& layoutBox)
+Position BlockFormattingContext::Geometry::inFlowPositionedPosition(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isInFlowPositioned());
 
@@ -306,9 +306,9 @@ Position BlockFormattingContext::Geometry::inFlowPositionedPosition(const Layout
     // 3. If neither is 'auto', 'bottom' is ignored (i.e., the used value of 'bottom' will be minus the value of 'top').
 
     auto& style = layoutBox.style();
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     auto& containingBlock = *layoutBox.containingBlock();
-    auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock).contentBoxWidth();
+    auto containingBlockWidth = layoutState.displayBoxForLayoutBox(containingBlock).contentBoxWidth();
 
     auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
     auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth);
@@ -369,42 +369,42 @@ Position BlockFormattingContext::Geometry::inFlowPositionedPosition(const Layout
     return { newLeftPosition, newTopPosition };
 }
 
-HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
+HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
 {
     ASSERT(layoutBox.isInFlow());
 
     // 10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block'
     // replaced elements in normal flow and floating replaced elements
     if (layoutBox.replaced())
-        return inlineReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight);
+        return inlineReplacedHeightAndMargin(layoutState, layoutBox, usedHeight);
 
     HeightAndMargin heightAndMargin;
     // TODO: Figure out the case for the document element. Let's just complicated-case it for now.
     if (layoutBox.isOverflowVisible() && !layoutBox.isDocumentBox())
-        heightAndMargin = inFlowNonReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight);
+        heightAndMargin = inFlowNonReplacedHeightAndMargin(layoutState, layoutBox, usedHeight);
     else {
         // 10.6.6 Complicated cases
         // Block-level, non-replaced elements in normal flow when 'overflow' does not compute to 'visible' (except if the 'overflow' property's value has been propagated to the viewport).
-        heightAndMargin = complicatedCases(layoutContext, layoutBox, usedHeight);
+        heightAndMargin = complicatedCases(layoutState, layoutBox, usedHeight);
     }
 
-    if (!isStretchedToInitialContainingBlock(layoutContext, layoutBox))
+    if (!isStretchedToInitialContainingBlock(layoutState, layoutBox))
         return heightAndMargin;
 
-    auto initialContainingBlockHeight = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxHeight();
+    auto initialContainingBlockHeight = layoutState.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxHeight();
     heightAndMargin = stretchHeightToInitialContainingBlock(heightAndMargin, initialContainingBlockHeight);
 
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> streched to viewport -> height(" << heightAndMargin.height << "px) margin(" << heightAndMargin.margin.top << "px, " << heightAndMargin.margin.bottom << "px) -> layoutBox(" << &layoutBox << ")");
     return heightAndMargin;
 }
 
-WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
+WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
 {
     ASSERT(layoutBox.isInFlow());
 
     if (!layoutBox.replaced())
-        return inFlowNonReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth);
-    return inFlowReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth);
+        return inFlowNonReplacedWidthAndMargin(layoutState, layoutBox, usedWidth);
+    return inFlowReplacedWidthAndMargin(layoutState, layoutBox, usedWidth);
 }
 
 bool BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWidth(const Box& layoutBox)
@@ -414,7 +414,7 @@ bool BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWid
     return layoutBox.style().width().isAuto();
 }
 
-FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::Geometry::instrinsicWidthConstraints(const LayoutContext& layoutContext, const Box& layoutBox)
+FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::Geometry::instrinsicWidthConstraints(const LayoutState& layoutState, const Box& layoutBox)
 {
     auto& style = layoutBox.style();
     if (auto width = fixedValue(style.logicalWidth()))
@@ -433,7 +433,7 @@ FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::Geometry::
     for (auto& child : childrenOfType<Box>(downcast<Container>(layoutBox))) {
         if (child.isOutOfFlowPositioned())
             continue;
-        auto& formattingState = layoutContext.formattingStateForBox(child);
+        auto& formattingState = layoutState.formattingStateForBox(child);
         ASSERT(formattingState.isBlockFormattingState());
         auto childInstrinsicWidthConstraints = formattingState.instrinsicWidthConstraints(child);
         ASSERT(childInstrinsicWidthConstraints);
@@ -453,7 +453,7 @@ FormattingContext::InstrinsicWidthConstraints BlockFormattingContext::Geometry::
     return { minimumIntrinsicWidth, maximumIntrinsicWidth };
 }
 
-LayoutUnit BlockFormattingContext::Geometry::estimatedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox)
+LayoutUnit BlockFormattingContext::Geometry::estimatedMarginTop(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isBlockLevelBox());
     // Can't estimate vertical margins for out of flow boxes (and we shouldn't need to do it for float boxes).
@@ -462,7 +462,7 @@ LayoutUnit BlockFormattingContext::Geometry::estimatedMarginTop(const LayoutCont
     ASSERT(!layoutBox.establishesBlockFormattingContext());
 
     // Let's just use the normal path for now.
-    return MarginCollapse::marginTop(layoutContext, layoutBox);
+    return MarginCollapse::marginTop(layoutState, layoutBox);
 }
 
 
index 06ca6d9..0d2491e 100644 (file)
@@ -37,8 +37,8 @@ namespace Layout {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(BlockFormattingState);
 
-BlockFormattingState::BlockFormattingState(Ref<FloatingState>&& floatingState, const LayoutContext& layoutContext)
-    : FormattingState(WTFMove(floatingState), Type::Block, layoutContext)
+BlockFormattingState::BlockFormattingState(Ref<FloatingState>&& floatingState, const LayoutState& layoutState)
+    : FormattingState(WTFMove(floatingState), Type::Block, layoutState)
 {
 }
 
index c196f5d..b46b8c9 100644 (file)
@@ -38,7 +38,7 @@ namespace Layout {
 class BlockFormattingState : public FormattingState {
     WTF_MAKE_ISO_ALLOCATED(BlockFormattingState);
 public:
-    BlockFormattingState(Ref<FloatingState>&&, const LayoutContext&);
+    BlockFormattingState(Ref<FloatingState>&&, const LayoutState&);
     virtual ~BlockFormattingState();
 };
 
index a9fa192..0064dd1 100644 (file)
@@ -32,7 +32,7 @@
 #include "Invalidation.h"
 #include "LayoutBox.h"
 #include "LayoutContainer.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
@@ -48,25 +48,25 @@ static bool invalidationStopsAtFormattingContextBoundary(const Container& format
     return true;
 }
 
-static LayoutContext::UpdateType computeUpdateType(const Box&, StyleDiff, BlockFormattingState&)
+static LayoutState::UpdateType computeUpdateType(const Box&, StyleDiff, BlockFormattingState&)
 {
-    return LayoutContext::UpdateType::All;
+    return LayoutState::UpdateType::All;
 }
 
-static LayoutContext::UpdateType computeUpdateTypeForAncestor(const Container&, StyleDiff, BlockFormattingState&)
+static LayoutState::UpdateType computeUpdateTypeForAncestor(const Container&, StyleDiff, BlockFormattingState&)
 {
-    return LayoutContext::UpdateType::All;
+    return LayoutState::UpdateType::All;
 }
 
-InvalidationResult BlockInvalidation::invalidate(const Box& layoutBox, StyleDiff styleDiff, LayoutContext& layoutContext,
+InvalidationResult BlockInvalidation::invalidate(const Box& layoutBox, StyleDiff styleDiff, LayoutState& layoutState,
     BlockFormattingState& formattingState)
 {
     // Invalidate this box and the containing block chain all the way up to the formatting context root (and beyond if needed).
-    layoutContext.markNeedsUpdate(layoutBox, computeUpdateType(layoutBox, styleDiff, formattingState));
+    layoutState.markNeedsUpdate(layoutBox, computeUpdateType(layoutBox, styleDiff, formattingState));
     for (auto* containingBlock = layoutBox.containingBlock(); containingBlock; containingBlock = containingBlock->containingBlock()) {
         if (containingBlock->establishesFormattingContext() && invalidationStopsAtFormattingContextBoundary(*containingBlock, layoutBox, styleDiff))
             return { containingBlock };
-        layoutContext.markNeedsUpdate(*containingBlock, computeUpdateTypeForAncestor(*containingBlock, styleDiff, formattingState));
+        layoutState.markNeedsUpdate(*containingBlock, computeUpdateTypeForAncestor(*containingBlock, styleDiff, formattingState));
     }
     // Invalidation always stops at the initial containing block.
     ASSERT_NOT_REACHED();
index aed44e0..53deb3f 100644 (file)
@@ -37,14 +37,14 @@ class Box;
 class BlockFormattingState;
 class Container;
 struct InvalidationResult;
-class LayoutContext;
+class LayoutState;
 enum class StyleDiff;
 
 // This class implements box invalidation for block formatting context.
 class BlockInvalidation {
     WTF_MAKE_ISO_ALLOCATED(BlockInvalidation);
 public:
-    static InvalidationResult invalidate(const Box&, StyleDiff, LayoutContext&, BlockFormattingState&);
+    static InvalidationResult invalidate(const Box&, StyleDiff, LayoutState&, BlockFormattingState&);
 };
 
 }
index ccf6dcf..0c166c1 100644 (file)
@@ -82,7 +82,7 @@ static bool isMarginBottomCollapsedWithSibling(const Box& layoutBox)
     return layoutBox.style().bottom().isAuto();
 }
 
-static bool isMarginTopCollapsedWithParent(const LayoutContext& layoutContext, const Box& layoutBox)
+static bool isMarginTopCollapsedWithParent(const LayoutState& layoutState, const Box& layoutBox)
 {
     // The first inflow child could propagate its top margin to parent.
     // https://www.w3.org/TR/CSS21/box.html#collapsing-margins
@@ -108,7 +108,7 @@ static bool isMarginTopCollapsedWithParent(const LayoutContext& layoutContext, c
     if (parent.isDocumentBox() || parent.isInitialContainingBlock())
         return false;
 
-    auto& parentDisplayBox = layoutContext.displayBoxForLayoutBox(parent);
+    auto& parentDisplayBox = layoutState.displayBoxForLayoutBox(parent);
     if (parentDisplayBox.borderTop())
         return false;
 
@@ -118,12 +118,12 @@ static bool isMarginTopCollapsedWithParent(const LayoutContext& layoutContext, c
     return true;
 }
 
-static bool isMarginBottomCollapsedThrough(const LayoutContext& layoutContext, const Box& layoutBox)
+static bool isMarginBottomCollapsedThrough(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isBlockLevelBox());
 
     // If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it.
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
 
     if (displayBox.borderTop() || displayBox.borderBottom())
         return false;
@@ -144,7 +144,7 @@ static bool isMarginBottomCollapsedThrough(const LayoutContext& layoutContext, c
     return true;
 }
 
-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopFromFirstChild(const LayoutContext& layoutContext, const Box& layoutBox)
+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopFromFirstChild(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isBlockLevelBox());
 
@@ -158,18 +158,18 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopF
 
     // FIXME: Take collapsed through margin into account.
     auto& firstInFlowChild = *downcast<Container>(layoutBox).firstInFlowChild();
-    if (!isMarginTopCollapsedWithParent(layoutContext, firstInFlowChild))
+    if (!isMarginTopCollapsedWithParent(layoutState, firstInFlowChild))
         return 0;
     // Collect collapsed margin top recursively.
-    return marginValue(computedNonCollapsedMarginTop(layoutContext, firstInFlowChild), collapsedMarginTopFromFirstChild(layoutContext, firstInFlowChild));
+    return marginValue(computedNonCollapsedMarginTop(layoutState, firstInFlowChild), collapsedMarginTopFromFirstChild(layoutState, firstInFlowChild));
 }
 
-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox)
+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginTop(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isBlockLevelBox());
 
     // Non collapsed margin top includes collapsed margin from inflow first child.
-    return marginValue(computedNonCollapsedMarginTop(layoutContext, layoutBox), collapsedMarginTopFromFirstChild(layoutContext, layoutBox));
+    return marginValue(computedNonCollapsedMarginTop(layoutState, layoutBox), collapsedMarginTopFromFirstChild(layoutState, layoutBox));
 }
 
 /*static bool hasAdjoiningMarginTopAndBottom(const Box&)
@@ -186,21 +186,21 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginT
     // A collapsed margin is considered adjoining to another margin if any of its component margins is adjoining to that margin.
     return false;
 }*/
-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginTop(const LayoutContext& layoutContext, const Box& layoutBox)
+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginTop(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isBlockLevelBox());
 
-    return computedNonCollapsedVerticalMarginValue(layoutContext, layoutBox).top;
+    return computedNonCollapsedVerticalMarginValue(layoutState, layoutBox).top;
 }
 
-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBottom(const LayoutContext& layoutContext, const Box& layoutBox)
+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBottom(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isBlockLevelBox());
 
-    return computedNonCollapsedVerticalMarginValue(layoutContext, layoutBox).bottom;
+    return computedNonCollapsedVerticalMarginValue(layoutState, layoutBox).bottom;
 }
 
-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginTop(const LayoutContext& layoutContext, const Box& layoutBox)
+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginTop(const LayoutState& layoutState, const Box& layoutBox)
 {
     if (layoutBox.isAnonymous())
         return 0;
@@ -208,15 +208,15 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginTop(const Lay
     ASSERT(layoutBox.isBlockLevelBox());
 
     // TODO: take _hasAdjoiningMarginTopAndBottom() into account.
-    if (isMarginTopCollapsedWithParent(layoutContext, layoutBox))
+    if (isMarginTopCollapsedWithParent(layoutState, layoutBox))
         return 0;
 
     if (!isMarginTopCollapsedWithSibling(layoutBox)) {
-        if (!isMarginBottomCollapsedThrough(layoutContext, layoutBox))
-            return nonCollapsedMarginTop(layoutContext, layoutBox);
+        if (!isMarginBottomCollapsedThrough(layoutState, layoutBox))
+            return nonCollapsedMarginTop(layoutState, layoutBox);
         // Compute the collapsed through value.
-        auto marginTop = nonCollapsedMarginTop(layoutContext, layoutBox);
-        auto marginBottom = nonCollapsedMarginBottom(layoutContext, layoutBox); 
+        auto marginTop = nonCollapsedMarginTop(layoutState, layoutBox);
+        auto marginBottom = nonCollapsedMarginBottom(layoutState, layoutBox); 
         return marginValue(marginTop, marginBottom);
     }
 
@@ -224,14 +224,14 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginTop(const Lay
     // unless that sibling has clearance.
     auto* previousInFlowSibling = layoutBox.previousInFlowSibling();
     if (!previousInFlowSibling)
-        return nonCollapsedMarginTop(layoutContext, layoutBox);
+        return nonCollapsedMarginTop(layoutState, layoutBox);
 
-    auto previousSiblingMarginBottom = nonCollapsedMarginBottom(layoutContext, *previousInFlowSibling);
-    auto marginTop = nonCollapsedMarginTop(layoutContext, layoutBox);
+    auto previousSiblingMarginBottom = nonCollapsedMarginBottom(layoutState, *previousInFlowSibling);
+    auto marginTop = nonCollapsedMarginTop(layoutState, layoutBox);
     return marginValue(marginTop, previousSiblingMarginBottom);
 }
 
-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginBottom(const LayoutContext& layoutContext, const Box& layoutBox)
+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginBottom(const LayoutState& layoutState, const Box& layoutBox)
 {
     if (layoutBox.isAnonymous())
         return 0;
@@ -239,24 +239,24 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginBottom(const
     ASSERT(layoutBox.isBlockLevelBox());
 
     // TODO: take _hasAdjoiningMarginTopAndBottom() into account.
-    if (isMarginBottomCollapsedWithParent(layoutContext, layoutBox))
+    if (isMarginBottomCollapsedWithParent(layoutState, layoutBox))
         return 0;
 
-    if (isMarginBottomCollapsedThrough(layoutContext, layoutBox))
+    if (isMarginBottomCollapsedThrough(layoutState, layoutBox))
         return 0;
 
     // Floats and out of flow positioned boxes do not collapse their margins.
     if (!isMarginBottomCollapsedWithSibling(layoutBox))
-        return nonCollapsedMarginBottom(layoutContext, layoutBox);
+        return nonCollapsedMarginBottom(layoutState, layoutBox);
 
     // The bottom margin of an in-flow block-level element always collapses with the top margin of its next in-flow block-level sibling,
     // unless that sibling has clearance.
     if (layoutBox.nextInFlowSibling())
         return 0;
-    return nonCollapsedMarginBottom(layoutContext, layoutBox);
+    return nonCollapsedMarginBottom(layoutState, layoutBox);
 }
 
-bool BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent(const LayoutContext& layoutContext, const Box& layoutBox)
+bool BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent(const LayoutState& layoutState, const Box& layoutBox)
 {
     // last inflow box to parent.
     // https://www.w3.org/TR/CSS21/box.html#collapsing-margins
@@ -268,7 +268,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWi
     if (layoutBox.isFloatingOrOutOfFlowPositioned())
         return false;
 
-    if (isMarginBottomCollapsedThrough(layoutContext, layoutBox))
+    if (isMarginBottomCollapsedThrough(layoutState, layoutBox))
         return false;
 
     // We never margin collapse the initial containing block.
@@ -285,7 +285,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWi
     if (parent.isDocumentBox() || parent.isInitialContainingBlock())
         return false;
 
-    auto& parentDisplayBox = layoutContext.displayBoxForLayoutBox(parent);
+    auto& parentDisplayBox = layoutState.displayBoxForLayoutBox(parent);
     if (parentDisplayBox.borderTop())
         return false;
 
@@ -303,7 +303,7 @@ bool BlockFormattingContext::Geometry::MarginCollapse::isMarginTopCollapsedWithP
     return false;
 }
 
-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBottomFromLastChild(const LayoutContext& layoutContext, const Box& layoutBox)
+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBottomFromLastChild(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isBlockLevelBox());
 
@@ -317,19 +317,19 @@ LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBott
 
     // FIXME: Check for collapsed through margin.
     auto& lastInFlowChild = *downcast<Container>(layoutBox).lastInFlowChild();
-    if (!isMarginBottomCollapsedWithParent(layoutContext, lastInFlowChild))
+    if (!isMarginBottomCollapsedWithParent(layoutState, lastInFlowChild))
         return 0;
 
     // Collect collapsed margin bottom recursively.
-    return marginValue(computedNonCollapsedMarginBottom(layoutContext, lastInFlowChild), collapsedMarginBottomFromLastChild(layoutContext, lastInFlowChild));
+    return marginValue(computedNonCollapsedMarginBottom(layoutState, lastInFlowChild), collapsedMarginBottomFromLastChild(layoutState, lastInFlowChild));
 }
 
-LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBottom(const LayoutContext& layoutContext, const Box& layoutBox)
+LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBottom(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isBlockLevelBox());
 
     // Non collapsed margin bottom includes collapsed margin from inflow last child.
-    return marginValue(computedNonCollapsedMarginBottom(layoutContext, layoutBox), collapsedMarginBottomFromLastChild(layoutContext, layoutBox));
+    return marginValue(computedNonCollapsedMarginBottom(layoutState, layoutBox), collapsedMarginBottomFromLastChild(layoutState, layoutBox));
 }
 
 }
index 927eadc..62a3992 100644 (file)
@@ -42,7 +42,7 @@ class FloatBox;
 class FormattingContext;
 class FloatingContext;
 class InlineFormattingContext;
-class LayoutContext;
+class LayoutState;
 }
 
 namespace Display {
@@ -56,7 +56,7 @@ public:
     friend class Layout::FormattingContext;
     friend class Layout::FloatingContext;
     friend class Layout::InlineFormattingContext;
-    friend class Layout::LayoutContext;
+    friend class Layout::LayoutState;
 
     Box(const RenderStyle&);
     Box(const Box&);
index 3b108d7..07f20ec 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "LayoutBox.h"
 #include "LayoutContainer.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
@@ -38,11 +38,11 @@ namespace Layout {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(FloatAvoider);
 
-FloatAvoider::FloatAvoider(const Box& layoutBox, const FloatingState& floatingState, const LayoutContext& layoutContext)
+FloatAvoider::FloatAvoider(const Box& layoutBox, const FloatingState& floatingState, const LayoutState& layoutState)
     : m_layoutBox(makeWeakPtr(layoutBox))
     , m_floatingState(floatingState)
-    , m_absoluteDisplayBox(FormattingContext::mapBoxToAncestor(layoutContext, layoutBox, downcast<Container>(floatingState.root())))
-    , m_containingBlockAbsoluteDisplayBox(layoutBox.containingBlock() == &floatingState.root() ? Display::Box(layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())) : FormattingContext::mapBoxToAncestor(layoutContext, *layoutBox.containingBlock(), downcast<Container>(floatingState.root())))
+    , m_absoluteDisplayBox(FormattingContext::mapBoxToAncestor(layoutState, layoutBox, downcast<Container>(floatingState.root())))
+    , m_containingBlockAbsoluteDisplayBox(layoutBox.containingBlock() == &floatingState.root() ? Display::Box(layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock())) : FormattingContext::mapBoxToAncestor(layoutState, *layoutBox.containingBlock(), downcast<Container>(floatingState.root())))
     , m_initialVerticalPosition(m_absoluteDisplayBox.top())
 {
     ASSERT(m_layoutBox->establishesBlockFormattingContext());
index a58eea2..8c26ddf 100644 (file)
@@ -38,12 +38,12 @@ namespace WebCore {
 namespace Layout {
 
 class FloatingState;
-class LayoutContext;
+class LayoutState;
 
 class FloatAvoider {
     WTF_MAKE_ISO_ALLOCATED(FloatAvoider);
 public:
-    FloatAvoider(const Box&, const FloatingState&, const LayoutContext&);
+    FloatAvoider(const Box&, const FloatingState&, const LayoutState&);
     virtual ~FloatAvoider() = default;
 
     virtual Display::Box::Rect rect() const { return m_absoluteDisplayBox.rect(); }
index 27ab341..69dd018 100644 (file)
@@ -35,8 +35,8 @@ namespace Layout {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(FloatBox);
 
-FloatBox::FloatBox(const Box& layoutBox, const FloatingState& floatingState, const LayoutContext& layoutContext)
-    : FloatAvoider(layoutBox, floatingState, layoutContext)
+FloatBox::FloatBox(const Box& layoutBox, const FloatingState& floatingState, const LayoutState& layoutState)
+    : FloatAvoider(layoutBox, floatingState, layoutState)
 {
 }
 
index 32fb3c2..819b14c 100644 (file)
@@ -36,12 +36,12 @@ namespace Layout {
 
 class Box;
 class FloatingState;
-class LayoutContext;
+class LayoutState;
 
 class FloatBox : public FloatAvoider {
     WTF_MAKE_ISO_ALLOCATED(FloatBox);
 public:
-    FloatBox(const Box&, const FloatingState&, const LayoutContext&);
+    FloatBox(const Box&, const FloatingState&, const LayoutState&);
 
     Display::Box::Rect rect() const final;
 
index 1f035d8..9047fe0 100644 (file)
@@ -33,7 +33,7 @@
 #include "FloatBox.h"
 #include "LayoutBox.h"
 #include "LayoutContainer.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
@@ -121,11 +121,11 @@ PointInContainingBlock FloatingContext::positionForFloat(const Box& layoutBox) c
     ASSERT(layoutBox.isFloatingPositioned());
 
     if (m_floatingState.isEmpty()) {
-        auto& displayBox = layoutContext().displayBoxForLayoutBox(layoutBox);
+        auto& displayBox = layoutState().displayBoxForLayoutBox(layoutBox);
 
         auto alignWithContainingBlock = [&]() -> PositionInContainingBlock {
             // If there is no floating to align with, push the box to the left/right edge of its containing block's content box.
-            auto& containingBlockDisplayBox = layoutContext().displayBoxForLayoutBox(*layoutBox.containingBlock());
+            auto& containingBlockDisplayBox = layoutState().displayBoxForLayoutBox(*layoutBox.containingBlock());
 
             if (layoutBox.isLeftFloatingPositioned())
                 return containingBlockDisplayBox.contentBoxLeft() + displayBox.marginLeft();
@@ -138,7 +138,7 @@ PointInContainingBlock FloatingContext::positionForFloat(const Box& layoutBox) c
     }
 
     // Find the top most position where the float box fits.
-    FloatBox floatBox = { layoutBox, m_floatingState, layoutContext() };
+    FloatBox floatBox = { layoutBox, m_floatingState, layoutState() };
     floatingPosition(floatBox);
     return floatBox.rectInContainingBlock().topLeft();
 }
@@ -152,7 +152,7 @@ std::optional<PointInContainingBlock> FloatingContext::positionForFloatAvoiding(
     if (m_floatingState.isEmpty())
         return { };
 
-    FloatAvoider floatAvoider = { layoutBox, m_floatingState, layoutContext() };
+    FloatAvoider floatAvoider = { layoutBox, m_floatingState, layoutState() };
     floatingPosition(floatAvoider);
     return { floatAvoider.rectInContainingBlock().topLeft() };
 }
@@ -176,16 +176,16 @@ std::optional<PositionInContainingBlock> FloatingContext::verticalPositionWithCl
         // 1. The amount necessary to place the border edge of the block even with the bottom outer edge of the lowest float that is to be cleared.
         // 2. The amount necessary to place the top border edge of the block at its hypothetical position.
 
-        auto& layoutContext = this->layoutContext();
-        auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
-        auto rootRelativeTop = FormattingContext::mapTopLeftToAncestor(layoutContext, layoutBox, downcast<Container>(m_floatingState.root())).y;
+        auto& layoutState = this->layoutState();
+        auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
+        auto rootRelativeTop = FormattingContext::mapTopLeftToAncestor(layoutState, layoutBox, downcast<Container>(m_floatingState.root())).y;
         auto clearance = *floatBottom - rootRelativeTop;
         if (clearance <= 0)
             return { };
 
         // Clearance inhibits margin collapsing. Let's reset the relevant adjoining margins.
         if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) {
-            auto& previousInFlowDisplayBox = layoutContext.displayBoxForLayoutBox(*previousInFlowSibling);
+            auto& previousInFlowDisplayBox = layoutState.displayBoxForLayoutBox(*previousInFlowSibling);
 
             // Since the previous inflow sibling has already been laid out, its margin is collapsed by now.
             ASSERT(!previousInFlowDisplayBox.marginBottom());
@@ -208,7 +208,7 @@ std::optional<PositionInContainingBlock> FloatingContext::verticalPositionWithCl
         ASSERT(*floatBottom == rootRelativeTop);
 
         // The return vertical position is in the containing block's coordinate system.
-        auto containingBlockRootRelativeTop = FormattingContext::mapTopLeftToAncestor(layoutContext, *layoutBox.containingBlock(), downcast<Container>(m_floatingState.root())).y;
+        auto containingBlockRootRelativeTop = FormattingContext::mapTopLeftToAncestor(layoutState, *layoutBox.containingBlock(), downcast<Container>(m_floatingState.root())).y;
         return rootRelativeTop - containingBlockRootRelativeTop;
     };
 
index bbfa1b2..f8d3d8c 100644 (file)
@@ -39,7 +39,7 @@ class FloatAvoider;
 class Box;
 class Container;
 class FloatingPair;
-class LayoutContext;
+class LayoutState;
 
 // FloatingContext is responsible for adjusting the position of a box in the current formatting context
 // by taking the floating boxes into account.
@@ -55,7 +55,7 @@ public:
     std::optional<PositionInContainingBlock> verticalPositionWithClearance(const Box&) const;
 
 private:
-    LayoutContext& layoutContext() const { return m_floatingState.layoutContext(); }
+    LayoutState& layoutState() const { return m_floatingState.layoutState(); }
 
     void floatingPosition(FloatAvoider&) const;
 
index 8312b71..90f811a 100644 (file)
@@ -31,7 +31,7 @@
 #include "FormattingContext.h"
 #include "LayoutBox.h"
 #include "LayoutContainer.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
@@ -41,12 +41,12 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(FloatingState);
 
 FloatingState::FloatItem::FloatItem(const Box& layoutBox, const FloatingState& floatingState)
     : m_layoutBox(makeWeakPtr(layoutBox))
-    , m_absoluteDisplayBox(FormattingContext::mapBoxToAncestor(floatingState.layoutContext(), layoutBox, downcast<Container>(floatingState.root())))
+    , m_absoluteDisplayBox(FormattingContext::mapBoxToAncestor(floatingState.layoutState(), layoutBox, downcast<Container>(floatingState.root())))
 {
 }
 
-FloatingState::FloatingState(LayoutContext& layoutContext, const Box& formattingContextRoot)
-    : m_layoutContext(layoutContext)
+FloatingState::FloatingState(LayoutState& layoutState, const Box& formattingContextRoot)
+    : m_layoutState(layoutState)
     , m_formattingContextRoot(makeWeakPtr(formattingContextRoot))
 {
 }
@@ -98,7 +98,7 @@ FloatingState::Constraints FloatingState::constraints(LayoutUnit verticalPositio
     auto adjustedPosition = Position { 0, verticalPosition };
 
     if (coordinateMappingIsRequired)
-        adjustedPosition = FormattingContext::mapCoordinateToAncestor(m_layoutContext, adjustedPosition, downcast<Container>(formattingContextRoot), downcast<Container>(root()));
+        adjustedPosition = FormattingContext::mapCoordinateToAncestor(m_layoutState, adjustedPosition, downcast<Container>(formattingContextRoot), downcast<Container>(root()));
 
     Constraints constraints;
     for (int index = m_floats.size() - 1; index >= 0; --index) {
index 773d1e5..6f16edf 100644 (file)
@@ -39,13 +39,13 @@ namespace WebCore {
 namespace Layout {
 
 class FormattingState;
-class LayoutContext;
+class LayoutState;
 
 // FloatingState holds the floating boxes per formatting context.
 class FloatingState : public RefCounted<FloatingState> {
     WTF_MAKE_ISO_ALLOCATED(FloatingState);
 public:
-    static Ref<FloatingState> create(LayoutContext& layoutContext, const Box& formattingContextRoot) { return adoptRef(*new FloatingState(layoutContext, formattingContextRoot)); }
+    static Ref<FloatingState> create(LayoutState& layoutState, const Box& formattingContextRoot) { return adoptRef(*new FloatingState(layoutState, formattingContextRoot)); }
 
     void append(const Box& layoutBox);
     void remove(const Box& layoutBox);
@@ -86,13 +86,13 @@ public:
 
 private:
     friend class FloatingContext;
-    FloatingState(LayoutContext&, const Box& formattingContextRoot);
+    FloatingState(LayoutState&, const Box& formattingContextRoot);
 
-    LayoutContext& layoutContext() const { return m_layoutContext; }
+    LayoutState& layoutState() const { return m_layoutState; }
 
     std::optional<LayoutUnit> bottom(const Box& formattingContextRoot, Clear) const;
 
-    LayoutContext& m_layoutContext;
+    LayoutState& m_layoutState;
     WeakPtr<const Box> m_formattingContextRoot;
     FloatList m_floats;
 };
index 347e76e..5a86220 100644 (file)
@@ -34,7 +34,7 @@
 #include "InlineRunProvider.h"
 #include "LayoutBox.h"
 #include "LayoutContainer.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include "LayoutInlineBox.h"
 #include "LayoutInlineContainer.h"
 #include "Logging.h"
@@ -51,12 +51,12 @@ InlineFormattingContext::InlineFormattingContext(const Box& formattingContextRoo
 {
 }
 
-void InlineFormattingContext::layout(LayoutContext& layoutContext, FormattingState& formattingState) const
+void InlineFormattingContext::layout(LayoutState& layoutState, FormattingState& formattingState) const
 {
     if (!is<Container>(root()))
         return;
 
-    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> inline formatting context -> layout context(" << &layoutContext << ") formatting root(" << &root() << ")");
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Start] -> inline formatting context -> layout context(" << &layoutState << ") formatting root(" << &root() << ")");
 
     auto& inlineFormattingState = downcast<InlineFormattingState>(formattingState);
     InlineRunProvider inlineRunProvider(inlineFormattingState);
@@ -66,7 +66,7 @@ void InlineFormattingContext::layout(LayoutContext& layoutContext, FormattingSta
     while (layoutBox) {
 
         if (layoutBox->establishesFormattingContext()) {
-            layoutFormattingContextRoot(layoutContext, *layoutBox);
+            layoutFormattingContextRoot(layoutState, *layoutBox);
             // Formatting context roots take care of their entire subtree. Continue with next sibling.
             inlineRunProvider.append(*layoutBox);
             layoutBox = layoutBox->nextInFlowOrFloatingSibling();
@@ -80,7 +80,7 @@ void InlineFormattingContext::layout(LayoutContext& layoutContext, FormattingSta
         }
 
         inlineRunProvider.append(*layoutBox);
-        computeWidthAndHeightForInlineBox(layoutContext, *layoutBox);
+        computeWidthAndHeightForInlineBox(layoutState, *layoutBox);
 
         for (; layoutBox; layoutBox = layoutBox->parent()) {
             if (layoutBox == &formattingRoot) {
@@ -95,9 +95,9 @@ void InlineFormattingContext::layout(LayoutContext& layoutContext, FormattingSta
         ASSERT(!layoutBox || layoutBox->isDescendantOf(formattingRoot));
     }
 
-    layoutInlineContent(layoutContext, inlineFormattingState, inlineRunProvider);
+    layoutInlineContent(layoutState, inlineFormattingState, inlineRunProvider);
 
-    LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> inline formatting context -> layout context(" << &layoutContext << ") formatting root(" << &root() << ")");
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> inline formatting context -> layout context(" << &layoutState << ") formatting root(" << &root() << ")");
 }
 
 static bool isTrimmableContent(const InlineLineBreaker::Run& run)
@@ -105,10 +105,10 @@ static bool isTrimmableContent(const InlineLineBreaker::Run& run)
     return run.content.isWhitespace() && run.content.style().collapseWhiteSpace();
 }
 
-void InlineFormattingContext::initializeNewLine(const LayoutContext& layoutContext, InlineFormattingState& inlineFormattingState, Line& line) const
+void InlineFormattingContext::initializeNewLine(const LayoutState& layoutState, InlineFormattingState& inlineFormattingState, Line& line) const
 {
     auto& formattingRoot = downcast<Container>(root());
-    auto& formattingRootDisplayBox = layoutContext.displayBoxForLayoutBox(formattingRoot);
+    auto& formattingRootDisplayBox = layoutState.displayBoxForLayoutBox(formattingRoot);
 
     auto lineLogicalLeft = formattingRootDisplayBox.contentBoxLeft();
     auto lineLogicalTop = line.isFirstLine() ? formattingRootDisplayBox.contentBoxTop() : line.logicalBottom();
@@ -148,14 +148,14 @@ void InlineFormattingContext::initializeNewLine(const LayoutContext& layoutConte
     line.init(logicalRect);
 }
 
-void InlineFormattingContext::layoutInlineContent(const LayoutContext& layoutContext, InlineFormattingState& inlineFormattingState, const InlineRunProvider& inlineRunProvider) const
+void InlineFormattingContext::layoutInlineContent(const LayoutState& layoutState, InlineFormattingState& inlineFormattingState, const InlineRunProvider& inlineRunProvider) const
 {
     auto floatingContext = FloatingContext { inlineFormattingState.floatingState() };
 
     Line line(inlineFormattingState, root());
-    initializeNewLine(layoutContext, inlineFormattingState, line);
+    initializeNewLine(layoutState, inlineFormattingState, line);
 
-    InlineLineBreaker lineBreaker(layoutContext, inlineFormattingState.inlineContent(), inlineRunProvider.runs());
+    InlineLineBreaker lineBreaker(layoutState, inlineFormattingState.inlineContent(), inlineRunProvider.runs());
     while (auto run = lineBreaker.nextRun(line.contentLogicalRight(), line.availableWidth(), !line.hasContent())) {
         auto isFirstRun = run->position == InlineLineBreaker::Run::Position::LineBegin;
         auto isLastRun = run->position == InlineLineBreaker::Run::Position::LineEnd;
@@ -164,10 +164,10 @@ void InlineFormattingContext::layoutInlineContent(const LayoutContext& layoutCon
         // Position float and adjust the runs on line.
         if (run->content.isFloat()) {
             auto& floatBox = run->content.inlineItem().layoutBox();
-            computeFloatPosition(layoutContext, floatingContext, line, floatBox);
+            computeFloatPosition(layoutState, floatingContext, line, floatBox);
             inlineFormattingState.floatingState().append(floatBox);
 
-            auto floatBoxWidth = layoutContext.displayBoxForLayoutBox(floatBox).width();
+            auto floatBoxWidth = layoutState.displayBoxForLayoutBox(floatBox).width();
             // Shrink availble space for current line and move existing inline runs.
             floatBox.isLeftFloatingPositioned() ? line.adjustLogicalLeft(floatBoxWidth) : line.adjustLogicalRight(floatBoxWidth);
 
@@ -188,7 +188,7 @@ void InlineFormattingContext::layoutInlineContent(const LayoutContext& layoutCon
                 // Previous run ended up being at the line end. Adjust the line accordingly.
                 if (!line.isClosed())
                     line.close(Line::LastLine::No);
-                initializeNewLine(layoutContext, inlineFormattingState, line);
+                initializeNewLine(layoutState, inlineFormattingState, line);
             }
          }
 
@@ -202,18 +202,18 @@ void InlineFormattingContext::layoutInlineContent(const LayoutContext& layoutCon
     line.close(Line::LastLine::Yes);
 }
 
-void InlineFormattingContext::layoutFormattingContextRoot(LayoutContext& layoutContext, const Box& layoutBox) const
+void InlineFormattingContext::layoutFormattingContextRoot(LayoutState& layoutState, const Box& layoutBox) const
 {
     ASSERT(layoutBox.isFloatingPositioned() || layoutBox.isInlineBlockBox());
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
 
     auto computeWidthAndMargin = [&]() {
         WidthAndMargin widthAndMargin;
 
         if (layoutBox.isFloatingPositioned())
-            widthAndMargin = Geometry::floatingWidthAndMargin(layoutContext, *this, layoutBox);
+            widthAndMargin = Geometry::floatingWidthAndMargin(layoutState, *this, layoutBox);
         else if (layoutBox.isInlineBlockBox())
-            widthAndMargin = Geometry::inlineBlockWidthAndMargin(layoutContext, layoutBox);
+            widthAndMargin = Geometry::inlineBlockWidthAndMargin(layoutState, layoutBox);
         else
             ASSERT_NOT_REACHED();
 
@@ -226,9 +226,9 @@ void InlineFormattingContext::layoutFormattingContextRoot(LayoutContext& layoutC
         HeightAndMargin heightAndMargin;
 
         if (layoutBox.isFloatingPositioned())
-            heightAndMargin = Geometry::floatingHeightAndMargin(layoutContext, layoutBox);
+            heightAndMargin = Geometry::floatingHeightAndMargin(layoutState, layoutBox);
         else if (layoutBox.isInlineBlockBox())
-            heightAndMargin = Geometry::inlineBlockHeightAndMargin(layoutContext, layoutBox);
+            heightAndMargin = Geometry::inlineBlockHeightAndMargin(layoutState, layoutBox);
         else
             ASSERT_NOT_REACHED();
 
@@ -237,17 +237,17 @@ void InlineFormattingContext::layoutFormattingContextRoot(LayoutContext& layoutC
         displayBox.setVerticalMargin(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin));
     };
 
-    computeBorderAndPadding(layoutContext, layoutBox);
+    computeBorderAndPadding(layoutState, layoutBox);
     computeWidthAndMargin();
 
     // Swich over to the new formatting context (the one that the root creates).
-    layoutContext.formattingContext(layoutBox)->layout(layoutContext, layoutContext.createFormattingStateForFormattingRootIfNeeded(layoutBox));
+    layoutState.formattingContext(layoutBox)->layout(layoutState, layoutState.createFormattingStateForFormattingRootIfNeeded(layoutBox));
 
     // Come back and finalize the root's height and margin.
     computeHeightAndMargin();
 }
 
-void InlineFormattingContext::computeWidthAndHeightForInlineBox(LayoutContext& layoutContext, const Box& layoutBox) const
+void InlineFormattingContext::computeWidthAndHeightForInlineBox(LayoutState& layoutState, const Box& layoutBox) const
 {
     ASSERT(!layoutBox.isContainer());
     ASSERT(!layoutBox.establishesFormattingContext());
@@ -260,12 +260,12 @@ void InlineFormattingContext::computeWidthAndHeightForInlineBox(LayoutContext& l
 
     // This is pretty much only for replaced inline boxes atm.
     ASSERT(layoutBox.replaced());
-    computeBorderAndPadding(layoutContext, layoutBox);
+    computeBorderAndPadding(layoutState, layoutBox);
 
-    auto widthAndMargin = Geometry::inlineReplacedWidthAndMargin(layoutContext, layoutBox);
-    auto heightAndMargin = Geometry::inlineReplacedHeightAndMargin(layoutContext, layoutBox);
+    auto widthAndMargin = Geometry::inlineReplacedWidthAndMargin(layoutState, layoutBox);
+    auto heightAndMargin = Geometry::inlineReplacedHeightAndMargin(layoutState, layoutBox);
 
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
     displayBox.setContentBoxWidth(widthAndMargin.width);
     displayBox.setHorizontalMargin(widthAndMargin.margin);
     displayBox.setHorizontalNonComputedMargin(widthAndMargin.nonComputedMargin);
@@ -275,10 +275,10 @@ void InlineFormattingContext::computeWidthAndHeightForInlineBox(LayoutContext& l
     displayBox.setVerticalMargin(heightAndMargin.collapsedMargin.value_or(heightAndMargin.margin));
 }
 
-void InlineFormattingContext::computeFloatPosition(const LayoutContext& layoutContext, const FloatingContext& floatingContext, Line& line, const Box& floatBox) const
+void InlineFormattingContext::computeFloatPosition(const LayoutState& layoutState, const FloatingContext& floatingContext, Line& line, const Box& floatBox) const
 {
-    ASSERT(layoutContext.hasDisplayBox(floatBox));
-    auto& displayBox = layoutContext.displayBoxForLayoutBox(floatBox);
+    ASSERT(layoutState.hasDisplayBox(floatBox));
+    auto& displayBox = layoutState.displayBoxForLayoutBox(floatBox);
 
     // Set static position first.
     displayBox.setTopLeft({ line.contentLogicalRight(), line.logicalTop() });
@@ -286,15 +286,15 @@ void InlineFormattingContext::computeFloatPosition(const LayoutContext& layoutCo
     displayBox.setTopLeft(floatingContext.positionForFloat(floatBox));
 }
 
-void InlineFormattingContext::computeStaticPosition(const LayoutContext&, const Box&) const
+void InlineFormattingContext::computeStaticPosition(const LayoutState&, const Box&) const
 {
 }
 
-void InlineFormattingContext::computeInFlowPositionedPosition(const LayoutContext&, const Box&) const
+void InlineFormattingContext::computeInFlowPositionedPosition(const LayoutState&, const Box&) const
 {
 }
 
-FormattingContext::InstrinsicWidthConstraints InlineFormattingContext::instrinsicWidthConstraints(LayoutContext&, const Box&) const
+FormattingContext::InstrinsicWidthConstraints InlineFormattingContext::instrinsicWidthConstraints(LayoutState&, const Box&) const
 {
     return { };
 }
index a4e00b0..429734f 100644 (file)
@@ -45,7 +45,7 @@ class InlineFormattingContext : public FormattingContext {
 public:
     InlineFormattingContext(const Box& formattingContextRoot);
 
-    void layout(LayoutContext&, FormattingState&) const override;
+    void layout(LayoutState&, FormattingState&) const override;
 
 private:
     class Line {
@@ -98,20 +98,20 @@ private:
     // This class implements positioning and sizing for boxes participating in a block formatting context.
     class Geometry : public FormattingContext::Geometry {
     public:
-        static HeightAndMargin inlineBlockHeightAndMargin(const LayoutContext&, const Box&);
-        static WidthAndMargin inlineBlockWidthAndMargin(const LayoutContext&, const Box&);
+        static HeightAndMargin inlineBlockHeightAndMargin(const LayoutState&, const Box&);
+        static WidthAndMargin inlineBlockWidthAndMargin(const LayoutState&, const Box&);
     };
 
-    void layoutInlineContent(const LayoutContext&, InlineFormattingState&, const InlineRunProvider&) const;
-    void initializeNewLine(const LayoutContext&, InlineFormattingState&, Line&) const;
+    void layoutInlineContent(const LayoutState&, InlineFormattingState&, const InlineRunProvider&) const;
+    void initializeNewLine(const LayoutState&, InlineFormattingState&, Line&) const;
 
-    void layoutFormattingContextRoot(LayoutContext&, const Box&) const;
-    void computeWidthAndHeightForInlineBox(LayoutContext&, const Box&) const;
-    void computeFloatPosition(const LayoutContext&, const FloatingContext&, Line&, const Box&) const;
-    void computeStaticPosition(const LayoutContext&, const Box&) const override;
-    void computeInFlowPositionedPosition(const LayoutContext&, const Box&) const override;
+    void layoutFormattingContextRoot(LayoutState&, const Box&) const;
+    void computeWidthAndHeightForInlineBox(LayoutState&, const Box&) const;
+    void computeFloatPosition(const LayoutState&, const FloatingContext&, Line&, const Box&) const;
+    void computeStaticPosition(const LayoutState&, const Box&) const override;
+    void computeInFlowPositionedPosition(const LayoutState&, const Box&) const override;
 
-    InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&) const override;
+    InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutState&, const Box&) const override;
 };
 
 }
index 795c7ee..d385f3d 100644 (file)
 namespace WebCore {
 namespace Layout {
 
-WidthAndMargin InlineFormattingContext::Geometry::inlineBlockWidthAndMargin(const LayoutContext&, const Box&)
+WidthAndMargin InlineFormattingContext::Geometry::inlineBlockWidthAndMargin(const LayoutState&, const Box&)
 {
     return { };
 }
 
-HeightAndMargin InlineFormattingContext::Geometry::inlineBlockHeightAndMargin(const LayoutContext&, const Box&)
+HeightAndMargin InlineFormattingContext::Geometry::inlineBlockHeightAndMargin(const LayoutState&, const Box&)
 {
     return { };
 }
index f0289b8..984bc6c 100644 (file)
@@ -35,8 +35,8 @@ namespace Layout {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(InlineFormattingState);
 
-InlineFormattingState::InlineFormattingState(Ref<FloatingState>&& floatingState, const LayoutContext& layoutContext)
-    : FormattingState(WTFMove(floatingState), Type::Inline, layoutContext)
+InlineFormattingState::InlineFormattingState(Ref<FloatingState>&& floatingState, const LayoutState& layoutState)
+    : FormattingState(WTFMove(floatingState), Type::Inline, layoutState)
 {
 }
 
index 86cc7e3..cfdf406 100644 (file)
@@ -39,7 +39,7 @@ namespace Layout {
 class InlineFormattingState : public FormattingState {
     WTF_MAKE_ISO_ALLOCATED(InlineFormattingState);
 public:
-    InlineFormattingState(Ref<FloatingState>&&, const LayoutContext&);
+    InlineFormattingState(Ref<FloatingState>&&, const LayoutState&);
     virtual ~InlineFormattingState();
 
     InlineContent& inlineContent() { return m_inlineContent; }
index 645b54d..7b56db3 100644 (file)
@@ -31,7 +31,7 @@
 #include "InlineFormattingState.h"
 #include "Invalidation.h"
 #include "LayoutBox.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include <wtf/IsoMallocInlines.h>
 
 namespace WebCore {
@@ -39,9 +39,9 @@ namespace Layout {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(InlineInvalidation);
 
-InvalidationResult InlineInvalidation::invalidate(const Box& layoutBox, StyleDiff, LayoutContext& layoutContext, InlineFormattingState&)
+InvalidationResult InlineInvalidation::invalidate(const Box& layoutBox, StyleDiff, LayoutState& layoutState, InlineFormattingState&)
 {
-    layoutContext.markNeedsUpdate(layoutBox, LayoutContext::UpdateType::All);
+    layoutState.markNeedsUpdate(layoutBox, LayoutState::UpdateType::All);
     return { nullptr };
 }
 
index d755565..5ae8821 100644 (file)
@@ -37,14 +37,14 @@ class Box;
 class Container;
 class InlineFormattingState;
 struct InvalidationResult;
-class LayoutContext;
+class LayoutState;
 enum class StyleDiff;
 
 // This class implements box invalidation for inline formatting context.
 class InlineInvalidation {
     WTF_MAKE_ISO_ALLOCATED(InlineInvalidation);
 public:
-    static InvalidationResult invalidate(const Box&, StyleDiff, LayoutContext&, InlineFormattingState&);
+    static InvalidationResult invalidate(const Box&, StyleDiff, LayoutState&, InlineFormattingState&);
 };
 
 }
index fbb05c3..f9e4247 100644 (file)
@@ -38,8 +38,8 @@ namespace Layout {
 
 WTF_MAKE_ISO_ALLOCATED_IMPL(InlineLineBreaker);
 
-InlineLineBreaker::InlineLineBreaker(const LayoutContext& layoutContext, const InlineContent& inlineContent, const Vector<InlineRunProvider::Run>& inlineRuns)
-    : m_layoutContext(layoutContext)
+InlineLineBreaker::InlineLineBreaker(const LayoutState& layoutState, const InlineContent& inlineContent, const Vector<InlineRunProvider::Run>& inlineRuns)
+    : m_layoutState(layoutState)
     , m_textUtil(inlineContent)
     , m_inlineRuns(inlineRuns)
 {
@@ -147,8 +147,8 @@ LayoutUnit InlineLineBreaker::runWidth(const InlineRunProvider::Run& inlineRun,
 
     ASSERT(inlineRun.isBox() || inlineRun.isFloat());
     auto& layoutBox = inlineRun.inlineItem().layoutBox();
-    ASSERT(m_layoutContext.hasDisplayBox(layoutBox));
-    auto& displayBox = m_layoutContext.displayBoxForLayoutBox(layoutBox);
+    ASSERT(m_layoutState.hasDisplayBox(layoutBox));
+    auto& displayBox = m_layoutState.displayBoxForLayoutBox(layoutBox);
     return displayBox.width();
 }
 
index 153dda8..6f5fc5e 100644 (file)
@@ -37,7 +37,7 @@ namespace Layout {
 class InlineLineBreaker {
     WTF_MAKE_ISO_ALLOCATED(InlineLineBreaker);
 public:
-    InlineLineBreaker(const LayoutContext&, const InlineContent&, const Vector<InlineRunProvider::Run>&);
+    InlineLineBreaker(const LayoutState&, const InlineContent&, const Vector<InlineRunProvider::Run>&);
 
     struct Run {
         enum class Position { Undetermined, LineBegin, LineEnd };
@@ -55,7 +55,7 @@ private:
     LayoutUnit runWidth(const InlineRunProvider::Run&, LayoutUnit contentLogicalLeft) const;
     std::optional<ItemPosition> adjustSplitPositionWithHyphenation(const InlineRunProvider::Run&, ItemPosition splitPosition, LayoutUnit contentLogicalLeft, LayoutUnit availableWidth, bool isLineEmpty) const;
 
-    const LayoutContext& m_layoutContext;
+    const LayoutState& m_layoutState;
     const TextUtil m_textUtil;
     const Vector<InlineRunProvider::Run>& m_inlineRuns;
 
index 9537848..08fb770 100644 (file)
@@ -34,7 +34,7 @@
 #include "LayoutBox.h"
 #include "LayoutChildIterator.h"
 #include "LayoutContainer.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include "LayoutInlineBox.h"
 #include "LayoutInlineContainer.h"
 #include "RenderBlock.h"
@@ -135,9 +135,9 @@ void TreeBuilder::createSubTree(const RenderElement& rootRenderer, Container& ro
 }
 
 #if ENABLE(TREE_DEBUGGING)
-static void outputInlineRuns(TextStream& stream, const LayoutContext& layoutContext, const Container& inlineFormattingRoot, unsigned depth)
+static void outputInlineRuns(TextStream& stream, const LayoutState& layoutState, const Container& inlineFormattingRoot, unsigned depth)
 {
-    auto& inlineFormattingState = layoutContext.establishedFormattingState(inlineFormattingRoot);
+    auto& inlineFormattingState = layoutState.establishedFormattingState(inlineFormattingRoot);
     ASSERT(is<InlineFormattingState>(inlineFormattingState));
     auto& inlineRuns = downcast<InlineFormattingState>(inlineFormattingState).inlineRuns();
 
@@ -190,30 +190,30 @@ static void outputLayoutBox(TextStream& stream, const Box& layoutBox, const Disp
     stream.nextLine();
 }
 
-static void outputLayoutTree(const LayoutContext* layoutContext, TextStream& stream, const Container& rootContainer, unsigned depth)
+static void outputLayoutTree(const LayoutState* layoutState, TextStream& stream, const Container& rootContainer, unsigned depth)
 {
     for (auto& child : childrenOfType<Box>(rootContainer)) {
         Display::Box* displayBox = nullptr;
         // Not all boxes generate display boxes.
-        if (layoutContext && layoutContext->hasDisplayBox(child))
-            displayBox = &layoutContext->displayBoxForLayoutBox(child);
+        if (layoutState && layoutState->hasDisplayBox(child))
+            displayBox = &layoutState->displayBoxForLayoutBox(child);
 
         outputLayoutBox(stream, child, displayBox, depth);
-        if (layoutContext && child.establishesInlineFormattingContext())
-            outputInlineRuns(stream, *layoutContext, downcast<Container>(child), depth + 1);
+        if (layoutState && child.establishesInlineFormattingContext())
+            outputInlineRuns(stream, *layoutState, downcast<Container>(child), depth + 1);
 
         if (is<Container>(child))
-            outputLayoutTree(layoutContext, stream, downcast<Container>(child), depth + 1);
+            outputLayoutTree(layoutState, stream, downcast<Container>(child), depth + 1);
     }
 }
 
-void showLayoutTree(const Box& layoutBox, const LayoutContext* layoutContext)
+void showLayoutTree(const Box& layoutBox, const LayoutState* layoutState)
 {
     TextStream stream(TextStream::LineMode::MultipleLine, TextStream::Formatting::SVGStyleRect);
 
     auto& initialContainingBlock = layoutBox.initialContainingBlock();
-    outputLayoutBox(stream, initialContainingBlock, layoutContext ? &layoutContext->displayBoxForLayoutBox(initialContainingBlock) : nullptr, 0);
-    outputLayoutTree(layoutContext, stream, initialContainingBlock, 1);
+    outputLayoutBox(stream, initialContainingBlock, layoutState ? &layoutState->displayBoxForLayoutBox(initialContainingBlock) : nullptr, 0);
+    outputLayoutTree(layoutState, stream, initialContainingBlock, 1);
     WTFLogAlways("%s", stream.release().utf8().data());
 }
 
index 92d3365..23a72aa 100644 (file)
@@ -36,7 +36,7 @@ namespace Layout {
 
 class Box;
 class Container;
-class LayoutContext;
+class LayoutState;
 
 class TreeBuilder {
 public:
@@ -47,7 +47,7 @@ private:
 };
 
 #if ENABLE(TREE_DEBUGGING)
-void showLayoutTree(const Box&, const LayoutContext*);
+void showLayoutTree(const Box&, const LayoutState*);
 void showLayoutTree(const Box&);
 void printLayoutTreeForLiveDocuments();
 #endif
index b3a8e4a..b67346f 100644 (file)
@@ -42,7 +42,7 @@
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 #include "FormattingState.h"
 #include "LayoutContainer.h"
-#include "LayoutContext.h"
+#include "LayoutFormattingState.h"
 #include "LayoutTreeBuilder.h"
 #endif
 
@@ -56,11 +56,11 @@ namespace WebCore {
 static void layoutUsingFormattingContext(const RenderView& renderView)
 {
     auto initialContainingBlock = Layout::TreeBuilder::createLayoutTree(renderView);
-    auto layoutContext = std::make_unique<Layout::LayoutContext>();
-    layoutContext->initializeRoot(*initialContainingBlock, renderView.size());
-    layoutContext->setInQuirksMode(renderView.document().inQuirksMode());
-    layoutContext->updateLayout();
-    layoutContext->verifyAndOutputMismatchingLayoutTree(renderView);
+    auto layoutState = std::make_unique<Layout::LayoutState>();
+    layoutState->initializeRoot(*initialContainingBlock, renderView.size());
+    layoutState->setInQuirksMode(renderView.document().inQuirksMode());
+    layoutState->updateLayout();
+    layoutState->verifyAndOutputMismatchingLayoutTree(renderView);
 } 
 #endif