Changeset 273805 in webkit
- Timestamp:
- Mar 2, 2021, 8:29:26 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
layout/inlineformatting/InlineFormattingContextGeometry.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r273777 r273805 1 2021-03-02 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Enable simplified vertical alignment for hard line breaks 4 https://bugs.webkit.org/show_bug.cgi?id=222606 5 6 Reviewed by Antti Koivisto. 7 8 This patch enables the simplified vertical alignment for cases when the line ends with a non-stretching hard line break. 9 e.g. 10 <div>text<br>content</div> 11 <div>text<span><br></span>content</div> 12 but not when 13 <div>text<span style="font-size: 100px;"><br></span>content</div> 14 15 * layout/inlineformatting/InlineFormattingContextGeometry.cpp: 16 (WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes): 17 (WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::canUseSimplifiedAlignment): 18 (WebCore::Layout::LineBoxBuilder::SimplifiedVerticalAlignment::align): 19 1 20 2021-03-02 Yusuke Suzuki <ysuzuki@apple.com> 2 21 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
r273754 r273805 365 365 auto lineBreakBox = LineBox::InlineLevelBox::createLineBreakBox(layoutBox, logicalLeft); 366 366 setVerticalGeometryForInlineBox(*lineBreakBox); 367 simplifiedAlignVerticallyIfApplicable(*lineBreakBox, formattingContext().geometryForBox(layoutBox)); 367 368 lineBox.addInlineLevelBox(WTFMove(lineBreakBox)); 368 simplifiedVerticalAlignment.setEnabled(false);369 369 continue; 370 370 } … … 637 637 && inlineLevelBoxGeometry.marginBoxHeight() <= rootInlineBox.baseline(); 638 638 } 639 if (inlineLevelBox.isLineBreakBox()) { 640 // Baseline aligned, non-stretchy line breaks e.g. <div><span><br></span></div> but not <div><span style="font-size: 100px;"><br></span></div>. 641 auto& layoutBox = inlineLevelBox.layoutBox(); 642 return layoutBox.style().verticalAlign() == VerticalAlign::Baseline 643 && inlineLevelBox.baseline() <= rootInlineBox.baseline(); 644 } 639 645 return false; 640 646 } … … 642 648 void LineBoxBuilder::SimplifiedVerticalAlignment::align(LineBox::InlineLevelBox& inlineLevelBox) 643 649 { 644 if (inlineLevelBox.isAtomicInlineLevelBox() ) {650 if (inlineLevelBox.isAtomicInlineLevelBox() || inlineLevelBox.isLineBreakBox()) { 645 651 // Only baseline alignment for now. 646 652 inlineLevelBox.setLogicalTop(m_rootInlineBox.baseline() - inlineLevelBox.baseline());
Note:
See TracChangeset
for help on using the changeset viewer.