Changeset 287036 in webkit
- Timestamp:
- Dec 14, 2021, 11:45:20 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
layout/formattingContexts/inline/InlineLineBoxBuilder.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287030 r287036 1 2021-12-14 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Take inline axis direction into account when computing horizontal alignment offset 4 https://bugs.webkit.org/show_bug.cgi?id=234286 5 6 Reviewed by Antti Koivisto. 7 8 This is in preparation for computing the content visual start when text-align is non-initial. 9 10 * layout/formattingContexts/inline/InlineLineBoxBuilder.cpp: 11 (WebCore::Layout::horizontalAlignmentOffset): 12 (WebCore::Layout::LineBoxBuilder::build): 13 1 14 2021-12-11 Dean Jackson <dino@apple.com> 2 15 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp
r287028 r287036 37 37 namespace Layout { 38 38 39 static std::optional<InlineLayoutUnit> horizontalAlignmentOffset(TextAlignMode textAlign, const LineBuilder::LineContent& lineContent )39 static std::optional<InlineLayoutUnit> horizontalAlignmentOffset(TextAlignMode textAlign, const LineBuilder::LineContent& lineContent, bool isLeftToRightDirection) 40 40 { 41 41 // Depending on the line’s alignment/justification, the hanging glyph can be placed outside the line box. … … 73 73 case TextAlignMode::Left: 74 74 case TextAlignMode::WebKitLeft: 75 if (!isLeftToRightDirection) 76 return extraHorizontalSpace; 77 FALLTHROUGH; 75 78 case TextAlignMode::Start: 76 79 return { }; 77 80 case TextAlignMode::Right: 78 81 case TextAlignMode::WebKitRight: 82 if (!isLeftToRightDirection) 83 return { }; 84 FALLTHROUGH; 79 85 case TextAlignMode::End: 80 86 return extraHorizontalSpace; … … 100 106 LineBoxBuilder::LineAndLineBox LineBoxBuilder::build(const LineBuilder::LineContent& lineContent, size_t lineIndex) 101 107 { 102 auto textAlign = !lineIndex ? rootBox().firstLineStyle().textAlign() : rootBox().style().textAlign();103 auto rootInlineBoxAlignmentOffset = Layout::horizontalAlignmentOffset( textAlign, lineContent).value_or(InlineLayoutUnit { });108 auto& rootStyle = lineIndex ? rootBox().firstLineStyle() : rootBox().style(); 109 auto rootInlineBoxAlignmentOffset = Layout::horizontalAlignmentOffset(rootStyle.textAlign(), lineContent, rootStyle.isLeftToRightDirection()).value_or(InlineLayoutUnit { }); 104 110 auto lineBox = LineBox { rootBox(), rootInlineBoxAlignmentOffset, lineContent.contentLogicalWidth, lineIndex, lineContent.nonSpanningInlineLevelBoxCount }; 105 111
Note:
See TracChangeset
for help on using the changeset viewer.