Changeset 285716 in webkit
- Timestamp:
- Nov 12, 2021, 6:40:42 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r285715 r285716 1 2021-11-12 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Add inline box margin-start support for visual ordering (bidi) 4 https://bugs.webkit.org/show_bug.cgi?id=233022 5 6 Reviewed by Antti Koivisto. 7 8 Line run geometry is margin box based (only applicable for inline level boxes), while 9 the displayRect() returns border box based geometry (again, only relevant for inline level boxes). 10 When computing the border box based left position using the distanceFromLogicalPreviousRun (line run based) 11 we have to offset it with the margin value. 12 13 * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp: 14 (WebCore::Layout::InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineContent): 15 1 16 2021-11-12 Adrian Perez de Castro <aperez@igalia.com> 2 17 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp
r285628 r285716 96 96 auto displayBoxRect = [&] { 97 97 auto logicalRect = InlineRect { }; 98 auto marginStart = std::optional<LayoutUnit> { }; 98 99 99 100 if (lineRun.isText() || lineRun.isSoftLineBreak()) … … 103 104 else { 104 105 auto& boxGeometry = formattingState.boxGeometry(layoutBox); 106 marginStart = boxGeometry.marginStart(); 105 107 if (lineRun.isBox()) 106 108 logicalRect = lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, boxGeometry); … … 120 122 auto distanceFromLogicalPreviousRun = logicalPreviousRun ? lineRun.logicalLeft() - logicalPreviousRun->logicalRight() : lineRun.logicalLeft(); 121 123 auto visualOrderRect = logicalRect; 122 auto contentLeft = contentRightInVisualOrder + distanceFromLogicalPreviousRun ;124 auto contentLeft = contentRightInVisualOrder + distanceFromLogicalPreviousRun + marginStart.value_or(0); 123 125 visualOrderRect.setLeft(contentLeft); 124 126 // The inline box right edge includes its content as well as the inline box end (padding-right etc). 125 127 // What we need here is the inline box start run's width. 126 contentRightInVisualOrder = lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart()127 ? visualOrderRect.left() + lineRun.logicalWidth()128 : visualOrderRect.right();128 // Note that content width does not refer to content _box_ here (it does include padding and border for inline level boxes). 129 auto contentWidth = lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart() ? lineRun.logicalWidth() - *marginStart : logicalRect.width(); 130 contentRightInVisualOrder = visualOrderRect.left() + contentWidth; 129 131 return visualOrderRect; 130 132 };
Note:
See TracChangeset
for help on using the changeset viewer.