[LFC][TFC] Maximum constraint of a cell should never be smaller than the minimum...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 May 2020 19:47:51 +0000 (19:47 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 May 2020 19:47:51 +0000 (19:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=212304

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content.html

* layout/tableformatting/TableFormattingContextGeometry.cpp:
(WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell):

LayoutTests:

* fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content-expected.html: Added.
* fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@262102 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content-expected.html [new file with mode: 0644]
LayoutTests/fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp

index 7d403b0..25932cc 100644 (file)
@@ -1,5 +1,15 @@
 2020-05-23  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][TFC] Maximum constraint of a cell should never be smaller than the minimum width
+        https://bugs.webkit.org/show_bug.cgi?id=212304
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content-expected.html: Added.
+        * fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content.html: Added.
+
+2020-05-23  Zalan Bujtas  <zalan@apple.com>
+
         [LFC][TFC] Used height of a cell is the maximum of the computed and the content height.
         https://bugs.webkit.org/show_bug.cgi?id=212302
 
diff --git a/LayoutTests/fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content-expected.html b/LayoutTests/fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content-expected.html
new file mode 100644 (file)
index 0000000..9d098a0
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+    height: 42px;
+    width: 42px;
+    border: 1px solid green;
+    position: absolute;
+}
+</style>
+<div style="top: 10px; left: 10px;"></div>
+<div style="top: 10px; left: 56px;"></div>
+<div style="top: 56px; left: 10px;"></div>
+<div style="top: 56px; left: 56px;"></div>
diff --git a/LayoutTests/fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content.html b/LayoutTests/fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content.html
new file mode 100644 (file)
index 0000000..1f65149
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+table {
+    font-size: 40px;
+    font-family: Ahem;
+    color: white;
+}
+
+td {
+    width: 10px;
+    height: 10px;
+    border: 1px solid green;
+}
+</style>
+<table>
+<tr><td>#</td><td>#</td></tr>
+<tr><td>#</td><td>#</td></tr>
+</table>
index 898685f..3c796e4 100644 (file)
@@ -1,5 +1,17 @@
 2020-05-23  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][TFC] Maximum constraint of a cell should never be smaller than the minimum width
+        https://bugs.webkit.org/show_bug.cgi?id=212304
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/layoutformattingcontext/table-simple-fixed-width-with-wide-content.html
+
+        * layout/tableformatting/TableFormattingContextGeometry.cpp:
+        (WebCore::Layout::TableFormattingContext::Geometry::intrinsicWidthConstraintsForCell):
+
+2020-05-23  Zalan Bujtas  <zalan@apple.com>
+
         [LFC][TFC] Used height of a cell is the maximum of the computed and the content height.
         https://bugs.webkit.org/show_bug.cgi?id=212302
 
index c51bb26..fd0c0b1 100644 (file)
@@ -95,14 +95,14 @@ FormattingContext::IntrinsicWidthConstraints TableFormattingContext::Geometry::i
     auto& cellBox = cell.box();
     auto& style = cellBox.style();
 
-    auto computedIntrinsicWidthConstraints = [&] {
+    auto computedIntrinsicWidthConstraints = [&]() -> FormattingContext::IntrinsicWidthConstraints {
         // Even fixed width cells expand to their minimum content width
         // <td style="width: 10px">test_content</td> will size to max(minimum content width, computed width).
         auto intrinsicWidthConstraints = FormattingContext::IntrinsicWidthConstraints { };
         if (cellBox.hasChild())
             intrinsicWidthConstraints = LayoutContext::createFormattingContext(cellBox, layoutState())->computedIntrinsicWidthConstraints();
-        if (auto width = fixedValue(style.logicalWidth()))
-            return FormattingContext::IntrinsicWidthConstraints { std::max(intrinsicWidthConstraints.minimum, *width), *width };
+        if (auto fixedWidth = fixedValue(style.logicalWidth()))
+            return { std::max(intrinsicWidthConstraints.minimum, *fixedWidth), std::max(intrinsicWidthConstraints.minimum, *fixedWidth) };
         return intrinsicWidthConstraints;
     };
     // FIXME Check for box-sizing: border-box;