Title: [261784] trunk
Revision
261784
Author
[email protected]
Date
2020-05-16 10:10:18 -0700 (Sat, 16 May 2020)

Log Message

[LFC][TFC] Ignore table padding when borders are collapsed
https://bugs.webkit.org/show_bug.cgi?id=211984

Reviewed by Antti Koivisto.

Source/WebCore:

Table padding has no room left when the table border is collapsed with the inner table elements.

Test: fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html

* layout/Verification.cpp:
(WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isPaddingApplicable const):

LayoutTests:

* fast/layoutformattingcontext/table-simple-border-collapse-with-padding-expected.html: Added.
* fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261783 => 261784)


--- trunk/LayoutTests/ChangeLog	2020-05-16 16:24:59 UTC (rev 261783)
+++ trunk/LayoutTests/ChangeLog	2020-05-16 17:10:18 UTC (rev 261784)
@@ -1,3 +1,13 @@
+2020-05-16  Zalan Bujtas  <[email protected]>
+
+        [LFC][TFC] Ignore table padding when borders are collapsed
+        https://bugs.webkit.org/show_bug.cgi?id=211984
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-simple-border-collapse-with-padding-expected.html: Added.
+        * fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html: Added.
+
 2020-05-16  Daniel Bates  <[email protected]>
 
         Make editing/spelling/editing-word-with-marker-2.html test what it claims and make it work on iOS

Added: trunk/LayoutTests/fast/layoutformattingcontext/table-simple-border-collapse-with-padding-expected.html (0 => 261784)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-border-collapse-with-padding-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-border-collapse-with-padding-expected.html	2020-05-16 17:10:18 UTC (rev 261784)
@@ -0,0 +1,12 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+    border: 1px solid red;
+    position: absolute;
+}
+</style>
+<div style="width: 274px; height: 18px; left: 7px; top: 7px;"></div>
+<div style="width: 274px; height: 18px; left: 281px; top: 7px;"></div>
+<div style="width: 274px; height: 18px; left: 7px; top: 25px;"></div>
+<div style="width: 274px; height: 18px; left: 281px; top: 25px;"></div>
+</div>

Added: trunk/LayoutTests/fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html (0 => 261784)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html	2020-05-16 17:10:18 UTC (rev 261784)
@@ -0,0 +1,17 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+table {
+    font-family: ahem;
+    border-collapse: collapse;
+    padding: 100px;
+    color: white;
+}
+
+td {
+    outline: 1px solid red;
+}
+</style>
+<table>
+<tr><td>iiiiiiii iiiiiiii</td><td> iiiiiiii</td></tr>
+<tr><td>iiiiiiii</td><td>iiiiiiii iiiiiiii</td></tr>
+</table>

Modified: trunk/Source/WebCore/ChangeLog (261783 => 261784)


--- trunk/Source/WebCore/ChangeLog	2020-05-16 16:24:59 UTC (rev 261783)
+++ trunk/Source/WebCore/ChangeLog	2020-05-16 17:10:18 UTC (rev 261784)
@@ -1,5 +1,21 @@
 2020-05-16  Zalan Bujtas  <[email protected]>
 
+        [LFC][TFC] Ignore table padding when borders are collapsed
+        https://bugs.webkit.org/show_bug.cgi?id=211984
+
+        Reviewed by Antti Koivisto.
+
+        Table padding has no room left when the table border is collapsed with the inner table elements.
+
+        Test: fast/layoutformattingcontext/table-simple-border-collapse-with-padding.html
+
+        * layout/Verification.cpp:
+        (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::isPaddingApplicable const):
+
+2020-05-16  Zalan Bujtas  <[email protected]>
+
         [LFC][TFC] Take vertical spacing into account when setting the height of a cell with rowspan
         https://bugs.webkit.org/show_bug.cgi?id=211976
 

Modified: trunk/Source/WebCore/layout/Verification.cpp (261783 => 261784)


--- trunk/Source/WebCore/layout/Verification.cpp	2020-05-16 16:24:59 UTC (rev 261783)
+++ trunk/Source/WebCore/layout/Verification.cpp	2020-05-16 17:10:18 UTC (rev 261784)
@@ -257,6 +257,13 @@
         displayBox.moveBy(tableWrapperDisplayBox.topLeft());
     }
 
+    if (is<RenderTableRow>(renderer) || is<RenderTableSection>(renderer)) {
+        // Table rows and tbody have 0 width for some reason when border collapsing is on.
+        if (is<RenderTableRow>(renderer) && downcast<RenderTableRow>(renderer).table()->collapseBorders())
+            return false;
+        if (downcast<RenderTableSection>(renderer).table()->collapseBorders())
+            return false;
+    }
     if (!areEssentiallyEqual(frameRect, displayBox.rect())) {
         outputRect("frameBox", renderer.frameRect(), displayBox.rect());
         return true;
@@ -272,8 +279,13 @@
         return true;
     }
 
-    // FIXME: Figure out why trunk/rendering comes back with odd values for <tbody> and <td> content box.
-    auto shouldCheckContentBox = !is<RenderTableCell>(renderer) && !is<RenderTableSection>(renderer);
+    auto shouldCheckContentBox = [&] {
+        // FIXME: Figure out why trunk/rendering comes back with odd values for <tbody> and <td> content box.
+        if (is<RenderTableCell>(renderer) || is<RenderTableSection>(renderer))
+            return false;
+        // Tables have 0 content box size for some reason when border collapsing is on.
+        return !is<RenderTable>(renderer) || !downcast<RenderTable>(renderer).collapseBorders();
+    }();
     if (shouldCheckContentBox && !areEssentiallyEqual(renderer.contentBoxRect(), displayBox.contentBox())) {
         outputRect("contentBox", renderer.contentBoxRect(), displayBox.contentBox());
         return true;

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (261783 => 261784)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2020-05-16 16:24:59 UTC (rev 261783)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2020-05-16 17:10:18 UTC (rev 261784)
@@ -374,11 +374,16 @@
 
 bool Box::isPaddingApplicable() const
 {
-    // 8.4 Padding properties:
-    // Applies to: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
     if (isAnonymous())
         return false;
 
+    if (isTableBox() && style().borderCollapse() == BorderCollapse::Collapse) {
+        // When the table collapses its borders with inner table elements, there's no room for padding.
+        return false;
+    }
+
+    // 8.4 Padding properties:
+    // Applies to: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
     return !isTableHeader()
         && !isTableBody()
         && !isTableFooter()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to