Title: [271347] trunk/Source/WebCore
- Revision
- 271347
- Author
- [email protected]
- Date
- 2021-01-09 04:31:53 -0800 (Sat, 09 Jan 2021)
Log Message
[LFC][IFC] Use the bottom margin edge as the baseline for inline-block when overflow is not visible
https://bugs.webkit.org/show_bug.cgi?id=220481
Reviewed by Antti Koivisto.
"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 if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge."
https://www.w3.org/TR/CSS22/visudet.html#leading
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (271346 => 271347)
--- trunk/Source/WebCore/ChangeLog 2021-01-09 12:01:48 UTC (rev 271346)
+++ trunk/Source/WebCore/ChangeLog 2021-01-09 12:31:53 UTC (rev 271347)
@@ -1,3 +1,17 @@
+2021-01-09 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Use the bottom margin edge as the baseline for inline-block when overflow is not visible
+ https://bugs.webkit.org/show_bug.cgi?id=220481
+
+ Reviewed by Antti Koivisto.
+
+ "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 if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge."
+ https://www.w3.org/TR/CSS22/visudet.html#leading
+
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+
2021-01-08 Peng Liu <[email protected]>
A video element needs to ignore the request to enter/exit fullscreen before the current fullscreen mode change is completed
Modified: trunk/Source/WebCore/layout/LayoutState.cpp (271346 => 271347)
--- trunk/Source/WebCore/layout/LayoutState.cpp 2021-01-09 12:01:48 UTC (rev 271346)
+++ trunk/Source/WebCore/layout/LayoutState.cpp 2021-01-09 12:31:53 UTC (rev 271347)
@@ -244,7 +244,12 @@
return RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled();
}
+bool LayoutState::shouldNotSynthesizeInlineBlockBaseline() const
+{
+ return RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled();
}
+
}
+}
#endif
Modified: trunk/Source/WebCore/layout/LayoutState.h (271346 => 271347)
--- trunk/Source/WebCore/layout/LayoutState.h 2021-01-09 12:01:48 UTC (rev 271346)
+++ trunk/Source/WebCore/layout/LayoutState.h 2021-01-09 12:31:53 UTC (rev 271347)
@@ -93,6 +93,7 @@
IsIntegratedRootBoxFirstChild isIntegratedRootBoxFirstChild() const { return m_isIntegratedRootBoxFirstChild; }
void setIsIntegratedRootBoxFirstChild(bool);
bool shouldIgnoreTrailingLetterSpacing() const;
+ bool shouldNotSynthesizeInlineBlockBaseline() const;
private:
void setQuirksMode(QuirksMode quirksMode) { m_quirksMode = quirksMode; }
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (271346 => 271347)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-01-09 12:01:48 UTC (rev 271346)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-01-09 12:31:53 UTC (rev 271347)
@@ -271,11 +271,22 @@
auto& inlineLevelBoxGeometry = formattingContext().geometryForBox(layoutBox);
auto marginBoxHeight = inlineLevelBoxGeometry.marginBoxHeight();
auto ascent = InlineLayoutUnit { };
- if (layoutBox.isInlineBlockBox() && layoutBox.establishesInlineFormattingContext()) {
- auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox));
- auto& lastLine = formattingState.lines().last();
- auto inlineBlockBaseline = lastLine.lineBoxLogicalRect().top() + lastLine.baseline();
- ascent = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderTop() + inlineLevelBoxGeometry.paddingTop().valueOr(0) + inlineBlockBaseline;
+ if (layoutState().shouldNotSynthesizeInlineBlockBaseline()) {
+ // Integration codepath constructs replaced boxes for inline-block content.
+ ASSERT(layoutBox.isReplacedBox());
+ ascent = *downcast<ReplacedBox>(layoutBox).baseline();
+ } else if (layoutBox.isInlineBlockBox()) {
+ // 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
+ // if its 'overflow' property has a computed value other than 'visible', in which case the baseline is the bottom margin edge.
+ auto synthesizeBaseline = !layoutBox.establishesInlineFormattingContext() || !layoutBox.style().isOverflowVisible();
+ if (synthesizeBaseline)
+ ascent = marginBoxHeight;
+ else {
+ auto& formattingState = layoutState().establishedInlineFormattingState(downcast<ContainerBox>(layoutBox));
+ auto& lastLine = formattingState.lines().last();
+ auto inlineBlockBaseline = lastLine.lineBoxLogicalRect().top() + lastLine.baseline();
+ ascent = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderTop() + inlineLevelBoxGeometry.paddingTop().valueOr(0) + inlineBlockBaseline;
+ }
} else if (layoutBox.isReplacedBox())
ascent = downcast<ReplacedBox>(layoutBox).baseline().valueOr(marginBoxHeight);
else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes