Skip to content

Commit ce676c7

Browse files
committed
vaev-engine: Fix by passing containing block in table layout, allowing correct padding resolution.
1 parent a6a82f2 commit ce676c7

File tree

2 files changed

+99
-2
lines changed

2 files changed

+99
-2
lines changed

src/vaev-engine/layout/table.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,14 +546,14 @@ struct TableFormatingContext : FormatingContext {
546546
tree,
547547
box,
548548
IntrinsicSize::MIN_CONTENT,
549-
{} // FIXME
549+
{tableComputedWidth, 0_au}
550550
);
551551

552552
auto cellMaxOutput = computeIntrinsicSize(
553553
tree,
554554
box,
555555
IntrinsicSize::MAX_CONTENT,
556-
{} // FIXME
556+
{tableComputedWidth, 0_au}
557557
);
558558

559559
auto cellMinWidth = cellMinOutput.x;
@@ -840,6 +840,7 @@ struct TableFormatingContext : FormatingContext {
840840
{
841841
.intrinsic = IntrinsicSize::MIN_CONTENT,
842842
.knownSize = {colWidth[j], NONE},
843+
.containingBlock = {tableUsedWidth, 0_au},
843844
}
844845
);
845846

@@ -1008,6 +1009,7 @@ struct TableFormatingContext : FormatingContext {
10081009
verticalSize,
10091010
},
10101011
.position = {currPositionX, startPositionY},
1012+
.containingBlock = tableBoxSize,
10111013
.breakpointTraverser = breakpointsForCell,
10121014
.pendingVerticalSizes = input.pendingVerticalSizes,
10131015
}

tests/css/display-table.xhtml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,3 +1885,98 @@
18851885
</div>
18861886
</rendering>
18871887
</test>
1888+
1889+
<test name="table: padding resolution" size="320">
1890+
<container>
1891+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
1892+
1893+
<head>
1894+
<style>
1895+
body {
1896+
margin: 0;
1897+
}
1898+
1899+
th,
1900+
td {
1901+
padding: 0;
1902+
border: 0;
1903+
}
1904+
1905+
table {
1906+
border-spacing: 0;
1907+
}
1908+
1909+
.green {
1910+
background-color: green;
1911+
}
1912+
1913+
.red {
1914+
background-color: red;
1915+
}
1916+
</style>
1917+
</head>
1918+
1919+
<body>
1920+
<slot />
1921+
</body>
1922+
1923+
</html>
1924+
</container>
1925+
1926+
<rendering>
1927+
<div style="position: absolute; top: 0px; left: 0px; height: 120px; width: 100px;" class="green">
1928+
<div style="position: absolute; top: 0px; left: 0px; height: 40px; width: 100px;">
1929+
<div style="position: absolute; top: 0px; left: 0px; height: 40px; width: 100px;">
1930+
<div style="position: absolute; top: 10px; left: 10px; height: 20px; width: 50px;" class="red">
1931+
</div>
1932+
</div>
1933+
</div>
1934+
<div style="position: absolute; top: 40px; left: 0px; height: 80px; width: 100px;">
1935+
<div style="position: absolute; top: 0px; left: 0px; height: 80px; width: 100px;">
1936+
<div style="position: absolute; top: 30px; left: 30px; height: 20px; width: 20px;" class="red">
1937+
</div>
1938+
</div>
1939+
</div>
1940+
</div>
1941+
<div style="position: absolute; top: 120px; left: 0px; height: 80px; width: 50px;" class="green">
1942+
<div style="position: absolute; top: 0px; left: 0px; height: 30px; width: 50px;">
1943+
<div style="position: absolute; top: 0px; left: 0px; height: 30px; width: 50px;">
1944+
<div style="position: absolute; top: 5px; left: 5px; height: 20px; width: 50px;" class="red"></div>
1945+
</div>
1946+
</div>
1947+
<div style="position: absolute; top: 30px; left: 0px; height: 50px; width: 50px;">
1948+
<div style="position: absolute; top: 0px; left: 0px; height: 50px; width: 50px;">
1949+
<div style="position: absolute; top: 15px; left: 15px; height: 20px; width: 20px;" class="red">
1950+
</div>
1951+
</div>
1952+
</div>
1953+
</div>
1954+
</rendering>
1955+
1956+
<rendering>
1957+
<table style="width: 100px;">
1958+
<tr>
1959+
<td style="padding: 10%; background-color: green;">
1960+
<div style="width: 50px;background-color: red;height: 20px;"></div>
1961+
</td>
1962+
</tr>
1963+
<tr>
1964+
<td style="padding: 30%; background-color: green;">
1965+
<div style="width: 20px;background-color: red;height: 20px;"></div>
1966+
</td>
1967+
</tr>
1968+
</table>
1969+
<table>
1970+
<tr>
1971+
<td style="padding: 10%; background-color: green;">
1972+
<div style="width: 50px;background-color: red;height: 20px;"></div>
1973+
</td>
1974+
</tr>
1975+
<tr>
1976+
<td style="padding: 30%; background-color: green;">
1977+
<div style="width: 20px;background-color: red;height: 20px;"></div>
1978+
</td>
1979+
</tr>
1980+
</table>
1981+
</rendering>
1982+
</test>

0 commit comments

Comments
 (0)