Title: [278403] trunk
Revision
278403
Author
[email protected]
Date
2021-06-03 06:02:37 -0700 (Thu, 03 Jun 2021)

Log Message

[LFC][TFC] Use the fixed table height value to resolve percent column height values
https://bugs.webkit.org/show_bug.cgi?id=226566

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/layoutformattingcontext/table-with-percent-columns-simple.html

* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::layoutInFlowContent):
(WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
(WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace):
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::verticalSpaceForCellContent const):
* layout/formattingContexts/table/TableFormattingGeometry.h:

LayoutTests:

* fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html:
* fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html:
* fast/layoutformattingcontext/table-with-percent-columns-simple-expected.html: Added.
* fast/layoutformattingcontext/table-with-percent-columns-simple.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278402 => 278403)


--- trunk/LayoutTests/ChangeLog	2021-06-03 12:49:30 UTC (rev 278402)
+++ trunk/LayoutTests/ChangeLog	2021-06-03 13:02:37 UTC (rev 278403)
@@ -1,3 +1,15 @@
+2021-06-03  Alan Bujtas  <[email protected]>
+
+        [LFC][TFC] Use the fixed table height value to resolve percent column height values
+        https://bugs.webkit.org/show_bug.cgi?id=226566
+
+        Reviewed by Antti Koivisto.
+
+        * fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html:
+        * fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html:
+        * fast/layoutformattingcontext/table-with-percent-columns-simple-expected.html: Added.
+        * fast/layoutformattingcontext/table-with-percent-columns-simple.html: Added.
+
 2021-06-03  Carlos Garcia Campos  <[email protected]>
 
         [GLIB] imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse_mixed_content.html is failing since r277493

Modified: trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html (278402 => 278403)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html	2021-06-03 12:49:30 UTC (rev 278402)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html	2021-06-03 13:02:37 UTC (rev 278403)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ LayoutFormattingContextEnabled=true LayoutFormattingContextIntegrationEnabled=false ] -->
 <style>
 div {
  background-color: green;

Modified: trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html (278402 => 278403)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html	2021-06-03 12:49:30 UTC (rev 278402)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html	2021-06-03 13:02:37 UTC (rev 278403)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ LayoutFormattingContextEnabled=true LayoutFormattingContextIntegrationEnabled=false ] -->
 <style>
 td {
  background-color: green;

Added: trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-simple-expected.html (0 => 278403)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-simple-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-simple-expected.html	2021-06-03 13:02:37 UTC (rev 278403)
@@ -0,0 +1,18 @@
+<!-- webkit-test-runner [ LayoutFormattingContextEnabled=true LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+div {
+ width: 50px;
+}
+div:nth-child(odd) {
+  background-color: green;
+}
+div:nth-child(even) {
+  background-color: blue;
+}
+</style>
+<body style="background-color: white">
+<div style="height: 50px"></div>
+<div style="height: 100px"></div>
+<div style="height: 150px"></div>
+<div style="height: 200px"></div>
+</body>
\ No newline at end of file

Added: trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-simple.html (0 => 278403)


--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-simple.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-simple.html	2021-06-03 13:02:37 UTC (rev 278403)
@@ -0,0 +1,19 @@
+<!-- webkit-test-runner [ LayoutFormattingContextEnabled=true LayoutFormattingContextIntegrationEnabled=false ] -->
+<style>
+table {
+ width: 50px;
+}
+tr:nth-child(odd) {
+  background-color: green;
+}
+tr:nth-child(even) {
+  background-color: blue;
+}
+</style>
+<body style="background-color: white">
+<table height=500px style="border-spacing: 0px;">
+  <tr><td height=10%></td></tr>
+  <tr><td height=20%></td></tr>
+  <tr><td height=30%></td></tr>
+  <tr><td height=40%></td></tr>
+</table>

Modified: trunk/Source/WebCore/ChangeLog (278402 => 278403)


--- trunk/Source/WebCore/ChangeLog	2021-06-03 12:49:30 UTC (rev 278402)
+++ trunk/Source/WebCore/ChangeLog	2021-06-03 13:02:37 UTC (rev 278403)
@@ -1,3 +1,21 @@
+2021-06-03  Alan Bujtas  <[email protected]>
+
+        [LFC][TFC] Use the fixed table height value to resolve percent column height values
+        https://bugs.webkit.org/show_bug.cgi?id=226566
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/layoutformattingcontext/table-with-percent-columns-simple.html
+
+        * layout/formattingContexts/table/TableFormattingContext.cpp:
+        (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
+        (WebCore::Layout::TableFormattingContext::setUsedGeometryForCells):
+        (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraSpace):
+        * layout/formattingContexts/table/TableFormattingContext.h:
+        * layout/formattingContexts/table/TableFormattingGeometry.cpp:
+        (WebCore::Layout::TableFormattingGeometry::verticalSpaceForCellContent const):
+        * layout/formattingContexts/table/TableFormattingGeometry.h:
+
 2021-06-03  Julian Gonzalez  <[email protected]>
 
         Crash in HTMLConverter::_addLinkForElement()

Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp (278402 => 278403)


--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp	2021-06-03 12:49:30 UTC (rev 278402)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp	2021-06-03 13:02:37 UTC (rev 278403)
@@ -61,7 +61,7 @@
     // 1. Compute width and height for the grid.
     computeAndDistributeExtraSpace(availableHorizontalSpace, availableVerticalSpace);
     // 2. Finalize cells.
-    setUsedGeometryForCells(availableHorizontalSpace);
+    setUsedGeometryForCells(availableHorizontalSpace, availableVerticalSpace);
     // 3. Finalize rows.
     setUsedGeometryForRows(availableHorizontalSpace);
     // 4. Finalize sections.
@@ -76,7 +76,7 @@
     return bottom - top;
 }
 
-void TableFormattingContext::setUsedGeometryForCells(LayoutUnit availableHorizontalSpace)
+void TableFormattingContext::setUsedGeometryForCells(LayoutUnit availableHorizontalSpace, std::optional<LayoutUnit> availableVerticalSpace)
 {
     auto& grid = formattingState().tableGrid();
     auto& columnList = grid.columns().list();
@@ -111,7 +111,7 @@
             floatingStateForCellContent.clear();
             LayoutContext::createFormattingContext(cellBox, layoutState())->layoutInFlowContent(invalidationState, formattingGeometry.constraintsForInFlowContent(cellBox));
         }
-        cellBoxGeometry.setContentBoxHeight(formattingGeometry.verticalSpaceForCellContent(*cell));
+        cellBoxGeometry.setContentBoxHeight(formattingGeometry.verticalSpaceForCellContent(*cell, availableVerticalSpace));
 
         auto computeIntrinsicVerticalPaddingForCell = [&] {
             auto cellLogicalHeight = rowList[cell->startRow()].logicalHeight();
@@ -444,7 +444,7 @@
                     auto invalidationState = InvalidationState { };
                     LayoutContext::createFormattingContext(cellBox, layoutState())->layoutInFlowContent(invalidationState, formattingGeometry.constraintsForInFlowContent(cellBox));
                 }
-                cellBoxGeometry.setContentBoxHeight(formattingGeometry.verticalSpaceForCellContent(cell));
+                cellBoxGeometry.setContentBoxHeight(formattingGeometry.verticalSpaceForCellContent(cell, availableVerticalSpace));
             };
             layoutCellContent(slot.cell());
             if (slot.hasRowSpan())

Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h (278402 => 278403)


--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h	2021-06-03 12:49:30 UTC (rev 278402)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h	2021-06-03 13:02:37 UTC (rev 278403)
@@ -72,7 +72,7 @@
     TableFormattingContext::TableLayout tableLayout() const { return TableLayout(*this, formattingState().tableGrid()); }
 
     IntrinsicWidthConstraints computedIntrinsicWidthConstraints() override;
-    void setUsedGeometryForCells(LayoutUnit availableHorizontalSpace);
+    void setUsedGeometryForCells(LayoutUnit availableHorizontalSpace, std::optional<LayoutUnit> availableVerticalSpace);
     void setUsedGeometryForRows(LayoutUnit availableHorizontalSpace);
     void setUsedGeometryForSections(const ConstraintsForInFlowContent&);
 

Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.cpp (278402 => 278403)


--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.cpp	2021-06-03 12:49:30 UTC (rev 278402)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.cpp	2021-06-03 13:02:37 UTC (rev 278403)
@@ -180,11 +180,11 @@
     return logicalWidth;
 }
 
-LayoutUnit TableFormattingGeometry::verticalSpaceForCellContent(const TableGrid::Cell& cell) const
+LayoutUnit TableFormattingGeometry::verticalSpaceForCellContent(const TableGrid::Cell& cell, std::optional<LayoutUnit> availableVerticalSpace) const
 {
     auto& cellBox = cell.box();
     auto contentHeight = cellBoxContentHeight(cellBox);
-    auto computedHeight = this->computedHeight(cellBox);
+    auto computedHeight = this->computedHeight(cellBox, availableVerticalSpace);
     if (!computedHeight)
         return contentHeight;
     auto heightUsesBorderBox = layoutState().inQuirksMode() || cellBox.style().boxSizing() == BoxSizing::BorderBox;

Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.h (278402 => 278403)


--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.h	2021-06-03 12:49:30 UTC (rev 278402)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.h	2021-06-03 13:02:37 UTC (rev 278403)
@@ -45,7 +45,7 @@
     IntrinsicWidthConstraints intrinsicWidthConstraintsForCell(const TableGrid::Cell&) const;
     InlineLayoutUnit usedBaselineForCell(const ContainerBox& cellBox) const;
     LayoutUnit horizontalSpaceForCellContent(const TableGrid::Cell&) const;
-    LayoutUnit verticalSpaceForCellContent(const TableGrid::Cell&) const;
+    LayoutUnit verticalSpaceForCellContent(const TableGrid::Cell&, std::optional<LayoutUnit> availableVerticalSpace) const;
 
 private:
     const TableFormattingContext& formattingContext() const { return downcast<TableFormattingContext>(FormattingGeometry::formattingContext()); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to