Changeset 285863 in webkit
- Timestamp:
- Nov 16, 2021, 8:38:52 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
layout/formattingContexts/inline/InlineLine.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r285862 r285863 1 2021-11-16 Alan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Fix fast/text/basic/005.html 4 https://bugs.webkit.org/show_bug.cgi?id=233150 5 6 Reviewed by Antti Koivisto. 7 8 Negative word-spacing acts as negative margin, pulling the content to the left. In this patch we account for such negative values when 9 computing the overall content width. 10 11 Note that this patch is in preparation for enabling IFC preferred width computation. 12 13 * layout/formattingContexts/inline/InlineLine.cpp: 14 (WebCore::Layout::Line::appendTextContent): 15 1 16 2021-11-16 Wenson Hsieh <wenson_hsieh@apple.com> 2 17 -
trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp
r285826 r285863 344 344 m_contentLogicalWidth = std::max(oldContentLogicalWidth, contentLogicalRight); 345 345 } else if (style.letterSpacing() >= 0) { 346 m_runs.last().expand(inlineTextItem, logicalWidth); 347 m_contentLogicalWidth += logicalWidth; 346 auto& lastRun = m_runs.last(); 347 lastRun.expand(inlineTextItem, logicalWidth); 348 // Ensure that property values that act like negative margin are not making the line wider. 349 m_contentLogicalWidth = std::max(oldContentLogicalWidth, lastRun.logicalRight()); 348 350 } else { 349 351 auto& lastRun = m_runs.last(); … … 351 353 // Negative letter spacing should only shorten the content to the boundary of the previous run. 352 354 // FIXME: We may need to traverse all the way to the previous non-text run (or even across inline boxes). 353 auto lastRunLogicalWidth = lastRun.logicalWidth(); 354 auto contentWidthWithoutLastTextRun = m_contentLogicalWidth - std::max(0.f, lastRunLogicalWidth); 355 auto contentWidthWithoutLastTextRun = [&] { 356 if (style.fontCascade().wordSpacing() >= 0) 357 return m_contentLogicalWidth - std::max(0.f, lastRun.logicalWidth()); 358 // FIXME: Let's see if we need to optimize for this is the rare case of both letter and word spacing being negative. 359 auto rightMostPosition = InlineLayoutUnit { }; 360 for (auto& run : makeReversedRange(m_runs)) 361 rightMostPosition = std::max(rightMostPosition, run.logicalRight()); 362 return std::max(0.f, rightMostPosition); 363 }(); 364 auto lastRunLogicalRight = lastRun.logicalRight(); 355 365 lastRun.expand(inlineTextItem, logicalWidth); 356 m_contentLogicalWidth = std::max(contentWidthWithoutLastTextRun, lastRunLogical Width+ logicalWidth);366 m_contentLogicalWidth = std::max(contentWidthWithoutLastTextRun, lastRunLogicalRight + logicalWidth); 357 367 } 358 368
Note:
See TracChangeset
for help on using the changeset viewer.