Title: [240547] trunk
Revision
240547
Author
[email protected]
Date
2019-01-26 11:24:10 -0800 (Sat, 26 Jan 2019)

Log Message

Source/WebCore:
[LFC] The initial values for top/bottom in contentHeightForFormattingContextRoot should not be 0.
https://bugs.webkit.org/show_bug.cgi?id=193867

Reviewed by Antti Koivisto.

The initial content top/bottom value is the border top + padding top.

This is only a problem when the box has float children only. While computing the height using the bottom-most float,
we call "top = std::min(floatTop, top)". With 0 initial top value, this returns an incorrect result when the box
has (top)border/padding.

Test: fast/block/block-only/abs-pos-with-border-padding-and-float-child.html

* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::contentHeightForFormattingContextRoot):

Tools:
[LFC] The default values for top/bottom in contentHeightForFormattingContextRoot should not be 0.
https://bugs.webkit.org/show_bug.cgi?id=193867

Reviewed by Antti Koivisto.

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:
[LFC] The default values for top/bottom in contentHeightForFormattingContextRoot should not be 0.
https://bugs.webkit.org/show_bug.cgi?id=193867

Reviewed by Antti Koivisto.

* fast/block/block-only/abs-pos-with-border-padding-and-float-child-expected.html: Added.
* fast/block/block-only/abs-pos-with-border-padding-and-float-child.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (240546 => 240547)


--- trunk/LayoutTests/ChangeLog	2019-01-26 15:01:34 UTC (rev 240546)
+++ trunk/LayoutTests/ChangeLog	2019-01-26 19:24:10 UTC (rev 240547)
@@ -1,5 +1,15 @@
 2019-01-26  Zalan Bujtas  <[email protected]>
 
+        [LFC] The default values for top/bottom in contentHeightForFormattingContextRoot should not be 0.
+        https://bugs.webkit.org/show_bug.cgi?id=193867
+
+        Reviewed by Antti Koivisto.
+
+        * fast/block/block-only/abs-pos-with-border-padding-and-float-child-expected.html: Added.
+        * fast/block/block-only/abs-pos-with-border-padding-and-float-child.html: Added.
+
+2019-01-26  Zalan Bujtas  <[email protected]>
+
         [LFC][BFC] Ignore last inflow child's collapsed through margin after when computing containing block's height.
         https://bugs.webkit.org/show_bug.cgi?id=193865
 

Added: trunk/LayoutTests/fast/block/block-only/abs-pos-with-border-padding-and-float-child-expected.html (0 => 240547)


--- trunk/LayoutTests/fast/block/block-only/abs-pos-with-border-padding-and-float-child-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/abs-pos-with-border-padding-and-float-child-expected.html	2019-01-26 19:24:10 UTC (rev 240547)
@@ -0,0 +1,16 @@
+<style>
+.container { 
+    width: 200px;
+    height: 100px;
+    background-color: red;
+    margin-bottom: 300px;
+}
+.float {
+    float: left;
+    width: 200px;
+    height: 200px;
+    background: green;
+}
+</style>
+<div class=container></div>
+<div class=float></div>

Added: trunk/LayoutTests/fast/block/block-only/abs-pos-with-border-padding-and-float-child.html (0 => 240547)


--- trunk/LayoutTests/fast/block/block-only/abs-pos-with-border-padding-and-float-child.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/abs-pos-with-border-padding-and-float-child.html	2019-01-26 19:24:10 UTC (rev 240547)
@@ -0,0 +1,16 @@
+<style>
+.container { 
+    position: absolute;
+    padding-top: 300px;
+    border-top: 100px solid red;
+}
+.float {
+    float: left;
+    width: 200px;
+    height: 200px;
+    background: green;
+}
+</style>
+<div class=container>
+    <div class=float></div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (240546 => 240547)


--- trunk/Source/WebCore/ChangeLog	2019-01-26 15:01:34 UTC (rev 240546)
+++ trunk/Source/WebCore/ChangeLog	2019-01-26 19:24:10 UTC (rev 240547)
@@ -1,5 +1,23 @@
 2019-01-26  Zalan Bujtas  <[email protected]>
 
+        [LFC] The initial values for top/bottom in contentHeightForFormattingContextRoot should not be 0.
+        https://bugs.webkit.org/show_bug.cgi?id=193867
+
+        Reviewed by Antti Koivisto.
+
+        The initial content top/bottom value is the border top + padding top.
+
+        This is only a problem when the box has float children only. While computing the height using the bottom-most float,
+        we call "top = std::min(floatTop, top)". With 0 initial top value, this returns an incorrect result when the box
+        has (top)border/padding.
+
+        Test: fast/block/block-only/abs-pos-with-border-padding-and-float-child.html
+
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::contentHeightForFormattingContextRoot):
+
+2019-01-26  Zalan Bujtas  <[email protected]>
+
         [LFC][BFC] Ignore last inflow child's collapsed through margin after when computing containing block's height.
         https://bugs.webkit.org/show_bug.cgi?id=193865
 

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (240546 => 240547)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2019-01-26 15:01:34 UTC (rev 240546)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2019-01-26 19:24:10 UTC (rev 240547)
@@ -103,8 +103,10 @@
     if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild())
         return 0;
 
-    LayoutUnit top;
-    LayoutUnit bottom;
+    auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
+    auto borderAndPaddingTop = displayBox.borderTop() + displayBox.paddingTop().valueOr(0);
+    auto top = borderAndPaddingTop;
+    auto bottom = borderAndPaddingTop;
     auto& formattingRootContainer = downcast<Container>(layoutBox);
     if (formattingRootContainer.establishesInlineFormattingContext()) {
         // This is temp and will be replaced by the correct display box once inline runs move over to the display tree.

Modified: trunk/Tools/ChangeLog (240546 => 240547)


--- trunk/Tools/ChangeLog	2019-01-26 15:01:34 UTC (rev 240546)
+++ trunk/Tools/ChangeLog	2019-01-26 19:24:10 UTC (rev 240547)
@@ -1,5 +1,14 @@
 2019-01-26  Zalan Bujtas  <[email protected]>
 
+        [LFC] The default values for top/bottom in contentHeightForFormattingContextRoot should not be 0.
+        https://bugs.webkit.org/show_bug.cgi?id=193867
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2019-01-26  Zalan Bujtas  <[email protected]>
+
         [LFC][BFC] Ignore last inflow child's collapsed through margin after when computing containing block's height.
         https://bugs.webkit.org/show_bug.cgi?id=193865
 

Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (240546 => 240547)


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-26 15:01:34 UTC (rev 240546)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-26 19:24:10 UTC (rev 240547)
@@ -81,6 +81,7 @@
 fast/block/block-only/non-auto-top-bottom-left-right-widht-height-out-of-flow.html
 fast/block/block-only/non-auto-top-bottom-height-with-margins.html
 fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html
+fast/block/block-only/abs-pos-with-border-padding-and-float-child-expected.html
 fast/block/basic/002.html
 fast/block/basic/003.html
 fast/block/basic/004.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to