Title: [262106] trunk
Revision
262106
Author
[email protected]
Date
2020-05-24 08:23:51 -0700 (Sun, 24 May 2020)

Log Message

[LFC][TFC] Take collapsed in-between row border into account when computing cell height
https://bugs.webkit.org/show_bug.cgi?id=212307

Reviewed by Antti Koivisto.

Source/WebCore:

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

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

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262105 => 262106)


--- trunk/LayoutTests/ChangeLog	2020-05-24 15:07:35 UTC (rev 262105)
+++ trunk/LayoutTests/ChangeLog	2020-05-24 15:23:51 UTC (rev 262106)
@@ -1,3 +1,13 @@
+2020-05-24  Zalan Bujtas  <[email protected]>
+
+        [LFC][TFC] Take collapsed in-between row border into account when computing cell height
+        https://bugs.webkit.org/show_bug.cgi?id=212307
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-simple-collapsed-row-border2-expected.html: Added.
+        * fast/layoutformattingcontext/table-simple-collapsed-row-border2.html: Added.
+
 2020-05-23  Zalan Bujtas  <[email protected]>
 
         [LFC][TFC] Take row border into account when computing collapsed borders.

Added: trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border2-expected.html (0 => 262106)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border2-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border2-expected.html	2020-05-24 15:23:51 UTC (rev 262106)
@@ -0,0 +1,12 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+    height: 20px;
+    width: 20px;
+    border: 10px solid green;
+    margin-bottom: -10px;
+}
+</style>
+<div></div>
+<div></div>
+<div></div>

Added: trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border2.html (0 => 262106)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-collapsed-row-border2.html	2020-05-24 15:23:51 UTC (rev 262106)
@@ -0,0 +1,21 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+table {
+  border-collapse: collapse;
+}
+td {
+    width: 10px;
+    height: 20px;
+    padding: 0px;
+}
+
+tr {
+    border: 10px solid green;
+}
+</style>
+<table>
+<tr><td></td><td></td></tr>
+<tr><td></td><td></td></tr>
+<tr><td></td><td></td></tr>
+</tbody>
+</table>

Modified: trunk/Source/WebCore/ChangeLog (262105 => 262106)


--- trunk/Source/WebCore/ChangeLog	2020-05-24 15:07:35 UTC (rev 262105)
+++ trunk/Source/WebCore/ChangeLog	2020-05-24 15:23:51 UTC (rev 262106)
@@ -1,3 +1,15 @@
+2020-05-24  Zalan Bujtas  <[email protected]>
+
+        [LFC][TFC] Take collapsed in-between row border into account when computing cell height
+        https://bugs.webkit.org/show_bug.cgi?id=212307
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/layoutformattingcontext/table-simple-collapsed-row-border2.html
+
+        * layout/tableformatting/TableFormattingContextGeometry.cpp:
+        (WebCore::Layout::TableFormattingContext::Geometry::computedCellBorder const):
+
 2020-05-23  Zalan Bujtas  <[email protected]>
 
         [LFC][TFC] Take row border into account when computing collapsed borders.

Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp (262105 => 262106)


--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp	2020-05-24 15:07:35 UTC (rev 262105)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp	2020-05-24 15:23:51 UTC (rev 262106)
@@ -54,6 +54,7 @@
 
     // We might want to cache these collapsed borders on the grid.
     auto cellPosition = cell.position();
+    // Collapsed border left from table and adjacent cells.
     if (!cellPosition.column)
         border.horizontal.left = collapsedBorder->horizontal.left / 2;
     else {
@@ -60,6 +61,7 @@
         auto adjacentBorderRight = computedBorder(m_grid.slot({ cellPosition.column - 1, cellPosition.row })->cell().box()).horizontal.right;
         border.horizontal.left = std::max(border.horizontal.left, adjacentBorderRight) / 2;
     }
+    // Collapsed border right from table and adjacent cells.
     if (cellPosition.column == m_grid.columns().size() - 1)
         border.horizontal.right = collapsedBorder->horizontal.right / 2;
     else {
@@ -66,17 +68,24 @@
         auto adjacentBorderLeft = computedBorder(m_grid.slot({ cellPosition.column + 1, cellPosition.row })->cell().box()).horizontal.left;
         border.horizontal.right = std::max(border.horizontal.right, adjacentBorderLeft) / 2;
     }
+    // Collapsed border top from table, row and adjacent cells.
+    auto& rows = m_grid.rows().list();
     if (!cellPosition.row)
         border.vertical.top = collapsedBorder->vertical.top / 2;
     else {
         auto adjacentBorderBottom = computedBorder(m_grid.slot({ cellPosition.column, cellPosition.row - 1 })->cell().box()).vertical.bottom;
-        border.vertical.top = std::max(border.vertical.top, adjacentBorderBottom) / 2;
+        auto adjacentRowBottom = computedBorder(rows[cellPosition.row - 1].box()).vertical.bottom;
+        auto adjacentCollapsedBorder = std::max(adjacentBorderBottom, adjacentRowBottom);
+        border.vertical.top = std::max(border.vertical.top, adjacentCollapsedBorder) / 2;
     }
+    // Collapsed border bottom from table, row and adjacent cells.
     if (cellPosition.row == m_grid.rows().size() - 1)
         border.vertical.bottom = collapsedBorder->vertical.bottom / 2;
     else {
         auto adjacentBorderTop = computedBorder(m_grid.slot({ cellPosition.column, cellPosition.row + 1 })->cell().box()).vertical.top;
-        border.vertical.bottom = std::max(border.vertical.bottom, adjacentBorderTop) / 2;
+        auto adjacentRowTop = computedBorder(rows[cellPosition.row + 1].box()).vertical.top;
+        auto adjacentCollapsedBorder = std::max(adjacentBorderTop, adjacentRowTop);
+        border.vertical.bottom = std::max(border.vertical.bottom, adjacentCollapsedBorder) / 2;
     }
     return border;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to