Title: [249591] trunk/Source/WebCore
- Revision
- 249591
- Author
- za...@apple.com
- Date
- 2019-09-06 14:08:35 -0700 (Fri, 06 Sep 2019)
Log Message
[LFC][TFC] Set computed row width.
https://bugs.webkit.org/show_bug.cgi?id=201533
<rdar://problem/55098828>
Reviewed by Antti Koivisto.
Decouple cell box layout/display box setup and set the computed row width.
* layout/Verification.cpp:
(WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::layout):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (249590 => 249591)
--- trunk/Source/WebCore/ChangeLog 2019-09-06 20:51:21 UTC (rev 249590)
+++ trunk/Source/WebCore/ChangeLog 2019-09-06 21:08:35 UTC (rev 249591)
@@ -1,5 +1,20 @@
2019-09-06 Zalan Bujtas <za...@apple.com>
+ [LFC][TFC] Set computed row width.
+ https://bugs.webkit.org/show_bug.cgi?id=201533
+ <rdar://problem/55098828>
+
+ Reviewed by Antti Koivisto.
+
+ Decouple cell box layout/display box setup and set the computed row width.
+
+ * layout/Verification.cpp:
+ (WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
+ * layout/tableformatting/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::layout):
+
+2019-09-06 Zalan Bujtas <za...@apple.com>
+
[LFC] A formatting context root is always a containing block for relative: static boxes.
https://bugs.webkit.org/show_bug.cgi?id=201554
<rdar://problem/55123295>
Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (249590 => 249591)
--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2019-09-06 20:51:21 UTC (rev 249590)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2019-09-06 21:08:35 UTC (rev 249591)
@@ -64,42 +64,59 @@
ASSERT(!cellList.isEmpty());
// Layout and position each table cell (and compute row height as well).
auto& layoutState = this->layoutState();
+ auto& rowList = grid.rows();
auto& columnList = grid.columnsContext().columns();
- auto& rowList = grid.rows();
- // First row.
- auto& row = rowList.first();
- row.setLogicalTop({ });
- initializeDisplayBoxToBlank(displayBoxForLayoutBox(row.box()));
for (auto& cell : cellList) {
auto& cellLayoutBox = cell->tableCellBox;
- ASSERT(cellLayoutBox.establishesBlockFormattingContext());
+ auto cellPosition = cell->position;
- auto& cellDisplayBox = displayBoxForLayoutBox(cellLayoutBox);
- // FIXME: Add support for column and row spanning.
- auto cellPosition = cell->position;
+ auto& column = columnList.at(cellPosition.x());
auto& row = rowList.at(cellPosition.y());
- auto& column = columnList.at(cellPosition.x());
+ auto& cellDisplayBox = displayBoxForLayoutBox(cell->tableCellBox);
initializeDisplayBoxToBlank(cellDisplayBox);
cellDisplayBox.setContentBoxWidth(column.logicalWidth());
cellDisplayBox.setTopLeft({ column.logicalLeft(), row.logicalTop() });
-
+ ASSERT(cellLayoutBox.establishesBlockFormattingContext());
layoutState.createFormattingContext(cellLayoutBox)->layout();
-
- // FIXME: This requires a 2 pass layout.
auto heightAndMargin = geometry().tableCellHeightAndMargin(cellLayoutBox);
- cellDisplayBox.setContentBoxHeight(heightAndMargin.height);
- cellDisplayBox.setVerticalMargin({ heightAndMargin.nonCollapsedMargin, { } });
+ // FIXME: Add support for column and row spanning and this requires a 2 pass layout.
row.setLogicalHeight(std::max(row.logicalHeight(), heightAndMargin.height));
- // FIXME: This also requires spanning support/check.
if (!cellPosition.x() && cellPosition.y()) {
auto& previousRow = rowList.at(cellPosition.y() - 1);
row.setLogicalTop(previousRow.logicalBottom());
- initializeDisplayBoxToBlank(displayBoxForLayoutBox(row.box()));
}
}
+
+ // Finalize size and position.
+ for (auto& cell : cellList) {
+ auto& cellDisplayBox = displayBoxForLayoutBox(cell->tableCellBox);
+ auto cellPosition = cell->position;
+ auto& column = columnList.at(cellPosition.x());
+ auto& row = rowList.at(cellPosition.y());
+
+ cellDisplayBox.setTop(row.logicalTop());
+ cellDisplayBox.setLeft(column.logicalLeft());
+ cellDisplayBox.setContentBoxWidth(column.logicalWidth());
+ cellDisplayBox.setContentBoxHeight(row.logicalHeight());
+ cellDisplayBox.setVerticalMargin({ });
+ cellDisplayBox.setHorizontalMargin({ });
+ }
+
+ LayoutUnit rowWidth;
+ for (auto& column : columnList)
+ rowWidth += column.logicalWidth();
+
+ for (auto& row : rowList) {
+ auto& rowDisplayBox = layoutState.displayBoxForLayoutBox(row.box());
+ initializeDisplayBoxToBlank(rowDisplayBox);
+ rowDisplayBox.setContentBoxHeight(row.logicalHeight());
+ rowDisplayBox.setContentBoxWidth(rowWidth);
+ rowDisplayBox.setTop(row.logicalTop());
+ }
+
// FIXME: This is temporary only. Size table sections properly.
for (auto& section : childrenOfType<Box>(downcast<Container>(root())))
initializeDisplayBoxToBlank(layoutState.displayBoxForLayoutBox(section));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes