Title: [263631] trunk
Revision
263631
Author
za...@apple.com
Date
2020-06-27 22:26:28 -0700 (Sat, 27 Jun 2020)

Log Message

[LFC][IFC] Replaced inline boxes sit on the baseline with their margins
https://bugs.webkit.org/show_bug.cgi?id=213679

Reviewed by Antti Koivisto.

Source/WebCore:

Take the margin box into account when computing the top position of a baseline aligned replaced inline box.

Test: fast/layoutformattingcontext/replaced-box-with-margin-on-baseline.html

* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::alignContentVertically):

LayoutTests:

* fast/layoutformattingcontext/replaced-box-with-margin-on-baseline-expected.html: Added.
* fast/layoutformattingcontext/replaced-box-with-margin-on-baseline.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (263630 => 263631)


--- trunk/LayoutTests/ChangeLog	2020-06-27 22:59:30 UTC (rev 263630)
+++ trunk/LayoutTests/ChangeLog	2020-06-28 05:26:28 UTC (rev 263631)
@@ -1,3 +1,13 @@
+2020-06-27  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][IFC] Replaced inline boxes sit on the baseline with their margins
+        https://bugs.webkit.org/show_bug.cgi?id=213679
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/replaced-box-with-margin-on-baseline-expected.html: Added.
+        * fast/layoutformattingcontext/replaced-box-with-margin-on-baseline.html: Added.
+
 2020-06-27  Mark Lam  <mark....@apple.com>
 
         Fix missing exception check in createIDBKeyFromValue().

Added: trunk/LayoutTests/fast/layoutformattingcontext/replaced-box-with-margin-on-baseline-expected.html (0 => 263631)


--- trunk/LayoutTests/fast/layoutformattingcontext/replaced-box-with-margin-on-baseline-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/replaced-box-with-margin-on-baseline-expected.html	2020-06-28 05:26:28 UTC (rev 263631)
@@ -0,0 +1,19 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+    width: 500px;
+    height: 365px; 
+    background-color: green;
+    font-size: 20px;
+}
+
+img {
+    width: 50px;
+    height: 50px;
+    position: relative;
+    top: -160px;
+    left: 5px;
+}
+</style>
+<div></div>
+<img src=""

Added: trunk/LayoutTests/fast/layoutformattingcontext/replaced-box-with-margin-on-baseline.html (0 => 263631)


--- trunk/LayoutTests/fast/layoutformattingcontext/replaced-box-with-margin-on-baseline.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/replaced-box-with-margin-on-baseline.html	2020-06-28 05:26:28 UTC (rev 263631)
@@ -0,0 +1,17 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+    width: 500px;
+    background-color: green;
+    font-size: 20px;
+}
+
+img {
+    margin-top: 200px;
+    margin-bottom: 100px;
+    border: 5px solid green;
+    width: 50px;
+    height: 50px;
+}
+</style>
+<div><img src=""

Modified: trunk/Source/WebCore/ChangeLog (263630 => 263631)


--- trunk/Source/WebCore/ChangeLog	2020-06-27 22:59:30 UTC (rev 263630)
+++ trunk/Source/WebCore/ChangeLog	2020-06-28 05:26:28 UTC (rev 263631)
@@ -1,3 +1,17 @@
+2020-06-27  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][IFC] Replaced inline boxes sit on the baseline with their margins
+        https://bugs.webkit.org/show_bug.cgi?id=213679
+
+        Reviewed by Antti Koivisto.
+
+        Take the margin box into account when computing the top position of a baseline aligned replaced inline box.
+
+        Test: fast/layoutformattingcontext/replaced-box-with-margin-on-baseline.html
+
+        * layout/inlineformatting/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineBuilder::alignContentVertically):
+
 2020-06-27  Mark Lam  <mark....@apple.com>
 
         Fix missing exception check in createIDBKeyFromValue().

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (263630 => 263631)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-06-27 22:59:30 UTC (rev 263630)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-06-28 05:26:28 UTC (rev 263631)
@@ -173,8 +173,10 @@
                 auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
                 auto baselineOffsetFromMarginBox = boxGeometry.marginBefore() + boxGeometry.borderTop() + boxGeometry.paddingTop().valueOr(0) + inlineBlockBaselineOffset;
                 logicalTop = baselineOffset() - baselineOffsetFromMarginBox;
-            } else
-                logicalTop = baselineOffset() - run.logicalRect().height();
+            } else {
+                auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
+                logicalTop = baselineOffset() - (boxGeometry.verticalBorder() + boxGeometry.verticalPadding().valueOr(0_lu) + run.logicalRect().height() + boxGeometry.marginAfter());
+            }
             break;
         case VerticalAlign::Top:
             logicalTop = 0_lu;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to