Title: [238737] trunk
Revision
238737
Author
[email protected]
Date
2018-11-30 07:26:10 -0800 (Fri, 30 Nov 2018)

Log Message

[LFC][BFC] Compute min/maxHeight margins only when they are needed.
https://bugs.webkit.org/show_bug.cgi?id=192223

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/block/block-only/collapsed-margin-with-min-height.html

* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):

Tools:

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

LayoutTests:

* fast/block/block-only/collapsed-margin-with-min-height-expected.txt: Added.
* fast/block/block-only/collapsed-margin-with-min-height.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238736 => 238737)


--- trunk/LayoutTests/ChangeLog	2018-11-30 15:24:11 UTC (rev 238736)
+++ trunk/LayoutTests/ChangeLog	2018-11-30 15:26:10 UTC (rev 238737)
@@ -1,3 +1,13 @@
+2018-11-30  Zalan Bujtas  <[email protected]>
+
+        [LFC][BFC] Compute min/maxHeight margins only when they are needed.
+        https://bugs.webkit.org/show_bug.cgi?id=192223
+
+        Reviewed by Antti Koivisto.
+
+        * fast/block/block-only/collapsed-margin-with-min-height-expected.txt: Added.
+        * fast/block/block-only/collapsed-margin-with-min-height.html: Added.
+
 2018-11-30  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed GTK+ gardening. Stop running tests without complex text enforced

Added: trunk/LayoutTests/fast/block/block-only/collapsed-margin-with-min-height-expected.txt (0 => 238737)


--- trunk/LayoutTests/fast/block/block-only/collapsed-margin-with-min-height-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/collapsed-margin-with-min-height-expected.txt	2018-11-30 15:26:10 UTC (rev 238737)
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,200) size 784x392
+      RenderBlock {DIV} at (0,0) size 100x100

Added: trunk/LayoutTests/fast/block/block-only/collapsed-margin-with-min-height.html (0 => 238737)


--- trunk/LayoutTests/fast/block/block-only/collapsed-margin-with-min-height.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/collapsed-margin-with-min-height.html	2018-11-30 15:26:10 UTC (rev 238737)
@@ -0,0 +1,14 @@
+<html>
+<head>
+<style>
+div {
+	outline: 1px solid green;
+	width: 100px;
+	height: 100px;
+}
+</style>
+</head>
+<body>
+<div style="min-height: 0px; margin-top: 200px;"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (238736 => 238737)


--- trunk/Source/WebCore/ChangeLog	2018-11-30 15:24:11 UTC (rev 238736)
+++ trunk/Source/WebCore/ChangeLog	2018-11-30 15:26:10 UTC (rev 238737)
@@ -1,5 +1,17 @@
 2018-11-30  Zalan Bujtas  <[email protected]>
 
+        [LFC][BFC] Compute min/maxHeight margins only when they are needed.
+        https://bugs.webkit.org/show_bug.cgi?id=192223
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/block/block-only/collapsed-margin-with-min-height.html
+
+        * layout/blockformatting/BlockFormattingContext.cpp:
+        (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
+
+2018-11-30  Zalan Bujtas  <[email protected]>
+
         [LFC][BFC] Geometry::inFlowNonReplacedHeightAndMargin should check for empty inline formatting context.
         https://bugs.webkit.org/show_bug.cgi?id=192215
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (238736 => 238737)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2018-11-30 15:24:11 UTC (rev 238736)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp	2018-11-30 15:26:10 UTC (rev 238737)
@@ -354,15 +354,21 @@
 
     auto heightAndMargin = compute({ });
     if (auto maxHeight = Geometry::computedMaxHeight(layoutState, layoutBox)) {
-        auto maxHeightAndMargin = compute(maxHeight);
-        if (heightAndMargin.height > maxHeightAndMargin.height)
-            heightAndMargin = maxHeightAndMargin;
+        if (heightAndMargin.height > *maxHeight) {
+            auto maxHeightAndMargin = compute(maxHeight);
+            // Used height should remain the same.
+            ASSERT((layoutState.inQuirksMode() && (layoutBox.isBodyBox() || layoutBox.isDocumentBox())) || maxHeightAndMargin.height == *maxHeight);
+            heightAndMargin = { *maxHeight, maxHeightAndMargin.margin, maxHeightAndMargin.collapsedMargin };
+        }
     }
 
     if (auto minHeight = Geometry::computedMinHeight(layoutState, layoutBox)) {
-        auto minHeightAndMargin = compute(minHeight);
-        if (heightAndMargin.height < minHeightAndMargin.height)
-            heightAndMargin = minHeightAndMargin;
+        if (heightAndMargin.height < *minHeight) {
+            auto minHeightAndMargin = compute(minHeight);
+            // Used height should remain the same.
+            ASSERT((layoutState.inQuirksMode() && (layoutBox.isBodyBox() || layoutBox.isDocumentBox())) || minHeightAndMargin.height == *minHeight);
+            heightAndMargin = { *minHeight, minHeightAndMargin.margin, minHeightAndMargin.collapsedMargin };
+        }
     }
 
     auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);

Modified: trunk/Tools/ChangeLog (238736 => 238737)


--- trunk/Tools/ChangeLog	2018-11-30 15:24:11 UTC (rev 238736)
+++ trunk/Tools/ChangeLog	2018-11-30 15:26:10 UTC (rev 238737)
@@ -1,5 +1,14 @@
 2018-11-30  Zalan Bujtas  <[email protected]>
 
+        [LFC][BFC] Compute min/maxHeight margins only when they are needed.
+        https://bugs.webkit.org/show_bug.cgi?id=192223
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2018-11-30  Zalan Bujtas  <[email protected]>
+
         [LFC][BFC][MarginCollapsing] Do not use computed display box values for border and padding
         https://bugs.webkit.org/show_bug.cgi?id=192214
 

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


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-30 15:24:11 UTC (rev 238736)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-30 15:26:10 UTC (rev 238737)
@@ -66,6 +66,7 @@
 fast/block/block-only/body-height-with-non-auto-html-height-quirk2.html
 fast/block/block-only/body-height-with-auto-html-height-quirk.html
 fast/block/block-only/body-height-with-auto-html-height-quirk2.html
+fast/block/block-only/collapsed-margin-with-min-height.html
 fast/block/basic/inline-content-with-floating-image.html
 fast/block/basic/inline-content-with-floating-images2.html
 fast/inline/simple-intruding-float1.html
@@ -100,6 +101,10 @@
 fast/block/basic/012.html
 fast/block/margin-collapse/002.html
 fast/block/margin-collapse/003.html
+fast/block/margin-collapse/026.html
+fast/block/margin-collapse/027.html
+fast/block/margin-collapse/039.html
+fast/block/margin-collapse/040.html
 fast/block/positioning/004.html
 fast/block/positioning/005.html
 fast/block/positioning/006.html
@@ -141,3 +146,4 @@
 fast/block/positioning/052.html
 fast/block/positioning/054.html
 fast/block/inside-inlines/basic-float-intrusion.html
+fast/block/inside-inlines/crash-on-first-line-change.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to