Changeset 287083 in webkit
- Timestamp:
- Dec 15, 2021, 10:09:48 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287081 r287083 1 2021-12-15 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Use the physical margin/border/padding values for inline boxes when generating the display content 4 https://bugs.webkit.org/show_bug.cgi?id=234346 5 6 Reviewed by Antti Koivisto. 7 8 Display content is always based on visual order. When we construct the display boxes 9 - we visit the line runs in visual order 10 - we make space for margin/border/padding by looking at the physical sides of the content 11 The visually first box may very well be logically the last and this first box's left side (again, visually) 12 may refer to the logical start/end values depending on the inline axis direction. 13 14 E.g in case of right to left inline direction, the border-inline-end value of an inline box should be use as the 15 "visually first" border on the left side of the inline box content. 16 17 It means that 18 - physical values are used when creating the display boxes 19 - and logical values are used throughout the layout 20 which in practice means that isLeftToRightDirection check should only happen before and after layout 21 (physical -> logical and logical -> physical respectively) but never during layout. 22 23 * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp: 24 (WebCore::Layout::marginLeft): 25 (WebCore::Layout::marginRight): 26 (WebCore::Layout::borderLeft): 27 (WebCore::Layout::borderRight): 28 (WebCore::Layout::paddingLeft): 29 (WebCore::Layout::paddingRight): 30 (WebCore::Layout::InlineDisplayContentBuilder::adjustVisualGeometryForDisplayBox): 31 1 32 2021-12-15 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> 2 33 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp
r287043 r287083 42 42 namespace Layout { 43 43 44 static inline LayoutUnit marginLeft(const Layout::BoxGeometry& boxGeometry, bool isLeftToRightDirection) 45 { 46 return isLeftToRightDirection ? boxGeometry.marginStart() : boxGeometry.marginEnd(); 47 } 48 49 static inline LayoutUnit marginRight(const Layout::BoxGeometry& boxGeometry, bool isLeftToRightDirection) 50 { 51 return isLeftToRightDirection ? boxGeometry.marginEnd() : boxGeometry.marginStart(); 52 } 53 54 static inline LayoutUnit borderLeft(const Layout::BoxGeometry& boxGeometry, bool isLeftToRightDirection) 55 { 56 return isLeftToRightDirection ? boxGeometry.borderStart() : boxGeometry.borderEnd(); 57 } 58 59 static inline LayoutUnit borderRight(const Layout::BoxGeometry& boxGeometry, bool isLeftToRightDirection) 60 { 61 return isLeftToRightDirection ? boxGeometry.borderEnd() : boxGeometry.borderStart(); 62 } 63 64 static inline LayoutUnit paddingLeft(const Layout::BoxGeometry& boxGeometry, bool isLeftToRightDirection) 65 { 66 return isLeftToRightDirection ? boxGeometry.paddingStart().value_or(0_lu) : boxGeometry.paddingEnd().value_or(0_lu); 67 } 68 69 static inline LayoutUnit paddingRight(const Layout::BoxGeometry& boxGeometry, bool isLeftToRightDirection) 70 { 71 return isLeftToRightDirection ? boxGeometry.paddingEnd().value_or(0_lu) : boxGeometry.paddingStart().value_or(0_lu); 72 } 73 44 74 static inline OptionSet<InlineDisplay::Box::PositionWithinInlineLevelBox> isFirstLastBox(const InlineLevelBox& inlineBox) 45 75 { … … 425 455 void InlineDisplayContentBuilder::adjustVisualGeometryForDisplayBox(size_t displayBoxNodeIndex, InlineLayoutUnit& contentRightInVisualOrder, InlineLayoutUnit lineBoxLogicalTop, const DisplayBoxTree& displayBoxTree, DisplayBoxes& boxes, const LineBox& lineBox) 426 456 { 457 auto isLeftToRightDirection = root().style().isLeftToRightDirection(); 427 458 // Non-inline box display boxes just need a horizontal adjustment while 428 459 // inline box type of display boxes need … … 436 467 contentRightInVisualOrder += displayBox.width(); 437 468 if (displayBox.isAtomicInlineLevelBox() || displayBox.isGenericInlineLevelBox()) 438 contentRightInVisualOrder += formattingState().boxGeometry(layoutBox).marginEnd();469 contentRightInVisualOrder += marginRight(formattingState().boxGeometry(layoutBox), isLeftToRightDirection); 439 470 return; 440 471 } … … 447 478 return displayBox.setRect(visualRect, visualRect); 448 479 449 contentRightInVisualOrder += boxGeometry.marginStart();450 auto visualRectWithMargin Start = InlineRect { visualRect.top(), contentRightInVisualOrder, visualRect.width(), visualRect.height() };451 displayBox.setRect(visualRectWithMargin Start, visualRectWithMarginStart);452 contentRightInVisualOrder += bo xGeometry.borderAndPaddingStart();480 contentRightInVisualOrder += marginLeft(boxGeometry, isLeftToRightDirection); 481 auto visualRectWithMarginLeft = InlineRect { visualRect.top(), contentRightInVisualOrder, visualRect.width(), visualRect.height() }; 482 displayBox.setRect(visualRectWithMarginLeft, visualRectWithMarginLeft); 483 contentRightInVisualOrder += borderLeft(boxGeometry, isLeftToRightDirection) + paddingLeft(boxGeometry, isLeftToRightDirection); 453 484 }; 454 485 beforeInlineBoxContent(); … … 461 492 return displayBox.setRight(contentRightInVisualOrder); 462 493 463 contentRightInVisualOrder += bo xGeometry.borderAndPaddingEnd();494 contentRightInVisualOrder += borderRight(boxGeometry, isLeftToRightDirection) + paddingRight(boxGeometry, isLeftToRightDirection); 464 495 displayBox.setRight(contentRightInVisualOrder); 465 contentRightInVisualOrder += boxGeometry.marginEnd();496 contentRightInVisualOrder += marginRight(boxGeometry, isLeftToRightDirection); 466 497 }; 467 498 afterInlineBoxContent();
Note:
See TracChangeset
for help on using the changeset viewer.