Changeset 287062 in webkit
- Timestamp:
- Dec 14, 2021, 9:44:52 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
layout/integration/LayoutIntegrationLineLayout.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287059 r287062 1 2021-12-14 Alan Bujtas <zalan@apple.com> 2 3 [IFC][Integration] Use logical margin/border/padding values in layout 4 https://bugs.webkit.org/show_bug.cgi?id=234305 5 6 Reviewed by Antti Koivisto. 7 8 Can't use RenderBoxModelObject::borderStart/End logical values as they return values based on the _renderer_'s 9 direction and not the direction the renderer is aligned within. 10 11 * layout/integration/LayoutIntegrationLineLayout.cpp: 12 (WebCore::LayoutIntegration::LineLayout::updateLayoutBoxDimensions): 13 (WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions): 14 1 15 2021-12-14 Jean-Yves Avenard <jya@apple.com> 2 16 -
trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
r286957 r287062 149 149 } 150 150 151 static inline Layout::BoxGeometry::HorizontalMargin logicalMargin(const RenderBoxModelObject& renderer, bool isLeftToRightDirection, bool retainMarginStart = true, bool retainMarginEnd = true) 152 { 153 auto marginStart = LayoutUnit { 0_lu }; 154 auto marginEnd = LayoutUnit { 0_lu }; 155 if (retainMarginStart) 156 marginStart = isLeftToRightDirection ? renderer.marginLeft() : renderer.marginRight(); 157 if (retainMarginEnd) 158 marginEnd = isLeftToRightDirection ? renderer.marginRight() : renderer.marginLeft(); 159 return { marginStart, marginEnd }; 160 } 161 162 static inline Layout::Edges logicalBorder(const RenderBoxModelObject& renderer, bool isLeftToRightDirection, bool retainBorderStart = true, bool retainBorderEnd = true) 163 { 164 auto borderStart = LayoutUnit { 0_lu }; 165 auto borderEnd = LayoutUnit { 0_lu }; 166 if (retainBorderStart) 167 borderStart = isLeftToRightDirection ? renderer.borderLeft() : renderer.borderRight(); 168 if (retainBorderEnd) 169 borderEnd = isLeftToRightDirection ? renderer.borderRight() : renderer.borderLeft(); 170 return { { borderStart, borderEnd }, { renderer.borderTop(), renderer.borderBottom() } }; 171 } 172 173 static inline Layout::Edges logicalPadding(const RenderBoxModelObject& renderer, bool isLeftToRightDirection, bool retainPaddingStart = true, bool retainPaddingEnd = true) 174 { 175 auto paddingStart = LayoutUnit { 0_lu }; 176 auto paddingEnd = LayoutUnit { 0_lu }; 177 if (retainPaddingStart) 178 paddingStart = isLeftToRightDirection ? renderer.paddingLeft() : renderer.paddingRight(); 179 if (retainPaddingEnd) 180 paddingEnd = isLeftToRightDirection ? renderer.paddingRight() : renderer.paddingLeft(); 181 return Layout::Edges { { paddingStart, paddingEnd }, { renderer.paddingTop(), renderer.paddingBottom() } }; 182 } 183 151 184 void LineLayout::updateLayoutBoxDimensions(const RenderBox& replacedOrInlineBlock) 152 185 { … … 170 203 replacedBoxGeometry.setContentBoxHeight(replacedOrInlineBlock.contentHeight()); 171 204 172 replacedBoxGeometry.setBorder({ { replacedOrInlineBlock.borderLeft(), replacedOrInlineBlock.borderRight() }, { replacedOrInlineBlock.borderTop(), replacedOrInlineBlock.borderBottom() } });173 replacedBoxGeometry.setPadding(Layout::Edges { { replacedOrInlineBlock.paddingLeft(), replacedOrInlineBlock.paddingRight() }, { replacedOrInlineBlock.paddingTop(), replacedOrInlineBlock.paddingBottom() } });174 175 replacedBoxGeometry.setHorizontalMargin({ replacedOrInlineBlock.marginLeft(), replacedOrInlineBlock.marginRight() });176 205 replacedBoxGeometry.setVerticalMargin({ replacedOrInlineBlock.marginTop(), replacedOrInlineBlock.marginBottom() }); 206 auto isLeftToRightDirection = flow().style().isLeftToRightDirection(); 207 replacedBoxGeometry.setHorizontalMargin(logicalMargin(replacedOrInlineBlock, isLeftToRightDirection)); 208 replacedBoxGeometry.setBorder(logicalBorder(replacedOrInlineBlock, isLeftToRightDirection)); 209 replacedBoxGeometry.setPadding(logicalPadding(replacedOrInlineBlock, isLeftToRightDirection)); 177 210 178 211 auto baseline = replacedOrInlineBlock.baselinePosition(AlphabeticBaseline, false /* firstLine */, HorizontalLine, PositionOnContainingLine); … … 199 232 auto shouldNotRetainBorderPaddingAndMarginStart = renderInline.parent()->isAnonymousBlock() && renderInline.isContinuation(); 200 233 auto shouldNotRetainBorderPaddingAndMarginEnd = renderInline.parent()->isAnonymousBlock() && !renderInline.isContinuation() && renderInline.inlineContinuation(); 201 202 auto horizontalMargin = Layout::BoxGeometry::HorizontalMargin { shouldNotRetainBorderPaddingAndMarginStart ? 0_lu : renderInline.marginLeft(), shouldNotRetainBorderPaddingAndMarginEnd ? 0_lu : renderInline.marginRight() }; 203 auto horizontalBorder = Layout::HorizontalEdges { shouldNotRetainBorderPaddingAndMarginStart ? 0_lu : renderInline.borderLeft(), shouldNotRetainBorderPaddingAndMarginEnd ? 0_lu : renderInline.borderRight() }; 204 auto horizontalPadding = Layout::HorizontalEdges { shouldNotRetainBorderPaddingAndMarginStart ? 0_lu : renderInline.paddingLeft(), shouldNotRetainBorderPaddingAndMarginEnd ? 0_lu : renderInline.paddingRight() }; 205 206 boxGeometry.setPadding(Layout::Edges { horizontalPadding, { renderInline.paddingTop(), renderInline.paddingBottom() } }); 207 boxGeometry.setBorder({ horizontalBorder, { renderInline.borderTop(), renderInline.borderBottom() } }); 208 boxGeometry.setHorizontalMargin(horizontalMargin); 234 209 235 boxGeometry.setVerticalMargin({ }); 236 auto isLeftToRightDirection = flow().style().isLeftToRightDirection(); 237 boxGeometry.setHorizontalMargin(logicalMargin(renderInline, isLeftToRightDirection, !shouldNotRetainBorderPaddingAndMarginStart, !shouldNotRetainBorderPaddingAndMarginEnd)); 238 boxGeometry.setBorder(logicalBorder(renderInline, isLeftToRightDirection, !shouldNotRetainBorderPaddingAndMarginStart, !shouldNotRetainBorderPaddingAndMarginEnd)); 239 boxGeometry.setPadding(logicalPadding(renderInline, isLeftToRightDirection, !shouldNotRetainBorderPaddingAndMarginStart, !shouldNotRetainBorderPaddingAndMarginEnd)); 210 240 } 211 241
Note:
See TracChangeset
for help on using the changeset viewer.