Changeset 252924 in webkit
- Timestamp:
- Nov 28, 2019 6:49:54 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252923 r252924 1 2019-11-28 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Adjust the line's is-visually-empty status after trimming the trailing whitespace content 4 https://bugs.webkit.org/show_bug.cgi?id=204660 5 <rdar://problem/57513035> 6 7 Reviewed by Antti Koivisto. 8 9 We need to check if the line is still visually empty after trimming the trailing content. 10 11 * layout/inlineformatting/InlineLineBox.h: 12 (WebCore::Layout::LineBox::setIsConsideredEmpty): 13 * layout/inlineformatting/InlineLineBuilder.cpp: 14 (WebCore::Layout::LineBuilder::removeTrailingTrimmableContent): 15 (WebCore::Layout::LineBuilder::appendTextContent): 16 * layout/inlineformatting/InlineLineBuilder.h: 17 1 18 2019-11-28 Zalan Bujtas <zalan@apple.com> 2 19 -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h
r252143 r252924 116 116 // Note that it does not necessarily mean visually non-empty line. <span style="font-size: 0px">this is still considered non-empty</span> 117 117 bool isConsideredEmpty() const { return m_isConsideredEmpty; } 118 void setIsConsideredEmpty() { m_isConsideredEmpty = true; } 118 119 void setIsConsideredNonEmpty() { m_isConsideredEmpty = false; } 119 120 -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp
r252923 r252924 235 235 m_inlineItemRuns.clear(); 236 236 m_trimmableContent.clear(); 237 m_lineIsVisuallyEmptyBeforeTrimmableContent = { }; 237 238 } 238 239 … … 436 437 m_lineBox.shrinkHorizontally(m_trimmableContent.width()); 437 438 m_trimmableContent.clear(); 439 // If we trimmed the first visible run on the line, we need to re-check the visibility status. 440 ASSERT(m_lineIsVisuallyEmptyBeforeTrimmableContent.hasValue()); 441 if (*m_lineIsVisuallyEmptyBeforeTrimmableContent) { 442 // Just because the line was visually empty before the trimmed content, it does not necessarily mean it is still visually empty. 443 // <span> </span><span style="padding-left: 10px"></span> <- non-empty 444 auto lineIsVisuallyEmpty = [&] { 445 for (auto& run : m_inlineItemRuns) { 446 if (isVisuallyNonEmpty(*run)) 447 return false; 448 } 449 return true; 450 }; 451 // We could only go from visually non empty -> to visually empty. Trimming runs should never make the line visible. 452 if (lineIsVisuallyEmpty()) 453 m_lineBox.setIsConsideredEmpty(); 454 m_lineIsVisuallyEmptyBeforeTrimmableContent = { }; 455 } 438 456 } 439 457 … … 541 559 if (collapsedRun) 542 560 lineRun->setIsCollapsed(); 543 if (isTrimmable) 561 if (isTrimmable) { 562 // If we ever trim this content, we need to know if the line visibility state needs to be recomputed. 563 if (m_trimmableContent.isEmpty()) 564 m_lineIsVisuallyEmptyBeforeTrimmableContent = isVisuallyEmpty(); 544 565 m_trimmableContent.append(*lineRun); 566 } 545 567 546 568 m_lineBox.expandHorizontally(lineRun->logicalRect().width()); -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h
r252923 r252924 173 173 bool m_hasIntrusiveFloat { false }; 174 174 LineBox m_lineBox; 175 Optional<bool> m_lineIsVisuallyEmptyBeforeTrimmableContent; 175 176 }; 176 177
Note: See TracChangeset
for help on using the changeset viewer.