Title: [261298] trunk
Revision
261298
Author
[email protected]
Date
2020-05-07 09:39:57 -0700 (Thu, 07 May 2020)

Log Message

[LFC][TFC] Set section [top, left] used position.
https://bugs.webkit.org/show_bug.cgi?id=211546

Reviewed by Antti Koivisto.

Source/WebCore:

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

* layout/Verification.cpp:
(WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::layoutInFlowContent):
(WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
* layout/tableformatting/TableFormattingContext.h:

LayoutTests:

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261297 => 261298)


--- trunk/LayoutTests/ChangeLog	2020-05-07 16:38:48 UTC (rev 261297)
+++ trunk/LayoutTests/ChangeLog	2020-05-07 16:39:57 UTC (rev 261298)
@@ -1,3 +1,13 @@
+2020-05-07  Zalan Bujtas  <[email protected]>
+
+        [LFC][TFC] Set section [top, left] used position.
+        https://bugs.webkit.org/show_bug.cgi?id=211546
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-simple-with-padding-expected.txt: Added.
+        * fast/layoutformattingcontext/table-simple-with-padding.html: Added.
+
 2020-05-07  Antti Koivisto  <[email protected]>
 
         [Wheel event region] Include listeners on Document

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


--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-with-padding-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-with-padding-expected.txt	2020-05-07 16:39:57 UTC (rev 261298)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x440
+  RenderBlock {HTML} at (0,0) size 800x440
+    RenderBody {BODY} at (8,8) size 784x424
+      RenderTable {TABLE} at (0,0) size 104x424
+        RenderTableSection {TBODY} at (10,10) size 84x404
+          RenderTableRow {TR} at (0,0) size 84x202
+            RenderTableCell {TD} at (0,100) size 42x2 [r=0 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (42,100) size 42x2 [r=0 c=1 rs=1 cs=1]
+          RenderTableRow {TR} at (0,202) size 84x202
+            RenderTableCell {TD} at (0,302) size 42x2 [r=1 c=0 rs=1 cs=1]
+            RenderTableCell {TD} at (42,302) size 42x2 [r=1 c=1 rs=1 cs=1]

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


--- trunk/LayoutTests/fast/layoutformattingcontext/table-simple-with-padding.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-simple-with-padding.html	2020-05-07 16:39:57 UTC (rev 261298)
@@ -0,0 +1,15 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:LayoutFormattingContextEnabled=true internal:LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+table {
+    font-size: 10px;
+    border-spacing: 0px;
+    padding: 10px;
+}
+td {
+    outline: 1px 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 (261297 => 261298)


--- trunk/Source/WebCore/ChangeLog	2020-05-07 16:38:48 UTC (rev 261297)
+++ trunk/Source/WebCore/ChangeLog	2020-05-07 16:39:57 UTC (rev 261298)
@@ -1,3 +1,19 @@
+2020-05-07  Zalan Bujtas  <[email protected]>
+
+        [LFC][TFC] Set section [top, left] used position.
+        https://bugs.webkit.org/show_bug.cgi?id=211546
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/layoutformattingcontext/table-simple-with-padding.html
+
+        * layout/Verification.cpp:
+        (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
+        * layout/tableformatting/TableFormattingContext.cpp:
+        (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
+        (WebCore::Layout::TableFormattingContext::setUsedGeometryForSections):
+        * layout/tableformatting/TableFormattingContext.h:
+
 2020-05-07  Antti Koivisto  <[email protected]>
 
         [Wheel event region] Include listeners on Document

Modified: trunk/Source/WebCore/layout/Verification.cpp (261297 => 261298)


--- trunk/Source/WebCore/layout/Verification.cpp	2020-05-07 16:38:48 UTC (rev 261297)
+++ trunk/Source/WebCore/layout/Verification.cpp	2020-05-07 16:39:57 UTC (rev 261298)
@@ -39,6 +39,8 @@
 #include "RenderBox.h"
 #include "RenderInline.h"
 #include "RenderLineBreak.h"
+#include "RenderTableCell.h"
+#include "RenderTableSection.h"
 #include "RenderView.h"
 #include <wtf/text/TextStream.h>
 
@@ -270,7 +272,9 @@
         return true;
     }
 
-    if (!areEssentiallyEqual(renderer.contentBoxRect(), displayBox.contentBox())) {
+    // 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);
+    if (shouldCheckContentBox && !areEssentiallyEqual(renderer.contentBoxRect(), displayBox.contentBox())) {
         outputRect("contentBox", renderer.contentBoxRect(), displayBox.contentBox());
         return true;
     }

Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (261297 => 261298)


--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp	2020-05-07 16:38:48 UTC (rev 261297)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp	2020-05-07 16:39:57 UTC (rev 261298)
@@ -60,7 +60,7 @@
     // 3. Finalize rows.
     setUsedGeometryForRows(availableHorizontalSpace);
     // 4. Finalize sections.
-    setUsedGeometryForSections(availableHorizontalSpace);
+    setUsedGeometryForSections(constraints);
 }
 
 void TableFormattingContext::setUsedGeometryForCells(LayoutUnit availableHorizontalSpace)
@@ -132,14 +132,14 @@
     }
 }
 
-void TableFormattingContext::setUsedGeometryForSections(LayoutUnit availableHorizontalSpace)
+void TableFormattingContext::setUsedGeometryForSections(const ConstraintsForInFlowContent& constraints)
 {
     auto& grid = formattingState().tableGrid();
     auto sectionWidth = grid.columns().logicalWidth() + 2 * grid.horizontalSpacing();
-
+    auto logicalTop = constraints.vertical.logicalTop;
     for (auto& section : childrenOfType<ContainerBox>(root())) {
         auto& sectionDisplayBox = formattingState().displayBox(section);
-        computeBorderAndPadding(section, HorizontalConstraints { { }, availableHorizontalSpace });
+        computeBorderAndPadding(section, HorizontalConstraints { { }, constraints.horizontal.logicalWidth });
         // Internal table elements do not have margins.
         sectionDisplayBox.setHorizontalMargin({ });
         sectionDisplayBox.setHorizontalComputedMargin({ });
@@ -147,8 +147,11 @@
 
         sectionDisplayBox.setContentBoxWidth(sectionWidth);
         sectionDisplayBox.setContentBoxHeight(grid.rows().list().last().logicalBottom() + grid.verticalSpacing());
-        // FIXME: Position table sections properly.
-        sectionDisplayBox.setTopLeft({ });
+
+        sectionDisplayBox.setLeft(constraints.horizontal.logicalLeft);
+        sectionDisplayBox.setTop(logicalTop);
+
+        logicalTop += sectionDisplayBox.height();
     }
 }
 

Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h (261297 => 261298)


--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h	2020-05-07 16:38:48 UTC (rev 261297)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.h	2020-05-07 16:39:57 UTC (rev 261298)
@@ -64,7 +64,7 @@
     void layoutCell(const TableGrid::Cell&, LayoutUnit availableHorizontalSpace, Optional<LayoutUnit> usedCellHeight = WTF::nullopt);
     void setUsedGeometryForCells(LayoutUnit availableHorizontalSpace);
     void setUsedGeometryForRows(LayoutUnit availableHorizontalSpace);
-    void setUsedGeometryForSections(LayoutUnit availableHorizontalSpace);
+    void setUsedGeometryForSections(const ConstraintsForInFlowContent&);
 
     void ensureTableGrid();
     IntrinsicWidthConstraints computedPreferredWidthForColumns();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to