Changeset 269826 in webkit
- Timestamp:
- Nov 15, 2020 6:25:42 AM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269825 r269826 1 2020-11-15 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Do not use RenderStyle's logical margin API 4 https://bugs.webkit.org/show_bug.cgi?id=218948 5 6 Reviewed by Antti Koivisto. 7 8 https://www.w3.org/TR/css-writing-modes-4/#logical-direction-layout 9 10 "Flow-relative directions are calculated with respect to the writing mode of the containing block of the box 11 and used to abstract layout rules related to the box properties (margins, borders, padding) 12 and any properties related to positioning the box within its containing block 13 (float, clear, top, bottom, left, right, caption-side). 14 For inline-level boxes, the writing mode of the parent box is used instead." 15 16 RenderStyle::marginStart/End/Before/After flips these values based on the box's own writing mode. 17 18 * layout/FormattingContextGeometry.cpp: 19 (WebCore::Layout::usedWritingMode): 20 (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin const): 21 (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin const): 22 1 23 2020-11-15 Zalan Bujtas <zalan@apple.com> 2 24 -
trunk/Source/WebCore/layout/FormattingContextGeometry.cpp
r269744 r269826 1123 1123 } 1124 1124 1125 inline static WritingMode usedWritingMode(const Box& layoutBox) 1126 { 1127 // https://www.w3.org/TR/css-writing-modes-4/#logical-direction-layout 1128 // Flow-relative directions are calculated with respect to the writing mode of the containing block of the box. 1129 // For inline-level boxes, the writing mode of the parent box is used instead. 1130 return layoutBox.isInlineLevelBox() ? layoutBox.parent().style().writingMode() : layoutBox.containingBlock().style().writingMode(); 1131 } 1132 1125 1133 Edges FormattingContext::Geometry::computedBorder(const Box& layoutBox) const 1126 1134 { … … 1150 1158 auto& style = layoutBox.style(); 1151 1159 auto containingBlockWidth = horizontalConstraints.logicalWidth; 1152 return { computedValue(style.marginStart(), containingBlockWidth), computedValue(style.marginEnd(), containingBlockWidth) }; 1160 if (isHorizontalWritingMode(usedWritingMode(layoutBox))) 1161 return { computedValue(style.marginLeft(), containingBlockWidth), computedValue(style.marginRight(), containingBlockWidth) }; 1162 return { computedValue(style.marginTop(), containingBlockWidth), computedValue(style.marginBottom(), containingBlockWidth) }; 1153 1163 } 1154 1164 … … 1157 1167 auto& style = layoutBox.style(); 1158 1168 auto containingBlockWidth = horizontalConstraints.logicalWidth; 1159 return { computedValue(style.marginBefore(), containingBlockWidth), computedValue(style.marginAfter(), containingBlockWidth) }; 1169 if (isHorizontalWritingMode(usedWritingMode(layoutBox))) 1170 return { computedValue(style.marginTop(), containingBlockWidth), computedValue(style.marginBottom(), containingBlockWidth) }; 1171 return { computedValue(style.marginLeft(), containingBlockWidth), computedValue(style.marginRight(), containingBlockWidth) }; 1160 1172 } 1161 1173
Note: See TracChangeset
for help on using the changeset viewer.