[LFC][TFC] Used height of a cell is the maximum of the computed and the content height.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 May 2020 17:10:56 +0000 (17:10 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 May 2020 17:10:56 +0000 (17:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=212302

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height.html

* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
* layout/tableformatting/TableFormattingContextGeometry.cpp:
(WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const):

LayoutTests:

* fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height-expected.html: Added.
* fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height.html: Added.

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

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

index f577b0b..7d403b0 100644 (file)
@@ -1,3 +1,13 @@
+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
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height-expected.html: Added.
+        * fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height.html: Added.
+
 2020-05-23  Caio Lima  <ticaiolima@gmail.com>
 
         [bmalloc] Fix OOM errors on MIPS after r261667
diff --git a/LayoutTests/fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height-expected.html b/LayoutTests/fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height-expected.html
new file mode 100644 (file)
index 0000000..ba19fb0
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+    height: 42px;
+    width: 102px;
+    border: 1px solid green;
+    position: absolute;
+}
+</style>
+<div style="top: 10px; left: 10px;"></div>
+<div style="top: 10px; left: 116px;"></div>
+<div style="top: 56px; left: 10px;"></div>
+<div style="top: 56px; left: 116px;"></div>
diff --git a/LayoutTests/fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height.html b/LayoutTests/fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height.html
new file mode 100644 (file)
index 0000000..2f2e32c
--- /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: 100px;
+    height: 10px;
+    border: 1px solid green;
+}
+</style>
+<table>
+<tr><td>#</td><td>#</td></tr>
+<tr><td>#</td><td>#</td></tr>
+</table>
index 29694a0..898685f 100644 (file)
@@ -1,5 +1,19 @@
 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
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/layoutformattingcontext/table-simple-tall-cell-content-with-fixed-height.html
+
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
+        * layout/tableformatting/TableFormattingContextGeometry.cpp:
+        (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const):
+
+2020-05-23  Zalan Bujtas  <zalan@apple.com>
+
         [LFC][TFC] Non-collapsing row border should not make the table wider/taller
         https://bugs.webkit.org/show_bug.cgi?id=212263
 
index 64998f7..d6c616c 100644 (file)
@@ -112,7 +112,7 @@ Optional<LayoutUnit> FormattingContext::Geometry::computedWidth(const Box& layou
 
 LayoutUnit FormattingContext::Geometry::contentHeightForFormattingContextRoot(const Box& layoutBox) const
 {
-    ASSERT((isHeightAuto(layoutBox) || layoutBox.establishesTableFormattingContext()) && (layoutBox.establishesFormattingContext() || layoutBox.isDocumentBox()));
+    ASSERT((isHeightAuto(layoutBox) || layoutBox.establishesTableFormattingContext() || layoutBox.isTableCell()) && (layoutBox.establishesFormattingContext() || layoutBox.isDocumentBox()));
 
     // 10.6.7 'Auto' heights for block formatting context roots
 
index c76b1db..c51bb26 100644 (file)
@@ -41,9 +41,7 @@ namespace Layout {
 LayoutUnit TableFormattingContext::Geometry::cellHeigh(const ContainerBox& cellBox) const
 {
     ASSERT(cellBox.isInFlow());
-    if (auto height = computedHeight(cellBox))
-        return *height;
-    return contentHeightForFormattingContextRoot(cellBox);
+    return std::max(computedHeight(cellBox).valueOr(0_lu), contentHeightForFormattingContextRoot(cellBox));
 }
 
 Edges TableFormattingContext::Geometry::computedCellBorder(const TableGrid::Cell& cell) const