Diff
Modified: trunk/Source/WebCore/ChangeLog (261163 => 261164)
--- trunk/Source/WebCore/ChangeLog 2020-05-05 13:40:04 UTC (rev 261163)
+++ trunk/Source/WebCore/ChangeLog 2020-05-05 13:48:55 UTC (rev 261164)
@@ -1,3 +1,37 @@
+2020-05-05 Zalan Bujtas <[email protected]>
+
+ [LFC] Rename computedContentHeight/Width to computedHeight/Width
+ https://bugs.webkit.org/show_bug.cgi?id=211432
+
+ Reviewed by Darin Adler.
+
+ These functions used to return the computed content box height/width but with box-sizing
+ support the name is not correct anymore.
+
+ * layout/FormattingContext.h:
+ * layout/FormattingContextGeometry.cpp:
+ (WebCore::Layout::FormattingContext::Geometry::computedHeight const):
+ (WebCore::Layout::FormattingContext::Geometry::computedWidth const):
+ (WebCore::Layout::FormattingContext::Geometry::computedMinHeight const):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::complicatedCases const):
+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
+ (WebCore::Layout::FormattingContext::Geometry::computedContentHeight const): Deleted.
+ (WebCore::Layout::FormattingContext::Geometry::computedContentWidth const): Deleted.
+ * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
+ * layout/tableformatting/TableFormattingContext.cpp:
+ (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace):
+ * layout/tableformatting/TableFormattingContextGeometry.cpp:
+ (WebCore::Layout::TableFormattingContext::Geometry::cellHeigh const):
+ (WebCore::Layout::TableFormattingContext::Geometry::computedColumnWidth const):
+
2020-05-05 Antoine Quint <[email protected]>
Unreviewed, reverting r260989.
Modified: trunk/Source/WebCore/layout/FormattingContext.h (261163 => 261164)
--- trunk/Source/WebCore/layout/FormattingContext.h 2020-05-05 13:40:04 UTC (rev 261163)
+++ trunk/Source/WebCore/layout/FormattingContext.h 2020-05-05 13:48:55 UTC (rev 261164)
@@ -164,10 +164,8 @@
friend class FormattingContext;
Geometry(const FormattingContext&);
- enum class HeightType { Min, Max, Normal };
- Optional<LayoutUnit> computedHeightValue(const Box&, HeightType, Optional<LayoutUnit> containingBlockHeight) const;
- Optional<LayoutUnit> computedContentHeight(const Box&, Optional<LayoutUnit> containingBlockHeight = WTF::nullopt) const;
- Optional<LayoutUnit> computedContentWidth(const Box&, LayoutUnit containingBlockWidth) const;
+ Optional<LayoutUnit> computedHeight(const Box&, Optional<LayoutUnit> containingBlockHeight = WTF::nullopt) const;
+ Optional<LayoutUnit> computedWidth(const Box&, LayoutUnit containingBlockWidth) const;
const LayoutState& layoutState() const { return m_formattingContext.layoutState(); }
LayoutState& layoutState() { return m_formattingContext.layoutState(); }
@@ -188,6 +186,9 @@
LayoutUnit staticVerticalPositionForOutOfFlowPositioned(const Box&, const VerticalConstraints&) const;
LayoutUnit staticHorizontalPositionForOutOfFlowPositioned(const Box&, const HorizontalConstraints&) const;
+ enum class HeightType { Min, Max, Normal };
+ Optional<LayoutUnit> computedHeightValue(const Box&, HeightType, Optional<LayoutUnit> containingBlockHeight) const;
+
const FormattingContext& m_formattingContext;
};
FormattingContext::Geometry geometry() const { return Geometry(*this); }
Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (261163 => 261164)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2020-05-05 13:40:04 UTC (rev 261163)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2020-05-05 13:48:55 UTC (rev 261164)
@@ -88,7 +88,7 @@
return valueForLength(height, *containingBlockHeight);
}
-Optional<LayoutUnit> FormattingContext::Geometry::computedContentHeight(const Box& layoutBox, Optional<LayoutUnit> containingBlockHeight) const
+Optional<LayoutUnit> FormattingContext::Geometry::computedHeight(const Box& layoutBox, Optional<LayoutUnit> containingBlockHeight) const
{
if (auto height = computedHeightValue(layoutBox, HeightType::Normal, containingBlockHeight)) {
if (layoutBox.style().boxSizing() == BoxSizing::ContentBox)
@@ -99,7 +99,7 @@
return { };
}
-Optional<LayoutUnit> FormattingContext::Geometry::computedContentWidth(const Box& layoutBox, LayoutUnit containingBlockWidth) const
+Optional<LayoutUnit> FormattingContext::Geometry::computedWidth(const Box& layoutBox, LayoutUnit containingBlockWidth) const
{
if (auto width = computedValueIfNotAuto(layoutBox.style().logicalWidth(), containingBlockWidth)) {
if (layoutBox.style().boxSizing() == BoxSizing::ContentBox)
@@ -199,10 +199,7 @@
Optional<LayoutUnit> FormattingContext::Geometry::computedMinHeight(const Box& layoutBox, Optional<LayoutUnit> containingBlockHeight) const
{
- if (auto minHeightValue = computedHeightValue(layoutBox, HeightType::Min, containingBlockHeight))
- return minHeightValue;
-
- return { LayoutUnit { } };
+ return computedHeightValue(layoutBox, HeightType::Min, containingBlockHeight);
}
Optional<LayoutUnit> FormattingContext::Geometry::computedMinWidth(const Box& layoutBox, LayoutUnit containingBlockWidth) const
@@ -332,7 +329,7 @@
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth);
- auto height = overrideVerticalValues.height ? overrideVerticalValues.height.value() : computedContentHeight(layoutBox, containingBlockHeight);
+ auto height = overrideVerticalValues.height ? overrideVerticalValues.height.value() : computedHeight(layoutBox, containingBlockHeight);
auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutBox, horizontalConstraints);
UsedVerticalMargin::NonCollapsedValues usedVerticalMargin;
auto paddingTop = boxGeometry.paddingTop().valueOr(0);
@@ -452,7 +449,7 @@
auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth);
auto right = computedValueIfNotAuto(style.logicalRight(), containingBlockWidth);
- auto width = overrideHorizontalValues.width ? overrideHorizontalValues.width : computedContentWidth(layoutBox, containingBlockWidth);
+ auto width = overrideHorizontalValues.width ? overrideHorizontalValues.width : computedWidth(layoutBox, containingBlockWidth);
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutBox, horizontalConstraints);
UsedHorizontalMargin usedHorizontalMargin;
auto paddingLeft = boxGeometry.paddingLeft().valueOr(0);
@@ -758,7 +755,7 @@
// 1. If 'margin-top', or 'margin-bottom' are 'auto', their used value is 0.
// 2. If 'height' is 'auto', the height depends on the element's descendants per 10.6.7.
- auto height = overrideVerticalValues.height ? overrideVerticalValues.height.value() : computedContentHeight(layoutBox);
+ auto height = overrideVerticalValues.height ? overrideVerticalValues.height.value() : computedHeight(layoutBox);
auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutBox, horizontalConstraints);
// #1
auto usedVerticalMargin = UsedVerticalMargin::NonCollapsedValues { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) };
@@ -788,7 +785,7 @@
// #1
auto usedHorizontallMargin = UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) };
// #2
- auto width = overrideHorizontalValues.width ? overrideHorizontalValues.width : computedContentWidth(layoutBox, horizontalConstraints.logicalWidth);
+ auto width = overrideHorizontalValues.width ? overrideHorizontalValues.width : computedWidth(layoutBox, horizontalConstraints.logicalWidth);
if (!width)
width = shrinkToFitWidth(layoutBox, horizontalConstraints.logicalWidth);
@@ -875,7 +872,7 @@
auto usedVerticalMargin = UsedVerticalMargin::NonCollapsedValues { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) };
auto& style = replacedBox.style();
- auto height = overrideVerticalValues.height ? overrideVerticalValues.height.value() : computedContentHeight(replacedBox, verticalConstraints ? verticalConstraints->logicalHeight : WTF::nullopt);
+ auto height = overrideVerticalValues.height ? overrideVerticalValues.height.value() : computedHeight(replacedBox, verticalConstraints ? verticalConstraints->logicalHeight : WTF::nullopt);
auto heightIsAuto = !overrideVerticalValues.height && isHeightAuto(replacedBox);
auto widthIsAuto = style.logicalWidth().isAuto();
@@ -935,9 +932,9 @@
return computedHorizontalMargin.end.valueOr(0_lu);
};
- auto width = overrideHorizontalValues.width ? overrideHorizontalValues.width : computedContentWidth(replacedBox, horizontalConstraints.logicalWidth);
+ auto width = overrideHorizontalValues.width ? overrideHorizontalValues.width : computedWidth(replacedBox, horizontalConstraints.logicalWidth);
auto heightIsAuto = isHeightAuto(replacedBox);
- auto height = computedContentHeight(replacedBox, verticalConstraints ? verticalConstraints->logicalHeight : WTF::nullopt);
+ auto height = computedHeight(replacedBox, verticalConstraints ? verticalConstraints->logicalHeight : WTF::nullopt);
if (!width && heightIsAuto && replacedBox.hasIntrinsicWidth()) {
// #1
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (261163 => 261164)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2020-05-05 13:40:04 UTC (rev 261163)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2020-05-05 13:48:55 UTC (rev 261164)
@@ -66,7 +66,7 @@
auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutBox, horizontalConstraints);
auto nonCollapsedMargin = UsedVerticalMargin::NonCollapsedValues { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) };
auto borderAndPaddingTop = boxGeometry.borderTop() + boxGeometry.paddingTop().valueOr(0);
- auto height = overrideVerticalValues.height ? overrideVerticalValues.height.value() : computedContentHeight(layoutBox);
+ auto height = overrideVerticalValues.height ? overrideVerticalValues.height.value() : computedHeight(layoutBox);
if (height)
return { *height, nonCollapsedMargin };
@@ -106,7 +106,7 @@
};
// 10.6.7 'Auto' heights for block formatting context roots
- auto isAutoHeight = !overrideVerticalValues.height && !computedContentHeight(layoutBox);
+ auto isAutoHeight = !overrideVerticalValues.height && !computedHeight(layoutBox);
if (isAutoHeight && layoutBox.establishesBlockFormattingContext())
return compute( OverrideVerticalValues { contentHeightForFormattingContextRoot(layoutBox) });
return compute(overrideVerticalValues);
@@ -142,7 +142,7 @@
auto containingBlockWidth = horizontalConstraints.logicalWidth;
auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
- auto width = overrideHorizontalValues.width ? overrideHorizontalValues.width : computedContentWidth(layoutBox, containingBlockWidth);
+ auto width = overrideHorizontalValues.width ? overrideHorizontalValues.width : computedWidth(layoutBox, containingBlockWidth);
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutBox, horizontalConstraints);
UsedHorizontalMargin usedHorizontalMargin;
auto borderLeft = boxGeometry.borderLeft();
@@ -258,7 +258,7 @@
// FIXME: Let's special case the table height computation for now -> figure out whether tables fall into the "inFlowNonReplacedHeightAndMargin" category.
if (layoutBox.establishesTableFormattingContext()) {
auto& tableBox = downcast<ContainerBox>(layoutBox);
- auto computedTableHeight = computedContentHeight(tableBox);
+ auto computedTableHeight = computedHeight(tableBox);
auto contentHeight = contentHeightForFormattingContextRoot(tableBox);
if (computedTableHeight && contentHeight > computedTableHeight) {
// Table content needs more vertical space than the table has.
@@ -304,7 +304,7 @@
intrinsicWidthConstraints = *precomputedIntrinsicWidthConstraints;
else
intrinsicWidthConstraints = LayoutContext::createFormattingContext(tableBox, layoutState())->computedIntrinsicWidthConstraints();
- auto computedTableWidth = computedContentWidth(tableBox, horizontalConstraints.logicalWidth);
+ auto computedTableWidth = computedWidth(tableBox, horizontalConstraints.logicalWidth);
auto usedWidth = computedTableWidth;
if (computedTableWidth && intrinsicWidthConstraints.minimum > computedTableWidth) {
// Table content needs more space than the table has.
Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp (261163 => 261164)
--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-05-05 13:40:04 UTC (rev 261163)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContext.cpp 2020-05-05 13:48:55 UTC (rev 261164)
@@ -580,7 +580,7 @@
auto distributedSpaces = distributeAvailableSpace<RowSpan>(grid, spaceToDistribute, [&] (const TableGrid::Slot& slot, size_t rowIndex) {
if (slot.hasRowSpan())
return geometryForBox(slot.cell().box()).height();
- auto computedRowHeight = geometry().computedContentHeight(rows.list()[rowIndex].box(), { });
+ auto computedRowHeight = geometry().computedHeight(rows.list()[rowIndex].box(), { });
return std::max(LayoutUnit { rowHeight[rowIndex].height() }, computedRowHeight.valueOr(0_lu));
});
Modified: trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp (261163 => 261164)
--- trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp 2020-05-05 13:40:04 UTC (rev 261163)
+++ trunk/Source/WebCore/layout/tableformatting/TableFormattingContextGeometry.cpp 2020-05-05 13:48:55 UTC (rev 261164)
@@ -39,7 +39,7 @@
LayoutUnit TableFormattingContext::Geometry::cellHeigh(const ContainerBox& cellBox) const
{
ASSERT(cellBox.isInFlow());
- if (auto height = computedContentHeight(cellBox))
+ if (auto height = computedHeight(cellBox))
return *height;
return contentHeightForFormattingContextRoot(cellBox);
}
@@ -48,7 +48,7 @@
{
// Check both style and <col>'s width attribute.
// FIXME: Figure out what to do with calculated values, like <col style="width: 10%">.
- if (auto computedWidthValue = computedContentWidth(columnBox, { }))
+ if (auto computedWidthValue = computedWidth(columnBox, { }))
return computedWidthValue;
return columnBox.columnWidth();
}