Changeset 263597 in webkit
- Timestamp:
- Jun 26, 2020 4:26:54 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r263594 r263597 1 2020-06-26 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][BFC] Add support for <center> 4 https://bugs.webkit.org/show_bug.cgi?id=213649 5 6 Reviewed by Antti Koivisto. 7 8 * fast/layoutformattingcontext/center-alignment-with-block-content-simple-expected.html: Added. 9 * fast/layoutformattingcontext/center-alignment-with-block-content-simple.html: Added. 10 1 11 2020-06-26 Karl Rackler <rackler@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r263588 r263597 1 2020-06-26 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][BFC] Add support for <center> 4 https://bugs.webkit.org/show_bug.cgi?id=213649 5 6 Reviewed by Antti Koivisto. 7 8 Adjust the margin box to center the block content (this is very similar to [style="margin-left: auto; margin-right: auto;"]). 9 10 Test: fast/layoutformattingcontext/center-alignment-with-block-content-simple.html 11 12 * layout/blockformatting/BlockFormattingContextGeometry.cpp: 13 (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): 14 1 15 2020-06-26 Jason Lawrence <lawrence.j@apple.com> 2 16 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
r263260 r263597 141 141 142 142 auto containingBlockWidth = horizontalConstraints.logicalWidth; 143 auto& containingBlockStyle = layoutBox.containingBlock().style(); 143 144 auto& boxGeometry = formattingContext().geometryForBox(layoutBox); 144 145 … … 160 161 // #2 161 162 if (width && computedHorizontalMargin.start && computedHorizontalMargin.end) { 162 if ( layoutBox.containingBlock().style().isLeftToRightDirection()) {163 if (containingBlockStyle.isLeftToRightDirection()) { 163 164 usedHorizontalMargin.start = *computedHorizontalMargin.start; 164 165 usedHorizontalMargin.end = containingBlockWidth - (usedHorizontalMargin.start + borderLeft + paddingLeft + *width + paddingRight + borderRight); … … 193 194 } 194 195 196 auto shouldApplyCenterAlignForBlockContent = containingBlockStyle.textAlign() == TextAlignMode::WebKitCenter && (computedHorizontalMargin.start || computedHorizontalMargin.end); 197 if (shouldApplyCenterAlignForBlockContent) { 198 auto borderBoxWidth = (borderLeft + paddingLeft + *width + paddingRight + borderRight); 199 auto marginStart = computedHorizontalMargin.start.valueOr(0); 200 auto marginEnd = computedHorizontalMargin.end.valueOr(0); 201 auto centeredLogicalLeftForMarginBox = std::max((containingBlockWidth - borderBoxWidth - marginStart - marginEnd) / 2, 0_lu); 202 usedHorizontalMargin.start = centeredLogicalLeftForMarginBox + marginStart; 203 usedHorizontalMargin.end = containingBlockWidth - borderBoxWidth - marginStart + marginEnd; 204 } 195 205 ASSERT(width); 196 206
Note: See TracChangeset
for help on using the changeset viewer.