Changeset 267076 in webkit
- Timestamp:
- Sep 14, 2020 10:52:14 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 38 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r267074 r267076 1 2020-09-14 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Layout::BoxGeometry rename, part II. 4 https://bugs.webkit.org/show_bug.cgi?id=216523 5 6 Reviewed by Simon Fraser. 7 8 Rename Layout::Geometry to Layout::BoxGeometry (so that later we can introduce Layout::LineGeometry and Layout::RunGeometry) and 9 make sure we don't use displayBox as a variable name in Layout namespace. 10 11 * Sources.txt: 12 * WebCore.xcodeproj/project.pbxproj: 13 * layout/FormattingContext.cpp: 14 (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry): 15 (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry): 16 (WebCore::Layout::FormattingContext::computeBorderAndPadding): 17 (WebCore::Layout::FormattingContext::geometryForBox const): 18 * layout/FormattingContext.h: 19 * layout/FormattingContextGeometry.cpp: 20 (WebCore::Layout::FormattingContext::Geometry::staticVerticalPositionForOutOfFlowPositioned const): 21 (WebCore::Layout::FormattingContext::Geometry::staticHorizontalPositionForOutOfFlowPositioned const): 22 * layout/FormattingContextQuirks.cpp: 23 * layout/FormattingState.cpp: 24 (WebCore::Layout::FormattingState::boxGeometry): 25 (WebCore::Layout::FormattingState::displayBox): Deleted. 26 * layout/FormattingState.h: 27 * layout/LayoutContext.cpp: 28 (WebCore::Layout::LayoutContext::layout): 29 (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree): 30 * layout/LayoutState.cpp: 31 (WebCore::Layout::LayoutState::geometryForRootBox): 32 (WebCore::Layout::LayoutState::ensureGeometryForBoxSlow): 33 (WebCore::Layout::LayoutState::geometryForRootLayoutBox): Deleted. 34 (WebCore::Layout::LayoutState::ensureDisplayBoxForLayoutBoxSlow): Deleted. 35 * layout/LayoutState.h: 36 (WebCore::Layout::LayoutState::hasBoxGeometry const): 37 (WebCore::Layout::LayoutState::ensureGeometryForBox): 38 (WebCore::Layout::LayoutState::geometryForBox const): 39 (WebCore::Layout::Box::cachedGeometryForLayoutState const): 40 (WebCore::Layout::LayoutState::hasDisplayBox const): Deleted. 41 (WebCore::Layout::LayoutState::ensureGeometryForLayoutBox): Deleted. 42 (WebCore::Layout::LayoutState::geometryForLayoutBox const): Deleted. 43 (WebCore::Layout::Box::cachedDisplayBoxForLayoutState const): Deleted. 44 * layout/Verification.cpp: 45 (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): 46 * layout/blockformatting/BlockFormattingContext.cpp: 47 (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren): 48 (WebCore::Layout::BlockFormattingContext::computeStaticVerticalPosition): 49 (WebCore::Layout::BlockFormattingContext::computeStaticHorizontalPosition): 50 (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForBoxAndAncestors): 51 (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats): 52 (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear): 53 (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin): 54 (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin): 55 * layout/blockformatting/BlockFormattingContextGeometry.cpp: 56 (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin): 57 * layout/blockformatting/BlockFormattingContextQuirks.cpp: 58 * layout/blockformatting/BlockMarginCollapse.cpp: 59 (WebCore::Layout::BlockFormattingContext::MarginCollapse::hasClearance const): 60 * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp: 61 (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox): 62 (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox): 63 (WebCore::Layout::TableWrapperBlockFormattingContext::computeHeightAndMarginForTableBox): 64 * layout/display/DisplayLayerController.cpp: 65 (WebCore::Display::LayerController::prepareForDisplay): 66 * layout/displaytree/DisplayPainter.cpp: 67 (WebCore::Display::paintBoxDecoration): 68 (WebCore::Display::Painter::absoluteBoxGeometry): 69 (WebCore::Display::paintSubtree): 70 (WebCore::Display::collectPaintRootsAndContentRect): 71 (WebCore::Display::Painter::absoluteDisplayBox): Deleted. 72 * layout/displaytree/DisplayPainter.h: 73 * layout/floats/FloatAvoider.h: 74 * layout/floats/FloatingContext.cpp: 75 (WebCore::Layout::FloatingContext::positionForFloat const): 76 (WebCore::Layout::FloatingContext::positionForNonFloatingFloatAvoider const): 77 (WebCore::Layout::FloatingContext::append): 78 (WebCore::Layout::FloatingContext::absoluteBoxGeometryCoordinates const): 79 (WebCore::Layout::FloatingContext::absoluteDisplayBoxCoordinates const): Deleted. 80 * layout/floats/FloatingContext.h: 81 * layout/floats/FloatingState.cpp: 82 (WebCore::Layout::FloatingState::FloatItem::FloatItem): 83 * layout/floats/FloatingState.h: 84 (WebCore::Layout::FloatingState::FloatItem::rectWithMargin const): 85 (WebCore::Layout::FloatingState::FloatItem::horizontalMargin const): 86 (WebCore::Layout::FloatingState::FloatItem::bottom const): 87 * layout/inlineformatting/InlineFormattingContext.cpp: 88 (WebCore::Layout::InlineFormattingContext::layoutInFlowContent): 89 (WebCore::Layout::InlineFormattingContext::lineLayout): 90 (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints): 91 (WebCore::Layout::InlineFormattingContext::computeHorizontalMargin): 92 (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin): 93 (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin): 94 (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent): 95 (WebCore::Layout::InlineFormattingContext::createDisplayBoxesForLineContent): Deleted. 96 * layout/inlineformatting/InlineFormattingContext.h: 97 * layout/inlineformatting/InlineLineBox.h: 98 * layout/inlineformatting/InlineLineBuilder.cpp: 99 * layout/integration/LayoutIntegrationLineLayout.cpp: 100 (WebCore::LayoutIntegration::LineLayout::prepareFloatingState): 101 * layout/layouttree/LayoutBox.cpp: 102 (WebCore::Layout::Box::setcachedGeometryForLayoutState const): 103 (WebCore::Layout::Box::setCachedDisplayBoxForLayoutState const): Deleted. 104 * layout/layouttree/LayoutBox.h: 105 * layout/layouttree/LayoutBoxGeometry.cpp: Renamed from Source/WebCore/layout/layouttree/LayoutGeometry.cpp. 106 (WebCore::Layout::BoxGeometry::BoxGeometry): 107 (WebCore::Layout::BoxGeometry::~BoxGeometry): 108 (WebCore::Layout::BoxGeometry::marginBox const): 109 (WebCore::Layout::BoxGeometry::borderBox const): 110 (WebCore::Layout::BoxGeometry::paddingBox const): 111 (WebCore::Layout::BoxGeometry::contentBox const): 112 * layout/layouttree/LayoutBoxGeometry.h: Renamed from Source/WebCore/layout/layouttree/LayoutGeometry.h. 113 (WebCore::Layout::Rect::expandHorizontally): 114 (WebCore::Layout::Rect::expandVertically): 115 (WebCore::Layout::Rect::intersects const): 116 (WebCore::Layout::Rect::invalidateTop): 117 (WebCore::Layout::Rect::invalidateLeft): 118 (WebCore::Layout::Rect::invalidateWidth): 119 (WebCore::Layout::Rect::invalidateHeight): 120 (WebCore::Layout::Rect::hasValidPosition const): 121 (WebCore::Layout::Rect::hasValidSize const): 122 (WebCore::Layout::Rect::hasValidGeometry const): 123 (WebCore::Layout::Rect::Rect): 124 (WebCore::Layout::Rect::invalidatePosition): 125 (WebCore::Layout::Rect::setHasValidPosition): 126 (WebCore::Layout::Rect::setHasValidSize): 127 (WebCore::Layout::Rect::top const): 128 (WebCore::Layout::Rect::left const): 129 (WebCore::Layout::Rect::bottom const): 130 (WebCore::Layout::Rect::right const): 131 (WebCore::Layout::Rect::topLeft const): 132 (WebCore::Layout::Rect::bottomRight const): 133 (WebCore::Layout::Rect::size const): 134 (WebCore::Layout::Rect::width const): 135 (WebCore::Layout::Rect::height const): 136 (WebCore::Layout::Rect::setTopLeft): 137 (WebCore::Layout::Rect::setTop): 138 (WebCore::Layout::Rect::setLeft): 139 (WebCore::Layout::Rect::setWidth): 140 (WebCore::Layout::Rect::setHeight): 141 (WebCore::Layout::Rect::setSize): 142 (WebCore::Layout::Rect::shiftLeftTo): 143 (WebCore::Layout::Rect::shiftRightTo): 144 (WebCore::Layout::Rect::shiftTopTo): 145 (WebCore::Layout::Rect::shiftBottomTo): 146 (WebCore::Layout::Rect::moveHorizontally): 147 (WebCore::Layout::Rect::moveVertically): 148 (WebCore::Layout::Rect::expand): 149 (WebCore::Layout::Rect::clone const): 150 (WebCore::Layout::Rect::operator LayoutRect const): 151 (WebCore::Layout::BoxGeometry::bottom const): 152 (WebCore::Layout::BoxGeometry::right const): 153 (WebCore::Layout::BoxGeometry::bottomRight const): 154 (WebCore::Layout::BoxGeometry::size const): 155 (WebCore::Layout::BoxGeometry::width const): 156 (WebCore::Layout::BoxGeometry::height const): 157 (WebCore::Layout::BoxGeometry::isEmpty const): 158 (WebCore::Layout::BoxGeometry::rect const): 159 (WebCore::Layout::BoxGeometry::rectWithMargin const): 160 (WebCore::Layout::BoxGeometry::hasClearance const): 161 (WebCore::Layout::BoxGeometry::verticalBorder const): 162 (WebCore::Layout::BoxGeometry::horizontalBorder const): 163 (WebCore::Layout::BoxGeometry::contentBoxTop const): 164 (WebCore::Layout::BoxGeometry::contentBoxLeft const): 165 (WebCore::Layout::BoxGeometry::contentBoxBottom const): 166 (WebCore::Layout::BoxGeometry::contentBoxRight const): 167 (WebCore::Layout::BoxGeometry::paddingBoxTop const): 168 (WebCore::Layout::BoxGeometry::paddingBoxLeft const): 169 (WebCore::Layout::BoxGeometry::paddingBoxBottom const): 170 (WebCore::Layout::BoxGeometry::paddingBoxRight const): 171 (WebCore::Layout::BoxGeometry::paddingBoxHeight const): 172 (WebCore::Layout::BoxGeometry::paddingBoxWidth const): 173 (WebCore::Layout::BoxGeometry::borderBoxHeight const): 174 (WebCore::Layout::BoxGeometry::borderBoxWidth const): 175 (WebCore::Layout::BoxGeometry::marginBoxHeight const): 176 (WebCore::Layout::BoxGeometry::marginBoxWidth const): 177 (WebCore::Layout::BoxGeometry::verticalMarginBorderAndPadding const): 178 (WebCore::Layout::BoxGeometry::horizontalMarginBorderAndPadding const): 179 (WebCore::Layout::BoxGeometry::setHasPrecomputedMarginBefore): 180 (WebCore::Layout::BoxGeometry::moveHorizontally): 181 (WebCore::Layout::BoxGeometry::moveVertically): 182 (WebCore::Layout::BoxGeometry::move): 183 (WebCore::Layout::BoxGeometry::moveBy): 184 (WebCore::Layout::BoxGeometry::setHasClearance): 185 (WebCore::Layout::BoxGeometry::invalidateBorder): 186 (WebCore::Layout::BoxGeometry::invalidatePadding): 187 (WebCore::Layout::BoxGeometry::invalidatePrecomputedMarginBefore): 188 (WebCore::Layout::BoxGeometry::setHasValidTop): 189 (WebCore::Layout::BoxGeometry::setHasValidLeft): 190 (WebCore::Layout::BoxGeometry::setHasValidVerticalMargin): 191 (WebCore::Layout::BoxGeometry::setHasValidHorizontalMargin): 192 (WebCore::Layout::BoxGeometry::setHasValidBorder): 193 (WebCore::Layout::BoxGeometry::setHasValidPadding): 194 (WebCore::Layout::BoxGeometry::setHasValidContentHeight): 195 (WebCore::Layout::BoxGeometry::setHasValidContentWidth): 196 (WebCore::Layout::BoxGeometry::invalidateMargin): 197 (WebCore::Layout::BoxGeometry::top const): 198 (WebCore::Layout::BoxGeometry::left const): 199 (WebCore::Layout::BoxGeometry::topLeft const): 200 (WebCore::Layout::BoxGeometry::setTopLeft): 201 (WebCore::Layout::BoxGeometry::setTop): 202 (WebCore::Layout::BoxGeometry::setLeft): 203 (WebCore::Layout::BoxGeometry::setContentBoxHeight): 204 (WebCore::Layout::BoxGeometry::setContentBoxWidth): 205 (WebCore::Layout::BoxGeometry::contentBoxHeight const): 206 (WebCore::Layout::BoxGeometry::contentBoxWidth const): 207 (WebCore::Layout::BoxGeometry::setHorizontalMargin): 208 (WebCore::Layout::BoxGeometry::setVerticalMargin): 209 (WebCore::Layout::BoxGeometry::setBorder): 210 (WebCore::Layout::BoxGeometry::setPadding): 211 (WebCore::Layout::BoxGeometry::setVerticalPadding): 212 (WebCore::Layout::BoxGeometry::verticalMargin const): 213 (WebCore::Layout::BoxGeometry::horizontalMargin const): 214 (WebCore::Layout::BoxGeometry::marginBefore const): 215 (WebCore::Layout::BoxGeometry::marginStart const): 216 (WebCore::Layout::BoxGeometry::marginAfter const): 217 (WebCore::Layout::BoxGeometry::marginEnd const): 218 (WebCore::Layout::BoxGeometry::paddingTop const): 219 (WebCore::Layout::BoxGeometry::paddingLeft const): 220 (WebCore::Layout::BoxGeometry::paddingBottom const): 221 (WebCore::Layout::BoxGeometry::paddingRight const): 222 (WebCore::Layout::BoxGeometry::verticalPadding const): 223 (WebCore::Layout::BoxGeometry::horizontalPadding const): 224 (WebCore::Layout::BoxGeometry::borderTop const): 225 (WebCore::Layout::BoxGeometry::borderLeft const): 226 (WebCore::Layout::BoxGeometry::borderBottom const): 227 (WebCore::Layout::BoxGeometry::borderRight const): 228 * layout/layouttree/LayoutTreeBuilder.cpp: 229 (WebCore::Layout::outputLayoutBox): 230 (WebCore::Layout::outputLayoutTree): 231 (WebCore::Layout::showLayoutTree): 232 * layout/tableformatting/TableFormattingContext.cpp: 233 (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells): 234 (WebCore::Layout::TableFormattingContext::setUsedGeometryForRows): 235 (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections): 236 (WebCore::Layout::TableFormattingContext::layoutCell): 237 * layout/tableformatting/TableFormattingContextGeometry.cpp: 238 * layout/tableformatting/TableLayout.cpp: 239 * page/FrameViewLayoutContext.cpp: 240 (WebCore::FrameViewLayoutContext::layoutUsingFormattingContext): 241 1 242 2020-09-14 Ryosuke Niwa <rniwa@webkit.org> 2 243 -
trunk/Source/WebCore/Sources.txt
r267054 r267076 1460 1460 layout/layouttree/LayoutBox.cpp 1461 1461 layout/layouttree/LayoutContainerBox.cpp 1462 layout/layouttree/Layout Geometry.cpp1462 layout/layouttree/LayoutBoxGeometry.cpp 1463 1463 layout/layouttree/LayoutInitialContainingBlock.cpp 1464 1464 layout/layouttree/LayoutInlineTextBox.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r267054 r267076 6062 6062 0FEF20CD1BD4A24100128E5D /* LengthSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LengthSize.cpp; sourceTree = "<group>"; }; 6063 6063 0FEF20CF1BD4A64F00128E5D /* RenderStyleConstants.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderStyleConstants.cpp; sourceTree = "<group>"; }; 6064 0FF29A5325101A61003C34E2 /* Layout Geometry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutGeometry.h; sourceTree = "<group>"; };6065 0FF29A5525101A61003C34E2 /* Layout Geometry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutGeometry.cpp; sourceTree = "<group>"; };6064 0FF29A5325101A61003C34E2 /* LayoutBoxGeometry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutBoxGeometry.h; sourceTree = "<group>"; }; 6065 0FF29A5525101A61003C34E2 /* LayoutBoxGeometry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutBoxGeometry.cpp; sourceTree = "<group>"; }; 6066 6066 0FF2E80C1EE0D430009EABD4 /* PerformanceLoggingClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceLoggingClient.cpp; sourceTree = "<group>"; }; 6067 6067 0FF3B9241EE3B6DE00B84144 /* JSDOMQuad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMQuad.cpp; sourceTree = "<group>"; }; … … 17480 17480 115CFA96208B952B001E6991 /* LayoutBox.cpp */, 17481 17481 115CFA95208B952B001E6991 /* LayoutBox.h */, 17482 0FF29A5525101A61003C34E2 /* LayoutBoxGeometry.cpp */, 17483 0FF29A5325101A61003C34E2 /* LayoutBoxGeometry.h */, 17482 17484 11100FC920927CBC0081AA6C /* LayoutChildIterator.h */, 17483 17485 1199FA45208E35A3002358CC /* LayoutContainerBox.cpp */, 17484 17486 1199FA44208E35A3002358CC /* LayoutContainerBox.h */, 17485 17487 11B042FB20B0E21400828A6B /* LayoutDescendantIterator.h */, 17486 0FF29A5525101A61003C34E2 /* LayoutGeometry.cpp */,17487 0FF29A5325101A61003C34E2 /* LayoutGeometry.h */,17488 17488 6FB0ED112427B6C6002737E6 /* LayoutInitialContainingBlock.cpp */, 17489 17489 6F6383F42427AF4900DABA53 /* LayoutInitialContainingBlock.h */, -
trunk/Source/WebCore/layout/FormattingContext.cpp
r267054 r267076 32 32 #include "InvalidationState.h" 33 33 #include "LayoutBox.h" 34 #include "LayoutBoxGeometry.h" 34 35 #include "LayoutContainerBox.h" 35 36 #include "LayoutContext.h" 36 37 #include "LayoutDescendantIterator.h" 37 #include "LayoutGeometry.h"38 38 #include "LayoutInitialContainingBlock.h" 39 39 #include "LayoutReplacedBox.h" … … 91 91 } 92 92 93 auto& displayBox = formattingState().displayBox(layoutBox);94 displayBox.setLeft(horizontalGeometry.left + horizontalGeometry.contentWidthAndMargin.usedMargin.start);95 displayBox.setContentBoxWidth(horizontalGeometry.contentWidthAndMargin.contentWidth);93 auto& boxGeometry = formattingState().boxGeometry(layoutBox); 94 boxGeometry.setLeft(horizontalGeometry.left + horizontalGeometry.contentWidthAndMargin.usedMargin.start); 95 boxGeometry.setContentBoxWidth(horizontalGeometry.contentWidthAndMargin.contentWidth); 96 96 auto& usedHorizontalMargin = horizontalGeometry.contentWidthAndMargin.usedMargin; 97 displayBox.setHorizontalMargin({ usedHorizontalMargin.start, usedHorizontalMargin.end });97 boxGeometry.setHorizontalMargin({ usedHorizontalMargin.start, usedHorizontalMargin.end }); 98 98 } 99 99 … … 119 119 } 120 120 121 auto& displayBox = formattingState().displayBox(layoutBox);121 auto& boxGeometry = formattingState().boxGeometry(layoutBox); 122 122 auto nonCollapsedVerticalMargin = verticalGeometry.contentHeightAndMargin.nonCollapsedMargin; 123 displayBox.setTop(verticalGeometry.top + nonCollapsedVerticalMargin.before);124 displayBox.setContentBoxHeight(verticalGeometry.contentHeightAndMargin.contentHeight);123 boxGeometry.setTop(verticalGeometry.top + nonCollapsedVerticalMargin.before); 124 boxGeometry.setContentBoxHeight(verticalGeometry.contentHeightAndMargin.contentHeight); 125 125 // Margins of absolutely positioned boxes do not collapse. 126 displayBox.setVerticalMargin({ nonCollapsedVerticalMargin.before, nonCollapsedVerticalMargin.after });126 boxGeometry.setVerticalMargin({ nonCollapsedVerticalMargin.before, nonCollapsedVerticalMargin.after }); 127 127 } 128 128 129 129 void FormattingContext::computeBorderAndPadding(const Box& layoutBox, const HorizontalConstraints& horizontalConstraint) 130 130 { 131 auto& displayBox = formattingState().displayBox(layoutBox);132 displayBox.setBorder(geometry().computedBorder(layoutBox));133 displayBox.setPadding(geometry().computedPadding(layoutBox, horizontalConstraint.logicalWidth));131 auto& boxGeometry = formattingState().boxGeometry(layoutBox); 132 boxGeometry.setBorder(geometry().computedBorder(layoutBox)); 133 boxGeometry.setPadding(geometry().computedPadding(layoutBox, horizontalConstraint.logicalWidth)); 134 134 } 135 135 … … 169 169 } 170 170 171 const Layout::Geometry& FormattingContext::geometryForBox(const Box& layoutBox, Optional<EscapeReason> escapeReason) const171 const BoxGeometry& FormattingContext::geometryForBox(const Box& layoutBox, Optional<EscapeReason> escapeReason) const 172 172 { 173 173 UNUSED_PARAM(escapeReason); 174 174 #if ASSERT_ENABLED 175 auto isOkToAccess DisplayBox= [&] {175 auto isOkToAccessBoxGeometry = [&] { 176 176 if (!is<InitialContainingBlock>(layoutBox) && &layoutBox.formattingContextRoot() == &root()) { 177 177 // This is the non-escape case of accessing a box's geometry information within the same formatting context. … … 250 250 }; 251 251 #endif 252 ASSERT(isOkToAccess DisplayBox());253 ASSERT(layoutState().has DisplayBox(layoutBox));254 return layoutState().geometryFor LayoutBox(layoutBox);252 ASSERT(isOkToAccessBoxGeometry()); 253 ASSERT(layoutState().hasBoxGeometry(layoutBox)); 254 return layoutState().geometryForBox(layoutBox); 255 255 } 256 256 -
trunk/Source/WebCore/layout/FormattingContext.h
r267054 r267076 42 42 43 43 class Box; 44 class BoxGeometry; 44 45 class ReplacedBox; 45 46 struct ComputedHorizontalMargin; … … 50 51 struct Edges; 51 52 class FormattingState; 52 class Geometry;53 53 struct HorizontalGeometry; 54 54 class InvalidationState; … … 106 106 TableNeedsAccessToTableWrapper 107 107 }; 108 const Layout::Geometry& geometryForBox(const Box&, Optional<EscapeReason> = WTF::nullopt) const;108 const BoxGeometry& geometryForBox(const Box&, Optional<EscapeReason> = WTF::nullopt) const; 109 109 const ContainerBox& root() const { return *m_root; } 110 110 -
trunk/Source/WebCore/layout/FormattingContextGeometry.cpp
r267054 r267076 298 298 for (auto* ancestor = &layoutBox.parent(); ancestor != &containingBlock; ancestor = &ancestor->containingBlock()) { 299 299 auto& boxGeometry = formattingContext.geometryForBox(*ancestor, EscapeReason::OutOfFlowBoxNeedsInFlowGeometry); 300 // Layout::Geometry::top is the border box top position in its containing block's coordinate system.300 // BoxGeometry::top is the border box top position in its containing block's coordinate system. 301 301 top += boxGeometry.top(); 302 302 ASSERT(!ancestor->isPositioned() || layoutBox.isFixedPositioned()); … … 320 320 for (auto* ancestor = &layoutBox.parent(); ancestor != &containingBlock; ancestor = &ancestor->containingBlock()) { 321 321 auto& boxGeometry = formattingContext.geometryForBox(*ancestor, EscapeReason::OutOfFlowBoxNeedsInFlowGeometry); 322 // Layout::Geometry::left is the border box left position in its containing block's coordinate system.322 // BoxGeometry::left is the border box left position in its containing block's coordinate system. 323 323 left += boxGeometry.left(); 324 324 ASSERT(!ancestor->isPositioned() || layoutBox.isFixedPositioned()); -
trunk/Source/WebCore/layout/FormattingContextQuirks.cpp
r267054 r267076 30 30 31 31 #include "LayoutBox.h" 32 #include "Layout Geometry.h"32 #include "LayoutBoxGeometry.h" 33 33 #include "LayoutInitialContainingBlock.h" 34 34 -
trunk/Source/WebCore/layout/FormattingState.cpp
r267054 r267076 30 30 31 31 #include "FloatingState.h" 32 #include "Layout Geometry.h"32 #include "LayoutBoxGeometry.h" 33 33 #include <wtf/IsoMallocInlines.h> 34 34 … … 49 49 } 50 50 51 Layout::Geometry& FormattingState::displayBox(const Box& layoutBox)51 BoxGeometry& FormattingState::boxGeometry(const Box& layoutBox) 52 52 { 53 53 // Should never need to mutate a display box outside of the formatting context. … … 55 55 // Anonymous text wrappers/line break boxes should not need display boxes. 56 56 ASSERT(!layoutBox.isInlineTextBox() && (!layoutBox.isLineBreakBox() || layoutBox.isOutOfFlowPositioned())); 57 return layoutState().ensureGeometryFor LayoutBox(layoutBox);57 return layoutState().ensureGeometryForBox(layoutBox); 58 58 } 59 59 -
trunk/Source/WebCore/layout/FormattingState.h
r267054 r267076 62 62 LayoutState& layoutState() const { return m_layoutState; } 63 63 64 Layout::Geometry& displayBox(const Box& layoutBox); 64 // FIXME: We need to find a way to limit access to mutatable geometry. 65 BoxGeometry& boxGeometry(const Box& layoutBox); 65 66 // Since we layout the out-of-flow boxes at the end of the formatting context layout, it's okay to store them in the formatting state -as opposed to the containing block level. 66 67 using OutOfFlowBoxList = Vector<WeakPtr<const Box>>; -
trunk/Source/WebCore/layout/LayoutContext.cpp
r267054 r267076 37 37 #include "InvalidationState.h" 38 38 #include "LayoutBox.h" 39 #include "LayoutBoxGeometry.h" 39 40 #include "LayoutContainerBox.h" 40 #include "LayoutGeometry.h"41 41 #include "LayoutPhase.h" 42 42 #include "LayoutTreeBuilder.h" … … 65 65 // ICB establishes the initial BFC, but it does not live in a formatting context and while a non-ICB root(subtree layout) has to have a formatting context, 66 66 // we could not lay it out even if we wanted to since it's outside of this LayoutContext. 67 auto& displayBox = layoutState().geometryForRootLayoutBox();68 displayBox.setHorizontalMargin({ });69 displayBox.setVerticalMargin({ });70 displayBox.setBorder({ });71 displayBox.setPadding({ });72 displayBox.setTopLeft({ });73 displayBox.setContentBoxHeight(rootContentBoxSize.height());74 displayBox.setContentBoxWidth(rootContentBoxSize.width());67 auto& boxGeometry = layoutState().geometryForRootBox(); 68 boxGeometry.setHorizontalMargin({ }); 69 boxGeometry.setVerticalMargin({ }); 70 boxGeometry.setBorder({ }); 71 boxGeometry.setPadding({ }); 72 boxGeometry.setTopLeft({ }); 73 boxGeometry.setContentBoxHeight(rootContentBoxSize.height()); 74 boxGeometry.setContentBoxWidth(rootContentBoxSize.width()); 75 75 76 76 layoutWithPreparedRootGeometry(invalidationState); … … 97 97 98 98 auto formattingContext = createFormattingContext(formattingContextRoot, layoutState()); 99 auto& displayBox = layoutState().geometryForLayoutBox(formattingContextRoot);99 auto& boxGeometry = layoutState().geometryForBox(formattingContextRoot); 100 100 101 101 if (formattingContextRoot.hasInFlowOrFloatingChild()) { 102 auto constraintsForInFlowContent = FormattingContext::ConstraintsForInFlowContent { { displayBox.contentBoxLeft(), displayBox.contentBoxWidth() }, { displayBox.contentBoxTop(), { } } };102 auto constraintsForInFlowContent = FormattingContext::ConstraintsForInFlowContent { { boxGeometry.contentBoxLeft(), boxGeometry.contentBoxWidth() }, { boxGeometry.contentBoxTop(), { } } }; 103 103 formattingContext->layoutInFlowContent(invalidationState, constraintsForInFlowContent); 104 104 } … … 108 108 // It also means that the formattingContextRoot has to have a valid/clean geometry at this point. 109 109 { 110 auto constraints = FormattingContext::ConstraintsForOutOfFlowContent { { displayBox.paddingBoxLeft(), displayBox.paddingBoxWidth() },111 { displayBox.paddingBoxTop(), displayBox.paddingBoxHeight() }, displayBox.contentBoxWidth() };110 auto constraints = FormattingContext::ConstraintsForOutOfFlowContent { { boxGeometry.paddingBoxLeft(), boxGeometry.paddingBoxWidth() }, 111 { boxGeometry.paddingBoxTop(), boxGeometry.paddingBoxHeight() }, boxGeometry.contentBoxWidth() }; 112 112 formattingContext->layoutOutOfFlowContent(invalidationState, constraints); 113 113 } -
trunk/Source/WebCore/layout/LayoutState.cpp
r267054 r267076 34 34 #include "InlineFormattingState.h" 35 35 #include "LayoutBox.h" 36 #include "LayoutBoxGeometry.h" 36 37 #include "LayoutContainerBox.h" 37 #include "LayoutGeometry.h"38 38 #include "RenderBox.h" 39 39 #include "RuntimeEnabledFeatures.h" … … 64 64 LayoutState::~LayoutState() = default; 65 65 66 Layout::Geometry& LayoutState::geometryForRootLayoutBox()67 { 68 return ensureGeometryFor LayoutBox(root());69 } 70 71 Layout::Geometry& LayoutState::ensureDisplayBoxForLayoutBoxSlow(const Box& layoutBox)66 BoxGeometry& LayoutState::geometryForRootBox() 67 { 68 return ensureGeometryForBox(root()); 69 } 70 71 BoxGeometry& LayoutState::ensureGeometryForBoxSlow(const Box& layoutBox) 72 72 { 73 73 if (layoutBox.canCacheForLayoutState(*this)) { 74 ASSERT(!layoutBox.cached DisplayBoxForLayoutState(*this));75 auto newBox = makeUnique< Layout::Geometry>();74 ASSERT(!layoutBox.cachedGeometryForLayoutState(*this)); 75 auto newBox = makeUnique<BoxGeometry>(); 76 76 auto& newBoxPtr = *newBox; 77 layoutBox.setCached DisplayBoxForLayoutState(*this, WTFMove(newBox));77 layoutBox.setCachedGeometryForLayoutState(*this, WTFMove(newBox)); 78 78 return newBoxPtr; 79 79 } 80 80 81 return *m_layout ToDisplayBox.ensure(&layoutBox, [] {82 return makeUnique< Layout::Geometry>();81 return *m_layoutBoxToBoxGeometry.ensure(&layoutBox, [] { 82 return makeUnique<BoxGeometry>(); 83 83 }).iterator->value; 84 84 } -
trunk/Source/WebCore/layout/LayoutState.h
r267054 r267076 42 42 class FormattingContext; 43 43 class FormattingState; 44 class Geometry;44 class BoxGeometry; 45 45 class InlineFormattingState; 46 46 class TableFormattingState; … … 72 72 #endif 73 73 74 Layout::Geometry& geometryForRootLayoutBox();75 Layout::Geometry& ensureGeometryForLayoutBox(const Box&);76 const Layout::Geometry& geometryForLayoutBox(const Box&) const;74 BoxGeometry& geometryForRootBox(); 75 BoxGeometry& ensureGeometryForBox(const Box&); 76 const BoxGeometry& geometryForBox(const Box&) const; 77 77 78 bool has DisplayBox(const Box&) const;78 bool hasBoxGeometry(const Box&) const; 79 79 80 80 enum class QuirksMode { No, Limited, Yes }; … … 94 94 private: 95 95 void setQuirksMode(QuirksMode quirksMode) { m_quirksMode = quirksMode; } 96 Layout::Geometry& ensureDisplayBoxForLayoutBoxSlow(const Box&);96 BoxGeometry& ensureGeometryForBoxSlow(const Box&); 97 97 98 98 HashMap<const ContainerBox*, std::unique_ptr<InlineFormattingState>> m_inlineFormattingStates; … … 106 106 HashSet<const FormattingContext*> m_formattingContextList; 107 107 #endif 108 HashMap<const Box*, std::unique_ptr< Layout::Geometry>> m_layoutToDisplayBox;108 HashMap<const Box*, std::unique_ptr<BoxGeometry>> m_layoutBoxToBoxGeometry; 109 109 QuirksMode m_quirksMode { QuirksMode::No }; 110 110 … … 116 116 }; 117 117 118 inline bool LayoutState::has DisplayBox(const Box& layoutBox) const118 inline bool LayoutState::hasBoxGeometry(const Box& layoutBox) const 119 119 { 120 if (layoutBox.cached DisplayBoxForLayoutState(*this))120 if (layoutBox.cachedGeometryForLayoutState(*this)) 121 121 return true; 122 return m_layout ToDisplayBox.contains(&layoutBox);122 return m_layoutBoxToBoxGeometry.contains(&layoutBox); 123 123 } 124 124 125 inline Layout::Geometry& LayoutState::ensureGeometryForLayoutBox(const Box& layoutBox)125 inline BoxGeometry& LayoutState::ensureGeometryForBox(const Box& layoutBox) 126 126 { 127 if (auto* displayBox = layoutBox.cachedDisplayBoxForLayoutState(*this))128 return * displayBox;129 return ensure DisplayBoxForLayoutBoxSlow(layoutBox);127 if (auto* boxGeometry = layoutBox.cachedGeometryForLayoutState(*this)) 128 return *boxGeometry; 129 return ensureGeometryForBoxSlow(layoutBox); 130 130 } 131 131 132 inline const Layout::Geometry& LayoutState::geometryForLayoutBox(const Box& layoutBox) const132 inline const BoxGeometry& LayoutState::geometryForBox(const Box& layoutBox) const 133 133 { 134 if (auto* displayBox = layoutBox.cachedDisplayBoxForLayoutState(*this))135 return * displayBox;136 ASSERT(m_layout ToDisplayBox.contains(&layoutBox));137 return *m_layout ToDisplayBox.get(&layoutBox);134 if (auto* boxGeometry = layoutBox.cachedGeometryForLayoutState(*this)) 135 return *boxGeometry; 136 ASSERT(m_layoutBoxToBoxGeometry.contains(&layoutBox)); 137 return *m_layoutBoxToBoxGeometry.get(&layoutBox); 138 138 } 139 139 … … 153 153 } 154 154 155 inline Layout::Geometry* Box::cachedDisplayBoxForLayoutState(const LayoutState& layoutState) const155 inline BoxGeometry* Box::cachedGeometryForLayoutState(const LayoutState& layoutState) const 156 156 { 157 157 if (m_cachedLayoutState.get() != &layoutState) 158 158 return nullptr; 159 return m_cached DisplayBoxForLayoutState.get();159 return m_cachedGeometryForLayoutState.get(); 160 160 } 161 161 -
trunk/Source/WebCore/layout/Verification.cpp
r267054 r267076 34 34 #include "InlineTextBox.h" 35 35 #include "LayoutBox.h" 36 #include "LayoutBoxGeometry.h" 36 37 #include "LayoutContainerBox.h" 37 38 #include "LayoutContext.h" 38 #include "LayoutGeometry.h"39 39 #include "LayoutTreeBuilder.h" 40 40 #include "RenderBox.h" … … 234 234 }; 235 235 236 auto renderBoxLikeMarginBox = [&] (const auto& displayBox) {236 auto renderBoxLikeMarginBox = [&] (const auto& boxGeometry) { 237 237 if (layoutBox.isInitialContainingBlock()) 238 return displayBox.rect();238 return boxGeometry.rect(); 239 239 240 240 // Produce a RenderBox matching margin box. 241 auto containingBlockWidth = layoutState.geometryFor LayoutBox(layoutBox.containingBlock()).contentBoxWidth();241 auto containingBlockWidth = layoutState.geometryForBox(layoutBox.containingBlock()).contentBoxWidth(); 242 242 auto marginStart = LayoutUnit { }; 243 243 auto& marginStartStyle = layoutBox.style().marginStart(); … … 250 250 marginEnd = valueForLength(marginEndStyle, containingBlockWidth); 251 251 252 auto marginBefore = displayBox.marginBefore();253 auto marginAfter = displayBox.marginAfter();252 auto marginBefore = boxGeometry.marginBefore(); 253 auto marginAfter = boxGeometry.marginAfter(); 254 254 if (layoutBox.isBlockLevelBox()) { 255 255 auto& formattingState = downcast<BlockFormattingState>(layoutState.formattingStateForBox(layoutBox)); … … 258 258 marginAfter = verticalMargin.nonCollapsedValues.after; 259 259 } 260 auto borderBox = displayBox.borderBox();260 auto borderBox = boxGeometry.borderBox(); 261 261 return Rect { 262 262 borderBox.top() - marginBefore, … … 272 272 frameRect.move(renderer.offsetForInFlowPosition()); 273 273 274 auto displayBox = Geometry { layoutState.geometryForLayoutBox(layoutBox) };274 auto boxGeometry = BoxGeometry { layoutState.geometryForBox(layoutBox) }; 275 275 if (layoutBox.isTableBox()) { 276 276 // When the <table> is out-of-flow positioned, the wrapper table box has the offset 277 277 // while the actual table box is static, inflow. 278 auto& tableWrapper DisplayBox = layoutState.geometryForLayoutBox(layoutBox.containingBlock());279 displayBox.moveBy(tableWrapperDisplayBox.topLeft());278 auto& tableWrapperBoxGeometry = layoutState.geometryForBox(layoutBox.containingBlock()); 279 boxGeometry.moveBy(tableWrapperBoxGeometry.topLeft()); 280 280 // Table wrapper box has the margin values for the table. 281 displayBox.setHorizontalMargin(tableWrapperDisplayBox.horizontalMargin());282 displayBox.setVerticalMargin(tableWrapperDisplayBox.verticalMargin());281 boxGeometry.setHorizontalMargin(tableWrapperBoxGeometry.horizontalMargin()); 282 boxGeometry.setVerticalMargin(tableWrapperBoxGeometry.verticalMargin()); 283 283 } 284 284 … … 291 291 return false; 292 292 } 293 if (!areEssentiallyEqual(frameRect, displayBox.rect())) {294 outputRect("frameBox", renderer.frameRect(), displayBox.rect());295 return true; 296 } 297 298 if (!areEssentiallyEqual(renderer.borderBoxRect(), displayBox.borderBox())) {299 outputRect("borderBox", renderer.borderBoxRect(), displayBox.borderBox());293 if (!areEssentiallyEqual(frameRect, boxGeometry.rect())) { 294 outputRect("frameBox", renderer.frameRect(), boxGeometry.rect()); 295 return true; 296 } 297 298 if (!areEssentiallyEqual(renderer.borderBoxRect(), boxGeometry.borderBox())) { 299 outputRect("borderBox", renderer.borderBoxRect(), boxGeometry.borderBox()); 300 300 return true; 301 301 } … … 303 303 // When the table row border overflows the row, padding box becomes negative and content box is incorrect. 304 304 auto shouldCheckPaddingAndContentBox = !is<RenderTableRow>(renderer) || renderer.paddingBoxRect().width() >= 0; 305 if (shouldCheckPaddingAndContentBox && !areEssentiallyEqual(renderer.paddingBoxRect(), displayBox.paddingBox())) {306 outputRect("paddingBox", renderer.paddingBoxRect(), displayBox.paddingBox());305 if (shouldCheckPaddingAndContentBox && !areEssentiallyEqual(renderer.paddingBoxRect(), boxGeometry.paddingBox())) { 306 outputRect("paddingBox", renderer.paddingBoxRect(), boxGeometry.paddingBox()); 307 307 return true; 308 308 } … … 317 317 return !is<RenderTable>(renderer) || !downcast<RenderTable>(renderer).collapseBorders(); 318 318 }(); 319 if (shouldCheckContentBox && !areEssentiallyEqual(renderer.contentBoxRect(), displayBox.contentBox())) {320 outputRect("contentBox", renderer.contentBoxRect(), displayBox.contentBox());321 return true; 322 } 323 324 if (!areEssentiallyEqual(renderer.marginBoxRect(), renderBoxLikeMarginBox( displayBox))) {319 if (shouldCheckContentBox && !areEssentiallyEqual(renderer.contentBoxRect(), boxGeometry.contentBox())) { 320 outputRect("contentBox", renderer.contentBoxRect(), boxGeometry.contentBox()); 321 return true; 322 } 323 324 if (!areEssentiallyEqual(renderer.marginBoxRect(), renderBoxLikeMarginBox(boxGeometry))) { 325 325 // In certain cases, like out-of-flow boxes with margin auto, marginBoxRect() returns 0. It's clearly incorrect, 326 326 // so let's check the individual margin values instead (and at this point we know that all other boxes match). 327 auto marginsMatch = displayBox.marginBefore() == renderer.marginBefore()328 && displayBox.marginAfter() == renderer.marginAfter()329 && displayBox.marginStart() == renderer.marginStart()330 && displayBox.marginEnd() == renderer.marginEnd();327 auto marginsMatch = boxGeometry.marginBefore() == renderer.marginBefore() 328 && boxGeometry.marginAfter() == renderer.marginAfter() 329 && boxGeometry.marginStart() == renderer.marginStart() 330 && boxGeometry.marginEnd() == renderer.marginEnd(); 331 331 332 332 if (!marginsMatch) { 333 outputRect("marginBox", renderer.marginBoxRect(), renderBoxLikeMarginBox( displayBox));333 outputRect("marginBox", renderer.marginBoxRect(), renderBoxLikeMarginBox(boxGeometry)); 334 334 return true; 335 335 } -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
r264281 r267076 223 223 continue; 224 224 auto positionOffset = geometry().inFlowPositionedPositionOffset(childBox, horizontalConstraints); 225 formattingState(). displayBox(childBox).move(positionOffset);225 formattingState().boxGeometry(childBox).move(positionOffset); 226 226 } 227 227 LOG_WITH_STREAM(FormattingContextLayout, stream << "End: move in-flow positioned children -> parent: " << &containerBox); … … 230 230 void BlockFormattingContext::computeStaticVerticalPosition(const Box& layoutBox, const VerticalConstraints& verticalConstraints) 231 231 { 232 formattingState(). displayBox(layoutBox).setTop(geometry().staticVerticalPosition(layoutBox, verticalConstraints));232 formattingState().boxGeometry(layoutBox).setTop(geometry().staticVerticalPosition(layoutBox, verticalConstraints)); 233 233 } 234 234 235 235 void BlockFormattingContext::computeStaticHorizontalPosition(const Box& layoutBox, const HorizontalConstraints& horizontalConstraints) 236 236 { 237 formattingState(). displayBox(layoutBox).setLeft(geometry().staticHorizontalPosition(layoutBox, horizontalConstraints));237 formattingState().boxGeometry(layoutBox).setLeft(geometry().staticHorizontalPosition(layoutBox, horizontalConstraints)); 238 238 } 239 239 … … 260 260 auto precomputedMarginBefore = marginCollapse().precomputedMarginBefore(*ancestor, usedNonCollapsedMargin); 261 261 262 auto& displayBox = formattingState().displayBox(*ancestor);262 auto& boxGeometry = formattingState().boxGeometry(*ancestor); 263 263 auto nonCollapsedValues = UsedVerticalMargin::NonCollapsedValues { precomputedMarginBefore.nonCollapsedValue, { } }; 264 264 auto collapsedValues = UsedVerticalMargin::CollapsedValues { precomputedMarginBefore.collapsedValue, { }, false }; … … 266 266 267 267 formattingState().setUsedVerticalMargin(*ancestor, verticalMargin); 268 displayBox.setVerticalMargin({ marginBefore(verticalMargin), marginAfter(verticalMargin) });269 displayBox.setTop(verticalPositionWithMargin(*ancestor, verticalMargin, constraintsForAncestor.vertical));268 boxGeometry.setVerticalMargin({ marginBefore(verticalMargin), marginAfter(verticalMargin) }); 269 boxGeometry.setTop(verticalPositionWithMargin(*ancestor, verticalMargin, constraintsForAncestor.vertical)); 270 270 #if ASSERT_ENABLED 271 271 setPrecomputedMarginBefore(*ancestor, precomputedMarginBefore); 272 displayBox.setHasPrecomputedMarginBefore();272 boxGeometry.setHasPrecomputedMarginBefore(); 273 273 #endif 274 274 } … … 285 285 if (layoutBox.isFloatingPositioned()) { 286 286 precomputeVerticalPositionForBoxAndAncestors(layoutBox, constraintsPair); 287 formattingState(). displayBox(layoutBox).setTopLeft(floatingContext.positionForFloat(layoutBox, constraintsPair.containingBlock.horizontal));287 formattingState().boxGeometry(layoutBox).setTopLeft(floatingContext.positionForFloat(layoutBox, constraintsPair.containingBlock.horizontal)); 288 288 return; 289 289 } … … 296 296 297 297 ASSERT(layoutBox.establishesFormattingContext()); 298 formattingState(). displayBox(layoutBox).setTopLeft(floatingContext.positionForNonFloatingFloatAvoider(layoutBox, constraintsPair.containingBlock.horizontal));298 formattingState().boxGeometry(layoutBox).setTopLeft(floatingContext.positionForNonFloatingFloatAvoider(layoutBox, constraintsPair.containingBlock.horizontal)); 299 299 } 300 300 … … 310 310 } 311 311 312 auto& displayBox = formattingState().displayBox(layoutBox);313 ASSERT(*verticalPositionAndClearance.position >= displayBox.top());314 displayBox.setTop(*verticalPositionAndClearance.position);312 auto& boxGeometry = formattingState().boxGeometry(layoutBox); 313 ASSERT(*verticalPositionAndClearance.position >= boxGeometry.top()); 314 boxGeometry.setTop(*verticalPositionAndClearance.position); 315 315 if (verticalPositionAndClearance.clearance) 316 displayBox.setHasClearance();316 boxGeometry.setHasClearance(); 317 317 // FIXME: Reset the margin values on the ancestors/previous siblings now that the float avoider with clearance does not margin collapse anymore. 318 318 } … … 326 326 } 327 327 auto contentWidthAndMargin = geometry().computedWidthAndMargin(layoutBox, constraintsPair.containingBlock.horizontal, availableWidthFloatAvoider); 328 auto& displayBox = formattingState().displayBox(layoutBox);329 displayBox.setContentBoxWidth(contentWidthAndMargin.contentWidth);330 displayBox.setHorizontalMargin({ contentWidthAndMargin.usedMargin.start, contentWidthAndMargin.usedMargin.end });328 auto& boxGeometry = formattingState().boxGeometry(layoutBox); 329 boxGeometry.setContentBoxWidth(contentWidthAndMargin.contentWidth); 330 boxGeometry.setHorizontalMargin({ contentWidthAndMargin.usedMargin.start, contentWidthAndMargin.usedMargin.end }); 331 331 } 332 332 … … 384 384 } 385 385 #endif 386 auto& displayBox = formattingState().displayBox(layoutBox);386 auto& boxGeometry = formattingState().boxGeometry(layoutBox); 387 387 if (!layoutBox.isFloatAvoider()) { 388 388 // Float avoiders have pre-computed vertical margins. 389 displayBox.setTop(verticalPositionWithMargin(layoutBox, verticalMargin, constraints.vertical));390 } 391 displayBox.setContentBoxHeight(contentHeightAndMargin.contentHeight);392 displayBox.setVerticalMargin({ marginBefore(verticalMargin), marginAfter(verticalMargin) });389 boxGeometry.setTop(verticalPositionWithMargin(layoutBox, verticalMargin, constraints.vertical)); 390 } 391 boxGeometry.setContentBoxHeight(contentHeightAndMargin.contentHeight); 392 boxGeometry.setVerticalMargin({ marginBefore(verticalMargin), marginAfter(verticalMargin) }); 393 393 // Adjust the previous sibling's margin bottom now that this box's vertical margin is computed. 394 394 MarginCollapse::updateMarginAfterForPreviousSibling(*this, marginCollapse, layoutBox); -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
r267054 r267076 32 32 #include "FormattingContext.h" 33 33 #include "InlineFormattingState.h" 34 #include "LayoutBoxGeometry.h" 34 35 #include "LayoutChildIterator.h" 35 36 #include "LayoutContext.h" 36 #include "LayoutGeometry.h"37 37 #include "LayoutInitialContainingBlock.h" 38 38 #include "LayoutReplacedBox.h" … … 97 97 inFlowChild = inFlowChild->previousInFlowSibling(); 98 98 if (inFlowChild) { 99 auto& inFlow DisplayBoxGeometry = formattingContext().geometryForBox(*inFlowChild);100 return { inFlow DisplayBoxGeometry.top() + inFlowDisplayBoxGeometry.borderBox().height() - borderAndPaddingTop, nonCollapsedMargin };99 auto& inFlowBoxGeometry = formattingContext().geometryForBox(*inFlowChild); 100 return { inFlowBoxGeometry.top() + inFlowBoxGeometry.borderBox().height() - borderAndPaddingTop, nonCollapsedMargin }; 101 101 } 102 102 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp
r267054 r267076 31 31 #include "BlockFormattingState.h" 32 32 #include "LayoutBox.h" 33 #include "LayoutBoxGeometry.h" 33 34 #include "LayoutContainerBox.h" 34 #include "LayoutGeometry.h"35 35 #include "LayoutInitialContainingBlock.h" 36 36 #include "LayoutState.h" -
trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp
r266685 r267076 88 88 // FIXME: precomputedVerticalPositionForFormattingRoot logic ends up calling into this function when the layoutBox (first inflow child) has 89 89 // not been laid out. 90 if (!layoutState().has DisplayBox(layoutBox))90 if (!layoutState().hasBoxGeometry(layoutBox)) 91 91 return false; 92 92 return formattingContext().geometryForBox(layoutBox).hasClearance(); -
trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp
r267054 r267076 31 31 #include "BlockFormattingState.h" 32 32 #include "InvalidationState.h" 33 #include "LayoutBoxGeometry.h" 33 34 #include "LayoutChildIterator.h" 34 35 #include "LayoutContext.h" 35 #include "LayoutGeometry.h"36 36 #include "LayoutInitialContainingBlock.h" 37 37 #include "TableFormattingContext.h" … … 137 137 grid.setCollapsedBorder(collapsedBorder); 138 138 139 auto& displayBox = formattingState().displayBox(tableBox);140 displayBox.setBorder(collapsedBorder / 2);141 displayBox.setPadding(geometry().computedPadding(tableBox, horizontalConstraints.logicalWidth));139 auto& boxGeometry = formattingState().boxGeometry(tableBox); 140 boxGeometry.setBorder(collapsedBorder / 2); 141 boxGeometry.setPadding(geometry().computedPadding(tableBox, horizontalConstraints.logicalWidth)); 142 142 } 143 143 … … 208 208 auto contentWidthAndMargin = geometry.inFlowWidthAndMargin(tableBox, horizontalConstraints, OverrideHorizontalValues { usedWidth, { } }); 209 209 210 auto& displayBox = formattingState().displayBox(tableBox);211 displayBox.setContentBoxWidth(contentWidthAndMargin.contentWidth);212 displayBox.setHorizontalMargin({ contentWidthAndMargin.usedMargin.start, contentWidthAndMargin.usedMargin.end });210 auto& boxGeometry = formattingState().boxGeometry(tableBox); 211 boxGeometry.setContentBoxWidth(contentWidthAndMargin.contentWidth); 212 boxGeometry.setHorizontalMargin({ contentWidthAndMargin.usedMargin.start, contentWidthAndMargin.usedMargin.end }); 213 213 } 214 214 … … 225 225 formattingState().setUsedVerticalMargin(tableBox, verticalMargin); 226 226 227 auto& displayBox = formattingState().displayBox(tableBox);228 displayBox.setTop(verticalPositionWithMargin(tableBox, verticalMargin, constraints.vertical));229 displayBox.setContentBoxHeight(heightAndMargin.contentHeight);230 displayBox.setVerticalMargin({ marginBefore(verticalMargin), marginAfter(verticalMargin) });227 auto& boxGeometry = formattingState().boxGeometry(tableBox); 228 boxGeometry.setTop(verticalPositionWithMargin(tableBox, verticalMargin, constraints.vertical)); 229 boxGeometry.setContentBoxHeight(heightAndMargin.contentHeight); 230 boxGeometry.setVerticalMargin({ marginBefore(verticalMargin), marginAfter(verticalMargin) }); 231 231 // Adjust the previous sibling's margin bottom now that this box's vertical margin is computed. 232 232 MarginCollapse::updateMarginAfterForPreviousSibling(*this, marginCollapse, tableBox); -
trunk/Source/WebCore/layout/display/DisplayLayerController.cpp
r267054 r267076 35 35 #include "Frame.h" 36 36 #include "FrameView.h" 37 #include "LayoutBoxGeometry.h" 37 38 #include "LayoutContext.h" 38 #include "LayoutGeometry.h"39 39 #include "Logging.h" 40 40 #include "Page.h" … … 84 84 return; 85 85 86 ASSERT(layoutState.has DisplayBox(rootLayoutBox));87 88 auto viewSize = layoutState.geometryFor LayoutBox(rootLayoutBox).size();89 auto contentSize = layoutState.geometryFor LayoutBox(*rootLayoutBox.firstChild()).size();86 ASSERT(layoutState.hasBoxGeometry(rootLayoutBox)); 87 88 auto viewSize = layoutState.geometryForBox(rootLayoutBox).size(); 89 auto contentSize = layoutState.geometryForBox(*rootLayoutBox.firstChild()).size(); 90 90 91 91 // FIXME: Using the firstChild() size won't be correct until we compute overflow correctly, -
trunk/Source/WebCore/layout/displaytree/DisplayPainter.cpp
r267054 r267076 35 35 #include "InlineTextItem.h" 36 36 #include "IntRect.h" 37 #include "LayoutBoxGeometry.h" 37 38 #include "LayoutContainerBox.h" 38 #include "LayoutGeometry.h"39 39 #include "LayoutInitialContainingBlock.h" 40 40 #include "LayoutState.h" … … 46 46 47 47 // FIXME: Move to display box. 48 static void paintBoxDecoration(GraphicsContext& context, const Layout:: Geometry& absoluteDisplayBox, const RenderStyle& style, bool needsMarginPainting)49 { 50 auto decorationBoxTopLeft = needsMarginPainting ? absolute DisplayBox.rectWithMargin().topLeft() : absoluteDisplayBox.topLeft();51 auto decorationBoxSize = needsMarginPainting ? absolute DisplayBox.rectWithMargin().size() : LayoutSize(absoluteDisplayBox.borderBoxWidth(), absoluteDisplayBox.borderBoxHeight());48 static void paintBoxDecoration(GraphicsContext& context, const Layout::BoxGeometry& absoluteBoxGeometry, const RenderStyle& style, bool needsMarginPainting) 49 { 50 auto decorationBoxTopLeft = needsMarginPainting ? absoluteBoxGeometry.rectWithMargin().topLeft() : absoluteBoxGeometry.topLeft(); 51 auto decorationBoxSize = needsMarginPainting ? absoluteBoxGeometry.rectWithMargin().size() : LayoutSize(absoluteBoxGeometry.borderBoxWidth(), absoluteBoxGeometry.borderBoxHeight()); 52 52 // Background color 53 53 if (style.hasBackground()) { … … 143 143 } 144 144 145 Layout:: Geometry Painter::absoluteDisplayBox(const Layout::LayoutState& layoutState, const Layout::Box& layoutBoxToPaint)145 Layout::BoxGeometry Painter::absoluteBoxGeometry(const Layout::LayoutState& layoutState, const Layout::Box& layoutBoxToPaint) 146 146 { 147 147 // Should never really happen but table code is way too incomplete. 148 if (!layoutState.has DisplayBox(layoutBoxToPaint))148 if (!layoutState.hasBoxGeometry(layoutBoxToPaint)) 149 149 return { }; 150 150 if (is<Layout::InitialContainingBlock>(layoutBoxToPaint)) 151 return layoutState.geometryFor LayoutBox(layoutBoxToPaint);151 return layoutState.geometryForBox(layoutBoxToPaint); 152 152 153 153 auto paintContainer = [&] (const auto& layoutBox) { … … 159 159 return &layoutBox.containingBlock(); 160 160 }; 161 auto absoluteBox = Layout:: Geometry { layoutState.geometryForLayoutBox(layoutBoxToPaint) };161 auto absoluteBox = Layout::BoxGeometry { layoutState.geometryForBox(layoutBoxToPaint) }; 162 162 for (auto* container = paintContainer(layoutBoxToPaint); !is<Layout::InitialContainingBlock>(container); container = paintContainer(*container)) 163 absoluteBox.moveBy(layoutState.geometryFor LayoutBox(*container).topLeft());163 absoluteBox.moveBy(layoutState.geometryForBox(*container).topLeft()); 164 164 return absoluteBox; 165 165 } … … 178 178 if (layoutBox.style().visibility() != Visibility::Visible) 179 179 return; 180 if (!layoutState.has DisplayBox(layoutBox))181 return; 182 auto absolute DisplayBox = Painter::absoluteDisplayBox(layoutState, layoutBox);183 if (!dirtyRect.intersects(snappedIntRect(absolute DisplayBox.rect())))180 if (!layoutState.hasBoxGeometry(layoutBox)) 181 return; 182 auto absoluteBoxGeometry = Painter::absoluteBoxGeometry(layoutState, layoutBox); 183 if (!dirtyRect.intersects(snappedIntRect(absoluteBoxGeometry.rect()))) 184 184 return; 185 185 … … 187 187 if (layoutBox.isAnonymous()) 188 188 return; 189 paintBoxDecoration(context, absolute DisplayBox, layoutBox.style(), layoutBox.isBodyBox());189 paintBoxDecoration(context, absoluteBoxGeometry, layoutBox.style(), layoutBox.isBodyBox()); 190 190 return; 191 191 } … … 193 193 if (layoutBox.establishesInlineFormattingContext()) { 194 194 auto& containerBox = downcast<Layout::ContainerBox>(layoutBox); 195 paintInlineContent(context, absolute DisplayBox.topLeft(), layoutState.establishedInlineFormattingState(containerBox));195 paintInlineContent(context, absoluteBoxGeometry.topLeft(), layoutState.establishedInlineFormattingState(containerBox)); 196 196 } 197 197 }; … … 236 236 }; 237 237 238 auto contentRect = LayoutRect { layoutState.geometryFor LayoutBox(rootLayoutBox).rect() };238 auto contentRect = LayoutRect { layoutState.geometryForBox(rootLayoutBox).rect() }; 239 239 240 240 // Initial BFC is always a paint root. … … 249 249 if (isPaintRootCandidate(layoutBox)) 250 250 appendPaintRoot(layoutBox); 251 if (layoutState.has DisplayBox(layoutBox))252 contentRect.uniteIfNonZero(Painter::absolute DisplayBox(layoutState, layoutBox).rect());251 if (layoutState.hasBoxGeometry(layoutBox)) 252 contentRect.uniteIfNonZero(Painter::absoluteBoxGeometry(layoutState, layoutBox).rect()); 253 253 if (!is<Layout::ContainerBox>(layoutBox) || !downcast<Layout::ContainerBox>(layoutBox).hasChild()) 254 254 break; -
trunk/Source/WebCore/layout/displaytree/DisplayPainter.h
r267054 r267076 34 34 35 35 namespace Layout { 36 class Geometry;36 class BoxGeometry; 37 37 class LayoutState; 38 38 } … … 46 46 47 47 // FIXME: Move to display box. 48 static Layout:: Geometry absoluteDisplayBox(const Layout::LayoutState&, const Layout::Box&);48 static Layout::BoxGeometry absoluteBoxGeometry(const Layout::LayoutState&, const Layout::Box&); 49 49 }; 50 50 -
trunk/Source/WebCore/layout/floats/FloatAvoider.h
r267054 r267076 29 29 30 30 #include "LayoutBox.h" 31 #include "Layout Geometry.h"31 #include "LayoutBoxGeometry.h" 32 32 #include "LayoutPoint.h" 33 33 #include "LayoutUnits.h" -
trunk/Source/WebCore/layout/floats/FloatingContext.cpp
r267054 r267076 33 33 #include "FormattingContext.h" 34 34 #include "LayoutBox.h" 35 #include "LayoutBoxGeometry.h" 35 36 #include "LayoutContainerBox.h" 36 #include "LayoutGeometry.h"37 37 #include <wtf/IsoMallocInlines.h> 38 38 … … 244 244 ASSERT(!isEmpty()); 245 245 auto previousFloatAbsoluteTop = floatingState().floats().last().rectWithMargin().top(); 246 auto absolute DisplayBoxCoordinates = this->absoluteDisplayBoxCoordinates(layoutBox);247 auto absoluteTopLeft = absolute DisplayBoxCoordinates.topLeft;246 auto absoluteBoxGeometryCoordinates = this->absoluteBoxGeometryCoordinates(layoutBox); 247 auto absoluteTopLeft = absoluteBoxGeometryCoordinates.topLeft; 248 248 // Incoming float cannot be placed higher than existing floats (margin box of the last float). 249 249 // Take the static position (where the box would go if it wasn't floating) and adjust it with the last float. 250 auto& displayBox= formattingContext().geometryForBox(layoutBox);251 if (absoluteTopLeft.y() - displayBox.marginBefore() < previousFloatAbsoluteTop)252 absoluteTopLeft.setY(previousFloatAbsoluteTop + displayBox.marginBefore());250 auto& boxGeometry = formattingContext().geometryForBox(layoutBox); 251 if (absoluteTopLeft.y() - boxGeometry.marginBefore() < previousFloatAbsoluteTop) 252 absoluteTopLeft.setY(previousFloatAbsoluteTop + boxGeometry.marginBefore()); 253 253 auto horizontalMargin = computedHorizontalMargin(layoutBox, horizontalConstraints.logicalWidth); 254 auto margins = Edges { { *horizontalMargin.start, *horizontalMargin.end }, { displayBox.marginBefore(), displayBox.marginAfter() } };255 auto floatBox = FloatAvoider { layoutBox, absoluteTopLeft, displayBox.width(), margins, absoluteDisplayBoxCoordinates.containingBlockContentBox };254 auto margins = Edges { { *horizontalMargin.start, *horizontalMargin.end }, { boxGeometry.marginBefore(), boxGeometry.marginAfter() } }; 255 auto floatBox = FloatAvoider { layoutBox, absoluteTopLeft, boxGeometry.width(), margins, absoluteBoxGeometryCoordinates.containingBlockContentBox }; 256 256 findAvailablePosition(floatBox, m_floatingState.floats()); 257 257 // From formatting root coordinate system back to containing block's. 258 auto containingBlockTopLeft = absolute DisplayBoxCoordinates.containingBlockTopLeft;258 auto containingBlockTopLeft = absoluteBoxGeometryCoordinates.containingBlockTopLeft; 259 259 return { floatBox.left() + margins.horizontal.left - containingBlockTopLeft.x(), floatBox.top() + margins.vertical.top - containingBlockTopLeft.y() }; 260 260 } … … 270 270 return formattingContext().geometryForBox(layoutBox).topLeft(); 271 271 272 auto absolute DisplayBoxCoordinates = this->absoluteDisplayBoxCoordinates(layoutBox);273 auto& displayBox= formattingContext().geometryForBox(layoutBox);272 auto absoluteBoxGeometryCoordinates = this->absoluteBoxGeometryCoordinates(layoutBox); 273 auto& boxGeometry = formattingContext().geometryForBox(layoutBox); 274 274 auto horizontalMargin = computedHorizontalMargin(layoutBox, horizontalConstraints.logicalWidth); 275 auto margins = Edges { { *horizontalMargin.start, *horizontalMargin.end }, { displayBox.marginBefore(), displayBox.marginAfter() } };276 auto floatAvoider = FloatAvoider { layoutBox, absolute DisplayBoxCoordinates.topLeft, displayBox.width(), margins, absoluteDisplayBoxCoordinates.containingBlockContentBox };275 auto margins = Edges { { *horizontalMargin.start, *horizontalMargin.end }, { boxGeometry.marginBefore(), boxGeometry.marginAfter() } }; 276 auto floatAvoider = FloatAvoider { layoutBox, absoluteBoxGeometryCoordinates.topLeft, boxGeometry.width(), margins, absoluteBoxGeometryCoordinates.containingBlockContentBox }; 277 277 findPositionForFormattingContextRoot(floatAvoider); 278 auto containingBlockTopLeft = absolute DisplayBoxCoordinates.containingBlockTopLeft;278 auto containingBlockTopLeft = absoluteBoxGeometryCoordinates.containingBlockTopLeft; 279 279 return { floatAvoider.left() - containingBlockTopLeft.x(), floatAvoider.top() - containingBlockTopLeft.y() }; 280 280 } … … 405 405 void FloatingContext::append(const Box& floatBox) 406 406 { 407 auto absolute DisplayBox =Geometry(formattingContext().geometryForBox(floatBox));408 absolute DisplayBox.setTopLeft(mapTopLeftToFloatingStateRoot(floatBox));409 floatingState().append(FloatingState::FloatItem { floatBox, absolute DisplayBox});407 auto absoluteBoxGeometry = BoxGeometry(formattingContext().geometryForBox(floatBox)); 408 absoluteBoxGeometry.setTopLeft(mapTopLeftToFloatingStateRoot(floatBox)); 409 floatingState().append(FloatingState::FloatItem { floatBox, absoluteBoxGeometry }); 410 410 } 411 411 … … 456 456 } 457 457 458 FloatingContext::AbsoluteCoordinateValuesForFloatAvoider FloatingContext::absolute DisplayBoxCoordinates(const Box& floatAvoider) const458 FloatingContext::AbsoluteCoordinateValuesForFloatAvoider FloatingContext::absoluteBoxGeometryCoordinates(const Box& floatAvoider) const 459 459 { 460 460 auto& containingBlock = floatAvoider.containingBlock(); -
trunk/Source/WebCore/layout/floats/FloatingContext.h
r263938 r267076 75 75 76 76 struct AbsoluteCoordinateValuesForFloatAvoider; 77 AbsoluteCoordinateValuesForFloatAvoider absolute DisplayBoxCoordinates(const Box&) const;77 AbsoluteCoordinateValuesForFloatAvoider absoluteBoxGeometryCoordinates(const Box&) const; 78 78 LayoutPoint mapTopLeftToFloatingStateRoot(const Box&) const; 79 79 Point mapPointFromFormattingContextRootToFloatingStateRoot(Point) const; -
trunk/Source/WebCore/layout/floats/FloatingState.cpp
r267054 r267076 41 41 WTF_MAKE_ISO_ALLOCATED_IMPL(FloatingState); 42 42 43 FloatingState::FloatItem::FloatItem(const Box& layoutBox, Geometry absoluteDisplayBox)43 FloatingState::FloatItem::FloatItem(const Box& layoutBox, BoxGeometry absoluteBoxGeometry) 44 44 : m_layoutBox(makeWeakPtr(layoutBox)) 45 45 , m_position(layoutBox.isLeftFloatingPositioned() ? Position::Left : Position::Right) 46 , m_absolute DisplayBox(absoluteDisplayBox)46 , m_absoluteBoxGeometry(absoluteBoxGeometry) 47 47 { 48 48 } 49 49 50 FloatingState::FloatItem::FloatItem(Position position, Geometry absoluteDisplayBox)50 FloatingState::FloatItem::FloatItem(Position position, BoxGeometry absoluteBoxGeometry) 51 51 : m_position(position) 52 , m_absolute DisplayBox(absoluteDisplayBox)52 , m_absoluteBoxGeometry(absoluteBoxGeometry) 53 53 { 54 54 } -
trunk/Source/WebCore/layout/floats/FloatingState.h
r267054 r267076 28 28 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 29 29 30 #include "LayoutBoxGeometry.h" 30 31 #include "LayoutContainerBox.h" 31 #include "LayoutGeometry.h"32 32 #include <wtf/IsoMalloc.h> 33 33 #include <wtf/Ref.h> … … 39 39 40 40 class Box; 41 class BoxGeometry; 41 42 class FloatingContext; 42 class Geometry;43 43 class LayoutState; 44 44 class Rect; … … 59 59 class FloatItem { 60 60 public: 61 FloatItem(const Box&, Geometry absoluteDisplayBox);61 FloatItem(const Box&, BoxGeometry absoluteBoxGeometry); 62 62 63 63 // FIXME: This c'tor is only used by the render tree integation codepath. 64 64 enum class Position { Left, Right }; 65 FloatItem(Position, Geometry absoluteDisplayBox);65 FloatItem(Position, BoxGeometry absoluteBoxGeometry); 66 66 67 67 bool isLeftPositioned() const { return m_position == Position::Left; } 68 68 bool isInFormattingContextOf(const ContainerBox& formattingContextRoot) const { return m_layoutBox->isInFormattingContextOf(formattingContextRoot); } 69 69 70 Rect rectWithMargin() const { return m_absolute DisplayBox.rectWithMargin(); }71 Geometry::HorizontalMargin horizontalMargin() const { return m_absoluteDisplayBox.horizontalMargin(); }72 PositionInContextRoot bottom() const { return { m_absolute DisplayBox.bottom() }; }70 Rect rectWithMargin() const { return m_absoluteBoxGeometry.rectWithMargin(); } 71 BoxGeometry::HorizontalMargin horizontalMargin() const { return m_absoluteBoxGeometry.horizontalMargin(); } 72 PositionInContextRoot bottom() const { return { m_absoluteBoxGeometry.bottom() }; } 73 73 74 74 #if ASSERT_ENABLED … … 78 78 WeakPtr<const Box> m_layoutBox; 79 79 Position m_position; 80 Geometry m_absoluteDisplayBox;80 BoxGeometry m_absoluteBoxGeometry; 81 81 }; 82 82 using FloatList = Vector<FloatItem>; -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp
r266979 r267076 118 118 computeBorderAndPadding(*layoutBox, constraints.horizontal); 119 119 computeHorizontalMargin(*layoutBox, constraints.horizontal); 120 formattingState(). displayBox(*layoutBox).setVerticalMargin({ });120 formattingState().boxGeometry(*layoutBox).setVerticalMargin({ }); 121 121 } 122 122 } else … … 151 151 auto initialLineConstraints = ConstraintsForInFlowContent { constraints.horizontal, { lineLogicalTop, makeOptional(toLayoutUnit(quirks().initialLineHeight())) } }; 152 152 auto lineContent = lineBuilder.layoutInlineContent(needsLayoutRange, partialLeadingContentLength, initialLineConstraints, isFirstLine); 153 auto lineLogicalRect = c reateDisplayBoxesForLineContent(lineContent, constraints.horizontal);153 auto lineLogicalRect = computeGeometryForLineContent(lineContent, constraints.horizontal); 154 154 155 155 auto lineContentRange = lineContent.inlineItemRange; … … 233 233 for (auto* formattingRoot : formattingContextRootList) { 234 234 auto intrinsicWidths = layoutState.formattingStateForBox(*formattingRoot).intrinsicWidthConstraintsForBox(*formattingRoot); 235 auto& displayBox = formattingState().displayBox(*formattingRoot);236 auto contentWidth = (availableWidth ? intrinsicWidths->maximum : intrinsicWidths->minimum) - displayBox.horizontalMarginBorderAndPadding();237 displayBox.setContentBoxWidth(contentWidth);235 auto& boxGeometry = formattingState().boxGeometry(*formattingRoot); 236 auto contentWidth = (availableWidth ? intrinsicWidths->maximum : intrinsicWidths->minimum) - boxGeometry.horizontalMarginBorderAndPadding(); 237 boxGeometry.setContentBoxWidth(contentWidth); 238 238 } 239 239 return computedIntrinsicWidthForConstraint(availableWidth); … … 279 279 { 280 280 auto computedHorizontalMargin = geometry().computedHorizontalMargin(layoutBox, horizontalConstraints); 281 formattingState(). displayBox(layoutBox).setHorizontalMargin({ computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) });281 formattingState().boxGeometry(layoutBox).setHorizontalMargin({ computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) }); 282 282 } 283 283 … … 309 309 contentWidthAndMargin = minWidthAndMargin; 310 310 311 auto& displayBox = formattingState().displayBox(layoutBox);312 displayBox.setContentBoxWidth(contentWidthAndMargin.contentWidth);313 displayBox.setHorizontalMargin({ contentWidthAndMargin.usedMargin.start, contentWidthAndMargin.usedMargin.end });311 auto& boxGeometry = formattingState().boxGeometry(layoutBox); 312 boxGeometry.setContentBoxWidth(contentWidthAndMargin.contentWidth); 313 boxGeometry.setHorizontalMargin({ contentWidthAndMargin.usedMargin.start, contentWidthAndMargin.usedMargin.end }); 314 314 } 315 315 … … 339 339 contentHeightAndMargin = minHeightAndMargin; 340 340 } 341 auto& displayBox = formattingState().displayBox(layoutBox);342 displayBox.setContentBoxHeight(contentHeightAndMargin.contentHeight);343 displayBox.setVerticalMargin({ contentHeightAndMargin.nonCollapsedMargin.before, contentHeightAndMargin.nonCollapsedMargin.after });341 auto& boxGeometry = formattingState().boxGeometry(layoutBox); 342 boxGeometry.setContentBoxHeight(contentHeightAndMargin.contentHeight); 343 boxGeometry.setVerticalMargin({ contentHeightAndMargin.nonCollapsedMargin.before, contentHeightAndMargin.nonCollapsedMargin.after }); 344 344 } 345 345 … … 441 441 } 442 442 443 Display::InlineRect InlineFormattingContext::c reateDisplayBoxesForLineContent(const LineBuilder::LineContent& lineContent, const HorizontalConstraints& horizontalConstraints)443 Display::InlineRect InlineFormattingContext::computeGeometryForLineContent(const LineBuilder::LineContent& lineContent, const HorizontalConstraints& horizontalConstraints) 444 444 { 445 445 auto& formattingState = this->formattingState(); … … 455 455 for (const auto& floatCandidate : lineContent.floats) { 456 456 auto& floatBox = floatCandidate.item->layoutBox(); 457 auto& displayBox = formattingState.displayBox(floatBox);457 auto& boxGeometry = formattingState.boxGeometry(floatBox); 458 458 // Set static position first. 459 459 auto verticalStaticPosition = floatCandidate.isIntrusive ? lineLogicalRect.top() : lineLogicalRect.bottom(); 460 displayBox.setTopLeft({ lineLogicalRect.left(), verticalStaticPosition });460 boxGeometry.setTopLeft({ lineLogicalRect.left(), verticalStaticPosition }); 461 461 // Float it. 462 displayBox.setTopLeft(floatingContext.positionForFloat(floatBox, horizontalConstraints));462 boxGeometry.setTopLeft(floatingContext.positionForFloat(floatBox, horizontalConstraints)); 463 463 floatingContext.append(floatBox); 464 464 } … … 507 507 // Create display boxes. 508 508 // FIXME: Since <br> and <wbr> runs have associated DOM elements, we might need to construct a display box here. 509 auto initiatesDisplayBox= lineRun.isBox() || lineRun.isContainerStart();510 if ( initiatesDisplayBox) {511 auto& displayBox = formattingState.displayBox(layoutBox);509 auto needsBoxGeometry = lineRun.isBox() || lineRun.isContainerStart(); 510 if (needsBoxGeometry) { 511 auto& boxGeometry = formattingState.boxGeometry(layoutBox); 512 512 auto& inlineBox = lineBox.inlineBoxForLayoutBox(layoutBox); 513 513 auto topLeft = inlineBox.logicalRect().topLeft(); … … 515 515 if (layoutBox.isInFlowPositioned()) 516 516 topLeft += geometry().inFlowPositionedPositionOffset(layoutBox, horizontalConstraints); 517 displayBox.setTopLeft(toLayoutPoint(topLeft));517 boxGeometry.setTopLeft(toLayoutPoint(topLeft)); 518 518 if (lineRun.isContainerStart()) { 519 519 auto marginBoxWidth = inlineBox.logicalWidth(); 520 auto contentBoxWidth = marginBoxWidth - ( displayBox.marginStart() + displayBox.borderLeft() + displayBox.paddingLeft().valueOr(0));520 auto contentBoxWidth = marginBoxWidth - (boxGeometry.marginStart() + boxGeometry.borderLeft() + boxGeometry.paddingLeft().valueOr(0)); 521 521 // FIXME: Fix it for multiline. 522 displayBox.setContentBoxWidth(toLayoutUnit(contentBoxWidth));523 displayBox.setContentBoxHeight(toLayoutUnit(inlineBox.logicalHeight()));522 boxGeometry.setContentBoxWidth(toLayoutUnit(contentBoxWidth)); 523 boxGeometry.setContentBoxHeight(toLayoutUnit(inlineBox.logicalHeight())); 524 524 } 525 525 } -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h
r266722 r267076 87 87 88 88 void collectInlineContentIfNeeded(); 89 Display::InlineRect c reateDisplayBoxesForLineContent(const LineBuilder::LineContent&, const HorizontalConstraints&);89 Display::InlineRect computeGeometryForLineContent(const LineBuilder::LineContent&, const HorizontalConstraints&); 90 90 struct LineRectAndLineBoxOffset { 91 91 InlineLayoutUnit lineBoxVerticalOffset; -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h
r267054 r267076 30 30 #include "DisplayInlineRect.h" 31 31 #include "InlineLine.h" 32 #include "Layout Geometry.h"32 #include "LayoutBoxGeometry.h" 33 33 #include <wtf/IsoMallocInlines.h> 34 34 #include <wtf/WeakPtr.h> -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp
r267054 r267076 32 32 #include "InlineFormattingContext.h" 33 33 #include "LayoutBox.h" 34 #include "Layout Geometry.h"34 #include "LayoutBoxGeometry.h" 35 35 #include "RuntimeEnabledFeatures.h" 36 36 #include "TextUtil.h" -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
r267054 r267076 37 37 #include "InlineFormattingState.h" 38 38 #include "InvalidationState.h" 39 #include "Layout Geometry.h"39 #include "LayoutBoxGeometry.h" 40 40 #include "LayoutTreeBuilder.h" 41 41 #include "PaintInfo.h" … … 139 139 ? Layout::FloatingState::FloatItem::Position::Right 140 140 : Layout::FloatingState::FloatItem::Position::Left; 141 auto box = Layout::Geometry { };141 auto boxGeometry = Layout::BoxGeometry { }; 142 142 // FIXME: We are flooring here for legacy compatibility. 143 143 // See FloatingObjects::intervalForFloatingObject. 144 144 auto y = rect.y().floor(); 145 145 auto maxY = rect.maxY().floor(); 146 box .setTopLeft({ rect.x(), y });147 box .setContentBoxWidth(rect.width());148 box .setContentBoxHeight(maxY - y);149 box .setBorder({ });150 box .setPadding({ });151 box .setHorizontalMargin({ });152 box .setVerticalMargin({ });153 floatingState.append({ position, box });146 boxGeometry.setTopLeft({ rect.x(), y }); 147 boxGeometry.setContentBoxWidth(rect.width()); 148 boxGeometry.setContentBoxHeight(maxY - y); 149 boxGeometry.setBorder({ }); 150 boxGeometry.setPadding({ }); 151 boxGeometry.setHorizontalMargin({ }); 152 boxGeometry.setVerticalMargin({ }); 153 floatingState.append({ position, boxGeometry }); 154 154 } 155 155 } -
trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp
r267059 r267076 29 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) 30 30 31 #include "LayoutBoxGeometry.h" 31 32 #include "LayoutContainerBox.h" 32 #include "LayoutGeometry.h"33 33 #include "LayoutInitialContainingBlock.h" 34 34 #include "LayoutPhase.h" … … 455 455 } 456 456 457 void Box::setCached DisplayBoxForLayoutState(LayoutState& layoutState, std::unique_ptr<Geometry> box) const457 void Box::setCachedGeometryForLayoutState(LayoutState& layoutState, std::unique_ptr<BoxGeometry> geometry) const 458 458 { 459 459 ASSERT(!m_cachedLayoutState); 460 460 m_cachedLayoutState = makeWeakPtr(layoutState); 461 m_cached DisplayBoxForLayoutState = WTFMove(box);461 m_cachedGeometryForLayoutState = WTFMove(geometry); 462 462 } 463 463 -
trunk/Source/WebCore/layout/layouttree/LayoutBox.h
r267059 r267076 38 38 39 39 class ContainerBox; 40 class Geometry;40 class BoxGeometry; 41 41 class InitialContainingBlock; 42 42 class LayoutState; … … 171 171 172 172 bool canCacheForLayoutState(const LayoutState&) const; 173 Geometry* cachedDisplayBoxForLayoutState(const LayoutState&) const;174 void setCached DisplayBoxForLayoutState(LayoutState&, std::unique_ptr<Geometry>) const;173 BoxGeometry* cachedGeometryForLayoutState(const LayoutState&) const; 174 void setCachedGeometryForLayoutState(LayoutState&, std::unique_ptr<BoxGeometry>) const; 175 175 176 176 protected: … … 208 208 // First LayoutState gets a direct cache. 209 209 mutable WeakPtr<LayoutState> m_cachedLayoutState; 210 mutable std::unique_ptr< Geometry> m_cachedDisplayBoxForLayoutState;210 mutable std::unique_ptr<BoxGeometry> m_cachedGeometryForLayoutState; 211 211 212 212 unsigned m_baseTypeFlags : 6; // OptionSet<BaseTypeFlag> -
trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.cpp
r267075 r267076 25 25 26 26 #include "config.h" 27 #include "Layout Geometry.h"27 #include "LayoutBoxGeometry.h" 28 28 29 29 #if ENABLE(LAYOUT_FORMATTING_CONTEXT) … … 34 34 namespace Layout { 35 35 36 WTF_MAKE_ISO_ALLOCATED_IMPL( Geometry);36 WTF_MAKE_ISO_ALLOCATED_IMPL(BoxGeometry); 37 37 38 Geometry::Geometry(constGeometry& other)38 BoxGeometry::BoxGeometry(const BoxGeometry& other) 39 39 : m_topLeft(other.m_topLeft) 40 40 , m_contentWidth(other.m_contentWidth) … … 59 59 } 60 60 61 Geometry::~Geometry()61 BoxGeometry::~BoxGeometry() 62 62 { 63 63 } 64 64 65 Rect Geometry::marginBox() const65 Rect BoxGeometry::marginBox() const 66 66 { 67 67 auto borderBox = this->borderBox(); … … 75 75 } 76 76 77 Rect Geometry::borderBox() const77 Rect BoxGeometry::borderBox() const 78 78 { 79 79 Rect borderBox; … … 83 83 } 84 84 85 Rect Geometry::paddingBox() const85 Rect BoxGeometry::paddingBox() const 86 86 { 87 87 auto borderBox = this->borderBox(); … … 95 95 } 96 96 97 Rect Geometry::contentBox() const97 Rect BoxGeometry::contentBox() const 98 98 { 99 99 Rect contentBox; -
trunk/Source/WebCore/layout/layouttree/LayoutBoxGeometry.h
r267075 r267076 306 306 307 307 308 class Geometry {309 WTF_MAKE_ISO_ALLOCATED( Geometry);308 class BoxGeometry { 309 WTF_MAKE_ISO_ALLOCATED(BoxGeometry); 310 310 public: 311 Geometry(constGeometry&);312 Geometry() = default;313 ~ Geometry();311 BoxGeometry(const BoxGeometry&); 312 BoxGeometry() = default; 313 ~BoxGeometry(); 314 314 315 315 LayoutUnit top() const; … … 454 454 455 455 #if ASSERT_ENABLED 456 inline void Geometry::invalidateMargin()456 inline void BoxGeometry::invalidateMargin() 457 457 { 458 458 m_hasValidHorizontalMargin = false; … … 461 461 #endif 462 462 463 inline LayoutUnit Geometry::top() const463 inline LayoutUnit BoxGeometry::top() const 464 464 { 465 465 ASSERT(m_hasValidTop && (m_hasPrecomputedMarginBefore || m_hasValidVerticalMargin)); … … 467 467 } 468 468 469 inline LayoutUnit Geometry::left() const469 inline LayoutUnit BoxGeometry::left() const 470 470 { 471 471 ASSERT(m_hasValidLeft && m_hasValidHorizontalMargin); … … 473 473 } 474 474 475 inline LayoutPoint Geometry::topLeft() const475 inline LayoutPoint BoxGeometry::topLeft() const 476 476 { 477 477 ASSERT(m_hasValidTop && (m_hasPrecomputedMarginBefore || m_hasValidVerticalMargin)); … … 480 480 } 481 481 482 inline void Geometry::setTopLeft(const LayoutPoint& topLeft)482 inline void BoxGeometry::setTopLeft(const LayoutPoint& topLeft) 483 483 { 484 484 #if ASSERT_ENABLED … … 489 489 } 490 490 491 inline void Geometry::setTop(LayoutUnit top)491 inline void BoxGeometry::setTop(LayoutUnit top) 492 492 { 493 493 #if ASSERT_ENABLED … … 497 497 } 498 498 499 inline void Geometry::setLeft(LayoutUnit left)499 inline void BoxGeometry::setLeft(LayoutUnit left) 500 500 { 501 501 #if ASSERT_ENABLED … … 505 505 } 506 506 507 inline void Geometry::setContentBoxHeight(LayoutUnit height)507 inline void BoxGeometry::setContentBoxHeight(LayoutUnit height) 508 508 { 509 509 #if ASSERT_ENABLED … … 513 513 } 514 514 515 inline void Geometry::setContentBoxWidth(LayoutUnit width)515 inline void BoxGeometry::setContentBoxWidth(LayoutUnit width) 516 516 { 517 517 #if ASSERT_ENABLED … … 521 521 } 522 522 523 inline LayoutUnit Geometry::contentBoxHeight() const523 inline LayoutUnit BoxGeometry::contentBoxHeight() const 524 524 { 525 525 ASSERT(m_hasValidContentHeight); … … 527 527 } 528 528 529 inline LayoutUnit Geometry::contentBoxWidth() const529 inline LayoutUnit BoxGeometry::contentBoxWidth() const 530 530 { 531 531 ASSERT(m_hasValidContentWidth); … … 533 533 } 534 534 535 inline void Geometry::setHorizontalMargin(HorizontalMargin margin)535 inline void BoxGeometry::setHorizontalMargin(HorizontalMargin margin) 536 536 { 537 537 #if ASSERT_ENABLED … … 541 541 } 542 542 543 inline void Geometry::setVerticalMargin(VerticalMargin margin)543 inline void BoxGeometry::setVerticalMargin(VerticalMargin margin) 544 544 { 545 545 #if ASSERT_ENABLED … … 550 550 } 551 551 552 inline void Geometry::setBorder(Layout::Edges border)552 inline void BoxGeometry::setBorder(Layout::Edges border) 553 553 { 554 554 #if ASSERT_ENABLED … … 558 558 } 559 559 560 inline void Geometry::setPadding(Optional<Layout::Edges> padding)560 inline void BoxGeometry::setPadding(Optional<Layout::Edges> padding) 561 561 { 562 562 #if ASSERT_ENABLED … … 566 566 } 567 567 568 inline void Geometry::setVerticalPadding(Layout::VerticalEdges verticalPadding)568 inline void BoxGeometry::setVerticalPadding(Layout::VerticalEdges verticalPadding) 569 569 { 570 570 #if ASSERT_ENABLED … … 574 574 } 575 575 576 inline Geometry::VerticalMarginGeometry::verticalMargin() const576 inline BoxGeometry::VerticalMargin BoxGeometry::verticalMargin() const 577 577 { 578 578 ASSERT(m_hasValidVerticalMargin); … … 580 580 } 581 581 582 inline Geometry::HorizontalMarginGeometry::horizontalMargin() const582 inline BoxGeometry::HorizontalMargin BoxGeometry::horizontalMargin() const 583 583 { 584 584 ASSERT(m_hasValidHorizontalMargin); … … 586 586 } 587 587 588 inline LayoutUnit Geometry::marginBefore() const588 inline LayoutUnit BoxGeometry::marginBefore() const 589 589 { 590 590 ASSERT(m_hasValidVerticalMargin); … … 592 592 } 593 593 594 inline LayoutUnit Geometry::marginStart() const594 inline LayoutUnit BoxGeometry::marginStart() const 595 595 { 596 596 ASSERT(m_hasValidHorizontalMargin); … … 598 598 } 599 599 600 inline LayoutUnit Geometry::marginAfter() const600 inline LayoutUnit BoxGeometry::marginAfter() const 601 601 { 602 602 ASSERT(m_hasValidVerticalMargin); … … 604 604 } 605 605 606 inline LayoutUnit Geometry::marginEnd() const606 inline LayoutUnit BoxGeometry::marginEnd() const 607 607 { 608 608 ASSERT(m_hasValidHorizontalMargin); … … 610 610 } 611 611 612 inline Optional<LayoutUnit> Geometry::paddingTop() const612 inline Optional<LayoutUnit> BoxGeometry::paddingTop() const 613 613 { 614 614 ASSERT(m_hasValidPadding); … … 618 618 } 619 619 620 inline Optional<LayoutUnit> Geometry::paddingLeft() const620 inline Optional<LayoutUnit> BoxGeometry::paddingLeft() const 621 621 { 622 622 ASSERT(m_hasValidPadding); … … 626 626 } 627 627 628 inline Optional<LayoutUnit> Geometry::paddingBottom() const628 inline Optional<LayoutUnit> BoxGeometry::paddingBottom() const 629 629 { 630 630 ASSERT(m_hasValidPadding); … … 634 634 } 635 635 636 inline Optional<LayoutUnit> Geometry::paddingRight() const636 inline Optional<LayoutUnit> BoxGeometry::paddingRight() const 637 637 { 638 638 ASSERT(m_hasValidPadding); … … 642 642 } 643 643 644 inline Optional<LayoutUnit> Geometry::verticalPadding() const644 inline Optional<LayoutUnit> BoxGeometry::verticalPadding() const 645 645 { 646 646 auto paddingTop = this->paddingTop(); … … 651 651 } 652 652 653 inline Optional<LayoutUnit> Geometry::horizontalPadding() const653 inline Optional<LayoutUnit> BoxGeometry::horizontalPadding() const 654 654 { 655 655 auto paddingLeft = this->paddingLeft(); … … 660 660 } 661 661 662 inline LayoutUnit Geometry::borderTop() const662 inline LayoutUnit BoxGeometry::borderTop() const 663 663 { 664 664 ASSERT(m_hasValidBorder); … … 666 666 } 667 667 668 inline LayoutUnit Geometry::borderLeft() const668 inline LayoutUnit BoxGeometry::borderLeft() const 669 669 { 670 670 ASSERT(m_hasValidBorder); … … 672 672 } 673 673 674 inline LayoutUnit Geometry::borderBottom() const674 inline LayoutUnit BoxGeometry::borderBottom() const 675 675 { 676 676 ASSERT(m_hasValidBorder); … … 678 678 } 679 679 680 inline LayoutUnit Geometry::borderRight() const680 inline LayoutUnit BoxGeometry::borderRight() const 681 681 { 682 682 ASSERT(m_hasValidBorder); -
trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
r267054 r267076 39 39 #include "InvalidationState.h" 40 40 #include "LayoutBox.h" 41 #include "LayoutBoxGeometry.h" 41 42 #include "LayoutChildIterator.h" 42 43 #include "LayoutContainerBox.h" 43 44 #include "LayoutContext.h" 44 #include "LayoutGeometry.h"45 45 #include "LayoutInitialContainingBlock.h" 46 46 #include "LayoutInlineTextBox.h" … … 427 427 } 428 428 429 static void outputLayoutBox(TextStream& stream, const Box& layoutBox, const Geometry* displayBox, unsigned depth)429 static void outputLayoutBox(TextStream& stream, const Box& layoutBox, const BoxGeometry* boxGeometry, unsigned depth) 430 430 { 431 431 unsigned printedCharacters = 0; … … 482 482 stream << "unknown box"; 483 483 484 if ( displayBox)485 stream << " at (" << displayBox->left() << "," << displayBox->top() << ") size " << displayBox->width() << "x" << displayBox->height();484 if (boxGeometry) 485 stream << " at (" << boxGeometry->left() << "," << boxGeometry->top() << ") size " << boxGeometry->width() << "x" << boxGeometry->height(); 486 486 stream << " (" << &layoutBox << ")"; 487 487 if (is<InlineTextBox>(layoutBox)) { … … 507 507 if (layoutState) { 508 508 // Not all boxes generate display boxes. 509 if (layoutState->has DisplayBox(child))510 outputLayoutBox(stream, child, &layoutState->geometryFor LayoutBox(child), depth);509 if (layoutState->hasBoxGeometry(child)) 510 outputLayoutBox(stream, child, &layoutState->geometryForBox(child), depth); 511 511 else 512 512 outputLayoutBox(stream, child, nullptr, depth); … … 526 526 527 527 auto& initialContainingBlock = layoutBox.initialContainingBlock(); 528 outputLayoutBox(stream, initialContainingBlock, layoutState ? &layoutState->geometryFor LayoutBox(initialContainingBlock) : nullptr, 0);528 outputLayoutBox(stream, initialContainingBlock, layoutState ? &layoutState->geometryForBox(initialContainingBlock) : nullptr, 0); 529 529 outputLayoutTree(layoutState, stream, initialContainingBlock, 1); 530 530 WTFLogAlways("%s", stream.release().utf8().data()); -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp
r267054 r267076 34 34 #include "InvalidationState.h" 35 35 #include "LayoutBox.h" 36 #include "LayoutBoxGeometry.h" 36 37 #include "LayoutChildIterator.h" 37 38 #include "LayoutContext.h" 38 #include "LayoutGeometry.h"39 39 #include "LayoutInitialContainingBlock.h" 40 40 #include "TableFormattingState.h" … … 76 76 for (auto& cell : grid.cells()) { 77 77 auto& cellBox = cell->box(); 78 auto& cell DisplayBox = formattingState().displayBox(cellBox);78 auto& cellBoxGeometry = formattingState().boxGeometry(cellBox); 79 79 auto& section = rowList[cell->startRow()].box().parent(); 80 80 if (§ion != currentSection) { … … 83 83 sectionOffset = rowList[cell->startRow()].logicalTop(); 84 84 } 85 cell DisplayBox.setTop(rowList[cell->startRow()].logicalTop() - sectionOffset);86 cell DisplayBox.setLeft(columnList[cell->startColumn()].logicalLeft());85 cellBoxGeometry.setTop(rowList[cell->startRow()].logicalTop() - sectionOffset); 86 cellBoxGeometry.setLeft(columnList[cell->startColumn()].logicalLeft()); 87 87 auto availableVerticalSpace = rowList[cell->startRow()].logicalHeight(); 88 88 for (size_t rowIndex = cell->startRow() + 1; rowIndex < cell->endRow(); ++rowIndex) … … 92 92 // FIXME: Find out if it is ok to use the regular padding here to align the content box inside a tall cell or we need to 93 93 // use some kind of intrinsic padding similar to RenderTableCell. 94 auto paddingTop = cell DisplayBox.paddingTop().valueOr(LayoutUnit { });95 auto paddingBottom = cell DisplayBox.paddingBottom().valueOr(LayoutUnit { });94 auto paddingTop = cellBoxGeometry.paddingTop().valueOr(LayoutUnit { }); 95 auto paddingBottom = cellBoxGeometry.paddingBottom().valueOr(LayoutUnit { }); 96 96 auto intrinsicPaddingTop = LayoutUnit { }; 97 97 auto intrinsicPaddingBottom = LayoutUnit { }; … … 99 99 switch (cellBox.style().verticalAlign()) { 100 100 case VerticalAlign::Middle: { 101 auto intrinsicVerticalPadding = std::max(0_lu, availableVerticalSpace - cell DisplayBox.verticalMarginBorderAndPadding() - cellDisplayBox.contentBoxHeight());101 auto intrinsicVerticalPadding = std::max(0_lu, availableVerticalSpace - cellBoxGeometry.verticalMarginBorderAndPadding() - cellBoxGeometry.contentBoxHeight()); 102 102 intrinsicPaddingTop = intrinsicVerticalPadding / 2; 103 103 intrinsicPaddingBottom = intrinsicVerticalPadding / 2; … … 107 107 auto rowBaseline = LayoutUnit { rowList[cell->startRow()].baseline() }; 108 108 auto cellBaseline = LayoutUnit { cell->baseline() }; 109 intrinsicPaddingTop = std::max(0_lu, rowBaseline - cellBaseline - cell DisplayBox.borderTop());110 intrinsicPaddingBottom = std::max(0_lu, availableVerticalSpace - cell DisplayBox.verticalMarginBorderAndPadding() - intrinsicPaddingTop - cellDisplayBox.contentBoxHeight());109 intrinsicPaddingTop = std::max(0_lu, rowBaseline - cellBaseline - cellBoxGeometry.borderTop()); 110 intrinsicPaddingBottom = std::max(0_lu, availableVerticalSpace - cellBoxGeometry.verticalMarginBorderAndPadding() - intrinsicPaddingTop - cellBoxGeometry.contentBoxHeight()); 111 111 break; 112 112 } … … 127 127 if (child->isAnonymous() || child->isLineBreakBox()) 128 128 continue; 129 formattingState. displayBox(*child).moveVertically(intrinsicPaddingTop);129 formattingState.boxGeometry(*child).moveVertically(intrinsicPaddingTop); 130 130 } 131 131 if (cellBox.establishesInlineFormattingContext()) { … … 139 139 adjustCellContentWithInstrinsicPaddingBefore(); 140 140 } 141 cell DisplayBox.setVerticalPadding({ paddingTop + intrinsicPaddingTop, paddingBottom + intrinsicPaddingBottom });141 cellBoxGeometry.setVerticalPadding({ paddingTop + intrinsicPaddingTop, paddingBottom + intrinsicPaddingBottom }); 142 142 } 143 143 } … … 153 153 auto& row = rows[rowIndex]; 154 154 auto& rowBox = row.box(); 155 auto& row DisplayBox = formattingState().displayBox(rowBox);156 157 row DisplayBox.setPadding(geometry().computedPadding(rowBox, availableHorizontalSpace));155 auto& rowBoxGeometry = formattingState().boxGeometry(rowBox); 156 157 rowBoxGeometry.setPadding(geometry().computedPadding(rowBox, availableHorizontalSpace)); 158 158 // Internal table elements do not have margins. 159 row DisplayBox.setHorizontalMargin({ });160 row DisplayBox.setVerticalMargin({ });159 rowBoxGeometry.setHorizontalMargin({ }); 160 rowBoxGeometry.setVerticalMargin({ }); 161 161 162 162 auto computedRowBorder = [&] { … … 182 182 computedRowBorder.vertical.bottom = { }; 183 183 } 184 row DisplayBox.setContentBoxHeight(row.logicalHeight() - computedRowBorder.height());184 rowBoxGeometry.setContentBoxHeight(row.logicalHeight() - computedRowBorder.height()); 185 185 186 186 auto rowLogicalWidth = grid.columns().logicalWidth() + 2 * grid.horizontalSpacing(); … … 190 190 computedRowBorder.horizontal.right = { }; 191 191 } 192 row DisplayBox.setContentBoxWidth(rowLogicalWidth - computedRowBorder.width());193 row DisplayBox.setBorder(computedRowBorder);192 rowBoxGeometry.setContentBoxWidth(rowLogicalWidth - computedRowBorder.width()); 193 rowBoxGeometry.setBorder(computedRowBorder); 194 194 195 195 if (previousRow && &previousRow->parent() != &rowBox.parent()) { … … 197 197 rowLogicalTop = { }; 198 198 } 199 row DisplayBox.setTop(rowLogicalTop);200 row DisplayBox.setLeft({ });199 rowBoxGeometry.setTop(rowLogicalTop); 200 rowBoxGeometry.setLeft({ }); 201 201 202 202 rowLogicalTop += row.logicalHeight() + grid.verticalSpacing(); … … 232 232 auto paddingAfter = verticalSpacing; 233 233 for (auto& sectionBox : childrenOfType<ContainerBox>(tableBox)) { 234 auto& section DisplayBox = formattingState().displayBox(sectionBox);234 auto& sectionBoxGeometry = formattingState().boxGeometry(sectionBox); 235 235 // Section borders are either collapsed or ignored. 236 section DisplayBox.setBorder({ });236 sectionBoxGeometry.setBorder({ }); 237 237 // Use fake vertical padding to space out the sections. 238 section DisplayBox.setPadding(Edges { { }, { paddingBefore.valueOr(0_lu), paddingAfter } });238 sectionBoxGeometry.setPadding(Edges { { }, { paddingBefore.valueOr(0_lu), paddingAfter } }); 239 239 paddingBefore = WTF::nullopt; 240 240 // Internal table elements do not have margins. 241 section DisplayBox.setHorizontalMargin({ });242 section DisplayBox.setVerticalMargin({ });243 244 section DisplayBox.setContentBoxWidth(sectionWidth);241 sectionBoxGeometry.setHorizontalMargin({ }); 242 sectionBoxGeometry.setVerticalMargin({ }); 243 244 sectionBoxGeometry.setContentBoxWidth(sectionWidth); 245 245 auto sectionContentHeight = LayoutUnit { }; 246 246 size_t rowCount = 0; … … 250 250 } 251 251 sectionContentHeight += verticalSpacing * (rowCount - 1); 252 section DisplayBox.setContentBoxHeight(sectionContentHeight);253 section DisplayBox.setLeft(constraints.horizontal.logicalLeft);254 section DisplayBox.setTop(logicalTop);255 256 logicalTop += section DisplayBox.height();252 sectionBoxGeometry.setContentBoxHeight(sectionContentHeight); 253 sectionBoxGeometry.setLeft(constraints.horizontal.logicalLeft); 254 sectionBoxGeometry.setTop(logicalTop); 255 256 logicalTop += sectionBoxGeometry.height(); 257 257 } 258 258 } … … 264 264 auto& grid = formattingState().tableGrid(); 265 265 auto& cellBox = cell.box(); 266 auto& cell DisplayBox = formattingState().displayBox(cellBox);267 268 cell DisplayBox.setBorder(geometry().computedCellBorder(cell));269 cell DisplayBox.setPadding(geometry().computedPadding(cellBox, availableHorizontalSpace));266 auto& cellBoxGeometry = formattingState().boxGeometry(cellBox); 267 268 cellBoxGeometry.setBorder(geometry().computedCellBorder(cell)); 269 cellBoxGeometry.setPadding(geometry().computedPadding(cellBox, availableHorizontalSpace)); 270 270 // Internal table elements do not have margins. 271 cell DisplayBox.setHorizontalMargin({ });272 cell DisplayBox.setVerticalMargin({ });271 cellBoxGeometry.setHorizontalMargin({ }); 272 cellBoxGeometry.setVerticalMargin({ }); 273 273 274 274 auto availableSpaceForContent = [&] { … … 279 279 // No column spacing when spanning. 280 280 logicalWidth += (cell.columnSpan() - 1) * grid.horizontalSpacing(); 281 return logicalWidth - cell DisplayBox.horizontalMarginBorderAndPadding();281 return logicalWidth - cellBoxGeometry.horizontalMarginBorderAndPadding(); 282 282 }(); 283 cell DisplayBox.setContentBoxWidth(availableSpaceForContent);283 cellBoxGeometry.setContentBoxWidth(availableSpaceForContent); 284 284 285 285 if (cellBox.hasInFlowOrFloatingChild()) { … … 293 293 LayoutContext::createFormattingContext(cellBox, layoutState())->layoutInFlowContent(invalidationState, constraintsForCellContent); 294 294 } 295 cell DisplayBox.setContentBoxHeight(geometry().cellHeigh(cellBox));295 cellBoxGeometry.setContentBoxHeight(geometry().cellHeigh(cellBox)); 296 296 } 297 297 -
trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp
r267054 r267076 30 30 31 31 #include "InlineFormattingState.h" 32 #include "LayoutBoxGeometry.h" 32 33 #include "LayoutContext.h" 33 34 #include "LayoutDescendantIterator.h" 34 #include "LayoutGeometry.h"35 35 #include "LayoutInitialContainingBlock.h" 36 36 #include "TableFormattingState.h" -
trunk/Source/WebCore/layout/tableformatting/TableLayout.cpp
r267054 r267076 30 30 31 31 #include "LayoutBox.h" 32 #include "Layout Geometry.h"32 #include "LayoutBoxGeometry.h" 33 33 34 34 namespace WebCore { -
trunk/Source/WebCore/page/FrameViewLayoutContext.cpp
r267054 r267076 43 43 #include "InvalidationContext.h" 44 44 #include "InvalidationState.h" 45 #include "LayoutBoxGeometry.h" 45 46 #include "LayoutContext.h" 46 #include "LayoutGeometry.h"47 47 #include "LayoutState.h" 48 48 #include "LayoutTreeBuilder.h" … … 82 82 // Clean up the render tree state when we don't run RenderView::layout. 83 83 if (renderView.needsLayout()) { 84 auto contentSize = m_layoutState->geometryFor LayoutBox(*m_layoutState->root().firstChild()).size();84 auto contentSize = m_layoutState->geometryForBox(*m_layoutState->root().firstChild()).size(); 85 85 renderView.setSize(contentSize); 86 86 renderView.repaintViewRectangle({ 0, 0, contentSize.width(), contentSize.height() });
Note: See TracChangeset
for help on using the changeset viewer.