Title: [264103] trunk
Revision
264103
Author
[email protected]
Date
2020-07-08 09:41:35 -0700 (Wed, 08 Jul 2020)

Log Message

[LFC][TFC] Table width is computed as if box-sizing was border-box
https://bugs.webkit.org/show_bug.cgi?id=214070

Reviewed by Antti Koivisto.

Source/WebCore:

Apparently the width property of the <table> works as if box-sizing were set to border-box (and <div style="display: table" does not).

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

* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::buildTableStructure):

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (264102 => 264103)


--- trunk/LayoutTests/ChangeLog	2020-07-08 16:22:33 UTC (rev 264102)
+++ trunk/LayoutTests/ChangeLog	2020-07-08 16:41:35 UTC (rev 264103)
@@ -1,3 +1,13 @@
+2020-07-08  Zalan Bujtas  <[email protected]>
+
+        [LFC][TFC] Table width is computed as if box-sizing was border-box
+        https://bugs.webkit.org/show_bug.cgi?id=214070
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-with-padding-and-border-simple-expected.html: Added.
+        * fast/layoutformattingcontext/table-with-padding-and-border-simple.html: Added.
+
 2020-07-08  Per Arne Vollan  <[email protected]>
 
         [Win] The layout test webanimations/accelerated-animation-single-keyframe.html is timing out

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


--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-padding-and-border-simple-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-padding-and-border-simple-expected.html	2020-07-08 16:41:35 UTC (rev 264103)
@@ -0,0 +1,15 @@
+<!DOCTYPE html><!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+.first {
+    width: 100px;
+    height: 100px;
+    background-color: green;
+}
+.second {
+    width: 140px;
+    height: 40px;
+    background-color: green;
+}
+</style>
+<div class=first></div>
+<div class=second></div>

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


--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-padding-and-border-simple.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-padding-and-border-simple.html	2020-07-08 16:41:35 UTC (rev 264103)
@@ -0,0 +1,14 @@
+<!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+.table_box {
+    width: 100px;
+    height: 100px;
+    border-spacing: 0px;
+    border: 10px solid green;
+    padding: 10px;
+    background-color: green;
+}
+
+</style>
+<table class=table_box><tr><td></td></tr></table>
+<div class=table_box style="display: table"></div>

Modified: trunk/Source/WebCore/ChangeLog (264102 => 264103)


--- trunk/Source/WebCore/ChangeLog	2020-07-08 16:22:33 UTC (rev 264102)
+++ trunk/Source/WebCore/ChangeLog	2020-07-08 16:41:35 UTC (rev 264103)
@@ -1,3 +1,17 @@
+2020-07-08  Zalan Bujtas  <[email protected]>
+
+        [LFC][TFC] Table width is computed as if box-sizing was border-box
+        https://bugs.webkit.org/show_bug.cgi?id=214070
+
+        Reviewed by Antti Koivisto.
+
+        Apparently the width property of the <table> works as if box-sizing were set to border-box (and <div style="display: table" does not).
+
+        Test: fast/layoutformattingcontext/table-with-padding-and-border-simple.html
+
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::TreeBuilder::buildTableStructure):
+
 2020-07-07  Antoine Quint  <[email protected]>
 
         [iOS] Sharing an <img> element with a base64-encoded URL shares the URL as raw text instead of an image

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (264102 => 264103)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-07-08 16:22:33 UTC (rev 264102)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-07-08 16:41:35 UTC (rev 264103)
@@ -34,6 +34,7 @@
 #include "HTMLNames.h"
 #include "HTMLTableCellElement.h"
 #include "HTMLTableColElement.h"
+#include "HTMLTableElement.h"
 #include "InlineFormattingState.h"
 #include "InvalidationContext.h"
 #include "InvalidationState.h"
@@ -315,6 +316,9 @@
     tableBoxStyle.setPosition(PositionType::Static);
     tableBoxStyle.setFloating(Float::No);
     tableBoxStyle.resetMargin();
+    // FIXME: Figure out where the spec says table width is like box-sizing: border-box;
+    if (is<HTMLTableElement>(tableRenderer.element()))
+        tableBoxStyle.setBoxSizing(BoxSizing::BorderBox);
     auto& tableBox = createContainer(Box::ElementAttributes { Box::ElementType::TableBox }, WTFMove(tableBoxStyle));
     appendChild(tableWrapperBox, tableBox);
     auto* sectionRenderer = tableChild;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to