Title: [271096] trunk/Source/WebCore
Revision
271096
Author
[email protected]
Date
2020-12-27 10:57:28 -0800 (Sun, 27 Dec 2020)

Log Message

[LFC][IFC] Inline box should start with a strut in standards mode
https://bugs.webkit.org/show_bug.cgi?id=220160

Reviewed by Antti Koivisto.

If the inline box contains no glyphs at all, or if it contains only glyphs from fallback fonts,
it is considered to contain a “strut” (an invisible glyph of zero width) with the metrics of the box’s first available font.
https://www.w3.org/TR/css-inline-3/#inline-height

(css2.1/20110323/empty-inline-003.htm)

* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271095 => 271096)


--- trunk/Source/WebCore/ChangeLog	2020-12-27 18:37:50 UTC (rev 271095)
+++ trunk/Source/WebCore/ChangeLog	2020-12-27 18:57:28 UTC (rev 271096)
@@ -1,3 +1,19 @@
+2020-12-27  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Inline box should start with a strut in standards mode
+        https://bugs.webkit.org/show_bug.cgi?id=220160
+
+        Reviewed by Antti Koivisto.
+
+        If the inline box contains no glyphs at all, or if it contains only glyphs from fallback fonts,
+        it is considered to contain a “strut” (an invisible glyph of zero width) with the metrics of the box’s first available font.
+        https://www.w3.org/TR/css-inline-3/#inline-height
+
+        (css2.1/20110323/empty-inline-003.htm)
+
+        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+        (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+
 2020-12-27  Sam Weinig  <[email protected]>
 
         Fix incorrect return types of fallback color conversion functions

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (271095 => 271096)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2020-12-27 18:37:50 UTC (rev 271095)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2020-12-27 18:57:28 UTC (rev 271096)
@@ -218,8 +218,8 @@
     auto createRootInlineBox = [&] {
         auto rootInlineBox = LineBox::InlineLevelBox::createRootInlineBox(rootBox(), horizontalAligmentOffset, lineBox.logicalWidth());
 
-        auto lineHasImaginaryStrut = layoutState().inNoQuirksMode();
-        auto isInitiallyConsideredNonEmpty = !lineBox.isConsideredEmpty() && lineHasImaginaryStrut;
+        auto inlineBoxHasImaginaryStrut = layoutState().inNoQuirksMode();
+        auto isInitiallyConsideredNonEmpty = !lineBox.isConsideredEmpty() && inlineBoxHasImaginaryStrut;
         if (isInitiallyConsideredNonEmpty)
             rootInlineBox->setIsNonEmpty();
         setVerticalGeometryForInlineBox(*rootInlineBox);
@@ -319,6 +319,10 @@
             auto initialLogicalWidth = lineBox.logicalWidth() - run.logicalLeft();
             ASSERT(initialLogicalWidth >= 0);
             auto inlineBox = LineBox::InlineLevelBox::createInlineBox(layoutBox, logicalLeft, initialLogicalWidth);
+            // 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();
+            if (inlineBoxHasImaginaryStrut)
+                inlineBox->setIsNonEmpty();
             setVerticalGeometryForInlineBox(*inlineBox);
             lineBox.addInlineLevelBox(WTFMove(inlineBox));
             continue;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to