Changeset 253001 in webkit
- Timestamp:
- Dec 2, 2019 11:52:10 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252998 r253001 1 2019-12-02 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] TrimmableContent only needs to keep track of the first trimmable run index 4 https://bugs.webkit.org/show_bug.cgi?id=204747 5 <rdar://problem/57557732> 6 7 Reviewed by Antti Koivisto. 8 9 Every run after the first trimmable run should either also be trimmable (more whitespace) or skippable (</span>). 10 11 * layout/inlineformatting/InlineLineBuilder.cpp: 12 (WebCore::Layout::LineBuilder::removeTrailingTrimmableContent): 13 (WebCore::Layout::LineBuilder::TrimmableContent::append): 14 * layout/inlineformatting/InlineLineBuilder.h: 15 (WebCore::Layout::LineBuilder::TrimmableContent::firstRunIndex): 16 (WebCore::Layout::LineBuilder::TrimmableContent::isEmpty const): 17 (WebCore::Layout::LineBuilder::TrimmableContent::clear): 18 (WebCore::Layout::LineBuilder::TrimmableContent::runIndexes): Deleted. 19 1 20 2019-12-02 Alex Christensen <achristensen@webkit.org> 2 21 -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp
r252982 r253001 377 377 return; 378 378 379 // Collapse trimmable trailing content 380 for (auto trimmableRunIndex : m_trimmableContent.runIndexes()) { 381 auto& trimmableRun = m_inlineItemRuns[trimmableRunIndex]; 382 ASSERT(trimmableRun.isText()); 383 if (trimmableRun.isWhitespace()) 384 trimmableRun.setCollapsesToZeroAdvanceWidth(); 385 else 386 trimmableRun.removeTrailingLetterSpacing(); 379 #ifndef NDEBUG 380 auto hasSeenNonWhitespaceTextContent = false; 381 #endif 382 // Collapse trimmable trailing content. 383 for (auto index = *m_trimmableContent.firstRunIndex(); index < m_inlineItemRuns.size(); ++index) { 384 auto& run = m_inlineItemRuns[index]; 385 if (!run.isText()) { 386 ASSERT(run.isContainerStart() || run.isContainerEnd() || run.isForcedLineBreak()); 387 continue; 388 } 389 if (run.isWhitespace()) 390 run.setCollapsesToZeroAdvanceWidth(); 391 else { 392 ASSERT(!hasSeenNonWhitespaceTextContent); 393 #ifndef NDEBUG 394 hasSeenNonWhitespaceTextContent = true; 395 #endif 396 // Must be a letter spacing trim. 397 ASSERT(run.layoutBox().style().letterSpacing()); 398 run.removeTrailingLetterSpacing(); 399 } 387 400 } 388 401 m_lineBox.shrinkHorizontally(m_trimmableContent.width()); … … 715 728 itemRunWidth = std::max(0_lu, itemRunWidth); 716 729 m_width += itemRunWidth; 730 m_firstRunIndex = m_firstRunIndex.valueOr(runIndex); 717 731 m_lastRunIsFullyTrimmable = isFullyTrimmable == IsFullyTrimmable::Yes; 718 m_runIndexes.append(runIndex);719 732 } 720 733 -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h
r252972 r253001 195 195 196 196 LayoutUnit width() const { return m_width; } 197 Vector<size_t, 5>& runIndexes() { return m_runIndexes; }198 bool isEmpty() const { return m_runIndexes.isEmpty(); }197 Optional<size_t> firstRunIndex() { return m_firstRunIndex; } 198 bool isEmpty() const { return !m_firstRunIndex.hasValue(); } 199 199 bool isTrailingContentFullyTrimmable() const { return m_lastRunIsFullyTrimmable; } 200 200 201 201 private: 202 Vector<size_t, 5> m_runIndexes;202 Optional<size_t> m_firstRunIndex; 203 203 LayoutUnit m_width; 204 204 bool m_lastRunIsFullyTrimmable { false }; … … 219 219 inline void LineBuilder::TrimmableContent::clear() 220 220 { 221 m_ runIndexes.clear();221 m_firstRunIndex = { }; 222 222 m_width = { }; 223 223 m_lastRunIsFullyTrimmable = false;
Note: See TracChangeset
for help on using the changeset viewer.