Changeset 253004 in webkit
- Timestamp:
- Dec 2, 2019 12:16:07 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r253003 r253004 1 2019-12-02 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Adjust trailing runs horizontally while trimming content 4 https://bugs.webkit.org/show_bug.cgi?id=204749 5 <rdar://problem/57559163> 6 7 Reviewed by Antti Koivisto. 8 9 When trailing content is getting trimmed, we also need to adjust subsequent trailing runs e.g. <span> </span> <- the [container end]'s run should be adjusted. 10 11 * layout/inlineformatting/InlineLineBuilder.cpp: 12 (WebCore::Layout::LineBuilder::removeTrailingTrimmableContent): 13 (WebCore::Layout::LineBuilder::appendTextContent): there's nothing to trim when the spacing is zero or negative. 14 * layout/inlineformatting/InlineLineBuilder.h: 15 (WebCore::Layout::LineBuilder::InlineItemRun::moveHorizontally): 16 1 17 2019-12-02 Zalan Bujtas <zalan@apple.com> 2 18 -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp
r253003 r253004 377 377 auto hasSeenNonWhitespaceTextContent = false; 378 378 #endif 379 // Collapse trimmable trailing content. 379 // Collapse trimmable trailing content and move all the other trailing runs. 380 // <span> </span><span></span> -> 381 // [whitespace][container end][container start][container end] 382 // Trim the whitespace run and move the trailing inline container runs to the left. 383 LayoutUnit accumulatedTrimmedWidth; 380 384 for (auto index = *m_trimmableContent.firstRunIndex(); index < m_inlineItemRuns.size(); ++index) { 381 385 auto& run = m_inlineItemRuns[index]; 386 run.moveHorizontally(-accumulatedTrimmedWidth); 382 387 if (!run.isText()) { 383 388 ASSERT(run.isContainerStart() || run.isContainerEnd() || run.isForcedLineBreak()); 384 389 continue; 385 390 } 386 if (run.isWhitespace()) 391 if (run.isWhitespace()) { 392 accumulatedTrimmedWidth += run.logicalWidth(); 387 393 run.setCollapsesToZeroAdvanceWidth(); 388 else {394 } else { 389 395 ASSERT(!hasSeenNonWhitespaceTextContent); 390 396 #ifndef NDEBUG … … 392 398 #endif 393 399 // Must be a letter spacing trim. 394 ASSERT(run.layoutBox().style().letterSpacing()); 400 ASSERT(run.layoutBox().style().letterSpacing() > 0); 401 accumulatedTrimmedWidth += run.layoutBox().style().letterSpacing(); 395 402 run.removeTrailingLetterSpacing(); 396 403 } 397 404 } 405 ASSERT(accumulatedTrimmedWidth == m_trimmableContent.width()); 398 406 m_lineBox.shrinkHorizontally(m_trimmableContent.width()); 399 407 m_trimmableContent.clear(); … … 518 526 // Trailing whitespace content is fully trimmable so as the trailing letter space. 519 527 auto isFullyTrimmable = !shouldPreserveTrailingContent(inlineItem); 520 auto isPartiallyTrimmable = !inlineItem.isWhitespace() && inlineItem.style().letterSpacing() ;528 auto isPartiallyTrimmable = !inlineItem.isWhitespace() && inlineItem.style().letterSpacing() > 0; 521 529 auto isTrimmable = isFullyTrimmable || isPartiallyTrimmable; 522 530 // Reset the trimmable content if needed. -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h
r253003 r253004 173 173 bool isCollapsed() const { return m_isCollapsed; } 174 174 175 void moveHorizontally(LayoutUnit offset) { m_logicalWidth += offset; } 176 175 177 void removeTrailingLetterSpacing(); 176 178 void setCollapsesToZeroAdvanceWidth();
Note: See TracChangeset
for help on using the changeset viewer.