Title: [261302] trunk
Revision
261302
Author
[email protected]
Date
2020-05-07 10:14:01 -0700 (Thu, 07 May 2020)

Log Message

[LFC[TFC] Adjust the table wrapper box style
https://bugs.webkit.org/show_bug.cgi?id=211574

Reviewed by Antti Koivisto.

Source/WebCore:

The computed values of properties 'position', 'float', 'margin-*', 'top', 'right', 'bottom', and 'left'
on the table element are used on the table wrapper box and not the table box; all other values of non-inheritable
properties are used on the table box and not the table wrapper box.

https://www.w3.org/TR/CSS22/tables.html#model

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

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isBlockContainerBox const):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createLayoutBox):
(WebCore::Layout::TreeBuilder::buildTableStructure):

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261301 => 261302)


--- trunk/LayoutTests/ChangeLog	2020-05-07 17:05:23 UTC (rev 261301)
+++ trunk/LayoutTests/ChangeLog	2020-05-07 17:14:01 UTC (rev 261302)
@@ -1,5 +1,15 @@
 2020-05-07  Zalan Bujtas  <[email protected]>
 
+        [LFC[TFC] Adjust the table wrapper box style
+        https://bugs.webkit.org/show_bug.cgi?id=211574
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-simple-with-border-expected.txt: Added.
+        * fast/layoutformattingcontext/table-simple-with-border.html: Added.
+
+2020-05-07  Zalan Bujtas  <[email protected]>
+
         [LFC][TFC] Set section [top, left] used position.
         https://bugs.webkit.org/show_bug.cgi?id=211546
 

Added: trunk/LayoutTests/fast/layoutformattingcontext/table-simple-with-border-expected.txt (0 => 261302)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-with-border-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-with-border-expected.txt	2020-05-07 17:14:01 UTC (rev 261302)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x540
+  RenderBlock {HTML} at (0,0) size 800x540
+    RenderBody {BODY} at (8,8) size 784x524
+      RenderTable {TABLE} at (0,0) size 204x524 [border: (10px solid #008000)]
+        RenderTableSection {TBODY} at (40,40) size 124x444
+          RenderTableRow {TR} at (0,0) size 124x222
+            RenderTableCell {TD} at (0,100) size 62x22 [border: (10px solid #FF0000)] [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (62,100) size 62x22 [border: (10px solid #FF0000)] [r=0 c=1 rs=1 cs=1]
+          RenderTableRow {TR} at (0,222) size 124x222
+            RenderTableCell {TD} at (0,322) size 62x22 [border: (10px solid #FF0000)] [r=1 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (62,322) size 62x22 [border: (10px solid #FF0000)] [r=1 c=1 rs=1 cs=1]

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


--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-with-border.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-with-border.html	2020-05-07 17:14:01 UTC (rev 261302)
@@ -0,0 +1,17 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+table {
+    font-size: 10px;
+    border-spacing: 0px;
+    padding: 30px;
+    border: 10px solid green;
+}
+
+td {
+    border: 10px solid red;
+}
+</style>
+<table>
+<tr><td style="height: 200px; width: 40px"></td><td style="height: 200px; width: 40px"></td></tr>
+<tr><td style="height: 200px; width: 40px"></td><td style="height: 200px; width: 40px"></td></tr>
+</table>

Modified: trunk/Source/WebCore/ChangeLog (261301 => 261302)


--- trunk/Source/WebCore/ChangeLog	2020-05-07 17:05:23 UTC (rev 261301)
+++ trunk/Source/WebCore/ChangeLog	2020-05-07 17:14:01 UTC (rev 261302)
@@ -1,3 +1,24 @@
+2020-05-07  Zalan Bujtas  <[email protected]>
+
+        [LFC[TFC] Adjust the table wrapper box style
+        https://bugs.webkit.org/show_bug.cgi?id=211574
+
+        Reviewed by Antti Koivisto.
+
+        The computed values of properties 'position', 'float', 'margin-*', 'top', 'right', 'bottom', and 'left'
+        on the table element are used on the table wrapper box and not the table box; all other values of non-inheritable
+        properties are used on the table box and not the table wrapper box.
+
+        https://www.w3.org/TR/CSS22/tables.html#model
+        
+        Test: fast/layoutformattingcontext/table-simple-with-border.html
+
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::isBlockContainerBox const):
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::TreeBuilder::createLayoutBox):
+        (WebCore::Layout::TreeBuilder::buildTableStructure):
+
 2020-05-07  Andres Gonzalez  <[email protected]>
 
         Make debug build run in accessibility isolated tree mode = 1.

Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (261301 => 261302)


--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2020-05-07 17:05:23 UTC (rev 261301)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp	2020-05-07 17:14:01 UTC (rev 261302)
@@ -308,7 +308,7 @@
 bool Box::isBlockContainerBox() const
 {
     auto display = m_style.display();
-    return display == DisplayType::Block || display == DisplayType::ListItem || isInlineBlockBox() || isTableWrapperBox() || isTableCell() || isTableCaption(); // TODO && !replaced element
+    return display == DisplayType::Block || display == DisplayType::ListItem || isInlineBlockBox() || isTableCell() || isTableCaption(); // TODO && !replaced element
 }
 
 const Box* Box::nextInFlowSibling() const

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (261301 => 261302)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-05-07 17:05:23 UTC (rev 261301)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2020-05-07 17:14:01 UTC (rev 261302)
@@ -216,7 +216,24 @@
             childLayoutBox = &createLineBreakBox(downcast<RenderLineBreak>(childRenderer).isWBR(), WTFMove(clonedStyle));
         } else if (is<RenderTable>(renderer)) {
             // Construct the principal table wrapper box (and not the table box itself).
-            childLayoutBox = &createContainer(Box::ElementAttributes { Box::ElementType::TableWrapperBox }, WTFMove(clonedStyle));
+            // The computed values of properties 'position', 'float', 'margin-*', 'top', 'right', 'bottom', and 'left' on the table element
+            // are used on the table wrapper box and not the table box; all other values of non-inheritable properties are used
+            // on the table box and not the table wrapper box.
+            auto tableWrapperBoxStyle = RenderStyle::createAnonymousStyleWithDisplay(parentContainer.style(), renderer.style().display() == DisplayType::Table ? DisplayType::Block : DisplayType::Inline);
+            tableWrapperBoxStyle.setPosition(renderer.style().position());
+            tableWrapperBoxStyle.setFloating(renderer.style().floating());
+
+            tableWrapperBoxStyle.setTop(Length { renderer.style().top() });
+            tableWrapperBoxStyle.setLeft(Length { renderer.style().left() });
+            tableWrapperBoxStyle.setBottom(Length { renderer.style().bottom() });
+            tableWrapperBoxStyle.setRight(Length { renderer.style().right() });
+
+            tableWrapperBoxStyle.setMarginTop(Length { renderer.style().marginTop() });
+            tableWrapperBoxStyle.setMarginLeft(Length { renderer.style().marginLeft() });
+            tableWrapperBoxStyle.setMarginBottom(Length { renderer.style().marginBottom() });
+            tableWrapperBoxStyle.setMarginRight(Length { renderer.style().marginRight() });
+
+            childLayoutBox = &createContainer(Box::ElementAttributes { Box::ElementType::TableWrapperBox }, WTFMove(tableWrapperBoxStyle));
             childLayoutBox->setIsAnonymous();
         } else if (is<RenderReplaced>(renderer)) {
             childLayoutBox = &createReplacedBox(WTFMove(clonedStyle));
@@ -294,6 +311,7 @@
     auto tableBoxStyle = RenderStyle::clone(tableRenderer.style());
     tableBoxStyle.setPosition(PositionType::Static);
     tableBoxStyle.setFloating(Float::No);
+    tableBoxStyle.resetMargin();
     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