Changeset 271347 in webkit
- Timestamp:
- Jan 9, 2021 4:31:53 AM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r271341 r271347 1 2021-01-09 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][IFC] Use the bottom margin edge as the baseline for inline-block when overflow is not visible 4 https://bugs.webkit.org/show_bug.cgi?id=220481 5 6 Reviewed by Antti Koivisto. 7 8 "The baseline of an 'inline-block' is the baseline of its last line box in the normal flow, unless it has either no in-flow line boxes 9 or if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge." 10 https://www.w3.org/TR/CSS22/visudet.html#leading 11 12 * layout/inlineformatting/InlineFormattingContextGeometry.cpp: 13 (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes): 14 1 15 2021-01-08 Peng Liu <peng.liu6@apple.com> 2 16 -
trunk/Source/WebCore/layout/LayoutState.cpp
r267515 r271347 245 245 } 246 246 247 bool LayoutState::shouldNotSynthesizeInlineBlockBaseline() const 248 { 249 return RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled(); 250 } 251 247 252 } 248 253 } -
trunk/Source/WebCore/layout/LayoutState.h
r267515 r271347 94 94 void setIsIntegratedRootBoxFirstChild(bool); 95 95 bool shouldIgnoreTrailingLetterSpacing() const; 96 bool shouldNotSynthesizeInlineBlockBaseline() const; 96 97 97 98 private: -
trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
r271116 r271347 272 272 auto marginBoxHeight = inlineLevelBoxGeometry.marginBoxHeight(); 273 273 auto ascent = InlineLayoutUnit { }; 274 if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) { 275 auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox)); 276 auto& lastLine = formattingState.lines().last(); 277 auto inlineBlockBaseline = lastLine.lineBoxLogicalRect().top() + lastLine.baseline(); 278 ascent = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderTop() + inlineLevelBoxGeometry.paddingTop().valueOr(0) + inlineBlockBaseline; 274 if (layoutState().shouldNotSynthesizeInlineBlockBaseline()) { 275 // Integration codepath constructs replaced boxes for inline-block content. 276 ASSERT(layoutBox.isReplacedBox()); 277 ascent = *downcast<ReplacedBox>(layoutBox).baseline(); 278 } else if (layoutBox.isInlineBlockBox()) { 279 // The baseline of an 'inline-block' is the baseline of its last line box in the normal flow, unless it has either no in-flow line boxes or 280 // if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge. 281 auto synthesizeBaseline = !layoutBox.establishesInlineFormattingContext() || !layoutBox.style().isOverflowVisible(); 282 if (synthesizeBaseline) 283 ascent = marginBoxHeight; 284 else { 285 auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox)); 286 auto& lastLine = formattingState.lines().last(); 287 auto inlineBlockBaseline = lastLine.lineBoxLogicalRect().top() + lastLine.baseline(); 288 ascent = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderTop() + inlineLevelBoxGeometry.paddingTop().valueOr(0) + inlineBlockBaseline; 289 } 279 290 } else if (layoutBox.isReplacedBox()) 280 291 ascent = downcast<ReplacedBox>(layoutBox).baseline().valueOr(marginBoxHeight);
Note: See TracChangeset
for help on using the changeset viewer.