[LFC][TFC] Take row border into account when computing collapsed borders.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 May 2020 20:53:52 +0000 (20:53 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 May 2020 20:53:52 +0000 (20:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=212305

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/layoutformattingcontext/table-simple-collapsed-row-border.html

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

LayoutTests:

* fast/layoutformattingcontext/table-simple-collapsed-row-border-expected.html: Added.
* fast/layoutformattingcontext/table-simple-collapsed-row-border.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border-expected.html [new file with mode: 0644]
LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp

index 25932cc..81f7ae3 100644 (file)
@@ -1,5 +1,15 @@
 2020-05-23  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][TFC] Take row border into account when computing collapsed borders.
+        https://bugs.webkit.org/show_bug.cgi?id=212305
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-simple-collapsed-row-border-expected.html: Added.
+        * fast/layoutformattingcontext/table-simple-collapsed-row-border.html: Added.
+
+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
 
diff --git a/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border-expected.html b/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border-expected.html
new file mode 100644 (file)
index 0000000..968e66e
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+    height: 100px;
+    width: 100px;
+    border: 100px solid green;
+}
+</style>
+<div></div>
diff --git a/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border.html b/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border.html
new file mode 100644 (file)
index 0000000..ee409f4
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+table {
+    border-collapse: collapse;
+}
+td {
+    width: 50px;
+    height: 100px;
+    padding: 0px;
+}
+
+tr {
+    border: 100px solid green;
+}
+</style>
+<table>
+<tr><td></td><td></td></tr>
+</tbody>
+</table>
index a4a5863..285eef9 100644 (file)
@@ -1,3 +1,15 @@
+2020-05-23  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC][TFC] Take row border into account when computing collapsed borders.
+        https://bugs.webkit.org/show_bug.cgi?id=212305
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/layoutformattingcontext/table-simple-collapsed-row-border.html
+
+        * layout/blockformatting/tablewrapper/TableWrapperBlockFormattingContext.cpp:
+        (WebCore::Layout::TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox):
+
 2020-05-23  Jack Lee  <shihchieh_lee@apple.com>
 
         ASSERTION FAILED: (!s_current || &m_view != &s_current->m_view) in RenderTreeBuilder::RenderTreeBuilder
index 08122f7..aaf8252 100644 (file)
@@ -110,6 +110,16 @@ void TableWrapperBlockFormattingContext::computeBorderAndPaddingForTableBox(cons
             topBorder = std::max(topBorder, geometry().computedBorder(boxInFirstRox).vertical.top);
             bottomBorder = std::max(bottomBorder, geometry().computedBorder(boxInLastRow).vertical.bottom);
         }
+
+        auto& rows = grid.rows().list();
+        topBorder = std::max(topBorder, geometry().computedBorder(rows[0].box()).vertical.top);
+        for (auto& row : rows) {
+            auto horiztonalBorder = geometry().computedBorder(row.box()).horizontal;
+            leftBorder = std::max(leftBorder, horiztonalBorder.left);
+            rightBorder = std::max(rightBorder, horiztonalBorder.right);
+        }
+        bottomBorder = std::max(topBorder, geometry().computedBorder(rows[rows.size() - 1].box()).vertical.bottom);
+
         auto collapsedBorder = Edges { { leftBorder, rightBorder }, { topBorder, bottomBorder } };
         grid.setCollapsedBorder(collapsedBorder);