- Revision
- 259983
- Author
- [email protected]
- Date
- 2020-04-12 10:53:37 -0700 (Sun, 12 Apr 2020)
Log Message
[LFC][TFC] Column, Row and Cell boxes are always ContainerBoxes
https://bugs.webkit.org/show_bug.cgi?id=210402
Reviewed by Antti Koivisto.
These boxes are always ContainerBox types.
* layout/tableformatting/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::layoutCell):
(WebCore::Layout::TableFormattingContext::ensureTableGrid):
(WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
* layout/tableformatting/TableGrid.cpp:
(WebCore::Layout::TableGrid::Column::Column):
(WebCore::Layout::TableGrid::Columns::addColumn):
(WebCore::Layout::TableGrid::Rows::addRow):
(WebCore::Layout::TableGrid::Row::Row):
(WebCore::Layout::TableGrid::Cell::Cell):
(WebCore::Layout::TableGrid::appendCell):
(WebCore::Layout::TableGrid::insertCell):
(WebCore::Layout::TableGrid::removeCell):
* layout/tableformatting/TableGrid.h:
(WebCore::Layout::TableGrid::Column::box const):
(WebCore::Layout::TableGrid::Row::box const):
(WebCore::Layout::TableGrid::Cell::box const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (259982 => 259983)
--- trunk/Source/WebCore/ChangeLog 2020-04-12 17:21:44 UTC (rev 259982)
+++ trunk/Source/WebCore/ChangeLog 2020-04-12 17:53:37 UTC (rev 259983)
@@ -1,5 +1,32 @@
2020-04-12 Zalan Bujtas <[email protected]>
+ [LFC][TFC] Column, Row and Cell boxes are always ContainerBoxes
+ https://bugs.webkit.org/show_bug.cgi?id=210402
+
+ Reviewed by Antti Koivisto.
+
+ These boxes are always ContainerBox types.
+
+ * layout/tableformatting/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::layoutCell):
+ (WebCore::Layout::TableFormattingContext::ensureTableGrid):
+ (WebCore::Layout::TableFormattingContext::computedPreferredWidthForColumns):
+ * layout/tableformatting/TableGrid.cpp:
+ (WebCore::Layout::TableGrid::Column::Column):
+ (WebCore::Layout::TableGrid::Columns::addColumn):
+ (WebCore::Layout::TableGrid::Rows::addRow):
+ (WebCore::Layout::TableGrid::Row::Row):
+ (WebCore::Layout::TableGrid::Cell::Cell):
+ (WebCore::Layout::TableGrid::appendCell):
+ (WebCore::Layout::TableGrid::insertCell):
+ (WebCore::Layout::TableGrid::removeCell):
+ * layout/tableformatting/TableGrid.h:
+ (WebCore::Layout::TableGrid::Column::box const):
+ (WebCore::Layout::TableGrid::Row::box const):
+ (WebCore::Layout::TableGrid::Cell::box const):
+
+2020-04-12 Zalan Bujtas <[email protected]>
+
[LFC][TFC] Add support for fixed width columns
https://bugs.webkit.org/show_bug.cgi?id=210401
Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (259982 => 259983)
--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-04-12 17:21:44 UTC (rev 259982)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-04-12 17:53:37 UTC (rev 259983)
@@ -122,9 +122,8 @@
cellDisplayBox.setContentBoxWidth(contentWidth);
ASSERT(cellBox.establishesBlockFormattingContext());
- if (is<ContainerBox>(cellBox) && downcast<ContainerBox>(cellBox).hasInFlowOrFloatingChild()) {
- auto& formattingContextRoot = downcast<ContainerBox>(cellBox);
- auto formattingContextForCellContent = LayoutContext::createFormattingContext(formattingContextRoot, layoutState());
+ if (cellBox.hasInFlowOrFloatingChild()) {
+ auto formattingContextForCellContent = LayoutContext::createFormattingContext(cellBox, layoutState());
auto horizontalConstraintsForCellContent = Geometry::horizontalConstraintsForInFlow(cellDisplayBox);
auto verticalConstraintsForCellContent = Geometry::verticalConstraintsForInFlow(cellDisplayBox);
formattingContextForCellContent->layoutInFlowContent(invalidationState, horizontalConstraintsForCellContent, verticalConstraintsForCellContent);
@@ -219,7 +218,7 @@
auto columnSpanCount = column->columnSpan();
ASSERT(columnSpanCount > 0);
while (columnSpanCount--)
- columns.addColumn(*column);
+ columns.addColumn(downcast<ContainerBox>(*column));
}
}
@@ -230,7 +229,7 @@
ASSERT(row->isTableRow());
for (auto* cell = downcast<ContainerBox>(*row).firstChild(); cell; cell = cell->nextSibling()) {
ASSERT(cell->isTableCell());
- tableGrid.appendCell(*cell);
+ tableGrid.appendCell(downcast<ContainerBox>(*cell));
}
}
}
@@ -251,7 +250,7 @@
auto intrinsicWidth = formattingState.intrinsicWidthConstraintsForBox(cellBox);
if (!intrinsicWidth) {
- intrinsicWidth = geometry().intrinsicWidthConstraintsForCell(downcast<ContainerBox>(cellBox));
+ intrinsicWidth = geometry().intrinsicWidthConstraintsForCell(cellBox);
formattingState.setIntrinsicWidthConstraintsForBox(cellBox, *intrinsicWidth);
}
// Spanner cells put their intrinsic widths on the initial slots.
Modified: trunk/Source/WebCore/layout/tableformatting/TableGrid.cpp (259982 => 259983)
--- trunk/Source/WebCore/layout/tableformatting/TableGrid.cpp 2020-04-12 17:21:44 UTC (rev 259982)
+++ trunk/Source/WebCore/layout/tableformatting/TableGrid.cpp 2020-04-12 17:53:37 UTC (rev 259983)
@@ -35,7 +35,7 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(TableGrid);
-TableGrid::Column::Column(const Box* columnBox)
+TableGrid::Column::Column(const ContainerBox* columnBox)
: m_layoutBox(makeWeakPtr(columnBox))
{
}
@@ -73,7 +73,7 @@
return hasFixedWidthCell() || (box() && box()->columnWidth());
}
-void TableGrid::Columns::addColumn(const Box& columnBox)
+void TableGrid::Columns::addColumn(const ContainerBox& columnBox)
{
m_columnList.append({ &columnBox });
}
@@ -83,17 +83,17 @@
m_columnList.append({ nullptr });
}
-void TableGrid::Rows::addRow(const Box& rowBox)
+void TableGrid::Rows::addRow(const ContainerBox& rowBox)
{
m_rowList.append({ rowBox });
}
-TableGrid::Row::Row(const Box& rowBox)
+TableGrid::Row::Row(const ContainerBox& rowBox)
: m_layoutBox(makeWeakPtr(rowBox))
{
}
-TableGrid::Cell::Cell(const Box& cellBox, SlotPosition position, CellSpan span)
+TableGrid::Cell::Cell(const ContainerBox& cellBox, SlotPosition position, CellSpan span)
: m_layoutBox(makeWeakPtr(cellBox))
, m_position(position)
, m_span(span)
@@ -121,7 +121,7 @@
return m_slotMap.get(position);
}
-void TableGrid::appendCell(const Box& cellBox)
+void TableGrid::appendCell(const ContainerBox& cellBox)
{
auto rowSpan = cellBox.rowSpan();
auto columnSpan = cellBox.columnSpan();
@@ -172,13 +172,13 @@
m_cells.add(WTFMove(cell));
}
-void TableGrid::insertCell(const Box& cellBox, const Box& before)
+void TableGrid::insertCell(const ContainerBox& cellBox, const ContainerBox& before)
{
UNUSED_PARAM(cellBox);
UNUSED_PARAM(before);
}
-void TableGrid::removeCell(const Box& cellBox)
+void TableGrid::removeCell(const ContainerBox& cellBox)
{
UNUSED_PARAM(cellBox);
}
Modified: trunk/Source/WebCore/layout/tableformatting/TableGrid.h (259982 => 259983)
--- trunk/Source/WebCore/layout/tableformatting/TableGrid.h 2020-04-12 17:21:44 UTC (rev 259982)
+++ trunk/Source/WebCore/layout/tableformatting/TableGrid.h 2020-04-12 17:53:37 UTC (rev 259983)
@@ -38,6 +38,7 @@
namespace WebCore {
namespace Layout {
class Box;
+class ContainerBox;
class TableGrid {
WTF_MAKE_ISO_ALLOCATED(TableGrid);
@@ -44,9 +45,9 @@
public:
TableGrid();
- void appendCell(const Box&);
- void insertCell(const Box&, const Box& before);
- void removeCell(const Box&);
+ void appendCell(const ContainerBox&);
+ void insertCell(const ContainerBox&, const ContainerBox& before);
+ void removeCell(const ContainerBox&);
void setHorizontalSpacing(LayoutUnit horizontalSpacing) { m_horizontalSpacing = horizontalSpacing; }
LayoutUnit horizontalSpacing() const { return m_horizontalSpacing; }
@@ -61,7 +62,7 @@
// Column represents a vertical set of slots in the grid. A column has horizontal position and width.
class Column {
public:
- Column(const Box*);
+ Column(const ContainerBox*);
void setLogicalLeft(LayoutUnit);
LayoutUnit logicalLeft() const;
@@ -72,7 +73,7 @@
bool isFixedWidth() const;
void setHasFixedWidthCell() { m_hasFixedWidthCell = true; }
- const Box* box() const { return m_layoutBox.get(); }
+ const ContainerBox* box() const { return m_layoutBox.get(); }
private:
bool hasFixedWidthCell() const { return m_hasFixedWidthCell; }
@@ -79,7 +80,7 @@
LayoutUnit m_computedLogicalWidth;
LayoutUnit m_computedLogicalLeft;
- WeakPtr<const Box> m_layoutBox;
+ WeakPtr<const ContainerBox> m_layoutBox;
bool m_hasFixedWidthCell { false };
#if ASSERT_ENABLED
@@ -95,7 +96,7 @@
const ColumnList& list() const { return m_columnList; }
size_t size() const { return m_columnList.size(); }
- void addColumn(const Box&);
+ void addColumn(const ContainerBox&);
void addAnonymousColumn();
LayoutUnit logicalWidth() const { return m_columnList.last().logicalRight() - m_columnList.first().logicalLeft(); }
@@ -106,7 +107,7 @@
class Row {
public:
- Row(const Box&);
+ Row(const ContainerBox&);
void setLogicalTop(LayoutUnit logicalTop) { m_logicalTop = logicalTop; }
LayoutUnit logicalTop() const { return m_logicalTop; }
@@ -115,12 +116,12 @@
void setLogicalHeight(LayoutUnit logicalHeight) { m_logicalHeight = logicalHeight; }
LayoutUnit logicalHeight() const { return m_logicalHeight; }
- const Box& box() const { return *m_layoutBox.get(); }
+ const ContainerBox& box() const { return *m_layoutBox.get(); }
private:
LayoutUnit m_logicalTop;
LayoutUnit m_logicalHeight;
- WeakPtr<const Box> m_layoutBox;
+ WeakPtr<const ContainerBox> m_layoutBox;
};
class Rows {
@@ -129,7 +130,7 @@
RowList& list() { return m_rowList; }
const RowList& rowList() const { return m_rowList; }
- void addRow(const Box&);
+ void addRow(const ContainerBox&);
size_t size() const { return m_rowList.size(); }
@@ -141,7 +142,7 @@
class Cell : public CanMakeWeakPtr<Cell> {
WTF_MAKE_ISO_ALLOCATED_INLINE(Cell);
public:
- Cell(const Box&, SlotPosition, CellSpan);
+ Cell(const ContainerBox&, SlotPosition, CellSpan);
size_t startColumn() const { return m_position.column; }
size_t endColumn() const { return m_position.column + m_span.column; }
@@ -157,10 +158,10 @@
bool isFixedWidth() const;
- const Box& box() const { return *m_layoutBox.get(); }
+ const ContainerBox& box() const { return *m_layoutBox.get(); }
private:
- WeakPtr<const Box> m_layoutBox;
+ WeakPtr<const ContainerBox> m_layoutBox;
SlotPosition m_position;
CellSpan m_span;
};