Title: [271359] trunk/Source/WebCore
- Revision
- 271359
- Author
- [email protected]
- Date
- 2021-01-11 06:56:06 -0800 (Mon, 11 Jan 2021)
Log Message
[LFC][IFC] InlineBox::setHasContent should be called when the inline box actually has some content
https://bugs.webkit.org/show_bug.cgi?id=220245
Reviewed by Antti Koivisto.
Do not call setHasContent unless the inline box has actual content (excluding border and padding).
However the "will stretch the line" logic checks against borders and paddings so move that over to
Quirks::inlineLevelBoxAffectsLineBox.
This change makes Quirks::inlineLevelBoxAffectsLineBox the only client of LineBox::isConsideredEmpty.
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
* layout/inlineformatting/InlineFormattingContextQuirks.cpp:
(WebCore::Layout::InlineFormattingContext::Quirks::inlineLevelBoxAffectsLineBox const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (271358 => 271359)
--- trunk/Source/WebCore/ChangeLog 2021-01-11 13:04:27 UTC (rev 271358)
+++ trunk/Source/WebCore/ChangeLog 2021-01-11 14:56:06 UTC (rev 271359)
@@ -1,3 +1,20 @@
+2021-01-11 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] InlineBox::setHasContent should be called when the inline box actually has some content
+ https://bugs.webkit.org/show_bug.cgi?id=220245
+
+ Reviewed by Antti Koivisto.
+
+ Do not call setHasContent unless the inline box has actual content (excluding border and padding).
+ However the "will stretch the line" logic checks against borders and paddings so move that over to
+ Quirks::inlineLevelBoxAffectsLineBox.
+ This change makes Quirks::inlineLevelBoxAffectsLineBox the only client of LineBox::isConsideredEmpty.
+
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+ * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
+ (WebCore::Layout::InlineFormattingContext::Quirks::inlineLevelBoxAffectsLineBox const):
+
2021-01-11 Kimmo Kinnunen <[email protected]>
WebKit::IPC::Encoder needs definitions of all custom enum values at the Encoder definition time
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (271358 => 271359)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-01-11 13:04:27 UTC (rev 271358)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2021-01-11 14:56:06 UTC (rev 271359)
@@ -217,11 +217,6 @@
auto createRootInlineBox = [&] {
auto rootInlineBox = LineBox::InlineLevelBox::createRootInlineBox(rootBox(), horizontalAligmentOffset, lineBox.logicalWidth());
-
- auto inlineBoxHasImaginaryStrut = layoutState().inNoQuirksMode();
- auto isInitiallyConsideredNonEmpty = !lineBox.isConsideredEmpty() && inlineBoxHasImaginaryStrut;
- if (isInitiallyConsideredNonEmpty)
- rootInlineBox->setHasContent();
setVerticalGeometryForInlineBox(*rootInlineBox);
simplifiedVerticalAlignment = { { } , rootInlineBox->layoutBounds().height(), rootInlineBox->layoutBounds().ascent - rootInlineBox->baseline() };
lineBox.addRootInlineBox(WTFMove(rootInlineBox));
@@ -326,12 +321,6 @@
auto initialLogicalWidth = lineBox.logicalWidth() - run.logicalLeft();
ASSERT(initialLogicalWidth >= 0);
auto inlineBox = LineBox::InlineLevelBox::createInlineBox(layoutBox, logicalLeft, initialLogicalWidth);
- auto& inlineBoxGeometry = formattingContext().geometryForBox(layoutBox);
- // Inline level boxes on empty lines are still considered empty (e.g. <span><div>pre and post blocks are empty</div></span>)
- auto inlineBoxHasImaginaryStrut = layoutState().inNoQuirksMode() && !lineBox.isConsideredEmpty();
- auto isConsideredNonEmpty = inlineBoxHasImaginaryStrut || inlineBoxGeometry.horizontalPadding().valueOr(0_lu) || inlineBoxGeometry.horizontalBorder();
- if (isConsideredNonEmpty)
- inlineBox->setHasContent();
setVerticalGeometryForInlineBox(*inlineBox);
lineBox.addInlineLevelBox(WTFMove(inlineBox));
continue;
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp (271358 => 271359)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp 2021-01-11 13:04:27 UTC (rev 271358)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextQuirks.cpp 2021-01-11 14:56:06 UTC (rev 271359)
@@ -42,8 +42,20 @@
bool InlineFormattingContext::Quirks::inlineLevelBoxAffectsLineBox(const LineBox::InlineLevelBox& inlineLevelBox, const LineBox& lineBox) const
{
- if (inlineLevelBox.isInlineBox())
- return inlineLevelBox.hasContent();
+ if (inlineLevelBox.isInlineBox()) {
+ // Inline boxes (e.g. root inline box or <span>) affects line boxes either through the strut or actual content.
+ if (inlineLevelBox.hasContent())
+ return true;
+ if (!inlineLevelBox.isRootInlineBox()) {
+ auto& boxGeometry = formattingContext().geometryForBox(inlineLevelBox.layoutBox());
+ if (boxGeometry.horizontalBorder() || boxGeometry.horizontalPadding().valueOr(0_lu)) {
+ // Horizontal border and padding make the inline box stretch the line (e.g. <span style="padding: 10px;"></span>).
+ return true;
+ }
+ }
+ auto inlineBoxHasImaginaryStrut = layoutState().inNoQuirksMode();
+ return inlineBoxHasImaginaryStrut && !lineBox.isConsideredEmpty();
+ }
if (inlineLevelBox.isLineBreakBox()) {
// <br> in non-standard mode stretches the line box only when the line is empty.
// e.g. <div><span><br></span></div> will stretch but <div>this will not stretch to 200px<span style="font-size: 200px;"><br></span></div>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes