Skip to content

Commit 203bbd0

Browse files
committed
[orthogonal td] RenderTableCell::logicalHeightForRowSizing should return the logical width of orthogonal content
https://bugs.webkit.org/show_bug.cgi?id=297174 Reviewed by Antti Koivisto. RenderTableSection::calcRowLogicalHeight walks through the cells and asks for height information in order to compute the final size of each rows. RenderTableCell::logicalHeightForRowSizing is supposed to tell how tall the cell is in the direction of the row. In case of orthogonal content, it's the logical _width_ of the box. * Source/WebCore/rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::logicalHeightForRowSizing const): * Source/WebCore/rendering/RenderTableCell.h: * Source/WebCore/rendering/RenderTableCellInlines.h: (WebCore::RenderTableCell::logicalHeightForRowSizing const): Deleted. * Source/WebCore/rendering/RenderTableSection.cpp: (WebCore::updateLogicalHeightForCell): (WebCore::RenderTableSection::calcRowLogicalHeight): Canonical link: https://commits.webkit.org/298559@main
1 parent 0933fd2 commit 203bbd0

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

Source/WebCore/rendering/RenderTableCell.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,28 @@ void RenderTableCell::updateLogicalWidth()
340340
setLogicalWidth(*logicalWidth);
341341
}
342342

343+
LayoutUnit RenderTableCell::logicalHeightForRowSizing() const
344+
{
345+
auto logicalSizeForRowSizing = [&] {
346+
if (!isOrthogonal())
347+
return logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
348+
LogicalExtentComputedValues values;
349+
computeLogicalWidth(values);
350+
return values.m_extent;
351+
};
352+
// FIXME: This function does too much work, and is very hot during table layout!
353+
auto usedLogicalSize = logicalSizeForRowSizing();
354+
auto specifiedSize = !isOrthogonal() ? style().logicalHeight() : style().logicalWidth();
355+
if (!specifiedSize.isSpecified())
356+
return usedLogicalSize;
357+
auto computedLogicaSize = Style::evaluate(specifiedSize, 0_lu);
358+
// In strict mode, box-sizing: content-box do the right thing and actually add in the border and padding.
359+
// Call computedCSSPadding* directly to avoid including implicitPadding.
360+
if (!document().inQuirksMode() && style().boxSizing() != BoxSizing::BorderBox)
361+
computedLogicaSize += computedCSSPaddingBefore() + computedCSSPaddingAfter() + borderBefore() + borderAfter();
362+
return std::max(computedLogicaSize, usedLogicalSize);
363+
}
364+
343365
void RenderTableCell::setCellLogicalWidth(LayoutUnit logicalWidthInTableDirection)
344366
{
345367
auto logicalSizeInTableDirection = !isOrthogonal() ? logicalWidth() : logicalHeight();

Source/WebCore/rendering/RenderTableCell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class RenderTableCell final : public RenderBlockFlow {
6161
RenderTable* table() const;
6262
unsigned rowIndex() const;
6363
inline Style::PreferredSize styleOrColLogicalWidth() const;
64-
inline LayoutUnit logicalHeightForRowSizing() const;
64+
LayoutUnit logicalHeightForRowSizing() const;
6565
LayoutUnit minLogicalWidthForColumnSizing();
6666
LayoutUnit maxLogicalWidthForColumnSizing();
6767

Source/WebCore/rendering/RenderTableCellInlines.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,6 @@ inline const BorderValue& RenderTableCell::borderAdjoiningTableStart() const
5151
return style().borderStart(tableWritingMode());
5252
}
5353

54-
inline LayoutUnit RenderTableCell::logicalHeightForRowSizing() const
55-
{
56-
// FIXME: This function does too much work, and is very hot during table layout!
57-
LayoutUnit adjustedLogicalHeight = logicalHeight() - (intrinsicPaddingBefore() + intrinsicPaddingAfter());
58-
if (!style().logicalHeight().isSpecified())
59-
return adjustedLogicalHeight;
60-
LayoutUnit styleLogicalHeight = Style::evaluate(style().logicalHeight(), 0_lu);
61-
// In strict mode, box-sizing: content-box do the right thing and actually add in the border and padding.
62-
// Call computedCSSPadding* directly to avoid including implicitPadding.
63-
if (!document().inQuirksMode() && style().boxSizing() != BoxSizing::BorderBox)
64-
styleLogicalHeight += computedCSSPaddingBefore() + computedCSSPaddingAfter() + borderBefore() + borderAfter();
65-
return std::max(styleLogicalHeight, adjustedLogicalHeight);
66-
}
67-
6854
inline Style::PreferredSize RenderTableCell::styleOrColLogicalWidth() const
6955
{
7056
auto& styleWidth = style().logicalWidth();

Source/WebCore/rendering/RenderTableSection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static inline void updateLogicalHeightForCell(RenderTableSection::RowStruct& row
7474
if (cell->rowSpan() != 1)
7575
return;
7676

77-
auto& logicalHeight = cell->style().logicalHeight();
77+
auto& logicalHeight = !cell->isOrthogonal() ? cell->style().logicalHeight() : cell->style().logicalWidth();
7878
if (logicalHeight.isPositive()) {
7979
if (auto percentageLogicalHeight = logicalHeight.tryPercentage()) {
8080
if (auto percentageRowLogicalHeight = row.logicalHeight.tryPercentage(); !percentageRowLogicalHeight || percentageRowLogicalHeight->value < percentageLogicalHeight->value)
@@ -292,7 +292,7 @@ LayoutUnit RenderTableSection::calcRowLogicalHeight()
292292
// For row spanning cells, |r| is the last row in the span.
293293
unsigned cellStartRow = cell->rowIndex();
294294

295-
if (cell->overridingBorderBoxLogicalHeight()) {
295+
if (cell->overridingBorderBoxLogicalHeight() && !cell->isOrthogonal()) {
296296
cell->clearIntrinsicPadding();
297297
cell->clearOverridingSize();
298298
cell->setChildNeedsLayout(MarkOnlyThis);

0 commit comments

Comments
 (0)