<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[259983] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/259983">259983</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2020-04-12 10:53:37 -0700 (Sun, 12 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>[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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorelayouttableformattingTableFormattingContextcpp">trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp</a></li>
<li><a href="#trunkSourceWebCorelayouttableformattingTableGridcpp">trunk/Source/WebCore/layout/tableformatting/TableGrid.cpp</a></li>
<li><a href="#trunkSourceWebCorelayouttableformattingTableGridh">trunk/Source/WebCore/layout/tableformatting/TableGrid.h</a></li>
</ul>

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

</body>
</html>