Changeset 270151 in webkit
- Timestamp:
- Nov 21, 2020 12:04:56 PM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r270150 r270151 1 2020-11-21 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Treat floats as soft wrap opportunities 4 https://bugs.webkit.org/show_bug.cgi?id=219235 5 6 Reviewed by Antti Koivisto. 7 8 While floats are not part of the inline content and they are not supposed to introduce soft wrap opportunities, 9 e.g. [text][float box][float box][text][float box][text] is essentially just [text][text][text] 10 figuring out whether a float (or set of floats) should stay on the line or not (and handle potentially out of order inline items) 11 brings in unnecessary complexity (and apparently Blink works like this too). 12 13 * layout/inlineformatting/InlineLineBuilder.cpp: 14 (WebCore::Layout::isAtSoftWrapOpportunity): 15 (WebCore::Layout::LineBuilder::nextWrapOpportunity const): 16 1 17 2020-11-21 Antti Koivisto <antti@apple.com> 2 18 -
trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp
r270114 r270151 79 79 // An incoming <img> box would enable us to commit the "<span>prior_continuous_content</span>" content 80 80 // but an incoming text content would not necessarily. 81 ASSERT(current.isText() || current.isBox() );82 ASSERT(next.isText() || next.isBox() );81 ASSERT(current.isText() || current.isBox() || current.isFloat()); 82 ASSERT(next.isText() || next.isBox() || next.isFloat()); 83 83 if (current.isText() && next.isText()) { 84 84 auto& currentInlineTextItem = downcast<InlineTextItem>(current); … … 102 102 // [text-][text] : after [hyphen] position is a soft wrap opportunity. 103 103 return endsWithSoftWrapOpportunity(currentInlineTextItem, nextInlineTextItem); 104 } 105 if (current.isFloat() || next.isFloat()) { 106 // While floats are not part of the inline content and they are not supposed to introduce soft wrap opportunities, 107 // e.g. [text][float box][float box][text][float box][text] is essentially just [text][text][text] 108 // figuring out whether a float (or set of floats) should stay on the line or not (and handle potentially out of order inline items) 109 // brings in unnecessary complexity. 110 return true; 104 111 } 105 112 if (current.isBox() || next.isBox()) { … … 516 523 return ++index; 517 524 } 518 if (inlineItem.isFloat()) {519 // Floats are not part of the inline content. We ignore them as far as wrap opportunities are concerned.520 // [text][float box][text] is essentially just [text][text]521 continue;522 }523 525 if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxEnd()) { 524 526 // There's no wrapping opportunity between <span>text, <span></span> or </span>text. 525 527 continue; 526 528 } 527 ASSERT(inlineItem.isText() || inlineItem.isBox() );529 ASSERT(inlineItem.isText() || inlineItem.isBox() || inlineItem.isFloat()); 528 530 if (!previousInlineItemIndex) { 529 531 previousInlineItemIndex = index; 530 532 continue; 531 533 } 532 if (isAtSoftWrapOpportunity(m_inlineFormattingContext, m_inlineItems[*previousInlineItemIndex], m_inlineItems[index])) { 534 auto& previousItem = m_inlineItems[*previousInlineItemIndex]; 535 auto& currentItem = m_inlineItems[index]; 536 if (isAtSoftWrapOpportunity(m_inlineFormattingContext, previousItem, currentItem)) { 537 if (!previousItem.isText() || !currentItem.isText()) 538 return index; 533 539 // There's a soft wrap opportunity between 'previousInlineItemIndex' and 'index'. 534 540 // Now forward-find from the start position to see where we can actually wrap.
Note: See TracChangeset
for help on using the changeset viewer.