Changeset 283477 in webkit
- Timestamp:
- Oct 3, 2021, 12:32:52 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
layout/formattingContexts/inline/InlineLine.cpp (modified) (5 diffs)
-
layout/formattingContexts/inline/InlineLine.h (modified) (2 diffs)
-
layout/formattingContexts/inline/InlineLineBuilder.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r283474 r283477 1 2021-10-03 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Line functions can compute the "extra horizontal space" 4 https://bugs.webkit.org/show_bug.cgi?id=231127 5 6 Reviewed by Antti Koivisto. 7 8 This is in preparation for making applyRunExpansion hanging whitespace aware. 9 10 * layout/formattingContexts/inline/InlineLine.cpp: 11 (WebCore::Layout::Line::removeCollapsibleContent): 12 (WebCore::Layout::Line::applyRunExpansion): 13 (WebCore::Layout::Line::visuallyCollapseHangingOverflow): 14 * layout/formattingContexts/inline/InlineLine.h: 15 * layout/formattingContexts/inline/InlineLineBuilder.cpp: 16 (WebCore::Layout::LineBuilder::close): 17 1 18 2021-10-03 Alan Bujtas <zalan@apple.com> 2 19 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp
r283474 r283477 61 61 } 62 62 63 void Line::removeCollapsibleContent(InlineLayoutUnit extraHorizontalSpace)63 void Line::removeCollapsibleContent(InlineLayoutUnit horizontalAvailableSpace) 64 64 { 65 65 removeTrailingTrimmableContent(); 66 visuallyCollapseHangingOverflow( extraHorizontalSpace);67 } 68 69 void Line::applyRunExpansion(InlineLayoutUnit extraHorizontalSpace)66 visuallyCollapseHangingOverflow(horizontalAvailableSpace); 67 } 68 69 void Line::applyRunExpansion(InlineLayoutUnit horizontalAvailableSpace) 70 70 { 71 71 ASSERT(formattingContext().root().style().textAlign() == TextAlignMode::Justify); … … 76 76 return; 77 77 // Anything to distribute? 78 if (!extraHorizontalSpace) 78 auto spaceToDistribute = horizontalAvailableSpace - contentLogicalWidth(); 79 if (spaceToDistribute <= 0) 79 80 return; 80 81 … … 126 127 return; 127 128 // Distribute the extra space. 128 auto expansionToDistribute = extraHorizontalSpace / lineExpansionOpportunities;129 auto expansionToDistribute = spaceToDistribute / lineExpansionOpportunities; 129 130 auto accumulatedExpansion = InlineLayoutUnit { }; 130 131 for (size_t runIndex = 0; runIndex < m_runs.size(); ++runIndex) { … … 164 165 } 165 166 166 void Line::visuallyCollapseHangingOverflow(InlineLayoutUnit extraHorizontalSpace)167 void Line::visuallyCollapseHangingOverflow(InlineLayoutUnit horizontalAvailableSpace) 167 168 { 168 169 ASSERT(m_trimmableTrailingContent.isEmpty()); … … 170 171 // ... 171 172 // It may also visually collapse the character advance widths of any that would otherwise overflow. 172 auto overflowWidth = -extraHorizontalSpace;173 auto overflowWidth = contentLogicalWidth() - horizontalAvailableSpace; 173 174 if (overflowWidth <= 0) 174 175 return; -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h
r283474 r283477 59 59 void addTrailingHyphen(InlineLayoutUnit hyphenLogicalWidth); 60 60 61 void removeCollapsibleContent(InlineLayoutUnit extraHorizontalSpace);62 void applyRunExpansion(InlineLayoutUnit extraHorizontalSpace);61 void removeCollapsibleContent(InlineLayoutUnit horizontalAvailableSpace); 62 void applyRunExpansion(InlineLayoutUnit horizontalAvailableSpace); 63 63 64 64 struct Run { … … 155 155 156 156 void removeTrailingTrimmableContent(); 157 void visuallyCollapseHangingOverflow(InlineLayoutUnit extraHorizontalSpace);157 void visuallyCollapseHangingOverflow(InlineLayoutUnit horizontalAvailableSpace); 158 158 159 159 const InlineFormattingContext& formattingContext() const; -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
r283474 r283477 373 373 return lineRange; 374 374 } 375 auto availableWidth = m_lineLogicalRect.width() - m_line.contentLogicalRight();376 m_line.removeCollapsibleContent( availableWidth);375 auto horizontalAvailableSpace = m_lineLogicalRect.width(); 376 m_line.removeCollapsibleContent(horizontalAvailableSpace); 377 377 auto horizontalAlignment = root().style().textAlign(); 378 378 auto runsExpandHorizontally = horizontalAlignment == TextAlignMode::Justify && !isLastLineWithInlineContent(lineRange, needsLayoutRange.end, committedContent.partialTrailingContentLength); 379 379 if (runsExpandHorizontally) 380 m_line.applyRunExpansion( m_lineLogicalRect.width() - m_line.contentLogicalRight());380 m_line.applyRunExpansion(horizontalAvailableSpace); 381 381 auto lineEndsWithHyphen = false; 382 382 if (!m_line.runs().isEmpty()) {
Note:
See TracChangeset
for help on using the changeset viewer.