Changeset 271359 in webkit
- Timestamp:
- Jan 11, 2021 6:56:06 AM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r271358 r271359 1 2021-01-11 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] InlineBox::setHasContent should be called when the inline box actually has some content 4 https://bugs.webkit.org/show_bug.cgi?id=220245 5 6 Reviewed by Antti Koivisto. 7 8 Do not call setHasContent unless the inline box has actual content (excluding border and padding). 9 However the "will stretch the line" logic checks against borders and paddings so move that over to 10 Quirks::inlineLevelBoxAffectsLineBox. 11 This change makes Quirks::inlineLevelBoxAffectsLineBox the only client of LineBox::isConsideredEmpty. 12 13 * layout/inlineformatting/InlineFormattingContextGeometry.cpp: 14 (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes): 15 * layout/inlineformatting/InlineFormattingContextQuirks.cpp: 16 (WebCore::Layout::InlineFormattingContext::Quirks::inlineLevelBoxAffectsLineBox const): 17 1 18 2021-01-11 Kimmo Kinnunen <kkinnunen@apple.com> 2 19 -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
r271351 r271359 218 218 auto createRootInlineBox = [&] { 219 219 auto rootInlineBox = LineBox::InlineLevelBox::createRootInlineBox(rootBox(), horizontalAligmentOffset, lineBox.logicalWidth()); 220 221 auto inlineBoxHasImaginaryStrut = layoutState().inNoQuirksMode();222 auto isInitiallyConsideredNonEmpty = !lineBox.isConsideredEmpty() && inlineBoxHasImaginaryStrut;223 if (isInitiallyConsideredNonEmpty)224 rootInlineBox->setHasContent();225 220 setVerticalGeometryForInlineBox(*rootInlineBox); 226 221 simplifiedVerticalAlignment = { { } , rootInlineBox->layoutBounds().height(), rootInlineBox->layoutBounds().ascent - rootInlineBox->baseline() }; … … 327 322 ASSERT(initialLogicalWidth >= 0); 328 323 auto inlineBox = LineBox::InlineLevelBox::createInlineBox(layoutBox, logicalLeft, initialLogicalWidth); 329 auto& inlineBoxGeometry = formattingContext().geometryForBox(layoutBox);330 // Inline level boxes on empty lines are still considered empty (e.g. <span><div>pre and post blocks are empty</div></span>)331 auto inlineBoxHasImaginaryStrut = layoutState().inNoQuirksMode() && !lineBox.isConsideredEmpty();332 auto isConsideredNonEmpty = inlineBoxHasImaginaryStrut || inlineBoxGeometry.horizontalPadding().valueOr(0_lu) || inlineBoxGeometry.horizontalBorder();333 if (isConsideredNonEmpty)334 inlineBox->setHasContent();335 324 setVerticalGeometryForInlineBox(*inlineBox); 336 325 lineBox.addInlineLevelBox(WTFMove(inlineBox)); -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp
r271351 r271359 43 43 bool InlineFormattingContext::Quirks::inlineLevelBoxAffectsLineBox(const LineBox::InlineLevelBox& inlineLevelBox, const LineBox& lineBox) const 44 44 { 45 if (inlineLevelBox.isInlineBox()) 46 return inlineLevelBox.hasContent(); 45 if (inlineLevelBox.isInlineBox()) { 46 // Inline boxes (e.g. root inline box or <span>) affects line boxes either through the strut or actual content. 47 if (inlineLevelBox.hasContent()) 48 return true; 49 if (!inlineLevelBox.isRootInlineBox()) { 50 auto& boxGeometry = formattingContext().geometryForBox(inlineLevelBox.layoutBox()); 51 if (boxGeometry.horizontalBorder() || boxGeometry.horizontalPadding().valueOr(0_lu)) { 52 // Horizontal border and padding make the inline box stretch the line (e.g. <span style="padding: 10px;"></span>). 53 return true; 54 } 55 } 56 auto inlineBoxHasImaginaryStrut = layoutState().inNoQuirksMode(); 57 return inlineBoxHasImaginaryStrut && !lineBox.isConsideredEmpty(); 58 } 47 59 if (inlineLevelBox.isLineBreakBox()) { 48 60 // <br> in non-standard mode stretches the line box only when the line is empty.
Note: See TracChangeset
for help on using the changeset viewer.