Changeset 285784 in webkit
- Timestamp:
- Nov 13, 2021, 3:28:17 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r285783 r285784 1 2021-11-13 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Inline box end's padding/border/margin should be taken into account when computing horizontal position for bidi content 4 https://bugs.webkit.org/show_bug.cgi?id=233083 5 6 Reviewed by Antti Koivisto. 7 8 Let's decouple the "display box rect" and the "content right in visual order" computation. 9 There are runs (e.g. inline box end) that don't need to call displayBoxRect() but they 10 still affect the "content right in visual order" (<span style="border-right: 10px solid green">). 11 12 * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp: 13 (WebCore::Layout::InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineContent): add the additional lineRun.isInlineBoxEnd() case. 14 1 15 2021-11-13 Alan Bujtas <zalan@apple.com> 2 16 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp
r285716 r285784 104 104 else { 105 105 auto& boxGeometry = formattingState.boxGeometry(layoutBox); 106 marginStart = boxGeometry.marginStart();107 if (lineRun.isBox())106 if (lineRun.isBox()) { 107 marginStart = boxGeometry.marginStart(); 108 108 logicalRect = lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, boxGeometry); 109 else if (lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart()) 109 } else if (lineRun.isInlineBoxStart()) { 110 marginStart = boxGeometry.marginStart(); 111 logicalRect = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry); 112 } else if (lineRun.isLineSpanningInlineBoxStart()) 110 113 logicalRect = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry); 111 114 else … … 124 127 auto contentLeft = contentRightInVisualOrder + distanceFromLogicalPreviousRun + marginStart.value_or(0); 125 128 visualOrderRect.setLeft(contentLeft); 126 // The inline box right edge includes its content as well as the inline box end (padding-right etc).127 // What we need here is the inline box start run's width.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;131 129 return visualOrderRect; 132 130 }; … … 134 132 if (lineRun.isText()) { 135 133 auto textRunRect = displayBoxRect(); 134 contentRightInVisualOrder = textRunRect.right(); 135 136 136 auto inkOverflow = [&] { 137 137 auto initialContaingBlockSize = RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled() … … 191 191 ASSERT(layoutBox.isAtomicInlineLevelBox()); 192 192 auto borderBoxRect = displayBoxRect(); 193 contentRightInVisualOrder = borderBoxRect.right(); 193 194 // FIXME: Add ink overflow support for atomic inline level boxes (e.g. box shadow). 194 195 boxes.append({ lineIndex, InlineDisplay::Box::Type::AtomicInlineLevelBox, layoutBox, lineRun.bidiLevel(), borderBoxRect, borderBoxRect, lineRun.expansion(), { } }); … … 211 212 } 212 213 if (lineRun.isInlineBoxStart()) { 214 auto& boxGeometry = formattingState.boxGeometry(layoutBox); 213 215 // This inline box showed up first on this line. 214 216 auto inlineBoxBorderBox = displayBoxRect(); 217 contentRightInVisualOrder += lineRun.logicalWidth(); 215 218 if (lineBox.hasContent()) { 216 219 // FIXME: It's expected to not have any boxes on empty lines. We should reconsider this. … … 223 226 } 224 227 225 auto& boxGeometry = formattingState.boxGeometry(layoutBox);226 228 auto inlineBoxSize = LayoutSize { LayoutUnit::fromFloatCeil(inlineBoxBorderBox.width()), LayoutUnit::fromFloatCeil(inlineBoxBorderBox.height()) }; 227 229 auto logicalRect = Rect { LayoutPoint { inlineBoxBorderBox.topLeft() }, inlineBoxSize }; … … 244 246 auto& inlineBox = lineBox.inlineLevelBoxForLayoutBox(layoutBox); 245 247 auto inlineBoxBorderBox = displayBoxRect(); 248 // The content right edge should not include the entire inline box here (including its content and right edge). 249 contentRightInVisualOrder += lineRun.logicalWidth(); 246 250 ASSERT(!inlineBox.isFirstBox()); 247 251 boxes.append({ lineIndex, InlineDisplay::Box::Type::NonRootInlineBox, layoutBox, lineRun.bidiLevel(), inlineBoxBorderBox, inlineBoxBorderBox, { }, { }, inlineBox.hasContent(), isFirstLastBox(inlineBox) }); … … 259 263 continue; 260 264 } 261 ASSERT(lineRun.isInlineBoxEnd() || lineRun.isWordBreakOpportunity()); 265 if (lineRun.isInlineBoxEnd()) { 266 contentRightInVisualOrder += lineRun.logicalWidth(); 267 continue; 268 } 269 ASSERT(lineRun.isWordBreakOpportunity()); 262 270 } 263 271 }
Note:
See TracChangeset
for help on using the changeset viewer.