<!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>[278239] trunk</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/278239">278239</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2021-05-29 06:38:58 -0700 (Sat, 29 May 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[LFC][TFC] Do not include vertical spacing when resolving percent height for table content
https://bugs.webkit.org/show_bug.cgi?id=226365

Source/WebCore:

Reviewed by Antti Koivisto.

<table style="height: 100px; border-spacing: 10px;"><tr><td style="height: 100%"></td></tr></table>
The <td>'s 100% height is resolved against 100px - (2 * 10px) -> 80px;

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

* layout/formattingContexts/table/TableFormattingContext.cpp:
(WebCore::Layout::TableFormattingContext::TableFormattingContext):
* layout/formattingContexts/table/TableFormattingContext.h:
* layout/formattingContexts/table/TableFormattingGeometry.cpp:
(WebCore::Layout::TableFormattingGeometry::TableFormattingGeometry):
(WebCore::Layout::TableFormattingGeometry::computedCellBorder const):
* layout/formattingContexts/table/TableFormattingGeometry.h:
(WebCore::Layout::TableFormattingGeometry::formattingContext const):
* layout/formattingContexts/table/TableFormattingQuirks.cpp:
(WebCore::Layout::TableFormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
* layout/formattingContexts/table/TableFormattingQuirks.h:
(WebCore::Layout::TableFormattingQuirks::formattingContext const):

LayoutTests:

Reviewed by Antti Koivisto.

* TestExpectations: WebKit table layout don't resolve the height percent properly when border spacing is present.
* fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html: Added.
* fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorelayoutformattingContextstableTableFormattingContextcpp">trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutformattingContextstableTableFormattingContexth">trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h</a></li>
<li><a href="#trunkSourceWebCorelayoutformattingContextstableTableFormattingGeometrycpp">trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutformattingContextstableTableFormattingGeometryh">trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.h</a></li>
<li><a href="#trunkSourceWebCorelayoutformattingContextstableTableFormattingQuirkscpp">trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutformattingContextstableTableFormattingQuirksh">trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastlayoutformattingcontexttablewithpercentcolumnsandspacingexpectedhtml">trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastlayoutformattingcontexttablewithpercentcolumnsandspacinghtml">trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (278238 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-05-29 12:12:10 UTC (rev 278238)
+++ trunk/LayoutTests/ChangeLog 2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2021-05-29  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC][TFC] Do not include vertical spacing when resolving percent height for table content
+        https://bugs.webkit.org/show_bug.cgi?id=226365
+
+        Reviewed by Antti Koivisto.
+
+        * TestExpectations: WebKit table layout don't resolve the height percent properly when border spacing is present.
+        * fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html: Added.
+        * fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html: Added.
+
</ins><span class="cx"> 2021-05-28  Wenson Hsieh  <wenson_hsieh@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Web process terminates when attempting to log in on bankid.no
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (278238 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations       2021-05-29 12:12:10 UTC (rev 278238)
+++ trunk/LayoutTests/TestExpectations  2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -4873,6 +4873,7 @@
</span><span class="cx"> webkit.org/b/225247 [ Debug ] fast/multicol/span/float-becomes-spanner-crash.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/226002 fast/layoutformattingcontext/table-simple-row-height.html [ Skip ]
</span><ins>+webkit.org/b/226364 fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> # This webstorage test has crashed since it was imported.
</span><span class="cx"> imported/w3c/web-platform-tests/webstorage/storage_session_setitem_quotaexceedederr.window.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsfastlayoutformattingcontexttablewithpercentcolumnsandspacingexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html (0 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html                              (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing-expected.html 2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+<style>
+div {
+ background-color: green;
+ width: 102px;
+ height: 235px;
+ margin: 10px;
+}
+</style>
+<div style="margin-top: 18px;"></div>
+<div></div>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastlayoutformattingcontexttablewithpercentcolumnsandspacinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html (0 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html                               (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html  2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+<style>
+td {
+ background-color: green;
+ width: 100px;
+}
+</style>
+<table height=500 style="border-spacing: 10px;">
+<tr><td height=50%></td></tr>
+<tr><td height=50%></td></tr>
+</table>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (278238 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-05-29 12:12:10 UTC (rev 278238)
+++ trunk/Source/WebCore/ChangeLog      2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -1,5 +1,30 @@
</span><span class="cx"> 2021-05-29  Alan Bujtas  <zalan@apple.com>
</span><span class="cx"> 
</span><ins>+        [LFC][TFC] Do not include vertical spacing when resolving percent height for table content
+        https://bugs.webkit.org/show_bug.cgi?id=226365
+
+        Reviewed by Antti Koivisto.
+
+        <table style="height: 100px; border-spacing: 10px;"><tr><td style="height: 100%"></td></tr></table>
+        The <td>'s 100% height is resolved against 100px - (2 * 10px) -> 80px;
+
+        Test: fast/layoutformattingcontext/table-with-percent-columns-and-spacing.html
+
+        * layout/formattingContexts/table/TableFormattingContext.cpp:
+        (WebCore::Layout::TableFormattingContext::TableFormattingContext):
+        * layout/formattingContexts/table/TableFormattingContext.h:
+        * layout/formattingContexts/table/TableFormattingGeometry.cpp:
+        (WebCore::Layout::TableFormattingGeometry::TableFormattingGeometry):
+        (WebCore::Layout::TableFormattingGeometry::computedCellBorder const):
+        * layout/formattingContexts/table/TableFormattingGeometry.h:
+        (WebCore::Layout::TableFormattingGeometry::formattingContext const):
+        * layout/formattingContexts/table/TableFormattingQuirks.cpp:
+        (WebCore::Layout::TableFormattingQuirks::heightValueOfNearestContainingBlockWithFixedHeight const):
+        * layout/formattingContexts/table/TableFormattingQuirks.h:
+        (WebCore::Layout::TableFormattingQuirks::formattingContext const):
+
+2021-05-29  Alan Bujtas  <zalan@apple.com>
+
</ins><span class="cx">         [LFC] Transition containing block for loops to range loops
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=226315
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutformattingContextstableTableFormattingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp (278238 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp  2021-05-29 12:12:10 UTC (rev 278238)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.cpp     2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> // https://www.w3.org/TR/css-tables-3/#table-layout-algorithm
</span><span class="cx"> TableFormattingContext::TableFormattingContext(const ContainerBox& formattingContextRoot, TableFormattingState& formattingState)
</span><span class="cx">     : FormattingContext(formattingContextRoot, formattingState)
</span><del>-    , m_tableFormattingGeometry(*this, formattingState.tableGrid())
</del><ins>+    , m_tableFormattingGeometry(*this)
</ins><span class="cx">     , m_tableFormattingQuirks(*this)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutformattingContextstableTableFormattingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h (278238 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h    2021-05-29 12:12:10 UTC (rev 278238)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingContext.h       2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -54,6 +54,8 @@
</span><span class="cx"> 
</span><span class="cx">     static UniqueRef<TableGrid> ensureTableGrid(const ContainerBox& tableBox);
</span><span class="cx"> 
</span><ins>+    const TableFormattingState& formattingState() const { return downcast<TableFormattingState>(FormattingContext::formattingState()); }
+
</ins><span class="cx"> private:
</span><span class="cx">     class TableLayout {
</span><span class="cx">     public:
</span><span class="lines">@@ -81,7 +83,6 @@
</span><span class="cx">     IntrinsicWidthConstraints computedPreferredWidthForColumns();
</span><span class="cx">     void computeAndDistributeExtraSpace(LayoutUnit availableHorizontalSpace, Optional<LayoutUnit> availableVerticalSpace);
</span><span class="cx"> 
</span><del>-    const TableFormattingState& formattingState() const { return downcast<TableFormattingState>(FormattingContext::formattingState()); }
</del><span class="cx">     TableFormattingState& formattingState() { return downcast<TableFormattingState>(FormattingContext::formattingState()); }
</span><span class="cx"> 
</span><span class="cx">     const TableFormattingGeometry m_tableFormattingGeometry;
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutformattingContextstableTableFormattingGeometrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.cpp (278238 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.cpp 2021-05-29 12:12:10 UTC (rev 278238)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.cpp    2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -39,9 +39,8 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace Layout {
</span><span class="cx"> 
</span><del>-TableFormattingGeometry::TableFormattingGeometry(const TableFormattingContext& tableFormattingContext, const TableGrid& grid)
</del><ins>+TableFormattingGeometry::TableFormattingGeometry(const TableFormattingContext& tableFormattingContext)
</ins><span class="cx">     : FormattingGeometry(tableFormattingContext)
</span><del>-    , m_grid(grid)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -65,9 +64,10 @@
</span><span class="cx"> 
</span><span class="cx"> Edges TableFormattingGeometry::computedCellBorder(const TableGrid::Cell& cell) const
</span><span class="cx"> {
</span><ins>+    auto& grid = formattingContext().formattingState().tableGrid();
</ins><span class="cx">     auto& cellBox = cell.box();
</span><span class="cx">     auto border = computedBorder(cellBox);
</span><del>-    auto collapsedBorder = m_grid.collapsedBorder();
</del><ins>+    auto collapsedBorder = grid.collapsedBorder();
</ins><span class="cx">     if (!collapsedBorder)
</span><span class="cx">         return border;
</span><span class="cx"> 
</span><span class="lines">@@ -77,31 +77,31 @@
</span><span class="cx">     if (!cellPosition.column)
</span><span class="cx">         border.horizontal.left = collapsedBorder->horizontal.left / 2;
</span><span class="cx">     else {
</span><del>-        auto adjacentBorderRight = computedBorder(m_grid.slot({ cellPosition.column - 1, cellPosition.row })->cell().box()).horizontal.right;
</del><ins>+        auto adjacentBorderRight = computedBorder(grid.slot({ cellPosition.column - 1, cellPosition.row })->cell().box()).horizontal.right;
</ins><span class="cx">         border.horizontal.left = std::max(border.horizontal.left, adjacentBorderRight) / 2;
</span><span class="cx">     }
</span><span class="cx">     // Collapsed border right from table and adjacent cells.
</span><del>-    if (cellPosition.column == m_grid.columns().size() - 1)
</del><ins>+    if (cellPosition.column == grid.columns().size() - 1)
</ins><span class="cx">         border.horizontal.right = collapsedBorder->horizontal.right / 2;
</span><span class="cx">     else {
</span><del>-        auto adjacentBorderLeft = computedBorder(m_grid.slot({ cellPosition.column + 1, cellPosition.row })->cell().box()).horizontal.left;
</del><ins>+        auto adjacentBorderLeft = computedBorder(grid.slot({ cellPosition.column + 1, cellPosition.row })->cell().box()).horizontal.left;
</ins><span class="cx">         border.horizontal.right = std::max(border.horizontal.right, adjacentBorderLeft) / 2;
</span><span class="cx">     }
</span><span class="cx">     // Collapsed border top from table, row and adjacent cells.
</span><del>-    auto& rows = m_grid.rows().list();
</del><ins>+    auto& rows = grid.rows().list();
</ins><span class="cx">     if (!cellPosition.row)
</span><span class="cx">         border.vertical.top = collapsedBorder->vertical.top / 2;
</span><span class="cx">     else {
</span><del>-        auto adjacentBorderBottom = computedBorder(m_grid.slot({ cellPosition.column, cellPosition.row - 1 })->cell().box()).vertical.bottom;
</del><ins>+        auto adjacentBorderBottom = computedBorder(grid.slot({ cellPosition.column, cellPosition.row - 1 })->cell().box()).vertical.bottom;
</ins><span class="cx">         auto adjacentRowBottom = computedBorder(rows[cellPosition.row - 1].box()).vertical.bottom;
</span><span class="cx">         auto adjacentCollapsedBorder = std::max(adjacentBorderBottom, adjacentRowBottom);
</span><span class="cx">         border.vertical.top = std::max(border.vertical.top, adjacentCollapsedBorder) / 2;
</span><span class="cx">     }
</span><span class="cx">     // Collapsed border bottom from table, row and adjacent cells.
</span><del>-    if (cellPosition.row == m_grid.rows().size() - 1)
</del><ins>+    if (cellPosition.row == grid.rows().size() - 1)
</ins><span class="cx">         border.vertical.bottom = collapsedBorder->vertical.bottom / 2;
</span><span class="cx">     else {
</span><del>-        auto adjacentBorderTop = computedBorder(m_grid.slot({ cellPosition.column, cellPosition.row + 1 })->cell().box()).vertical.top;
</del><ins>+        auto adjacentBorderTop = computedBorder(grid.slot({ cellPosition.column, cellPosition.row + 1 })->cell().box()).vertical.top;
</ins><span class="cx">         auto adjacentRowTop = computedBorder(rows[cellPosition.row + 1].box()).vertical.top;
</span><span class="cx">         auto adjacentCollapsedBorder = std::max(adjacentBorderTop, adjacentRowTop);
</span><span class="cx">         border.vertical.bottom = std::max(border.vertical.bottom, adjacentCollapsedBorder) / 2;
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutformattingContextstableTableFormattingGeometryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.h (278238 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.h   2021-05-29 12:12:10 UTC (rev 278238)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingGeometry.h      2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> 
</span><span class="cx"> class TableFormattingGeometry : public FormattingGeometry {
</span><span class="cx"> public:
</span><del>-    TableFormattingGeometry(const TableFormattingContext&, const TableGrid&);
</del><ins>+    TableFormattingGeometry(const TableFormattingContext&);
</ins><span class="cx"> 
</span><span class="cx">     LayoutUnit cellBoxContentHeight(const ContainerBox&) const;
</span><span class="cx">     Edges computedCellBorder(const TableGrid::Cell&) const;
</span><span class="lines">@@ -47,7 +47,6 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     const TableFormattingContext& formattingContext() const { return downcast<TableFormattingContext>(FormattingGeometry::formattingContext()); }
</span><del>-    const TableGrid& m_grid;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutformattingContextstableTableFormattingQuirkscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.cpp (278238 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.cpp   2021-05-29 12:12:10 UTC (rev 278238)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.cpp      2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "LayoutContainingBlockChainIterator.h"
</span><span class="cx"> #include "LayoutState.h"
</span><span class="cx"> #include "TableFormattingContext.h"
</span><ins>+#include "TableGrid.h"
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace Layout {
</span><span class="lines">@@ -61,12 +62,19 @@
</span><span class="cx">     // The "let's find the nearest ancestor with fixed height to resolve percent height" quirk is limited to the table formatting
</span><span class="cx">     // context. If we can't resolve it within the table subtree, we default it to 0.
</span><span class="cx">     // e.g <div style="height: 100px"><table><tr><td style="height: 100%"></td></tr></table></div> is resolved to 0px.
</span><del>-    auto fixedLogicalHeight = [&](const auto& ancestorBox) {
</del><ins>+    auto& tableBox = formattingContext().root();
+    auto fixedLogicalHeight = [&](const auto& ancestorBox) -> Optional<LayoutUnit> {
</ins><span class="cx">         auto height = ancestorBox.style().logicalHeight();
</span><del>-        return height.isFixed() ? std::make_optional(LayoutUnit { height.value() }) : std::nullopt;
</del><ins>+        if (!height.isFixed())
+            return { };
+        if (&ancestorBox != &tableBox)
+            return LayoutUnit { height.value() };
+        auto& grid = formattingContext().formattingState().tableGrid();
+        auto verticalSpacing = grid.verticalSpacing();
+        return LayoutUnit { height.value() - ((grid.rows().size() + 1) * verticalSpacing) };
</ins><span class="cx">     };
</span><span class="cx"> 
</span><del>-    for (auto& ancestor : containingBlockChain(layoutBox, formattingContext().root().containingBlock())) {
</del><ins>+    for (auto& ancestor : containingBlockChain(layoutBox, tableBox.containingBlock())) {
</ins><span class="cx">         if (auto fixedHeight = fixedLogicalHeight(ancestor))
</span><span class="cx">             return *fixedHeight;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutformattingContextstableTableFormattingQuirksh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.h (278238 => 278239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.h     2021-05-29 12:12:10 UTC (rev 278238)
+++ trunk/Source/WebCore/layout/formattingContexts/table/TableFormattingQuirks.h        2021-05-29 13:38:58 UTC (rev 278239)
</span><span class="lines">@@ -40,6 +40,10 @@
</span><span class="cx"> 
</span><span class="cx">     static bool shouldIgnoreChildContentVerticalMargin(const ContainerBox&);
</span><span class="cx">     LayoutUnit heightValueOfNearestContainingBlockWithFixedHeight(const Box&) const final;
</span><ins>+
+private:
+    const TableFormattingContext& formattingContext() const { return downcast<TableFormattingContext>(FormattingQuirks::formattingContext()); }
+
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>