Title: [263268] trunk
Revision
263268
Author
za...@apple.com
Date
2020-06-19 08:39:55 -0700 (Fri, 19 Jun 2020)

Log Message

[LFC][TFC] Do not special-case empty tables
https://bugs.webkit.org/show_bug.cgi?id=213378

Reviewed by Antti Koivisto.

Source/WebCore:

Now that min/max-width support is added, empty tables can just go through the normal width computation path.

Test: fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html

* layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
(WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):

LayoutTests:

* fast/layoutformattingcontext/table-min-max-width-empty-content-simple-expected.html: Added.
* fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (263267 => 263268)


--- trunk/LayoutTests/ChangeLog	2020-06-19 15:31:10 UTC (rev 263267)
+++ trunk/LayoutTests/ChangeLog	2020-06-19 15:39:55 UTC (rev 263268)
@@ -1,3 +1,13 @@
+2020-06-19  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][TFC] Do not special-case empty tables
+        https://bugs.webkit.org/show_bug.cgi?id=213378
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-min-max-width-empty-content-simple-expected.html: Added.
+        * fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html: Added.
+
 2020-06-19  Jason Lawrence  <lawrenc...@apple.com>
 
         Mac wk2 Debug] webaudio/biquad-bandpass.html is flaky crashing with alert WTFCrash - WebCore::WebKitAudioContext::~WebKitAudioContext() + 654 (WebKitAudioContext.cpp:209).

Added: trunk/LayoutTests/fast/layoutformattingcontext/table-min-max-width-empty-content-simple-expected.html (0 => 263268)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-min-max-width-empty-content-simple-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-min-max-width-empty-content-simple-expected.html	2020-06-19 15:39:55 UTC (rev 263268)
@@ -0,0 +1,10 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+  height: 120px;
+  width: 20px;
+  background-color: green;
+}
+
+</style>
+<div></div>

Added: trunk/LayoutTests/fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html (0 => 263268)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html	2020-06-19 15:39:55 UTC (rev 263268)
@@ -0,0 +1,49 @@
+<!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+.container {
+  width: 100px;
+  height: 20px;
+}
+
+.floatBox {
+  float: left;
+  width: 20px;
+  height: 100%;
+  background-color: green;
+}
+
+.table {
+  display: table;
+  height: 20px;
+  background-color: blue;
+}
+</style>
+<div class=container>
+  <div class=floatBox></div>
+  <div class=table></div>
+</div>
+
+<div class=container>
+  <div class=floatBox></div>
+  <div class=table style="width: 20px;"></div>
+</div>
+
+<div class=container>
+  <div class=floatBox></div>
+  <div class=table style="min-width: 20px;"></div>
+</div>
+
+<div class=container>
+  <div class=floatBox></div>
+  <div class=table style="max-width: 20px;"></div>
+</div>
+
+<div class=container>
+  <div class=floatBox></div>
+  <div class=table style="width: 40px; max-width: 40px;"></div>
+</div>
+
+<div class=container>
+  <div class=floatBox></div>
+  <div class=table style="width: 10px; min-width: 20px;"></div>
+</div>

Modified: trunk/Source/WebCore/ChangeLog (263267 => 263268)


--- trunk/Source/WebCore/ChangeLog	2020-06-19 15:31:10 UTC (rev 263267)
+++ trunk/Source/WebCore/ChangeLog	2020-06-19 15:39:55 UTC (rev 263268)
@@ -1,3 +1,17 @@
+2020-06-19  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][TFC] Do not special-case empty tables
+        https://bugs.webkit.org/show_bug.cgi?id=213378
+
+        Reviewed by Antti Koivisto.
+
+        Now that min/max-width support is added, empty tables can just go through the normal width computation path. 
+
+        Test: fast/layoutformattingcontext/table-min-max-width-empty-content-simple.html
+
+        * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
+        (WebCore::Layout::TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox):
+
 2020-06-10  Sergio Villar Senin  <svil...@igalia.com>
 
         REGRESSION(r262254?): [WPE] imported/w3c/web-platform-tests/webxr/idlharness.https.window.html is failing

Modified: trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp (263267 => 263268)


--- trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp	2020-06-19 15:31:10 UTC (rev 263267)
+++ trunk/Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp	2020-06-19 15:39:55 UTC (rev 263268)
@@ -144,15 +144,6 @@
 void TableWrapperBlockFormattingContext::computeWidthAndMarginForTableBox(const ContainerBox& tableBox, const HorizontalConstraints& horizontalConstraints)
 {
     ASSERT(tableBox.isTableBox());
-    if (!tableBox.hasChild()) {
-        auto computedWidthAndMargin = geometry().computedWidthAndMargin(tableBox, horizontalConstraints, { });
-        auto& displayBox = formattingState().displayBox(tableBox);
-        displayBox.setContentBoxWidth(computedWidthAndMargin.contentWidth);
-        displayBox.setHorizontalMargin(computedWidthAndMargin.usedMargin);
-        displayBox.setHorizontalComputedMargin(computedWidthAndMargin.computedMargin);
-        return;
-    }
-
     // This is a special table "fit-content size" behavior handling. Not in the spec though.
     // Table returns its final width as min/max. Use this final width value to computed horizontal margins etc.
     auto& formattingStateForTableBox = layoutState().establishedTableFormattingState(tableBox);
@@ -160,16 +151,18 @@
     if (auto precomputedIntrinsicWidthConstraints = formattingStateForTableBox.intrinsicWidthConstraints())
         intrinsicWidthConstraints = *precomputedIntrinsicWidthConstraints;
     else {
-        intrinsicWidthConstraints = LayoutContext::createFormattingContext(tableBox, layoutState())->computedIntrinsicWidthConstraints();
+        if (tableBox.hasChild())
+            intrinsicWidthConstraints = LayoutContext::createFormattingContext(tableBox, layoutState())->computedIntrinsicWidthConstraints();
         formattingStateForTableBox.setIntrinsicWidthConstraints(intrinsicWidthConstraints);
     }
 
+    auto availableHorizontalSpace = horizontalConstraints.logicalWidth;
     auto geometry = this->geometry();
-    auto computedWidth = geometry.computedWidth(tableBox, horizontalConstraints.logicalWidth);
-    auto computedMaxWidth = geometry.computedMaxWidth(tableBox, horizontalConstraints.logicalWidth);
-    auto computedMinWidth = geometry.computedMinWidth(tableBox, horizontalConstraints.logicalWidth);
+    auto computedWidth = geometry.computedWidth(tableBox, availableHorizontalSpace);
+    auto computedMaxWidth = geometry.computedMaxWidth(tableBox, availableHorizontalSpace);
+    auto computedMinWidth = geometry.computedMinWidth(tableBox, availableHorizontalSpace);
     // Use the generic shrink-to-fit-width logic as the initial width for the table.
-    auto usedWidth = std::min(std::max(intrinsicWidthConstraints.minimum, horizontalConstraints.logicalWidth), intrinsicWidthConstraints.maximum);
+    auto usedWidth = std::min(std::max(intrinsicWidthConstraints.minimum, availableHorizontalSpace), intrinsicWidthConstraints.maximum);
     if (computedWidth || computedMinWidth || computedMaxWidth) {
         if (computedWidth) {
             // Normalize the computed width value first.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to