Title: [273754] trunk/Source/WebCore
Revision
273754
Author
[email protected]
Date
2021-03-02 12:35:44 -0800 (Tue, 02 Mar 2021)

Log Message

[LFC][IFC] Enable simplified vertical alignment for non-empty root inline box
https://bugs.webkit.org/show_bug.cgi?id=222604

Reviewed by Antti Koivisto.

This patch enables the simplified vertical alignment for cases when the root inline box has text content.
e.g. <div>this is text only</div>

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273753 => 273754)


--- trunk/Source/WebCore/ChangeLog	2021-03-02 20:23:49 UTC (rev 273753)
+++ trunk/Source/WebCore/ChangeLog	2021-03-02 20:35:44 UTC (rev 273754)
@@ -1,3 +1,16 @@
+2021-03-02  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Enable simplified vertical alignment for non-empty root inline box
+        https://bugs.webkit.org/show_bug.cgi?id=222604
+
+        Reviewed by Antti Koivisto.
+
+        This patch enables the simplified vertical alignment for cases when the root inline box has text content.
+        e.g. <div>this is text only</div>
+
+        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+        (WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
+
 2021-03-02  Rob Buis  <[email protected]>
 
         Take box-sizing into account in replaced element intrinsic sizing

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (273753 => 273754)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2021-03-02 20:23:49 UTC (rev 273753)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2021-03-02 20:35:44 UTC (rev 273754)
@@ -329,7 +329,6 @@
         // FIXME: Add support for simple inline boxes too.
         // We can do simplified vertical alignment with non-atomic inline boxes as long as the line has no content.
         // e.g. <div><span></span><span></span></div> is still okay.
-        simplifiedVerticalAlignment.setEnabled(!lineHasContent);
         if (run.isInlineBoxStart()) {
             // At this point we don't know yet how wide this inline box is. Let's assume it's as long as the line is
             // and adjust it later if we come across an inlineBoxEnd run (see below).
@@ -342,6 +341,7 @@
             auto inlineBox = LineBox::InlineLevelBox::createInlineBox(layoutBox, logicalLeft, initialLogicalWidth);
             setVerticalGeometryForInlineBox(*inlineBox);
             lineBox.addInlineLevelBox(WTFMove(inlineBox));
+            simplifiedVerticalAlignment.setEnabled(!lineHasContent);
             continue;
         }
         if (run.isInlineBoxEnd()) {
@@ -352,11 +352,13 @@
             auto marginEnd = std::max(0_lu, formattingContext().geometryForBox(layoutBox).marginEnd());
             auto inlineBoxLogicalRight = logicalLeft + run.logicalWidth() - marginEnd;
             inlineBox.setLogicalWidth(inlineBoxLogicalRight - inlineBox.logicalLeft());
+            simplifiedVerticalAlignment.setEnabled(!lineHasContent);
             continue;
         }
         if (run.isText() || run.isSoftLineBreak()) {
             // FIXME: Adjust non-empty inline box height when glyphs from the non-primary font stretch the box.
             lineBox.inlineLevelBoxForLayoutBox(layoutBox.parent()).setHasContent();
+            simplifiedVerticalAlignment.setEnabled(simplifiedVerticalAlignment.isEnabled() && &layoutBox.parent() == &rootBox());
             continue;
         }
         if (run.isHardLineBreak()) {
@@ -363,6 +365,7 @@
             auto lineBreakBox = LineBox::InlineLevelBox::createLineBreakBox(layoutBox, logicalLeft);
             setVerticalGeometryForInlineBox(*lineBreakBox);
             lineBox.addInlineLevelBox(WTFMove(lineBreakBox));
+            simplifiedVerticalAlignment.setEnabled(false);
             continue;
         }
         if (run.isWordBreakOpportunity()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to