Title: [272809] trunk/Source/WebCore
Revision
272809
Author
za...@apple.com
Date
2021-02-12 13:53:38 -0800 (Fri, 12 Feb 2021)

Log Message

[LFC][IFC] Multiline inline boxes have incorrect content box height/width values
https://bugs.webkit.org/show_bug.cgi?id=221827

Reviewed by Antti Koivisto.

Exclude padding and borders when computing the content box size for a multiline inline box.
(This is similar to r272724 but with inline boxes spanning multiple lines.)

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272808 => 272809)


--- trunk/Source/WebCore/ChangeLog	2021-02-12 21:52:10 UTC (rev 272808)
+++ trunk/Source/WebCore/ChangeLog	2021-02-12 21:53:38 UTC (rev 272809)
@@ -1,3 +1,16 @@
+2021-02-12  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][IFC] Multiline inline boxes have incorrect content box height/width values
+        https://bugs.webkit.org/show_bug.cgi?id=221827
+
+        Reviewed by Antti Koivisto.
+
+        Exclude padding and borders when computing the content box size for a multiline inline box.
+        (This is similar to r272724 but with inline boxes spanning multiple lines.)
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
+
 2021-02-12  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Fix Windows build again after r272772

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (272808 => 272809)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2021-02-12 21:52:10 UTC (rev 272808)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2021-02-12 21:53:38 UTC (rev 272809)
@@ -575,14 +575,16 @@
                 continue;
             }
             // Middle or end of the inline box. Let's stretch the box as needed.
-            logicalRect.expandHorizontally(-std::max(0_lu, boxGeometry.marginEnd()));
+            if (inlineBoxEndSet.contains(&layoutBox)) {
+                // The inline box ends on this line e.g. <span>fist<br>middle<br>last line</span>
+                logicalRect.expandHorizontally(-std::max(0_lu, boxGeometry.marginEnd()));
+            }
+            auto enclosingBorderBoxRect = BoxGeometry::borderBoxRect(boxGeometry);
+            enclosingBorderBoxRect.expandToContain(logicalRect);
+            boxGeometry.setLogicalLeft(enclosingBorderBoxRect.left());
 
-            auto enclosingRect = Rect { BoxGeometry::borderBoxTopLeft(boxGeometry), boxGeometry.contentBox().size() };
-            enclosingRect.expandToContain(logicalRect);
-
-            boxGeometry.setLogicalLeft(enclosingRect.left());
-            boxGeometry.setContentBoxHeight(enclosingRect.height());
-            boxGeometry.setContentBoxWidth(enclosingRect.width());
+            boxGeometry.setContentBoxHeight(enclosingBorderBoxRect.height() - (boxGeometry.verticalBorder() + boxGeometry.verticalPadding().valueOr(0_lu)));
+            boxGeometry.setContentBoxWidth(enclosingBorderBoxRect.width() - (boxGeometry.horizontalBorder() + boxGeometry.horizontalPadding().valueOr(0_lu)));
         }
     };
     updateBoxGeometryForInlineBoxes();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to