Changeset 256417 in webkit
- Timestamp:
- Feb 11, 2020 5:08:08 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 42 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r256414 r256417 1 2020-02-11 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Rename Layout::Container to Layout::ContainerBox 4 https://bugs.webkit.org/show_bug.cgi?id=207585 5 <rdar://problem/59363845> 6 7 Reviewed by Antti Koivisto. 8 9 ContainerBox name is more inline with the rest of the box classes. 10 11 * Sources.txt: 12 * WebCore.xcodeproj/project.pbxproj: 13 * layout/FormattingContext.cpp: 14 (WebCore::Layout::FormattingContext::FormattingContext): 15 (WebCore::Layout::FormattingContext::layoutOutOfFlowContent): 16 (WebCore::Layout::mapHorizontalPositionToAncestor): 17 (WebCore::Layout::FormattingContext::mapTopToFormattingContextRoot const): 18 * layout/FormattingContext.h: 19 (WebCore::Layout::FormattingContext::root const): 20 * layout/FormattingContextGeometry.cpp: 21 (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const): 22 (WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const): 23 (WebCore::Layout::FormattingContext::Geometry::staticHorizontalPositionForOutOfFlowPositioned const): 24 (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth): 25 * layout/LayoutContext.cpp: 26 (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree): 27 (WebCore::Layout::LayoutContext::createFormattingContext): 28 * layout/LayoutContext.h: 29 * layout/LayoutState.cpp: 30 (WebCore::Layout::LayoutState::LayoutState): 31 (WebCore::Layout::LayoutState::establishedFormattingState const): 32 (WebCore::Layout::LayoutState::establishedInlineFormattingState const): 33 (WebCore::Layout::LayoutState::establishedBlockFormattingState const): 34 (WebCore::Layout::LayoutState::establishedTableFormattingState const): 35 (WebCore::Layout::LayoutState::ensureFormattingState): 36 (WebCore::Layout::LayoutState::ensureInlineFormattingState): 37 (WebCore::Layout::LayoutState::ensureBlockFormattingState): 38 (WebCore::Layout::LayoutState::ensureTableFormattingState): 39 * layout/LayoutState.h: 40 (WebCore::Layout::LayoutState::hasInlineFormattingState const): 41 (WebCore::Layout::LayoutState::root const): 42 * layout/Verification.cpp: 43 (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded): 44 (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded): 45 (WebCore::Layout::verifyAndOutputSubtree): 46 * layout/blockformatting/BlockFormattingContext.cpp: 47 (WebCore::Layout::BlockFormattingContext::BlockFormattingContext): 48 (WebCore::Layout::BlockFormattingContext::layoutInFlowContent): 49 (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren): 50 (WebCore::Layout::BlockFormattingContext::computedIntrinsicWidthConstraints): 51 * layout/blockformatting/BlockFormattingContext.h: 52 * layout/blockformatting/BlockFormattingContextGeometry.cpp: 53 (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): 54 (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints): 55 * layout/blockformatting/BlockFormattingContextQuirks.cpp: 56 (WebCore::Layout::initialContainingBlock): 57 * layout/blockformatting/BlockMarginCollapse.cpp: 58 (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore const): 59 (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter const): 60 (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough const): 61 (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore const): 62 (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter const): 63 * layout/displaytree/DisplayPainter.cpp: 64 (WebCore::Display::absoluteDisplayBox): 65 (WebCore::Display::paintSubtree): 66 (WebCore::Display::collectPaintRootsAndContentRect): 67 * layout/floats/FloatAvoider.cpp: 68 * layout/floats/FloatingContext.cpp: 69 (WebCore::Layout::FloatingContext::FloatingContext): 70 (WebCore::Layout::FloatingContext::mapTopToFloatingStateRoot const): 71 (WebCore::Layout::FloatingContext::mapPointFromFormattingContextRootToFloatingStateRoot const): 72 * layout/floats/FloatingContext.h: 73 (WebCore::Layout::FloatingContext::root const): 74 * layout/floats/FloatingState.cpp: 75 (WebCore::Layout::FloatingState::FloatingState): 76 (WebCore::Layout::FloatingState::append): 77 (WebCore::Layout::FloatingState::bottom const): 78 (WebCore::Layout::FloatingState::top const): 79 * layout/floats/FloatingState.h: 80 (WebCore::Layout::FloatingState::create): 81 (WebCore::Layout::FloatingState::root const): 82 (WebCore::Layout::FloatingState::leftBottom const): 83 (WebCore::Layout::FloatingState::rightBottom const): 84 (WebCore::Layout::FloatingState::bottom const): 85 (WebCore::Layout::FloatingState::FloatItem::isDescendantOfFormattingRoot const): 86 * layout/inlineformatting/InlineFormattingContext.cpp: 87 (WebCore::Layout::InlineFormattingContext::InlineFormattingContext): 88 (WebCore::Layout::nextInlineLevelBoxToLayout): 89 (WebCore::Layout::InlineFormattingContext::layoutInFlowContent): 90 (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFormattingRoot): 91 (WebCore::Layout::InlineFormattingContext::collectInlineContentIfNeeded): 92 * layout/inlineformatting/InlineFormattingContext.h: 93 * layout/inlineformatting/InlineFormattingContextGeometry.cpp: 94 (WebCore::Layout::InlineFormattingContext::Geometry::computedTextIndent const): 95 * layout/inlineformatting/InlineFormattingContextQuirks.cpp: 96 (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const): 97 (WebCore::Layout::InlineFormattingContext::Quirks::lineHeightConstraints const): 98 * layout/inlineformatting/InlineLineBuilder.cpp: 99 (WebCore::Layout::LineBuilder::alignContentVertically): 100 (WebCore::Layout::LineBuilder::adjustBaselineAndLineHeight): 101 * layout/inlineformatting/LineLayoutContext.cpp: 102 (WebCore::Layout::LineLayoutContext::LineLayoutContext): 103 * layout/inlineformatting/LineLayoutContext.h: 104 (WebCore::Layout::LineLayoutContext::root const): 105 * layout/integration/LayoutIntegrationBoxTree.h: 106 (WebCore::LayoutIntegration::BoxTree::rootLayoutBox const): 107 (WebCore::LayoutIntegration::BoxTree::rootLayoutBox): 108 * layout/integration/LayoutIntegrationLineLayout.cpp: 109 (WebCore::LayoutIntegration::LineLayout::rootLayoutBox const): 110 (WebCore::LayoutIntegration::LineLayout::rootLayoutBox): 111 * layout/integration/LayoutIntegrationLineLayout.h: 112 * layout/invalidation/InvalidationState.h: 113 * layout/layouttree/LayoutBox.cpp: 114 (WebCore::Layout::Box::establishesInlineFormattingContext const): 115 (WebCore::Layout::Box::containingBlock const): 116 (WebCore::Layout::Box::formattingContextRoot const): 117 (WebCore::Layout::Box::initialContainingBlock const): 118 (WebCore::Layout::Box::isDescendantOf const): 119 (WebCore::Layout::Box::isContainingBlockDescendantOf const): 120 (WebCore::Layout::Box::isOverflowVisible const): 121 * layout/layouttree/LayoutBox.h: 122 (WebCore::Layout::Box::parent const): 123 (WebCore::Layout::Box::isContainerBox const): 124 (WebCore::Layout::Box::setParent): 125 (WebCore::Layout::Box::isContainer const): Deleted. 126 * layout/layouttree/LayoutChildIterator.h: 127 (WebCore::Layout::LayoutChildIterator<T>::LayoutChildIterator): 128 (WebCore::Layout::LayoutChildIteratorAdapter<T>::LayoutChildIteratorAdapter): 129 (WebCore::Layout::childrenOfType): 130 * layout/layouttree/LayoutContainerBox.cpp: Renamed from Source/WebCore/layout/layouttree/LayoutContainer.cpp. 131 (WebCore::Layout::ContainerBox::ContainerBox): 132 (WebCore::Layout::ContainerBox::firstInFlowChild const): 133 (WebCore::Layout::ContainerBox::firstInFlowOrFloatingChild const): 134 (WebCore::Layout::ContainerBox::lastInFlowChild const): 135 (WebCore::Layout::ContainerBox::lastInFlowOrFloatingChild const): 136 (WebCore::Layout::ContainerBox::setFirstChild): 137 (WebCore::Layout::ContainerBox::setLastChild): 138 (WebCore::Layout::ContainerBox::appendChild): 139 * layout/layouttree/LayoutContainerBox.h: Renamed from Source/WebCore/layout/layouttree/LayoutContainer.h. 140 * layout/layouttree/LayoutDescendantIterator.h: 141 (WebCore::Layout::LayoutDescendantIterator<T>::LayoutDescendantIterator): 142 (WebCore::Layout::LayoutDescendantIteratorAdapter<T>::LayoutDescendantIteratorAdapter): 143 (WebCore::Layout::descendantsOfType): 144 * layout/layouttree/LayoutIterator.h: 145 (WebCore::Layout::LayoutBoxTraversal::firstChild): 146 (WebCore::Layout::LayoutBoxTraversal::nextAncestorSibling): 147 (WebCore::Layout::LayoutBoxTraversal::next): 148 (WebCore::Layout::LayoutBoxTraversal::nextSkippingChildren): 149 (WebCore::Layout::Traversal::next): 150 (WebCore::Layout::LayoutIterator<T>::LayoutIterator): 151 * layout/layouttree/LayoutTreeBuilder.cpp: 152 (WebCore::Layout::LayoutTreeContent::LayoutTreeContent): 153 (WebCore::Layout::appendChild): 154 (WebCore::Layout::TreeBuilder::buildLayoutTree): 155 (WebCore::Layout::TreeBuilder::createContainer): 156 (WebCore::Layout::TreeBuilder::createLayoutBox): 157 (WebCore::Layout::TreeBuilder::buildTableStructure): 158 (WebCore::Layout::TreeBuilder::buildSubTree): 159 (WebCore::Layout::outputInlineRuns): 160 (WebCore::Layout::outputLayoutTree): 161 * layout/layouttree/LayoutTreeBuilder.h: 162 (WebCore::Layout::LayoutTreeContent::rootLayoutBox const): 163 (WebCore::Layout::LayoutTreeContent::rootLayoutBox): 164 (WebCore::Layout::LayoutTreeContent::addBox): 165 (WebCore::Layout::LayoutTreeContent::addContainer): 166 * layout/tableformatting/TableFormattingContext.cpp: 167 (WebCore::Layout::TableFormattingContext::TableFormattingContext): 168 (WebCore::Layout::TableFormattingContext::layoutTableCellBox): 169 (WebCore::Layout::TableFormattingContext::ensureTableGrid): 170 (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns): 171 * layout/tableformatting/TableFormattingContext.h: 172 1 173 2020-02-11 Sihui Liu <sihui_liu@apple.com> 2 174 -
trunk/Source/WebCore/Sources.txt
r256380 r256417 1451 1451 layout/invalidation/InvalidationState.cpp 1452 1452 layout/layouttree/LayoutBox.cpp 1453 layout/layouttree/LayoutContainer .cpp1453 layout/layouttree/LayoutContainerBox.cpp 1454 1454 layout/layouttree/LayoutInlineTextBox.cpp 1455 1455 layout/layouttree/LayoutLineBreakBox.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r256380 r256417 394 394 119340971FED715500935F1E /* RenderTreeBuilderFormControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340951FED715500935F1E /* RenderTreeBuilderFormControls.h */; }; 395 395 119340A31FEE024000935F1E /* RenderTreeBuilderBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 119340A11FEE024000935F1E /* RenderTreeBuilderBlock.h */; }; 396 1199FA46208E35A3002358CC /* LayoutContainer .h in Headers */ = {isa = PBXBuildFile; fileRef = 1199FA44208E35A3002358CC /* LayoutContainer.h */; settings = {ATTRIBUTES = (Private, ); }; };396 1199FA46208E35A3002358CC /* LayoutContainerBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 1199FA44208E35A3002358CC /* LayoutContainerBox.h */; settings = {ATTRIBUTES = (Private, ); }; }; 397 397 1199FA5B208E3C7F002358CC /* DisplayBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 1199FA59208E3C7F002358CC /* DisplayBox.h */; settings = {ATTRIBUTES = (Private, ); }; }; 398 398 11CB2789203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 11CB2787203BA570004A1DC9 /* RenderTreeBuilderFullScreen.h */; }; … … 5932 5932 119340A01FEE024000935F1E /* RenderTreeBuilderBlock.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderBlock.cpp; sourceTree = "<group>"; }; 5933 5933 119340A11FEE024000935F1E /* RenderTreeBuilderBlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderTreeBuilderBlock.h; sourceTree = "<group>"; }; 5934 1199FA44208E35A3002358CC /* LayoutContainer .h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutContainer.h; sourceTree = "<group>"; };5935 1199FA45208E35A3002358CC /* LayoutContainer .cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutContainer.cpp; sourceTree = "<group>"; };5934 1199FA44208E35A3002358CC /* LayoutContainerBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutContainerBox.h; sourceTree = "<group>"; }; 5935 1199FA45208E35A3002358CC /* LayoutContainerBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutContainerBox.cpp; sourceTree = "<group>"; }; 5936 5936 1199FA59208E3C7F002358CC /* DisplayBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayBox.h; sourceTree = "<group>"; }; 5937 5937 1199FA5A208E3C7F002358CC /* DisplayBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayBox.cpp; sourceTree = "<group>"; }; … … 16730 16730 115CFA95208B952B001E6991 /* LayoutBox.h */, 16731 16731 11100FC920927CBC0081AA6C /* LayoutChildIterator.h */, 16732 1199FA45208E35A3002358CC /* LayoutContainer .cpp */,16733 1199FA44208E35A3002358CC /* LayoutContainer .h */,16732 1199FA45208E35A3002358CC /* LayoutContainerBox.cpp */, 16733 1199FA44208E35A3002358CC /* LayoutContainerBox.h */, 16734 16734 11B042FB20B0E21400828A6B /* LayoutDescendantIterator.h */, 16735 16735 6F0B98B623F2690600EEC2F2 /* LayoutInlineTextBox.cpp */, … … 31279 31279 115CFA97208B952B001E6991 /* LayoutBox.h in Headers */, 31280 31280 11310CF620BA4A560065A8D0 /* LayoutChildIterator.h in Headers */, 31281 1199FA46208E35A3002358CC /* LayoutContainer .h in Headers */,31281 1199FA46208E35A3002358CC /* LayoutContainerBox.h in Headers */, 31282 31282 6F26BB6C23343E6F002F2BEA /* LayoutContext.h in Headers */, 31283 31283 11310CF520BA4A4C0065A8D0 /* LayoutDescendantIterator.h in Headers */, -
trunk/Source/WebCore/layout/FormattingContext.cpp
r256380 r256417 33 33 #include "InvalidationState.h" 34 34 #include "LayoutBox.h" 35 #include "LayoutContainer .h"35 #include "LayoutContainerBox.h" 36 36 #include "LayoutContext.h" 37 37 #include "LayoutDescendantIterator.h" … … 47 47 WTF_MAKE_ISO_ALLOCATED_IMPL(FormattingContext); 48 48 49 FormattingContext::FormattingContext(const Container & formattingContextRoot, FormattingState& formattingState)49 FormattingContext::FormattingContext(const ContainerBox& formattingContextRoot, FormattingState& formattingState) 50 50 : m_root(makeWeakPtr(formattingContextRoot)) 51 51 , m_formattingState(formattingState) … … 166 166 computeBorderAndPadding(*outOfFlowBox, Geometry::horizontalConstraintsForInFlow(outOfFlowRootDisplayBox)); 167 167 computeOutOfFlowHorizontalGeometry(*outOfFlowBox, horizontalConstraints); 168 if (!is<Container >(*outOfFlowBox) || !downcast<Container>(*outOfFlowBox).hasChild()) {168 if (!is<ContainerBox>(*outOfFlowBox) || !downcast<ContainerBox>(*outOfFlowBox).hasChild()) { 169 169 computeOutOfFlowVerticalGeometry(*outOfFlowBox, horizontalConstraints, verticalConstraints); 170 170 continue; 171 171 } 172 172 173 auto& outOfFlowRootContainer = downcast<Container >(*outOfFlowBox);173 auto& outOfFlowRootContainer = downcast<ContainerBox>(*outOfFlowBox); 174 174 auto formattingContext = LayoutContext::createFormattingContext(outOfFlowRootContainer, layoutState()); 175 175 if (outOfFlowRootContainer.hasInFlowOrFloatingChild()) … … 181 181 } 182 182 183 static LayoutUnit mapHorizontalPositionToAncestor(const FormattingContext& formattingContext, LayoutUnit horizontalPosition, const Container & containingBlock, const Container& ancestor)183 static LayoutUnit mapHorizontalPositionToAncestor(const FormattingContext& formattingContext, LayoutUnit horizontalPosition, const ContainerBox& containingBlock, const ContainerBox& ancestor) 184 184 { 185 185 // "horizontalPosition" is in the coordinate system of the "containingBlock". -> map from containingBlock to ancestor. … … 187 187 return horizontalPosition; 188 188 ASSERT(containingBlock.isContainingBlockDescendantOf(ancestor)); 189 for (auto* container = &containingBlock; container && container != &ancestor; container = container->containingBlock())190 horizontalPosition += formattingContext.geometryForBox(*container ).left();189 for (auto* containerBox = &containingBlock; containerBox && containerBox != &ancestor; containerBox = containerBox->containingBlock()) 190 horizontalPosition += formattingContext.geometryForBox(*containerBox).left(); 191 191 return horizontalPosition; 192 192 } … … 199 199 ASSERT(layoutBox.isContainingBlockDescendantOf(formattingContextRoot)); 200 200 auto top = geometryForBox(layoutBox).top(); 201 for (auto* container = layoutBox.containingBlock(); container && container != &formattingContextRoot; container = container->containingBlock())202 top += geometryForBox(*container ).top();201 for (auto* containerBox = layoutBox.containingBlock(); containerBox && containerBox != &formattingContextRoot; containerBox = containerBox->containingBlock()) 202 top += geometryForBox(*containerBox).top(); 203 203 return top; 204 204 } -
trunk/Source/WebCore/layout/FormattingContext.h
r256380 r256417 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "LayoutContainer .h"30 #include "LayoutContainerBox.h" 31 31 #include "LayoutUnit.h" 32 32 #include "LayoutUnits.h" … … 48 48 struct ComputedHorizontalMargin; 49 49 struct ComputedVerticalMargin; 50 class Container ;50 class ContainerBox; 51 51 struct ContentHeightAndMargin; 52 52 struct ContentWidthAndMargin; … … 63 63 WTF_MAKE_ISO_ALLOCATED(FormattingContext); 64 64 public: 65 FormattingContext(const Container & formattingContextRoot, FormattingState&);65 FormattingContext(const ContainerBox& formattingContextRoot, FormattingState&); 66 66 virtual ~FormattingContext(); 67 67 … … 100 100 using LayoutQueue = Vector<const Box*>; 101 101 102 const Container & root() const { return *m_root; }102 const ContainerBox& root() const { return *m_root; } 103 103 LayoutState& layoutState() const; 104 104 const FormattingState& formattingState() const { return m_formattingState; } … … 205 205 void computeOutOfFlowHorizontalGeometry(const Box&, const HorizontalConstraints&); 206 206 207 WeakPtr<const Container > m_root;207 WeakPtr<const ContainerBox> m_root; 208 208 FormattingState& m_formattingState; 209 209 }; -
trunk/Source/WebCore/layout/FormattingContextGeometry.cpp
r256380 r256417 123 123 // then the height is increased to include those edges. Only floats that participate in this block formatting context are taken 124 124 // into account, e.g., floats inside absolutely positioned descendants or other floats are not. 125 if (!is<Container >(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild())125 if (!is<ContainerBox>(layoutBox) || !downcast<ContainerBox>(layoutBox).hasInFlowOrFloatingChild()) 126 126 return { }; 127 127 … … 132 132 auto top = borderAndPaddingTop; 133 133 auto bottom = borderAndPaddingTop; 134 auto& formattingRootContainer = downcast<Container >(layoutBox);134 auto& formattingRootContainer = downcast<ContainerBox>(layoutBox); 135 135 if (formattingRootContainer.establishesInlineFormattingContext()) { 136 136 auto& lineBoxes = layoutState.establishedInlineFormattingState(formattingRootContainer).displayInlineContent()->lineBoxes; … … 240 240 auto& containingBlock = *layoutBox.containingBlock(); 241 241 // Start with the parent since we pretend that this box is normal flow. 242 for (auto* container = layoutBox.parent(); container != &containingBlock; container = container->containingBlock()) {243 auto& boxGeometry = formattingContext.geometryForBox(*container , EscapeReason::OutOfFlowBoxNeedsInFlowGeometry);242 for (auto* containerBox = layoutBox.parent(); containerBox != &containingBlock; containerBox = containerBox->containingBlock()) { 243 auto& boxGeometry = formattingContext.geometryForBox(*containerBox, EscapeReason::OutOfFlowBoxNeedsInFlowGeometry); 244 244 // Display::Box::top is the border box top position in its containing block's coordinate system. 245 245 top += boxGeometry.top(); 246 ASSERT(!container ->isPositioned() || layoutBox.isFixedPositioned());246 ASSERT(!containerBox->isPositioned() || layoutBox.isFixedPositioned()); 247 247 } 248 248 // Move the static position relative to the padding box. This is very specific to abolutely positioned boxes. … … 263 263 auto& containingBlock = *layoutBox.containingBlock(); 264 264 // Start with the parent since we pretend that this box is normal flow. 265 for (auto* container = layoutBox.parent(); container != &containingBlock; container = container->containingBlock()) {266 auto& boxGeometry = formattingContext.geometryForBox(*container , EscapeReason::OutOfFlowBoxNeedsInFlowGeometry);265 for (auto* containerBox = layoutBox.parent(); containerBox != &containingBlock; containerBox = containerBox->containingBlock()) { 266 auto& boxGeometry = formattingContext.geometryForBox(*containerBox, EscapeReason::OutOfFlowBoxNeedsInFlowGeometry); 267 267 // Display::Box::left is the border box left position in its containing block's coordinate system. 268 268 left += boxGeometry.left(); 269 ASSERT(!container ->isPositioned() || layoutBox.isFixedPositioned());269 ASSERT(!containerBox->isPositioned() || layoutBox.isFixedPositioned()); 270 270 } 271 271 // Move the static position relative to the padding box. This is very specific to abolutely positioned boxes. … … 286 286 // Then the shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width). 287 287 auto intrinsicWidthConstraints = IntrinsicWidthConstraints { }; 288 if (is<Container >(formattingRoot) && downcast<Container>(formattingRoot).hasInFlowOrFloatingChild()) {289 auto& root = downcast<Container >(formattingRoot);288 if (is<ContainerBox>(formattingRoot) && downcast<ContainerBox>(formattingRoot).hasInFlowOrFloatingChild()) { 289 auto& root = downcast<ContainerBox>(formattingRoot); 290 290 auto& formattingStateForRoot = layoutState().ensureFormattingState(root); 291 291 auto precomputedIntrinsicWidthConstraints = formattingStateForRoot.intrinsicWidthConstraints(); -
trunk/Source/WebCore/layout/LayoutContext.cpp
r256098 r256417 38 38 #include "InvalidationState.h" 39 39 #include "LayoutBox.h" 40 #include "LayoutContainer .h"40 #include "LayoutContainerBox.h" 41 41 #include "LayoutPhase.h" 42 42 #include "LayoutTreeBuilder.h" … … 90 90 } 91 91 92 void LayoutContext::layoutFormattingContextSubtree(const Container & formattingContextRoot, InvalidationState& invalidationState)92 void LayoutContext::layoutFormattingContextSubtree(const ContainerBox& formattingContextRoot, InvalidationState& invalidationState) 93 93 { 94 94 RELEASE_ASSERT(formattingContextRoot.establishesFormattingContext()); … … 110 110 } 111 111 112 std::unique_ptr<FormattingContext> LayoutContext::createFormattingContext(const Container & formattingContextRoot, LayoutState& layoutState)112 std::unique_ptr<FormattingContext> LayoutContext::createFormattingContext(const ContainerBox& formattingContextRoot, LayoutState& layoutState) 113 113 { 114 114 ASSERT(formattingContextRoot.establishesFormattingContext()); -
trunk/Source/WebCore/layout/LayoutContext.h
r254797 r256417 40 40 namespace Layout { 41 41 42 class Container ;42 class ContainerBox; 43 43 class InvalidationState; 44 44 class LayoutState; … … 58 58 void layoutWithPreparedRootGeometry(InvalidationState&); 59 59 60 static std::unique_ptr<FormattingContext> createFormattingContext(const Container & formattingContextRoot, LayoutState&);60 static std::unique_ptr<FormattingContext> createFormattingContext(const ContainerBox& formattingContextRoot, LayoutState&); 61 61 62 62 // FIXME: This is temporary. … … 68 68 69 69 private: 70 void layoutFormattingContextSubtree(const Container &, InvalidationState&);70 void layoutFormattingContextSubtree(const ContainerBox&, InvalidationState&); 71 71 LayoutState& layoutState() { return m_layoutState; } 72 72 -
trunk/Source/WebCore/layout/LayoutState.cpp
r254875 r256417 34 34 #include "InlineFormattingState.h" 35 35 #include "LayoutBox.h" 36 #include "LayoutContainer .h"36 #include "LayoutContainerBox.h" 37 37 #include "RenderBox.h" 38 38 #include "RuntimeEnabledFeatures.h" … … 45 45 WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutState); 46 46 47 LayoutState::LayoutState(const Document& document, const Container & rootContainer)47 LayoutState::LayoutState(const Document& document, const ContainerBox& rootContainer) 48 48 : m_rootContainer(makeWeakPtr(rootContainer)) 49 49 { … … 88 88 } 89 89 90 FormattingState& LayoutState::establishedFormattingState(const Container & formattingContextRoot) const90 FormattingState& LayoutState::establishedFormattingState(const ContainerBox& formattingContextRoot) const 91 91 { 92 92 if (RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled()) { … … 105 105 } 106 106 107 InlineFormattingState& LayoutState::establishedInlineFormattingState(const Container & formattingContextRoot) const107 InlineFormattingState& LayoutState::establishedInlineFormattingState(const ContainerBox& formattingContextRoot) const 108 108 { 109 109 ASSERT(formattingContextRoot.establishesInlineFormattingContext()); … … 117 117 } 118 118 119 BlockFormattingState& LayoutState::establishedBlockFormattingState(const Container & formattingContextRoot) const119 BlockFormattingState& LayoutState::establishedBlockFormattingState(const ContainerBox& formattingContextRoot) const 120 120 { 121 121 ASSERT(formattingContextRoot.establishesBlockFormattingContext()); … … 123 123 } 124 124 125 TableFormattingState& LayoutState::establishedTableFormattingState(const Container & formattingContextRoot) const125 TableFormattingState& LayoutState::establishedTableFormattingState(const ContainerBox& formattingContextRoot) const 126 126 { 127 127 ASSERT(formattingContextRoot.establishesTableFormattingContext()); … … 129 129 } 130 130 131 FormattingState& LayoutState::ensureFormattingState(const Container & formattingContextRoot)131 FormattingState& LayoutState::ensureFormattingState(const ContainerBox& formattingContextRoot) 132 132 { 133 133 if (formattingContextRoot.establishesInlineFormattingContext()) … … 140 140 } 141 141 142 InlineFormattingState& LayoutState::ensureInlineFormattingState(const Container & formattingContextRoot)142 InlineFormattingState& LayoutState::ensureInlineFormattingState(const ContainerBox& formattingContextRoot) 143 143 { 144 144 ASSERT(formattingContextRoot.establishesInlineFormattingContext()); … … 169 169 } 170 170 171 BlockFormattingState& LayoutState::ensureBlockFormattingState(const Container & formattingContextRoot)171 BlockFormattingState& LayoutState::ensureBlockFormattingState(const ContainerBox& formattingContextRoot) 172 172 { 173 173 ASSERT(formattingContextRoot.establishesBlockFormattingContext()); … … 180 180 } 181 181 182 TableFormattingState& LayoutState::ensureTableFormattingState(const Container & formattingContextRoot)182 TableFormattingState& LayoutState::ensureTableFormattingState(const ContainerBox& formattingContextRoot) 183 183 { 184 184 ASSERT(formattingContextRoot.establishesTableFormattingContext()); -
trunk/Source/WebCore/layout/LayoutState.h
r254875 r256417 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "LayoutContainer .h"30 #include "LayoutContainerBox.h" 31 31 #include <wtf/HashMap.h> 32 32 #include <wtf/HashSet.h> … … 51 51 WTF_MAKE_ISO_ALLOCATED(LayoutState); 52 52 public: 53 LayoutState(const Document&, const Container & rootContainer);53 LayoutState(const Document&, const ContainerBox& rootContainer); 54 54 ~LayoutState(); 55 55 56 FormattingState& ensureFormattingState(const Container & formattingContextRoot);57 InlineFormattingState& ensureInlineFormattingState(const Container & formattingContextRoot);58 BlockFormattingState& ensureBlockFormattingState(const Container & formattingContextRoot);59 TableFormattingState& ensureTableFormattingState(const Container & formattingContextRoot);56 FormattingState& ensureFormattingState(const ContainerBox& formattingContextRoot); 57 InlineFormattingState& ensureInlineFormattingState(const ContainerBox& formattingContextRoot); 58 BlockFormattingState& ensureBlockFormattingState(const ContainerBox& formattingContextRoot); 59 TableFormattingState& ensureTableFormattingState(const ContainerBox& formattingContextRoot); 60 60 61 FormattingState& establishedFormattingState(const Container & formattingRoot) const;62 InlineFormattingState& establishedInlineFormattingState(const Container & formattingContextRoot) const;63 BlockFormattingState& establishedBlockFormattingState(const Container & formattingContextRoot) const;64 TableFormattingState& establishedTableFormattingState(const Container & formattingContextRoot) const;61 FormattingState& establishedFormattingState(const ContainerBox& formattingRoot) const; 62 InlineFormattingState& establishedInlineFormattingState(const ContainerBox& formattingContextRoot) const; 63 BlockFormattingState& establishedBlockFormattingState(const ContainerBox& formattingContextRoot) const; 64 TableFormattingState& establishedTableFormattingState(const ContainerBox& formattingContextRoot) const; 65 65 66 66 FormattingState& formattingStateForBox(const Box&) const; 67 bool hasInlineFormattingState(const Container & formattingRoot) const { return m_inlineFormattingStates.contains(&formattingRoot); }67 bool hasInlineFormattingState(const ContainerBox& formattingRoot) const { return m_inlineFormattingStates.contains(&formattingRoot); } 68 68 69 69 #ifndef NDEBUG … … 83 83 bool inNoQuirksMode() const { return m_quirksMode == QuirksMode::No; } 84 84 85 const Container & root() const { return *m_rootContainer; }85 const ContainerBox& root() const { return *m_rootContainer; } 86 86 87 87 // LFC integration only. Full LFC has proper ICB access. … … 95 95 Display::Box& ensureDisplayBoxForLayoutBoxSlow(const Box&); 96 96 97 HashMap<const Container *, std::unique_ptr<InlineFormattingState>> m_inlineFormattingStates;98 HashMap<const Container *, std::unique_ptr<BlockFormattingState>> m_blockFormattingStates;99 HashMap<const Container *, std::unique_ptr<TableFormattingState>> m_tableFormattingStates;97 HashMap<const ContainerBox*, std::unique_ptr<InlineFormattingState>> m_inlineFormattingStates; 98 HashMap<const ContainerBox*, std::unique_ptr<BlockFormattingState>> m_blockFormattingStates; 99 HashMap<const ContainerBox*, std::unique_ptr<TableFormattingState>> m_tableFormattingStates; 100 100 101 101 std::unique_ptr<InlineFormattingState> m_rootInlineFormattingStateForIntegration; … … 107 107 QuirksMode m_quirksMode { QuirksMode::No }; 108 108 109 WeakPtr<const Container > m_rootContainer;109 WeakPtr<const ContainerBox> m_rootContainer; 110 110 111 111 // LFC integration only. -
trunk/Source/WebCore/layout/Verification.cpp
r256304 r256417 34 34 #include "InlineTextBox.h" 35 35 #include "LayoutBox.h" 36 #include "LayoutContainer .h"36 #include "LayoutContainerBox.h" 37 37 #include "LayoutContext.h" 38 38 #include "LayoutTreeBuilder.h" … … 68 68 } 69 69 70 static bool outputMismatchingSimpleLineInformationIfNeeded(TextStream& stream, const LayoutState& layoutState, const RenderBlockFlow& blockFlow, const Container & inlineFormattingRoot)70 static bool outputMismatchingSimpleLineInformationIfNeeded(TextStream& stream, const LayoutState& layoutState, const RenderBlockFlow& blockFlow, const ContainerBox& inlineFormattingRoot) 71 71 { 72 72 auto* lineLayoutData = blockFlow.simpleLineLayout(); … … 160 160 } 161 161 162 static bool outputMismatchingComplexLineInformationIfNeeded(TextStream& stream, const LayoutState& layoutState, const RenderBlockFlow& blockFlow, const Container & inlineFormattingRoot)162 static bool outputMismatchingComplexLineInformationIfNeeded(TextStream& stream, const LayoutState& layoutState, const RenderBlockFlow& blockFlow, const ContainerBox& inlineFormattingRoot) 163 163 { 164 164 auto& inlineFormattingState = layoutState.establishedFormattingState(inlineFormattingRoot); … … 291 291 // Rendering code does not have the concept of table wrapper box. Skip it by verifying the first child(table box) instead. 292 292 if (layoutBox.isTableWrapperBox()) 293 return verifyAndOutputSubtree(stream, context, renderer, *downcast<Container >(layoutBox).firstChild());293 return verifyAndOutputSubtree(stream, context, renderer, *downcast<ContainerBox>(layoutBox).firstChild()); 294 294 295 295 auto mismtachingGeometry = outputMismatchingBlockBoxInformationIfNeeded(stream, context, renderer, layoutBox); 296 296 297 if (!is<Container >(layoutBox))297 if (!is<ContainerBox>(layoutBox)) 298 298 return mismtachingGeometry; 299 299 300 auto& container = downcast<Container>(layoutBox);301 auto* childLayoutBox = container .firstChild();300 auto& containerBox = downcast<ContainerBox>(layoutBox); 301 auto* childLayoutBox = containerBox.firstChild(); 302 302 auto* childRenderer = renderer.firstChild(); 303 303 … … 321 321 322 322 auto& blockFlow = downcast<RenderBlockFlow>(*childRenderer); 323 auto& formattingRoot = downcast<Container >(*childLayoutBox);323 auto& formattingRoot = downcast<ContainerBox>(*childLayoutBox); 324 324 mismtachingGeometry |= blockFlow.lineLayoutPath() == RenderBlockFlow::SimpleLinesPath ? outputMismatchingSimpleLineInformationIfNeeded(stream, context, blockFlow, formattingRoot) : outputMismatchingComplexLineInformationIfNeeded(stream, context, blockFlow, formattingRoot); 325 325 } else { -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
r256106 r256417 35 35 #include "LayoutBox.h" 36 36 #include "LayoutChildIterator.h" 37 #include "LayoutContainer .h"37 #include "LayoutContainerBox.h" 38 38 #include "LayoutContext.h" 39 39 #include "LayoutState.h" … … 47 47 WTF_MAKE_ISO_ALLOCATED_IMPL(BlockFormattingContext); 48 48 49 BlockFormattingContext::BlockFormattingContext(const Container & formattingContextRoot, BlockFormattingState& formattingState)49 BlockFormattingContext::BlockFormattingContext(const ContainerBox& formattingContextRoot, BlockFormattingState& formattingState) 50 50 : FormattingContext(formattingContextRoot, formattingState) 51 51 { … … 67 67 auto appendNextToLayoutQueue = [&] (const auto& layoutBox, auto direction) { 68 68 if (direction == LayoutDirection::Child) { 69 if (!is<Container >(layoutBox))69 if (!is<ContainerBox>(layoutBox)) 70 70 return false; 71 for (auto* child = downcast<Container >(layoutBox).firstInFlowOrFloatingChild(); child; child = child->nextInFlowOrFloatingSibling()) {71 for (auto* child = downcast<ContainerBox>(layoutBox).firstInFlowOrFloatingChild(); child; child = child->nextInFlowOrFloatingSibling()) { 72 72 if (!invalidationState.needsLayout(*child)) 73 73 continue; … … 126 126 127 127 if (layoutBox.establishesFormattingContext()) { 128 if (is<Container >(layoutBox) && downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) {128 if (is<ContainerBox>(layoutBox) && downcast<ContainerBox>(layoutBox).hasInFlowOrFloatingChild()) { 129 129 // Layout the inflow descendants of this formatting context root. 130 130 precomputeVerticalPositionForFormattingRoot(floatingContext, layoutBox, horizontalConstraints, verticalConstraints); … … 132 132 auto horizontalConstraintsForFormattingContext = Geometry::horizontalConstraintsForInFlow(rootDisplayBox); 133 133 auto verticalConstraintsForFormattingContext = Geometry::verticalConstraintsForInFlow(rootDisplayBox); 134 LayoutContext::createFormattingContext(downcast<Container >(layoutBox), layoutState())->layoutInFlowContent(invalidationState, horizontalConstraintsForFormattingContext, verticalConstraintsForFormattingContext);134 LayoutContext::createFormattingContext(downcast<ContainerBox>(layoutBox), layoutState())->layoutInFlowContent(invalidationState, horizontalConstraintsForFormattingContext, verticalConstraintsForFormattingContext); 135 135 } 136 136 break; … … 151 151 if (layoutBox.establishesFormattingContext()) { 152 152 // Now that we computed the root's height, we can layout the out-of-flow descendants. 153 if (is<Container >(layoutBox) && downcast<Container>(layoutBox).hasChild()) {153 if (is<ContainerBox>(layoutBox) && downcast<ContainerBox>(layoutBox).hasChild()) { 154 154 auto& rootDisplayBox = geometryForBox(layoutBox); 155 155 auto horizontalConstraintsForOutOfFlow = Geometry::horizontalConstraintsForOutOfFlow(rootDisplayBox); 156 156 auto verticalConstraintsForOutOfFlow = Geometry::verticalConstraintsForOutOfFlow(rootDisplayBox); 157 LayoutContext::createFormattingContext(downcast<Container >(layoutBox), layoutState())->layoutOutOfFlowContent(invalidationState, horizontalConstraintsForOutOfFlow, verticalConstraintsForOutOfFlow);157 LayoutContext::createFormattingContext(downcast<ContainerBox>(layoutBox), layoutState())->layoutOutOfFlowContent(invalidationState, horizontalConstraintsForOutOfFlow, verticalConstraintsForOutOfFlow); 158 158 } 159 159 } … … 213 213 void BlockFormattingContext::placeInFlowPositionedChildren(const Box& layoutBox, const ConstraintsPair<HorizontalConstraints>& horizontalConstraints) 214 214 { 215 if (!is<Container >(layoutBox))215 if (!is<ContainerBox>(layoutBox)) 216 216 return; 217 217 LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: move in-flow positioned children -> parent: " << &layoutBox); 218 auto& container = downcast<Container>(layoutBox);219 for (auto& childBox : childrenOfType<Box>(container )) {218 auto& containerBox = downcast<ContainerBox>(layoutBox); 219 for (auto& childBox : childrenOfType<Box>(containerBox)) { 220 220 if (!childBox.isInFlowPositioned()) 221 221 continue; … … 456 456 while (true) { 457 457 auto& layoutBox = *queue.last(); 458 auto hasInFlowOrFloatingChild = is<Container >(layoutBox) && downcast<Container>(layoutBox).hasInFlowOrFloatingChild();458 auto hasInFlowOrFloatingChild = is<ContainerBox>(layoutBox) && downcast<ContainerBox>(layoutBox).hasInFlowOrFloatingChild(); 459 459 auto skipDescendants = formattingState.intrinsicWidthConstraintsForBox(layoutBox) || !hasInFlowOrFloatingChild || layoutBox.establishesFormattingContext() || layoutBox.style().width().isFixed(); 460 460 if (skipDescendants) 461 461 break; 462 queue.append(downcast<Container >(layoutBox).firstInFlowOrFloatingChild());462 queue.append(downcast<ContainerBox>(layoutBox).firstInFlowOrFloatingChild()); 463 463 } 464 464 // Compute min/max intrinsic width bottom up if needed. -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h
r256380 r256417 47 47 WTF_MAKE_ISO_ALLOCATED(BlockFormattingContext); 48 48 public: 49 BlockFormattingContext(const Container & formattingContextRoot, BlockFormattingState&);49 BlockFormattingContext(const ContainerBox& formattingContextRoot, BlockFormattingState&); 50 50 51 51 void layoutInFlowContent(InvalidationState&, const HorizontalConstraints&, const VerticalConstraints&) override; -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
r256380 r256417 71 71 return { *height, nonCollapsedMargin }; 72 72 73 if (!is<Container >(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())73 if (!is<ContainerBox>(layoutBox) || !downcast<ContainerBox>(layoutBox).hasInFlowChild()) 74 74 return { 0, nonCollapsedMargin }; 75 75 76 76 // 1. the bottom edge of the last line box, if the box establishes a inline formatting context with one or more lines 77 auto& layoutContainer = downcast<Container >(layoutBox);77 auto& layoutContainer = downcast<ContainerBox>(layoutBox); 78 78 if (layoutContainer.establishesInlineFormattingContext()) { 79 79 auto& lineBoxes = layoutState().establishedInlineFormattingState(layoutContainer).displayInlineContent()->lineBoxes; … … 322 322 } 323 323 324 if (!is<Container >(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild())324 if (!is<ContainerBox>(layoutBox) || !downcast<ContainerBox>(layoutBox).hasInFlowOrFloatingChild()) 325 325 return { }; 326 326 327 327 if (layoutBox.establishesFormattingContext()) 328 return LayoutContext::createFormattingContext(downcast<Container >(layoutBox), layoutState())->computedIntrinsicWidthConstraints();328 return LayoutContext::createFormattingContext(downcast<ContainerBox>(layoutBox), layoutState())->computedIntrinsicWidthConstraints(); 329 329 330 330 auto intrinsicWidthConstraints = IntrinsicWidthConstraints { }; 331 331 auto& formattingState = layoutState().formattingStateForBox(layoutBox); 332 for (auto& child : childrenOfType<Box>(downcast<Container >(layoutBox))) {332 for (auto& child : childrenOfType<Box>(downcast<ContainerBox>(layoutBox))) { 333 333 if (child.isOutOfFlowPositioned()) 334 334 continue; -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp
r254666 r256417 32 32 #include "DisplayBox.h" 33 33 #include "LayoutBox.h" 34 #include "LayoutContainer .h"34 #include "LayoutContainerBox.h" 35 35 #include "LayoutState.h" 36 36 … … 38 38 namespace Layout { 39 39 40 static const Container & initialContainingBlock(const Box& layoutBox)40 static const ContainerBox& initialContainingBlock(const Box& layoutBox) 41 41 { 42 42 auto* containingBlock = layoutBox.containingBlock(); -
trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp
r256380 r256417 33 33 #include "InlineFormattingState.h" 34 34 #include "LayoutBox.h" 35 #include "LayoutContainer .h"35 #include "LayoutContainerBox.h" 36 36 #include "LayoutUnit.h" 37 37 #include "RenderStyle.h" … … 196 196 return false; 197 197 198 if (!is<Container >(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())199 return false; 200 201 auto& firstInFlowChild = *downcast<Container >(layoutBox).firstInFlowChild();198 if (!is<ContainerBox>(layoutBox) || !downcast<ContainerBox>(layoutBox).hasInFlowChild()) 199 return false; 200 201 auto& firstInFlowChild = *downcast<ContainerBox>(layoutBox).firstInFlowChild(); 202 202 if (!firstInFlowChild.isBlockLevelBox()) 203 203 return false; … … 305 305 return false; 306 306 307 if (!is<Container >(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())308 return false; 309 310 auto& lastInFlowChild = *downcast<Container >(layoutBox).lastInFlowChild();307 if (!is<ContainerBox>(layoutBox) || !downcast<ContainerBox>(layoutBox).hasInFlowChild()) 308 return false; 309 310 auto& lastInFlowChild = *downcast<ContainerBox>(layoutBox).lastInFlowChild(); 311 311 if (!lastInFlowChild.isBlockLevelBox()) 312 312 return false; … … 381 381 return false; 382 382 383 if (!is<Container >(layoutBox))383 if (!is<ContainerBox>(layoutBox)) 384 384 return true; 385 385 386 if (!downcast<Container >(layoutBox).hasInFlowChild())386 if (!downcast<ContainerBox>(layoutBox).hasInFlowChild()) 387 387 return !establishesBlockFormattingContext(layoutBox); 388 388 … … 392 392 // If we get here through margin estimation, we don't necessarily have an actual state for this layout box since 393 393 // we haven't started laying it out yet. 394 auto& layoutContainer = downcast<Container>(layoutBox);395 if (!layoutState.hasInlineFormattingState( layoutContainer))394 auto& containerBox = downcast<ContainerBox>(layoutBox); 395 if (!layoutState.hasInlineFormattingState(containerBox)) 396 396 return false; 397 397 398 398 auto isConsideredEmpty = [&] { 399 auto& formattingState = layoutState.establishedInlineFormattingState( layoutContainer);399 auto& formattingState = layoutState.establishedInlineFormattingState(containerBox); 400 400 if (auto* inlineContent = formattingState.displayInlineContent()) { 401 401 for (auto& lineBox : inlineContent->lineBoxes) { … … 407 407 auto& floats = formattingState.floatingState().floats(); 408 408 for (auto& floatItem : floats) { 409 if (floatItem.isDescendantOfFormattingRoot( layoutContainer))409 if (floatItem.isDescendantOfFormattingRoot(containerBox)) 410 410 return false; 411 411 } … … 419 419 } 420 420 421 for (auto* inflowChild = downcast<Container >(layoutBox).firstInFlowOrFloatingChild(); inflowChild; inflowChild = inflowChild->nextInFlowOrFloatingSibling()) {421 for (auto* inflowChild = downcast<ContainerBox>(layoutBox).firstInFlowOrFloatingChild(); inflowChild; inflowChild = inflowChild->nextInFlowOrFloatingSibling()) { 422 422 if (establishesBlockFormattingContext(*inflowChild)) 423 423 return false; … … 528 528 if (!marginBeforeCollapsesWithFirstInFlowChildMarginBefore(layoutBox)) 529 529 return { }; 530 return positiveNegativeValues(*downcast<Container >(layoutBox).firstInFlowChild(), MarginType::Before);530 return positiveNegativeValues(*downcast<ContainerBox>(layoutBox).firstInFlowChild(), MarginType::Before); 531 531 }; 532 532 … … 558 558 if (!marginAfterCollapsesWithLastInFlowChildMarginAfter(layoutBox)) 559 559 return { }; 560 return positiveNegativeValues(*downcast<Container >(layoutBox).lastInFlowChild(), MarginType::After);560 return positiveNegativeValues(*downcast<ContainerBox>(layoutBox).lastInFlowChild(), MarginType::After); 561 561 }; 562 562 -
trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp
r255257 r256417 36 36 #include "InlineTextItem.h" 37 37 #include "IntRect.h" 38 #include "LayoutContainer .h"38 #include "LayoutContainerBox.h" 39 39 #include "LayoutDescendantIterator.h" 40 40 #include "LayoutState.h" … … 153 153 154 154 auto absoluteBox = Box { layoutState.displayBoxForLayoutBox(layoutBox) }; 155 for (auto* container = layoutBox.containingBlock(); container != &layoutBox.initialContainingBlock(); container = container->containingBlock())156 absoluteBox.moveBy(layoutState.displayBoxForLayoutBox(*container ).topLeft());155 for (auto* containerBox = layoutBox.containingBlock(); containerBox != &layoutBox.initialContainingBlock(); containerBox = containerBox->containingBlock()) 156 absoluteBox.moveBy(layoutState.displayBoxForLayoutBox(*containerBox).topLeft()); 157 157 return absoluteBox; 158 158 } … … 183 183 // Only inline content for now. 184 184 if (layoutBox.establishesInlineFormattingContext()) { 185 auto& container = downcast<Layout::Container>(layoutBox);186 paintInlineContent(context, absoluteDisplayBox.topLeft(), layoutState.establishedInlineFormattingState(container ));185 auto& containerBox = downcast<Layout::ContainerBox>(layoutBox); 186 paintInlineContent(context, absoluteDisplayBox.topLeft(), layoutState.establishedInlineFormattingState(containerBox)); 187 187 } 188 188 }; 189 189 190 190 paint(paintRootBox); 191 if (!is<Layout::Container >(paintRootBox) || !downcast<Layout::Container>(paintRootBox).hasChild())191 if (!is<Layout::ContainerBox>(paintRootBox) || !downcast<Layout::ContainerBox>(paintRootBox).hasChild()) 192 192 return; 193 193 194 194 LayoutBoxList layoutBoxList; 195 layoutBoxList.append(downcast<Layout::Container >(paintRootBox).firstChild());195 layoutBoxList.append(downcast<Layout::ContainerBox>(paintRootBox).firstChild()); 196 196 while (!layoutBoxList.isEmpty()) { 197 197 while (true) { … … 200 200 break; 201 201 paint(layoutBox); 202 if (!is<Layout::Container >(layoutBox) || !downcast<Layout::Container>(layoutBox).hasChild())203 break; 204 layoutBoxList.append(downcast<Layout::Container >(layoutBox).firstChild());202 if (!is<Layout::ContainerBox>(layoutBox) || !downcast<Layout::ContainerBox>(layoutBox).hasChild()) 203 break; 204 layoutBoxList.append(downcast<Layout::ContainerBox>(layoutBox).firstChild()); 205 205 } 206 206 while (!layoutBoxList.isEmpty()) { … … 241 241 appendPaintRoot(layoutBox); 242 242 contentRect.uniteIfNonZero(Display::absoluteDisplayBox(layoutState, layoutBox).rect()); 243 if (!is<Layout::Container >(layoutBox) || !downcast<Layout::Container>(layoutBox).hasChild())244 break; 245 layoutBoxList.append(downcast<Layout::Container >(layoutBox).firstChild());243 if (!is<Layout::ContainerBox>(layoutBox) || !downcast<Layout::ContainerBox>(layoutBox).hasChild()) 244 break; 245 layoutBoxList.append(downcast<Layout::ContainerBox>(layoutBox).firstChild()); 246 246 } 247 247 while (!layoutBoxList.isEmpty()) { -
trunk/Source/WebCore/layout/floats/FloatAvoider.cpp
r250766 r256417 30 30 31 31 #include "LayoutBox.h" 32 #include "LayoutContainer .h"32 #include "LayoutContainerBox.h" 33 33 #include <wtf/IsoMallocInlines.h> 34 34 -
trunk/Source/WebCore/layout/floats/FloatingContext.cpp
r256107 r256417 34 34 #include "FormattingContext.h" 35 35 #include "LayoutBox.h" 36 #include "LayoutContainer .h"36 #include "LayoutContainerBox.h" 37 37 #include <wtf/IsoMallocInlines.h> 38 38 … … 156 156 }; 157 157 158 FloatingContext::FloatingContext(const Container & floatingContextRoot, const FormattingContext& formattingContext, FloatingState& floatingState)158 FloatingContext::FloatingContext(const ContainerBox& floatingContextRoot, const FormattingContext& formattingContext, FloatingState& floatingState) 159 159 : m_root(makeWeakPtr(floatingContextRoot)) 160 160 , m_formattingContext(formattingContext) … … 447 447 auto& floatingStateRoot = floatingState().root(); 448 448 auto top = formattingContext().geometryForBox(floatBox, FormattingContext::EscapeReason::FloatBoxNeedsToBeInAbsoluteCoordinates).top(); 449 for (auto* container = floatBox.containingBlock(); container && container != &floatingStateRoot; container = container->containingBlock())450 top += formattingContext().geometryForBox(*container , FormattingContext::EscapeReason::FloatBoxNeedsToBeInAbsoluteCoordinates).top();449 for (auto* containerBox = floatBox.containingBlock(); containerBox && containerBox != &floatingStateRoot; containerBox = containerBox->containingBlock()) 450 top += formattingContext().geometryForBox(*containerBox, FormattingContext::EscapeReason::FloatBoxNeedsToBeInAbsoluteCoordinates).top(); 451 451 return top; 452 452 } … … 459 459 return position; 460 460 auto mappedPosition = position; 461 for (auto* container = &from; container && container != &to; container = container->containingBlock())462 mappedPosition.moveBy(formattingContext().geometryForBox(*container , FormattingContext::EscapeReason::FloatBoxNeedsToBeInAbsoluteCoordinates).topLeft());461 for (auto* containerBox = &from; containerBox && containerBox != &to; containerBox = containerBox->containingBlock()) 462 mappedPosition.moveBy(formattingContext().geometryForBox(*containerBox, FormattingContext::EscapeReason::FloatBoxNeedsToBeInAbsoluteCoordinates).topLeft()); 463 463 return mappedPosition; 464 464 } -
trunk/Source/WebCore/layout/floats/FloatingContext.h
r256107 r256417 29 29 30 30 #include "FloatingState.h" 31 #include "LayoutContainer .h"31 #include "LayoutContainerBox.h" 32 32 #include <wtf/IsoMalloc.h> 33 33 … … 46 46 WTF_MAKE_ISO_ALLOCATED(FloatingContext); 47 47 public: 48 FloatingContext(const Container & floatingContextRoot, const FormattingContext&, FloatingState&);48 FloatingContext(const ContainerBox& floatingContextRoot, const FormattingContext&, FloatingState&); 49 49 50 50 FloatingState& floatingState() const { return m_floatingState; } … … 71 71 LayoutState& layoutState() const { return m_floatingState.layoutState(); } 72 72 const FormattingContext& formattingContext() const { return m_formattingContext; } 73 const Container & root() const { return *m_root; }73 const ContainerBox& root() const { return *m_root; } 74 74 75 75 void findPositionForFloatBox(FloatBox&) const; … … 82 82 Point mapPointFromFormattingContextRootToFloatingStateRoot(Point) const; 83 83 84 WeakPtr<const Container > m_root;84 WeakPtr<const ContainerBox> m_root; 85 85 const FormattingContext& m_formattingContext; 86 86 FloatingState& m_floatingState; -
trunk/Source/WebCore/layout/floats/FloatingState.cpp
r256107 r256417 31 31 #include "FormattingContext.h" 32 32 #include "LayoutBox.h" 33 #include "LayoutContainer .h"33 #include "LayoutContainerBox.h" 34 34 #include "LayoutState.h" 35 35 #include <wtf/IsoMallocInlines.h> … … 53 53 } 54 54 55 FloatingState::FloatingState(LayoutState& layoutState, const Container & formattingContextRoot)55 FloatingState::FloatingState(LayoutState& layoutState, const ContainerBox& formattingContextRoot) 56 56 : m_layoutState(layoutState) 57 57 , m_formattingContextRoot(makeWeakPtr(formattingContextRoot)) … … 61 61 void FloatingState::append(FloatItem floatItem) 62 62 { 63 ASSERT(is<Container >(*m_formattingContextRoot));63 ASSERT(is<ContainerBox>(*m_formattingContextRoot)); 64 64 65 65 if (m_floats.isEmpty()) … … 88 88 } 89 89 90 Optional<PositionInContextRoot> FloatingState::bottom(const Container & formattingContextRoot, Clear type) const90 Optional<PositionInContextRoot> FloatingState::bottom(const ContainerBox& formattingContextRoot, Clear type) const 91 91 { 92 92 if (m_floats.isEmpty()) … … 115 115 } 116 116 117 Optional<PositionInContextRoot> FloatingState::top(const Container & formattingContextRoot) const117 Optional<PositionInContextRoot> FloatingState::top(const ContainerBox& formattingContextRoot) const 118 118 { 119 119 if (m_floats.isEmpty()) -
trunk/Source/WebCore/layout/floats/FloatingState.h
r256107 r256417 29 29 30 30 #include "DisplayBox.h" 31 #include "LayoutContainer .h"31 #include "LayoutContainerBox.h" 32 32 #include <wtf/IsoMalloc.h> 33 33 #include <wtf/Ref.h> … … 50 50 WTF_MAKE_ISO_ALLOCATED(FloatingState); 51 51 public: 52 static Ref<FloatingState> create(LayoutState& layoutState, const Container & formattingContextRoot) { return adoptRef(*new FloatingState(layoutState, formattingContextRoot)); }52 static Ref<FloatingState> create(LayoutState& layoutState, const ContainerBox& formattingContextRoot) { return adoptRef(*new FloatingState(layoutState, formattingContextRoot)); } 53 53 54 const Container & root() const { return *m_formattingContextRoot; }54 const ContainerBox& root() const { return *m_formattingContextRoot; } 55 55 56 Optional<PositionInContextRoot> top(const Container & formattingContextRoot) const;57 Optional<PositionInContextRoot> leftBottom(const Container & formattingContextRoot) const;58 Optional<PositionInContextRoot> rightBottom(const Container & formattingContextRoot) const;59 Optional<PositionInContextRoot> bottom(const Container & formattingContextRoot) const;56 Optional<PositionInContextRoot> top(const ContainerBox& formattingContextRoot) const; 57 Optional<PositionInContextRoot> leftBottom(const ContainerBox& formattingContextRoot) const; 58 Optional<PositionInContextRoot> rightBottom(const ContainerBox& formattingContextRoot) const; 59 Optional<PositionInContextRoot> bottom(const ContainerBox& formattingContextRoot) const; 60 60 61 61 class FloatItem { … … 67 67 68 68 bool isLeftPositioned() const { return m_position == Position::Left; } 69 bool isDescendantOfFormattingRoot(const Container &) const;69 bool isDescendantOfFormattingRoot(const ContainerBox&) const; 70 70 71 71 Display::Rect rectWithMargin() const { return m_absoluteDisplayBox.rectWithMargin(); } … … 87 87 private: 88 88 friend class FloatingContext; 89 FloatingState(LayoutState&, const Container & formattingContextRoot);89 FloatingState(LayoutState&, const ContainerBox& formattingContextRoot); 90 90 91 91 LayoutState& layoutState() const { return m_layoutState; } 92 92 93 Optional<PositionInContextRoot> bottom(const Container & formattingContextRoot, Clear) const;93 Optional<PositionInContextRoot> bottom(const ContainerBox& formattingContextRoot, Clear) const; 94 94 95 95 LayoutState& m_layoutState; 96 WeakPtr<const Container > m_formattingContextRoot;96 WeakPtr<const ContainerBox> m_formattingContextRoot; 97 97 FloatList m_floats; 98 98 }; 99 99 100 inline Optional<PositionInContextRoot> FloatingState::leftBottom(const Container & formattingContextRoot) const100 inline Optional<PositionInContextRoot> FloatingState::leftBottom(const ContainerBox& formattingContextRoot) const 101 101 { 102 102 ASSERT(formattingContextRoot.establishesFormattingContext()); … … 104 104 } 105 105 106 inline Optional<PositionInContextRoot> FloatingState::rightBottom(const Container & formattingContextRoot) const106 inline Optional<PositionInContextRoot> FloatingState::rightBottom(const ContainerBox& formattingContextRoot) const 107 107 { 108 108 ASSERT(formattingContextRoot.establishesFormattingContext()); … … 110 110 } 111 111 112 inline Optional<PositionInContextRoot> FloatingState::bottom(const Container & formattingContextRoot) const112 inline Optional<PositionInContextRoot> FloatingState::bottom(const ContainerBox& formattingContextRoot) const 113 113 { 114 114 ASSERT(formattingContextRoot.establishesFormattingContext()); … … 116 116 } 117 117 118 inline bool FloatingState::FloatItem::isDescendantOfFormattingRoot(const Container & formattingContextRoot) const118 inline bool FloatingState::FloatItem::isDescendantOfFormattingRoot(const ContainerBox& formattingContextRoot) const 119 119 { 120 120 ASSERT(formattingContextRoot.establishesFormattingContext()); 121 return m_layoutBox->isContainingBlockDescendantOf(downcast<Container >(formattingContextRoot));121 return m_layoutBox->isContainingBlockDescendantOf(downcast<ContainerBox>(formattingContextRoot)); 122 122 } 123 123 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
r256380 r256417 35 35 #include "InvalidationState.h" 36 36 #include "LayoutBox.h" 37 #include "LayoutContainer .h"37 #include "LayoutContainerBox.h" 38 38 #include "LayoutContext.h" 39 39 #include "LayoutInlineTextBox.h" … … 51 51 WTF_MAKE_ISO_ALLOCATED_IMPL(InlineFormattingContext); 52 52 53 InlineFormattingContext::InlineFormattingContext(const Container & formattingContextRoot, InlineFormattingState& formattingState)53 InlineFormattingContext::InlineFormattingContext(const ContainerBox& formattingContextRoot, InlineFormattingState& formattingState) 54 54 : FormattingContext(formattingContextRoot, formattingState) 55 55 { 56 56 } 57 57 58 static inline const Box* nextInlineLevelBoxToLayout(const Box& layoutBox, const Container & stayWithin)58 static inline const Box* nextInlineLevelBoxToLayout(const Box& layoutBox, const ContainerBox& stayWithin) 59 59 { 60 60 // Atomic inline-level boxes and floats are opaque boxes meaning that they are … … 62 62 // Only inline boxes may have relevant descendant content. 63 63 if (layoutBox.isInlineBox()) { 64 if (is<Container >(layoutBox) && downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) {64 if (is<ContainerBox>(layoutBox) && downcast<ContainerBox>(layoutBox).hasInFlowOrFloatingChild()) { 65 65 // Anonymous inline boxes/line breaks can't have descendant content by definition. 66 66 ASSERT(!layoutBox.isAnonymous() && !layoutBox.isLineBreakBox()); 67 return downcast<Container >(layoutBox).firstInFlowOrFloatingChild();67 return downcast<ContainerBox>(layoutBox).firstInFlowOrFloatingChild(); 68 68 } 69 69 } … … 93 93 computeWidthAndMargin(*layoutBox, horizontalConstraints); 94 94 auto createsFormattingContext = layoutBox->isInlineBlockBox() || layoutBox->isInlineTableBox(); 95 auto hasInFlowOrFloatingChild = is<Container >(*layoutBox) && downcast<Container>(*layoutBox).hasInFlowOrFloatingChild();95 auto hasInFlowOrFloatingChild = is<ContainerBox>(*layoutBox) && downcast<ContainerBox>(*layoutBox).hasInFlowOrFloatingChild(); 96 96 if (createsFormattingContext && hasInFlowOrFloatingChild) { 97 auto formattingContext = LayoutContext::createFormattingContext(downcast<Container >(*layoutBox), layoutState());97 auto formattingContext = LayoutContext::createFormattingContext(downcast<ContainerBox>(*layoutBox), layoutState()); 98 98 formattingContext->layoutInFlowContent(invalidationState, horizontalConstraints, verticalConstraints); 99 99 } 100 100 computeHeightAndMargin(*layoutBox, horizontalConstraints); 101 if (createsFormattingContext && is<Container >(*layoutBox) && downcast<Container>(*layoutBox).hasChild()) {101 if (createsFormattingContext && is<ContainerBox>(*layoutBox) && downcast<ContainerBox>(*layoutBox).hasChild()) { 102 102 auto& displayBox = geometryForBox(*layoutBox); 103 103 auto horizontalConstraintsForOutOfFlow = Geometry::horizontalConstraintsForOutOfFlow(displayBox); 104 104 auto verticalConstraintsForOutOfFlow = Geometry::verticalConstraintsForOutOfFlow(displayBox); 105 auto formattingContext = LayoutContext::createFormattingContext(downcast<Container >(*layoutBox), layoutState());105 auto formattingContext = LayoutContext::createFormattingContext(downcast<ContainerBox>(*layoutBox), layoutState()); 106 106 formattingContext->layoutOutOfFlowContent(invalidationState, horizontalConstraintsForOutOfFlow, verticalConstraintsForOutOfFlow); 107 107 } … … 254 254 if (auto fixedWidth = geometry().fixedValue(formattingRoot.style().logicalWidth())) 255 255 constraints = { *fixedWidth, *fixedWidth }; 256 else if (is<Container >(formattingRoot) && downcast<Container>(formattingRoot).hasInFlowOrFloatingChild())257 constraints = LayoutContext::createFormattingContext(downcast<Container >(formattingRoot), layoutState())->computedIntrinsicWidthConstraints();256 else if (is<ContainerBox>(formattingRoot) && downcast<ContainerBox>(formattingRoot).hasInFlowOrFloatingChild()) 257 constraints = LayoutContext::createFormattingContext(downcast<ContainerBox>(formattingRoot), layoutState())->computedIntrinsicWidthConstraints(); 258 258 constraints = geometry().constrainByMinMaxWidth(formattingRoot, constraints); 259 259 constraints.expand(geometryForBox(formattingRoot).horizontalMarginBorderAndPadding()); … … 326 326 // This is the start of an inline box (e.g. <span>). 327 327 formattingState.addInlineItem({ layoutBox, InlineItem::Type::ContainerStart }); 328 auto& inlineBoxWithInlineContent = downcast<Container >(layoutBox);328 auto& inlineBoxWithInlineContent = downcast<ContainerBox>(layoutBox); 329 329 if (!inlineBoxWithInlineContent.hasInFlowOrFloatingChild()) 330 330 break; -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h
r255118 r256417 43 43 WTF_MAKE_ISO_ALLOCATED(InlineFormattingContext); 44 44 public: 45 InlineFormattingContext(const Container & formattingContextRoot, InlineFormattingState&);45 InlineFormattingContext(const ContainerBox& formattingContextRoot, InlineFormattingState&); 46 46 void layoutInFlowContent(InvalidationState&, const HorizontalConstraints&, const VerticalConstraints&) override; 47 47 … … 52 52 public: 53 53 bool lineDescentNeedsCollapsing(const LineBuilder::RunList&) const; 54 LineBuilder::Constraints::HeightAndBaseline lineHeightConstraints(const Container & formattingRoot) const;54 LineBuilder::Constraints::HeightAndBaseline lineHeightConstraints(const ContainerBox& formattingRoot) const; 55 55 56 56 private: … … 67 67 ContentHeightAndMargin inlineBlockHeightAndMargin(const Box&, const HorizontalConstraints&, const OverrideVerticalValues&) const; 68 68 ContentWidthAndMargin inlineBlockWidthAndMargin(const Box&, const HorizontalConstraints&, const OverrideHorizontalValues&); 69 Optional<InlineLayoutUnit> computedTextIndent(const Container & formattingContextRoot, const HorizontalConstraints&) const;69 Optional<InlineLayoutUnit> computedTextIndent(const ContainerBox& formattingContextRoot, const HorizontalConstraints&) const; 70 70 71 71 private: -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
r256380 r256417 31 31 #include "FormattingContext.h" 32 32 #include "LayoutBox.h" 33 #include "LayoutContainer .h"33 #include "LayoutContainerBox.h" 34 34 #include "LengthFunctions.h" 35 35 … … 75 75 } 76 76 77 Optional<InlineLayoutUnit> InlineFormattingContext::Geometry::computedTextIndent(const Container & formattingContextRoot, const HorizontalConstraints& horizontalConstraints) const77 Optional<InlineLayoutUnit> InlineFormattingContext::Geometry::computedTextIndent(const ContainerBox& formattingContextRoot, const HorizontalConstraints& horizontalConstraints) const 78 78 { 79 79 auto textIndent = formattingContextRoot.style().textIndent(); -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp
r255257 r256417 60 60 if (run.isBox()) { 61 61 if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) { 62 auto& formattingState = layoutState.establishedInlineFormattingState(downcast<Container >(layoutBox));62 auto& formattingState = layoutState.establishedInlineFormattingState(downcast<ContainerBox>(layoutBox)); 63 63 auto inlineBlockBaseline = formattingState.displayInlineContent()->lineBoxes.last().baseline(); 64 64 if (inlineBlockBaseline.descent()) … … 72 72 } 73 73 74 LineBuilder::Constraints::HeightAndBaseline InlineFormattingContext::Quirks::lineHeightConstraints(const Container & formattingRoot) const74 LineBuilder::Constraints::HeightAndBaseline InlineFormattingContext::Quirks::lineHeightConstraints(const ContainerBox& formattingRoot) const 75 75 { 76 76 // computedLineHeight takes font-size into account when line-height is not set. -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp
r256380 r256417 156 156 logicalTop = baselineOffset() - ascent - boxGeometry.borderTop() - boxGeometry.paddingTop().valueOr(0); 157 157 } else if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) { 158 auto& formattingState = layoutState().establishedInlineFormattingState(downcast<Container >(layoutBox));158 auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox)); 159 159 // Spec makes us generate at least one line -even if it is empty. 160 160 auto inlineBlockBaselineOffset = formattingState.displayInlineContent()->lineBoxes.last().baselineOffset(); … … 566 566 if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) { 567 567 // Inline-blocks with inline content always have baselines. 568 auto& formattingState = layoutState().establishedInlineFormattingState(downcast<Container >(layoutBox));568 auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox)); 569 569 // Spec makes us generate at least one line -even if it is empty. 570 570 auto& lastLineBox = formattingState.displayInlineContent()->lineBoxes.last(); -
trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp
r256380 r256417 246 246 } 247 247 248 LineLayoutContext::LineLayoutContext(const InlineFormattingContext& inlineFormattingContext, const Container & formattingContextRoot, const InlineItems& inlineItems)248 LineLayoutContext::LineLayoutContext(const InlineFormattingContext& inlineFormattingContext, const ContainerBox& formattingContextRoot, const InlineItems& inlineItems) 249 249 : m_inlineFormattingContext(inlineFormattingContext) 250 250 , m_formattingContextRoot(formattingContextRoot) -
trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.h
r255257 r256417 38 38 class LineLayoutContext { 39 39 public: 40 LineLayoutContext(const InlineFormattingContext&, const Container & formattingContextRoot, const InlineItems&);40 LineLayoutContext(const InlineFormattingContext&, const ContainerBox& formattingContextRoot, const InlineItems&); 41 41 42 42 struct LineContent { … … 76 76 77 77 const InlineFormattingContext& formattingContext() const { return m_inlineFormattingContext; } 78 const Container & root() const { return m_formattingContextRoot; }78 const ContainerBox& root() const { return m_formattingContextRoot; } 79 79 80 80 const InlineFormattingContext& m_inlineFormattingContext; 81 const Container & m_formattingContextRoot;81 const ContainerBox& m_formattingContextRoot; 82 82 const InlineItems& m_inlineItems; 83 83 FloatList m_floats; -
trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.h
r254806 r256417 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "LayoutContainer .h"30 #include "LayoutContainerBox.h" 31 31 #include <wtf/HashMap.h> 32 32 #include <wtf/Vector.h> … … 42 42 BoxTree(const RenderBlockFlow&); 43 43 44 const Layout::Container & rootLayoutBox() const { return m_root; }45 Layout::Container & rootLayoutBox() { return m_root; }44 const Layout::ContainerBox& rootLayoutBox() const { return m_root; } 45 Layout::ContainerBox& rootLayoutBox() { return m_root; } 46 46 47 47 const Layout::Box* layoutBoxForRenderer(const RenderObject&) const; … … 51 51 void buildTree(const RenderBlockFlow&); 52 52 53 Layout::Container m_root;53 Layout::ContainerBox m_root; 54 54 struct BoxAndRenderer { 55 55 std::unique_ptr<const Layout::Box> box; -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
r256107 r256417 243 243 } 244 244 245 const Layout::Container & LineLayout::rootLayoutBox() const245 const Layout::ContainerBox& LineLayout::rootLayoutBox() const 246 246 { 247 247 return m_boxTree.rootLayoutBox(); 248 248 } 249 249 250 Layout::Container & LineLayout::rootLayoutBox()250 Layout::ContainerBox& LineLayout::rootLayoutBox() 251 251 { 252 252 return m_boxTree.rootLayoutBox(); -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h
r256107 r256417 87 87 void prepareFloatingState(); 88 88 89 const Layout::Container & rootLayoutBox() const;90 Layout::Container & rootLayoutBox();89 const Layout::ContainerBox& rootLayoutBox() const; 90 Layout::ContainerBox& rootLayoutBox(); 91 91 ShadowData* debugTextShadow(); 92 92 void releaseInlineItemCache(); -
trunk/Source/WebCore/layout/invalidation/InvalidationState.h
r252460 r256417 29 29 30 30 #include "LayoutBox.h" 31 #include "LayoutContainer .h"31 #include "LayoutContainerBox.h" 32 32 #include <wtf/IsoMalloc.h> 33 33 #include <wtf/WeakHashSet.h> … … 44 44 bool needsLayout(const Box&) const; 45 45 46 using FormattingContextRoots = WeakHashSet<const Container >;46 using FormattingContextRoots = WeakHashSet<const ContainerBox>; 47 47 // FIXME: We currently do full formatting context layouts (no partial layout within a formatting context). 48 48 const FormattingContextRoots& formattingContextRoots() const { return m_formattingContextRoots; } -
trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp
r256384 r256417 30 30 31 31 #include "DisplayBox.h" 32 #include "LayoutContainer .h"32 #include "LayoutContainerBox.h" 33 33 #include "LayoutPhase.h" 34 34 #include "LayoutState.h" … … 100 100 return false; 101 101 102 if (!isContainer ())102 if (!isContainerBox()) 103 103 return false; 104 104 105 105 // FIXME ??? 106 if (!downcast<Container >(*this).firstInFlowChild())106 if (!downcast<ContainerBox>(*this).firstInFlowChild()) 107 107 return false; 108 108 109 109 // It's enough to check the first in-flow child since we can't have both block and inline level sibling boxes. 110 return downcast<Container >(*this).firstInFlowChild()->isInlineLevelBox();110 return downcast<ContainerBox>(*this).firstInFlowChild()->isInlineLevelBox(); 111 111 } 112 112 … … 175 175 } 176 176 177 const Container * Box::containingBlock() const177 const ContainerBox* Box::containingBlock() const 178 178 { 179 179 // Finding the containing block by traversing the tree during tree construction could provide incorrect result. … … 214 214 } 215 215 216 const Container & Box::formattingContextRoot() const216 const ContainerBox& Box::formattingContextRoot() const 217 217 { 218 218 // Finding the context root by traversing the tree during tree construction could provide incorrect result. … … 227 227 // While the relatively positioned inline container (span) is placed relative to its containing block "outer", it lives in the inline 228 228 // formatting context established by "inner". 229 const Container * ancestor = nullptr;229 const ContainerBox* ancestor = nullptr; 230 230 if (isInlineLevelBox() && isInFlowPositioned()) 231 231 ancestor = parent(); … … 238 238 } 239 239 240 const Container & Box::initialContainingBlock() const240 const ContainerBox& Box::initialContainingBlock() const 241 241 { 242 242 if (isInitialContainingBlock()) 243 return downcast<Container >(*this);243 return downcast<ContainerBox>(*this); 244 244 245 245 auto* parent = this->parent(); … … 249 249 } 250 250 251 bool Box::isDescendantOf(const Container & ancestorCandidate) const251 bool Box::isDescendantOf(const ContainerBox& ancestorCandidate) const 252 252 { 253 253 for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) { … … 258 258 } 259 259 260 bool Box::isContainingBlockDescendantOf(const Container & ancestorCandidate) const260 bool Box::isContainingBlockDescendantOf(const ContainerBox& ancestorCandidate) const 261 261 { 262 262 for (auto* ancestor = containingBlock(); ancestor; ancestor = ancestor->containingBlock()) { … … 366 366 } 367 367 if (isInitialContainingBlock()) { 368 auto* documentBox = downcast<Container >(*this).firstChild();369 if (!documentBox || !documentBox->isDocumentBox() || !is<Container >(documentBox))368 auto* documentBox = downcast<ContainerBox>(*this).firstChild(); 369 if (!documentBox || !documentBox->isDocumentBox() || !is<ContainerBox>(documentBox)) 370 370 return isOverflowVisible; 371 auto* bodyBox = downcast<Container >(documentBox)->firstChild();371 auto* bodyBox = downcast<ContainerBox>(documentBox)->firstChild(); 372 372 if (!bodyBox || !bodyBox->isBodyBox()) 373 373 return isOverflowVisible; -
trunk/Source/WebCore/layout/layouttree/LayoutBox.h
r256384 r256417 40 40 namespace Layout { 41 41 42 class Container ;42 class ContainerBox; 43 43 class LayoutState; 44 44 class TreeBuilder; … … 66 66 LineBreakBox = 1 << 2, 67 67 ReplacedBox = 1 << 3, 68 Container Flag= 1 << 468 ContainerBoxFlag = 1 << 4 69 69 }; 70 70 typedef unsigned BaseTypeFlags; … … 94 94 bool isFloatingOrOutOfFlowPositioned() const { return isFloatingPositioned() || isOutOfFlowPositioned(); } 95 95 96 const Container * containingBlock() const;97 const Container & formattingContextRoot() const;98 const Container & initialContainingBlock() const;99 100 bool isDescendantOf(const Container &) const;101 bool isContainingBlockDescendantOf(const Container &) const;96 const ContainerBox* containingBlock() const; 97 const ContainerBox& formattingContextRoot() const; 98 const ContainerBox& initialContainingBlock() const; 99 100 bool isDescendantOf(const ContainerBox&) const; 101 bool isContainingBlockDescendantOf(const ContainerBox&) const; 102 102 103 103 bool isAnonymous() const { return m_isAnonymous; } … … 127 127 bool isImage() const { return m_elementAttributes && m_elementAttributes.value().elementType == ElementType::Image; } 128 128 129 const Container * parent() const { return m_parent; }129 const ContainerBox* parent() const { return m_parent; } 130 130 const Box* nextSibling() const { return m_nextSibling; } 131 131 const Box* nextInFlowSibling() const; … … 138 138 Box* nextSibling() { return m_nextSibling; } 139 139 140 bool isContainer () const { return m_baseTypeFlags & ContainerFlag; }140 bool isContainerBox() const { return m_baseTypeFlags & ContainerBoxFlag; } 141 141 bool isInlineTextBox() const { return m_baseTypeFlags & InlineTextBox; } 142 142 bool isLineBreakBox() const { return m_baseTypeFlags & LineBreakBox; } … … 159 159 Optional<LayoutUnit> columnWidth() const; 160 160 161 void setParent(Container & parent) { m_parent = &parent; }161 void setParent(ContainerBox& parent) { m_parent = &parent; } 162 162 void setNextSibling(Box& nextSibling) { m_nextSibling = &nextSibling; } 163 163 void setPreviousSibling(Box& previousSibling) { m_previousSibling = &previousSibling; } … … 196 196 Optional<ElementAttributes> m_elementAttributes; 197 197 198 Container * m_parent { nullptr };198 ContainerBox* m_parent { nullptr }; 199 199 Box* m_previousSibling { nullptr }; 200 200 Box* m_nextSibling { nullptr }; -
trunk/Source/WebCore/layout/layouttree/LayoutChildIterator.h
r250767 r256417 36 36 class LayoutChildIterator : public LayoutIterator<T> { 37 37 public: 38 LayoutChildIterator(const Container & parent);39 LayoutChildIterator(const Container & parent, const T* current);38 LayoutChildIterator(const ContainerBox& parent); 39 LayoutChildIterator(const ContainerBox& parent, const T* current); 40 40 LayoutChildIterator& operator++(); 41 41 }; … … 44 44 class LayoutChildIteratorAdapter { 45 45 public: 46 LayoutChildIteratorAdapter(const Container & parent);46 LayoutChildIteratorAdapter(const ContainerBox& parent); 47 47 LayoutChildIterator<T> begin() const; 48 48 LayoutChildIterator<T> end() const; … … 51 51 52 52 private: 53 const Container & m_parent;53 const ContainerBox& m_parent; 54 54 }; 55 55 56 template <typename T> LayoutChildIteratorAdapter<T> childrenOfType(const Container &);56 template <typename T> LayoutChildIteratorAdapter<T> childrenOfType(const ContainerBox&); 57 57 58 58 // LayoutChildIterator 59 59 60 60 template <typename T> 61 inline LayoutChildIterator<T>::LayoutChildIterator(const Container & parent)61 inline LayoutChildIterator<T>::LayoutChildIterator(const ContainerBox& parent) 62 62 : LayoutIterator<T>(&parent) 63 63 { … … 65 65 66 66 template <typename T> 67 inline LayoutChildIterator<T>::LayoutChildIterator(const Container & parent, const T* current)67 inline LayoutChildIterator<T>::LayoutChildIterator(const ContainerBox& parent, const T* current) 68 68 : LayoutIterator<T>(&parent, current) 69 69 { … … 79 79 80 80 template <typename T> 81 inline LayoutChildIteratorAdapter<T>::LayoutChildIteratorAdapter(const Container & parent)81 inline LayoutChildIteratorAdapter<T>::LayoutChildIteratorAdapter(const ContainerBox& parent) 82 82 : m_parent(parent) 83 83 { … … 109 109 110 110 template <typename T> 111 inline LayoutChildIteratorAdapter<T> childrenOfType(const Container & parent)111 inline LayoutChildIteratorAdapter<T> childrenOfType(const ContainerBox& parent) 112 112 { 113 113 return LayoutChildIteratorAdapter<T>(parent); -
trunk/Source/WebCore/layout/layouttree/LayoutContainerBox.cpp
r256414 r256417 25 25 26 26 #include "config.h" 27 #include "LayoutContainer .h"27 #include "LayoutContainerBox.h" 28 28 29 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) … … 35 35 namespace Layout { 36 36 37 WTF_MAKE_ISO_ALLOCATED_IMPL(Container );37 WTF_MAKE_ISO_ALLOCATED_IMPL(ContainerBox); 38 38 39 Container ::Container(Optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags)40 : Box(attributes, WTFMove(style), baseTypeFlags | Container Flag)39 ContainerBox::ContainerBox(Optional<ElementAttributes> attributes, RenderStyle&& style, BaseTypeFlags baseTypeFlags) 40 : Box(attributes, WTFMove(style), baseTypeFlags | ContainerBoxFlag) 41 41 { 42 42 } 43 43 44 const Box* Container ::firstInFlowChild() const44 const Box* ContainerBox::firstInFlowChild() const 45 45 { 46 46 if (auto* firstChild = this->firstChild()) { … … 52 52 } 53 53 54 const Box* Container ::firstInFlowOrFloatingChild() const54 const Box* ContainerBox::firstInFlowOrFloatingChild() const 55 55 { 56 56 if (auto* firstChild = this->firstChild()) { … … 62 62 } 63 63 64 const Box* Container ::lastInFlowChild() const64 const Box* ContainerBox::lastInFlowChild() const 65 65 { 66 66 if (auto* lastChild = this->lastChild()) { … … 72 72 } 73 73 74 const Box* Container ::lastInFlowOrFloatingChild() const74 const Box* ContainerBox::lastInFlowOrFloatingChild() const 75 75 { 76 76 if (auto* lastChild = this->lastChild()) { … … 82 82 } 83 83 84 void Container ::setFirstChild(Box& childBox)84 void ContainerBox::setFirstChild(Box& childBox) 85 85 { 86 86 m_firstChild = &childBox; 87 87 } 88 88 89 void Container ::setLastChild(Box& childBox)89 void ContainerBox::setLastChild(Box& childBox) 90 90 { 91 91 m_lastChild = &childBox; 92 92 } 93 93 94 void Container ::appendChild(Box& childBox)94 void ContainerBox::appendChild(Box& childBox) 95 95 { 96 96 childBox.setParent(*this); -
trunk/Source/WebCore/layout/layouttree/LayoutContainerBox.h
r256414 r256417 37 37 namespace Layout { 38 38 39 class Container final : public Box {40 WTF_MAKE_ISO_ALLOCATED(Container );39 class ContainerBox final : public Box { 40 WTF_MAKE_ISO_ALLOCATED(ContainerBox); 41 41 public: 42 Container (Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = ContainerFlag);42 ContainerBox(Optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags = Box::ContainerBoxFlag); 43 43 44 44 const Box* firstChild() const { return m_firstChild; } … … 68 68 } 69 69 70 SPECIALIZE_TYPE_TRAITS_LAYOUT_BOX(Container , isContainer())70 SPECIALIZE_TYPE_TRAITS_LAYOUT_BOX(ContainerBox, isContainerBox()) 71 71 72 72 #endif -
trunk/Source/WebCore/layout/layouttree/LayoutDescendantIterator.h
r232042 r256417 36 36 class LayoutDescendantIterator : public LayoutIterator<T> { 37 37 public: 38 LayoutDescendantIterator(const Container & root);39 LayoutDescendantIterator(const Container & root, const T* current);38 LayoutDescendantIterator(const ContainerBox& root); 39 LayoutDescendantIterator(const ContainerBox& root, const T* current); 40 40 LayoutDescendantIterator& operator++(); 41 41 }; … … 44 44 class LayoutDescendantIteratorAdapter { 45 45 public: 46 LayoutDescendantIteratorAdapter(const Container & root);46 LayoutDescendantIteratorAdapter(const ContainerBox& root); 47 47 LayoutDescendantIterator<T> begin(); 48 48 LayoutDescendantIterator<T> end(); … … 50 50 51 51 private: 52 const Container & m_root;52 const ContainerBox& m_root; 53 53 }; 54 54 … … 58 58 59 59 template <typename T> 60 inline LayoutDescendantIterator<T>::LayoutDescendantIterator(const Container & root)60 inline LayoutDescendantIterator<T>::LayoutDescendantIterator(const ContainerBox& root) 61 61 : LayoutIterator<T>(&root) 62 62 { … … 64 64 65 65 template <typename T> 66 inline LayoutDescendantIterator<T>::LayoutDescendantIterator(const Container & root, const T* current)66 inline LayoutDescendantIterator<T>::LayoutDescendantIterator(const ContainerBox& root, const T* current) 67 67 : LayoutIterator<T>(&root, current) 68 68 { … … 78 78 79 79 template <typename T> 80 inline LayoutDescendantIteratorAdapter<T>::LayoutDescendantIteratorAdapter(const Container & root)80 inline LayoutDescendantIteratorAdapter<T>::LayoutDescendantIteratorAdapter(const ContainerBox& root) 81 81 : m_root(root) 82 82 { … … 104 104 105 105 template <typename T> 106 inline LayoutDescendantIteratorAdapter<T> descendantsOfType(const Container & root)106 inline LayoutDescendantIteratorAdapter<T> descendantsOfType(const ContainerBox& root) 107 107 { 108 108 return LayoutDescendantIteratorAdapter<T>(root); -
trunk/Source/WebCore/layout/layouttree/LayoutIterator.h
r248199 r256417 34 34 class LayoutIterator { 35 35 public: 36 LayoutIterator(const Container * root);37 LayoutIterator(const Container * root, const T* current);36 LayoutIterator(const ContainerBox* root); 37 LayoutIterator(const ContainerBox* root, const T* current); 38 38 39 39 const T& operator*() const; … … 49 49 50 50 private: 51 const Container * m_root;51 const ContainerBox* m_root; 52 52 const T* m_current; 53 53 }; … … 67 67 inline const Box* firstChild(const Box& box) 68 68 { 69 if (is<Container >(box))70 return downcast<Container >(box).firstChild();69 if (is<ContainerBox>(box)) 70 return downcast<ContainerBox>(box).firstChild(); 71 71 return nullptr; 72 72 } 73 73 74 inline const Box* nextAncestorSibling(const Box& current, const Container * stayWithin)74 inline const Box* nextAncestorSibling(const Box& current, const ContainerBox* stayWithin) 75 75 { 76 76 for (auto* ancestor = current.parent(); ancestor; ancestor = ancestor->parent()) { … … 84 84 85 85 template <typename U> 86 inline const Box* next(const U& current, const Container * stayWithin)86 inline const Box* next(const U& current, const ContainerBox* stayWithin) 87 87 { 88 88 if (auto* child = firstChild(current)) … … 98 98 } 99 99 100 inline const Box* nextSkippingChildren(Box& current, const Container * stayWithin)100 inline const Box* nextSkippingChildren(Box& current, const ContainerBox* stayWithin) 101 101 { 102 102 if (¤t == stayWithin) … … 169 169 170 170 template <typename T, typename U> 171 inline const T* next(const U& current, const Container * stayWithin)171 inline const T* next(const U& current, const ContainerBox* stayWithin) 172 172 { 173 173 auto* descendant = LayoutBoxTraversal::next(current, stayWithin); … … 182 182 183 183 template <typename T> 184 inline LayoutIterator<T>::LayoutIterator(const Container * root)184 inline LayoutIterator<T>::LayoutIterator(const ContainerBox* root) 185 185 : m_root(root) 186 186 , m_current(nullptr) … … 189 189 190 190 template <typename T> 191 inline LayoutIterator<T>::LayoutIterator(const Container * root, const T* current)191 inline LayoutIterator<T>::LayoutIterator(const ContainerBox* root, const T* current) 192 192 : m_root(root) 193 193 , m_current(current) -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r256380 r256417 40 40 #include "LayoutBox.h" 41 41 #include "LayoutChildIterator.h" 42 #include "LayoutContainer .h"42 #include "LayoutContainerBox.h" 43 43 #include "LayoutContext.h" 44 44 #include "LayoutDescendantIterator.h" … … 68 68 69 69 WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutTreeContent); 70 LayoutTreeContent::LayoutTreeContent(const RenderBox& rootRenderer, std::unique_ptr<Container > rootLayoutBox)70 LayoutTreeContent::LayoutTreeContent(const RenderBox& rootRenderer, std::unique_ptr<ContainerBox> rootLayoutBox) 71 71 : m_rootRenderer(rootRenderer) 72 72 , m_rootLayoutBox(WTFMove(rootLayoutBox)) … … 83 83 } 84 84 85 static void appendChild(Container & parent, Box& newChild)85 static void appendChild(ContainerBox& parent, Box& newChild) 86 86 { 87 87 if (!parent.hasChild()) { … … 131 131 style.setLogicalHeight(Length(renderView.height(), Fixed)); 132 132 133 auto layoutTreeContent = makeUnique<LayoutTreeContent>(renderView, makeUnique<Container >(WTF::nullopt, WTFMove(style)));133 auto layoutTreeContent = makeUnique<LayoutTreeContent>(renderView, makeUnique<ContainerBox>(WTF::nullopt, WTFMove(style))); 134 134 TreeBuilder(*layoutTreeContent).buildTree(); 135 135 return layoutTreeContent; … … 170 170 } 171 171 172 Container & TreeBuilder::createContainer(Optional<Box::ElementAttributes> elementAttributes, RenderStyle&& style)173 { 174 auto newContainer = makeUnique<Container >(elementAttributes, WTFMove(style));172 ContainerBox& TreeBuilder::createContainer(Optional<Box::ElementAttributes> elementAttributes, RenderStyle&& style) 173 { 174 auto newContainer = makeUnique<ContainerBox>(elementAttributes, WTFMove(style)); 175 175 auto& container = *newContainer; 176 176 m_layoutTreeContent.addContainer(WTFMove(newContainer)); … … 178 178 } 179 179 180 Box* TreeBuilder::createLayoutBox(const Container & parentContainer, const RenderObject& childRenderer)180 Box* TreeBuilder::createLayoutBox(const ContainerBox& parentContainer, const RenderObject& childRenderer) 181 181 { 182 182 auto elementAttributes = [] (const RenderElement& renderer) -> Optional<Box::ElementAttributes> { … … 279 279 } 280 280 281 void TreeBuilder::buildTableStructure(const RenderTable& tableRenderer, Container & tableWrapperBox)281 void TreeBuilder::buildTableStructure(const RenderTable& tableRenderer, ContainerBox& tableWrapperBox) 282 282 { 283 283 // Create caption and table box. … … 287 287 auto* captionBox = createLayoutBox(tableWrapperBox, captionRenderer); 288 288 appendChild(tableWrapperBox, *captionBox); 289 auto& captionContainer = downcast<Container >(*captionBox);289 auto& captionContainer = downcast<ContainerBox>(*captionBox); 290 290 buildSubTree(downcast<RenderElement>(captionRenderer), captionContainer); 291 291 tableChild = tableChild->nextSibling(); … … 298 298 auto* sectionBox = createLayoutBox(tableBox, *sectionRenderer); 299 299 appendChild(tableBox, *sectionBox); 300 auto& sectionContainer = downcast<Container >(*sectionBox);300 auto& sectionContainer = downcast<ContainerBox>(*sectionBox); 301 301 buildSubTree(downcast<RenderElement>(*sectionRenderer), sectionContainer); 302 302 sectionRenderer = sectionRenderer->nextSibling(); … … 304 304 } 305 305 306 void TreeBuilder::buildSubTree(const RenderElement& parentRenderer, Container & parentContainer)306 void TreeBuilder::buildSubTree(const RenderElement& parentRenderer, ContainerBox& parentContainer) 307 307 { 308 308 for (auto& childRenderer : childrenOfType<RenderObject>(parentRenderer)) { … … 310 310 appendChild(parentContainer, *childLayoutBox); 311 311 if (childLayoutBox->isTableWrapperBox()) 312 buildTableStructure(downcast<RenderTable>(childRenderer), downcast<Container >(*childLayoutBox));313 else if (is<Container >(*childLayoutBox))314 buildSubTree(downcast<RenderElement>(childRenderer), downcast<Container >(*childLayoutBox));312 buildTableStructure(downcast<RenderTable>(childRenderer), downcast<ContainerBox>(*childLayoutBox)); 313 else if (is<ContainerBox>(*childLayoutBox)) 314 buildSubTree(downcast<RenderElement>(childRenderer), downcast<ContainerBox>(*childLayoutBox)); 315 315 } 316 316 } 317 317 318 318 #if ENABLE(TREE_DEBUGGING) 319 static void outputInlineRuns(TextStream& stream, const LayoutState& layoutState, const Container & inlineFormattingRoot, unsigned depth)319 static void outputInlineRuns(TextStream& stream, const LayoutState& layoutState, const ContainerBox& inlineFormattingRoot, unsigned depth) 320 320 { 321 321 auto& inlineFormattingState = layoutState.establishedInlineFormattingState(inlineFormattingRoot); … … 416 416 } 417 417 418 static void outputLayoutTree(const LayoutState* layoutState, TextStream& stream, const Container & rootContainer, unsigned depth)418 static void outputLayoutTree(const LayoutState* layoutState, TextStream& stream, const ContainerBox& rootContainer, unsigned depth) 419 419 { 420 420 for (auto& child : childrenOfType<Box>(rootContainer)) { … … 424 424 outputLayoutBox(stream, child, &layoutState->displayBoxForLayoutBox(child), depth); 425 425 if (child.establishesInlineFormattingContext()) 426 outputInlineRuns(stream, *layoutState, downcast<Container >(child), depth + 1);426 outputInlineRuns(stream, *layoutState, downcast<ContainerBox>(child), depth + 1); 427 427 } else 428 428 outputLayoutBox(stream, child, nullptr, depth); 429 429 430 if (is<Container >(child))431 outputLayoutTree(layoutState, stream, downcast<Container >(child), depth + 1);430 if (is<ContainerBox>(child)) 431 outputLayoutTree(layoutState, stream, downcast<ContainerBox>(child), depth + 1); 432 432 } 433 433 } -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.h
r256380 r256417 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "LayoutContainer .h"30 #include "LayoutContainerBox.h" 31 31 #include <wtf/IsoMalloc.h> 32 32 #include <wtf/WeakPtr.h> … … 48 48 WTF_MAKE_ISO_ALLOCATED(LayoutTreeContent); 49 49 public: 50 LayoutTreeContent(const RenderBox&, std::unique_ptr<Container >);50 LayoutTreeContent(const RenderBox&, std::unique_ptr<ContainerBox>); 51 51 ~LayoutTreeContent(); 52 52 53 const Container & rootLayoutBox() const { return *m_rootLayoutBox; }54 Container & rootLayoutBox() { return *m_rootLayoutBox; }53 const ContainerBox& rootLayoutBox() const { return *m_rootLayoutBox; } 54 ContainerBox& rootLayoutBox() { return *m_rootLayoutBox; } 55 55 const RenderBox& rootRenderer() const { return m_rootRenderer; } 56 56 57 57 void addBox(std::unique_ptr<Box> box) 58 58 { 59 ASSERT(!box->isContainer ());59 ASSERT(!box->isContainerBox()); 60 60 m_boxes.add(WTFMove(box)); 61 61 } 62 void addContainer(std::unique_ptr<Container > container) { m_containers.add(WTFMove(container)); }62 void addContainer(std::unique_ptr<ContainerBox> container) { m_containers.add(WTFMove(container)); } 63 63 64 64 Box* layoutBoxForRenderer(const RenderObject& renderer) { return m_renderObjectToLayoutBox.get(&renderer); } … … 71 71 private: 72 72 const RenderBox& m_rootRenderer; 73 std::unique_ptr<Container > m_rootLayoutBox;73 std::unique_ptr<ContainerBox> m_rootLayoutBox; 74 74 HashSet<std::unique_ptr<Box>> m_boxes; 75 HashSet<std::unique_ptr<Container >> m_containers;75 HashSet<std::unique_ptr<ContainerBox>> m_containers; 76 76 77 77 HashMap<const RenderObject*, Box*> m_renderObjectToLayoutBox; … … 87 87 88 88 void buildTree(); 89 void buildSubTree(const RenderElement& parentRenderer, Container & parentContainer);90 void buildTableStructure(const RenderTable& tableRenderer, Container & tableWrapperBox);91 Box* createLayoutBox(const Container & parentContainer, const RenderObject& childRenderer);89 void buildSubTree(const RenderElement& parentRenderer, ContainerBox& parentContainer); 90 void buildTableStructure(const RenderTable& tableRenderer, ContainerBox& tableWrapperBox); 91 Box* createLayoutBox(const ContainerBox& parentContainer, const RenderObject& childRenderer); 92 92 93 93 Box& createReplacedBox(RenderStyle&&); 94 94 Box& createTextBox(String text, bool canUseSimplifiedTextMeasuring, RenderStyle&&); 95 95 Box& createLineBreakBox(bool isOptional, RenderStyle&&); 96 Container & createContainer(Optional<Box::ElementAttributes>, RenderStyle&&);96 ContainerBox& createContainer(Optional<Box::ElementAttributes>, RenderStyle&&); 97 97 98 98 LayoutTreeContent& m_layoutTreeContent; -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp
r254927 r256417 56 56 57 57 // https://www.w3.org/TR/css-tables-3/#table-layout-algorithm 58 TableFormattingContext::TableFormattingContext(const Container & formattingContextRoot, TableFormattingState& formattingState)58 TableFormattingContext::TableFormattingContext(const ContainerBox& formattingContextRoot, TableFormattingState& formattingState) 59 59 : FormattingContext(formattingContextRoot, formattingState) 60 60 { … … 112 112 113 113 ASSERT(cellLayoutBox.establishesBlockFormattingContext()); 114 if (is<Container >(cellLayoutBox) && downcast<Container>(cellLayoutBox).hasInFlowOrFloatingChild())115 LayoutContext::createFormattingContext(downcast<Container >(cellLayoutBox), layoutState())->layoutInFlowContent(invalidationState, Geometry::horizontalConstraintsForInFlow(cellDisplayBox), Geometry::verticalConstraintsForInFlow(cellDisplayBox));114 if (is<ContainerBox>(cellLayoutBox) && downcast<ContainerBox>(cellLayoutBox).hasInFlowOrFloatingChild()) 115 LayoutContext::createFormattingContext(downcast<ContainerBox>(cellLayoutBox), layoutState())->layoutInFlowContent(invalidationState, Geometry::horizontalConstraintsForInFlow(cellDisplayBox), Geometry::verticalConstraintsForInFlow(cellDisplayBox)); 116 116 cellDisplayBox.setVerticalMargin({ { }, { } }); 117 117 cellDisplayBox.setContentBoxHeight(geometry().tableCellHeightAndMargin(cellLayoutBox).contentHeight); … … 197 197 if (colgroup) { 198 198 auto& columnsContext = tableGrid.columnsContext(); 199 for (auto* column = downcast<Container >(*colgroup).firstChild(); column; column = column->nextSibling()) {199 for (auto* column = downcast<ContainerBox>(*colgroup).firstChild(); column; column = column->nextSibling()) { 200 200 ASSERT(column->isTableColumn()); 201 201 auto columnSpanCount = column->columnSpan(); … … 209 209 for (auto* section = firstSection; section; section = section->nextSibling()) { 210 210 ASSERT(section->isTableHeader() || section->isTableBody() || section->isTableFooter()); 211 for (auto* row = downcast<Container >(*section).firstChild(); row; row = row->nextSibling()) {211 for (auto* row = downcast<ContainerBox>(*section).firstChild(); row; row = row->nextSibling()) { 212 212 ASSERT(row->isTableRow()); 213 for (auto* cell = downcast<Container >(*row).firstChild(); cell; cell = cell->nextSibling()) {213 for (auto* cell = downcast<ContainerBox>(*row).firstChild(); cell; cell = cell->nextSibling()) { 214 214 ASSERT(cell->isTableCell()); 215 215 tableGrid.appendCell(*cell); … … 235 235 if (!intrinsicWidth) { 236 236 intrinsicWidth = IntrinsicWidthConstraints { }; 237 if (is<Container >(tableCellBox))238 intrinsicWidth = LayoutContext::createFormattingContext(downcast<Container >(tableCellBox), layoutState())->computedIntrinsicWidthConstraints();237 if (is<ContainerBox>(tableCellBox)) 238 intrinsicWidth = LayoutContext::createFormattingContext(downcast<ContainerBox>(tableCellBox), layoutState())->computedIntrinsicWidthConstraints(); 239 239 intrinsicWidth = geometry().constrainByMinMaxWidth(tableCellBox, *intrinsicWidth); 240 240 auto border = geometry().computedBorder(tableCellBox); -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h
r254853 r256417 42 42 WTF_MAKE_ISO_ALLOCATED(TableFormattingContext); 43 43 public: 44 TableFormattingContext(const Container & formattingContextRoot, TableFormattingState&);44 TableFormattingContext(const ContainerBox& formattingContextRoot, TableFormattingState&); 45 45 void layoutInFlowContent(InvalidationState&, const HorizontalConstraints&, const VerticalConstraints&) override; 46 46
Note: See TracChangeset
for help on using the changeset viewer.