Diff
Modified: trunk/Source/WebCore/ChangeLog (235786 => 235787)
--- trunk/Source/WebCore/ChangeLog 2018-09-07 17:29:04 UTC (rev 235786)
+++ trunk/Source/WebCore/ChangeLog 2018-09-07 17:50:35 UTC (rev 235787)
@@ -1,3 +1,59 @@
+2018-09-07 Zalan Bujtas <[email protected]>
+
+ [LFC] Replace "computed" value with "used" value to match spec language
+ https://bugs.webkit.org/show_bug.cgi?id=189414
+
+ Reviewed by Antti Koivisto.
+
+ * layout/FormattingContext.cpp:
+ (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
+ (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
+ * layout/FormattingContext.h:
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
+ * layout/FormattingContextGeometry.cpp:
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
+ (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
+ (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
+ (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
+ * layout/blockformatting/BlockFormattingContext.h:
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
+ * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
+
2018-09-06 Ryosuke Niwa <[email protected]>
ShadowRoot should have its own node flag
Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (235786 => 235787)
--- trunk/Source/WebCore/layout/FormattingContext.cpp 2018-09-07 17:29:04 UTC (rev 235786)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp 2018-09-07 17:50:35 UTC (rev 235787)
@@ -53,8 +53,8 @@
void FormattingContext::computeOutOfFlowHorizontalGeometry(LayoutContext& layoutContext, const Box& layoutBox) const
{
- auto compute = [&](std::optional<LayoutUnit> precomputedWidth) {
- return Geometry::outOfFlowHorizontalGeometry(layoutContext, *this, layoutBox, precomputedWidth);
+ auto compute = [&](std::optional<LayoutUnit> usedWidth) {
+ return Geometry::outOfFlowHorizontalGeometry(layoutContext, *this, layoutBox, usedWidth);
};
auto horizontalGeometry = compute({ });
@@ -81,8 +81,8 @@
void FormattingContext::computeOutOfFlowVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox) const
{
- auto compute = [&](std::optional<LayoutUnit> precomputedHeight) {
- return Geometry::outOfFlowVerticalGeometry(layoutContext, layoutBox, precomputedHeight);
+ auto compute = [&](std::optional<LayoutUnit> usedHeight) {
+ return Geometry::outOfFlowVerticalGeometry(layoutContext, layoutBox, usedHeight);
};
auto verticalGeometry = compute({ });
Modified: trunk/Source/WebCore/layout/FormattingContext.h (235786 => 235787)
--- trunk/Source/WebCore/layout/FormattingContext.h 2018-09-07 17:29:04 UTC (rev 235786)
+++ trunk/Source/WebCore/layout/FormattingContext.h 2018-09-07 17:50:35 UTC (rev 235787)
@@ -82,17 +82,17 @@
// This class implements generic positioning and sizing.
class Geometry {
public:
- static VerticalGeometry outOfFlowVerticalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedHeight = { });
- static HorizontalGeometry outOfFlowHorizontalGeometry(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { });
+ static VerticalGeometry outOfFlowVerticalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+ static HorizontalGeometry outOfFlowHorizontalGeometry(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
- static HeightAndMargin floatingHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedHeight = { });
- static WidthAndMargin floatingWidthAndMargin(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { });
+ static HeightAndMargin floatingHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+ static WidthAndMargin floatingWidthAndMargin(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
- static HeightAndMargin inlineReplacedHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedHeight = { });
- static WidthAndMargin inlineReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { },
+ static HeightAndMargin inlineReplacedHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+ static WidthAndMargin inlineReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { },
std::optional<LayoutUnit> precomputedMarginLeft = { }, std::optional<LayoutUnit> precomputedMarginRight = { });
- static HeightAndMargin complicatedCases(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedHeight = { });
+ static HeightAndMargin complicatedCases(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
static Edges computedBorder(const LayoutContext&, const Box&);
static std::optional<Edges> computedPadding(const LayoutContext&, const Box&);
@@ -107,16 +107,16 @@
static std::optional<LayoutUnit> computedMaxHeight(const LayoutContext&, const Box&);
private:
- static VerticalGeometry outOfFlowReplacedVerticalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedHeight = { });
- static HorizontalGeometry outOfFlowReplacedHorizontalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { });
+ static VerticalGeometry outOfFlowReplacedVerticalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+ static HorizontalGeometry outOfFlowReplacedHorizontalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
- static VerticalGeometry outOfFlowNonReplacedVerticalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedHeight = { });
- static HorizontalGeometry outOfFlowNonReplacedHorizontalGeometry(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { });
+ static VerticalGeometry outOfFlowNonReplacedVerticalGeometry(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+ static HorizontalGeometry outOfFlowNonReplacedHorizontalGeometry(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
- static HeightAndMargin floatingReplacedHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedHeight = { });
- static WidthAndMargin floatingReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { });
+ static HeightAndMargin floatingReplacedHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+ static WidthAndMargin floatingReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
- static WidthAndMargin floatingNonReplacedWidthAndMargin(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { });
+ static WidthAndMargin floatingNonReplacedWidthAndMargin(LayoutContext&, const FormattingContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
static LayoutUnit shrinkToFitWidth(LayoutContext&, const FormattingContext&, const Box&);
};
Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (235786 => 235787)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2018-09-07 17:29:04 UTC (rev 235786)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2018-09-07 17:50:35 UTC (rev 235787)
@@ -214,7 +214,7 @@
return std::min(std::max(instrinsicWidthConstraints.minimum, availableWidth), instrinsicWidthConstraints.maximum);
}
-VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedHeight)
+VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
{
ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced());
@@ -250,7 +250,7 @@
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth);
- auto height = computedValueIfNotAuto(precomputedHeight ? Length { precomputedHeight.value(), Fixed } : style.logicalHeight(), containingBlockHeight);
+ auto height = computedValueIfNotAuto(usedHeight ? Length { usedHeight.value(), Fixed } : style.logicalHeight(), containingBlockHeight);
auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth);
auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth);
auto paddingTop = displayBox.paddingTop().value_or(0);
@@ -330,7 +330,7 @@
return { *top, *bottom, { *height, { *marginTop, *marginBottom }, { } } };
}
-HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedWidth)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
{
ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.replaced());
@@ -368,7 +368,7 @@
auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth);
auto right = computedValueIfNotAuto(style.logicalRight(), containingBlockWidth);
- auto width = computedValueIfNotAuto(precomputedWidth ? Length { precomputedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth);
+ auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth);
auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth);
auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth);
auto nonComputedMarginLeft = marginLeft.value_or(0);
@@ -476,7 +476,7 @@
return { *left, *right, { *width, { *marginLeft, *marginRight }, { nonComputedMarginLeft, nonComputedMarginRight } } };
}
-VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedHeight)
+VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
{
ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced());
@@ -498,7 +498,7 @@
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth);
- auto height = inlineReplacedHeightAndMargin(layoutContext, layoutBox, precomputedHeight).height;
+ auto height = inlineReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight).height;
auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth);
auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth);
auto paddingTop = displayBox.paddingTop().value_or(0);
@@ -545,7 +545,7 @@
return { *top, *bottom, { height, { *marginTop, *marginBottom }, { } } };
}
-HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedWidth)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
{
ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced());
@@ -575,7 +575,7 @@
auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth);
auto nonComputedMarginLeft = marginLeft.value_or(0);
auto nonComputedMarginRight = marginRight.value_or(0);
- auto width = inlineReplacedWidthAndMargin(layoutContext, layoutBox, precomputedWidth).width;
+ auto width = inlineReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth).width;
auto paddingLeft = displayBox.paddingLeft().value_or(0);
auto paddingRight = displayBox.paddingRight().value_or(0);
auto borderLeft = displayBox.borderLeft();
@@ -643,7 +643,7 @@
return { *left, *right, { width, { *marginLeft, *marginRight }, { nonComputedMarginLeft, nonComputedMarginRight } } };
}
-HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedHeight)
+HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
{
ASSERT(!layoutBox.replaced());
// TODO: Use complicated-case for document renderer for now (see BlockFormattingContext::Geometry::inFlowHeightAndMargin).
@@ -663,7 +663,7 @@
auto& containingBlockDisplayBox = layoutContext.displayBoxForLayoutBox(containingBlock);
auto containingBlockWidth = containingBlockDisplayBox.contentBoxWidth();
- auto height = fixedValue(precomputedHeight ? Length { precomputedHeight.value(), Fixed } : style.logicalHeight());
+ auto height = fixedValue(usedHeight ? Length { usedHeight.value(), Fixed } : style.logicalHeight());
auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth);
auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth);
@@ -686,7 +686,7 @@
return HeightAndMargin { *height, { *marginTop, *marginBottom }, { } };
}
-WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedWidth)
+WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
{
ASSERT(layoutBox.isFloatingPositioned() && !layoutBox.replaced());
@@ -701,7 +701,7 @@
// #1
auto margin = computedNonCollapsedHorizontalMarginValue(layoutContext, layoutBox);
// #2
- auto width = computedValueIfNotAuto(precomputedWidth ? Length { precomputedWidth.value(), Fixed } : layoutBox.style().logicalWidth(), containingBlockWidth);
+ auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : layoutBox.style().logicalWidth(), containingBlockWidth);
if (!width)
width = shrinkToFitWidth(layoutContext, formattingContext, layoutBox);
@@ -709,7 +709,7 @@
return WidthAndMargin { *width, margin, margin };
}
-HeightAndMargin FormattingContext::Geometry::floatingReplacedHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedHeight)
+HeightAndMargin FormattingContext::Geometry::floatingReplacedHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
{
ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced());
@@ -716,10 +716,10 @@
// 10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block'
// replaced elements in normal flow and floating replaced elements
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating replaced -> redirected to inline replaced");
- return inlineReplacedHeightAndMargin(layoutContext, layoutBox, precomputedHeight);
+ return inlineReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight);
}
-WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedWidth)
+WidthAndMargin FormattingContext::Geometry::floatingReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
{
ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced());
@@ -730,46 +730,46 @@
auto margin = computedNonCollapsedHorizontalMarginValue(layoutContext, layoutBox);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating replaced -> redirected to inline replaced");
- return inlineReplacedWidthAndMargin(layoutContext, layoutBox, precomputedWidth, margin.left, margin.right);
+ return inlineReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth, margin.left, margin.right);
}
-VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedHeight)
+VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
{
ASSERT(layoutBox.isOutOfFlowPositioned());
if (!layoutBox.replaced())
- return outOfFlowNonReplacedVerticalGeometry(layoutContext, layoutBox, precomputedHeight);
- return outOfFlowReplacedVerticalGeometry(layoutContext, layoutBox, precomputedHeight);
+ return outOfFlowNonReplacedVerticalGeometry(layoutContext, layoutBox, usedHeight);
+ return outOfFlowReplacedVerticalGeometry(layoutContext, layoutBox, usedHeight);
}
-HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedWidth)
+HorizontalGeometry FormattingContext::Geometry::outOfFlowHorizontalGeometry(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
{
ASSERT(layoutBox.isOutOfFlowPositioned());
if (!layoutBox.replaced())
- return outOfFlowNonReplacedHorizontalGeometry(layoutContext, formattingContext, layoutBox, precomputedWidth);
- return outOfFlowReplacedHorizontalGeometry(layoutContext, layoutBox, precomputedWidth);
+ return outOfFlowNonReplacedHorizontalGeometry(layoutContext, formattingContext, layoutBox, usedWidth);
+ return outOfFlowReplacedHorizontalGeometry(layoutContext, layoutBox, usedWidth);
}
-HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedHeight)
+HeightAndMargin FormattingContext::Geometry::floatingHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
{
ASSERT(layoutBox.isFloatingPositioned());
if (!layoutBox.replaced())
- return complicatedCases(layoutContext, layoutBox, precomputedHeight);
- return floatingReplacedHeightAndMargin(layoutContext, layoutBox, precomputedHeight);
+ return complicatedCases(layoutContext, layoutBox, usedHeight);
+ return floatingReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight);
}
-WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedWidth)
+WidthAndMargin FormattingContext::Geometry::floatingWidthAndMargin(LayoutContext& layoutContext, const FormattingContext& formattingContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
{
ASSERT(layoutBox.isFloatingPositioned());
if (!layoutBox.replaced())
- return floatingNonReplacedWidthAndMargin(layoutContext, formattingContext, layoutBox, precomputedWidth);
- return floatingReplacedWidthAndMargin(layoutContext, layoutBox, precomputedWidth);
+ return floatingNonReplacedWidthAndMargin(layoutContext, formattingContext, layoutBox, usedWidth);
+ return floatingReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth);
}
-HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedHeight)
+HeightAndMargin FormattingContext::Geometry::inlineReplacedHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
{
ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced());
@@ -789,8 +789,8 @@
auto& style = layoutBox.style();
auto replaced = layoutBox.replaced();
- auto height = fixedValue(precomputedHeight ? Length { precomputedHeight.value(), Fixed } : style.logicalHeight());
- auto heightIsAuto = !precomputedHeight && style.logicalHeight().isAuto();
+ auto height = fixedValue(usedHeight ? Length { usedHeight.value(), Fixed } : style.logicalHeight());
+ auto heightIsAuto = !usedHeight && style.logicalHeight().isAuto();
auto widthIsAuto = style.logicalWidth().isAuto();
if (!height && !heightIsAuto)
@@ -818,7 +818,7 @@
}
WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox,
- std::optional<LayoutUnit> precomputedWidth, std::optional<LayoutUnit> precomputedMarginLeft, std::optional<LayoutUnit> precomputedMarginRight)
+ std::optional<LayoutUnit> usedWidth, std::optional<LayoutUnit> precomputedMarginLeft, std::optional<LayoutUnit> precomputedMarginRight)
{
ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced());
@@ -866,7 +866,7 @@
auto marginRight = computeMarginRight();
auto nonComputedMarginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth).value_or(0);
auto nonComputedMarginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth).value_or(0);
- auto width = computedValueIfNotAuto(precomputedWidth ? Length { precomputedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth);
+ auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth);
auto heightIsAuto = style.logicalHeight().isAuto();
auto height = fixedValue(style.logicalHeight());
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (235786 => 235787)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2018-09-07 17:29:04 UTC (rev 235786)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2018-09-07 17:50:35 UTC (rev 235787)
@@ -242,13 +242,13 @@
void BlockFormattingContext::computeWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox) const
{
- auto compute = [&](std::optional<LayoutUnit> precomputedWidth) -> WidthAndMargin {
+ auto compute = [&](std::optional<LayoutUnit> usedWidth) -> WidthAndMargin {
if (layoutBox.isInFlow())
- return Geometry::inFlowWidthAndMargin(layoutContext, layoutBox, precomputedWidth);
+ return Geometry::inFlowWidthAndMargin(layoutContext, layoutBox, usedWidth);
if (layoutBox.isFloatingPositioned())
- return Geometry::floatingWidthAndMargin(layoutContext, *this, layoutBox, precomputedWidth);
+ return Geometry::floatingWidthAndMargin(layoutContext, *this, layoutBox, usedWidth);
ASSERT_NOT_REACHED();
return { };
@@ -278,13 +278,13 @@
void BlockFormattingContext::computeHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox) const
{
- auto compute = [&](std::optional<LayoutUnit> precomputedHeight) -> HeightAndMargin {
+ auto compute = [&](std::optional<LayoutUnit> usedHeight) -> HeightAndMargin {
if (layoutBox.isInFlow())
- return Geometry::inFlowHeightAndMargin(layoutContext, layoutBox, precomputedHeight);
+ return Geometry::inFlowHeightAndMargin(layoutContext, layoutBox, usedHeight);
if (layoutBox.isFloatingPositioned())
- return Geometry::floatingHeightAndMargin(layoutContext, layoutBox, precomputedHeight);
+ return Geometry::floatingHeightAndMargin(layoutContext, layoutBox, usedHeight);
ASSERT_NOT_REACHED();
return { };
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (235786 => 235787)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2018-09-07 17:29:04 UTC (rev 235786)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2018-09-07 17:50:35 UTC (rev 235787)
@@ -69,8 +69,8 @@
// This class implements positioning and sizing for boxes participating in a block formatting context.
class Geometry : public FormattingContext::Geometry {
public:
- static HeightAndMargin inFlowHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedHeight = { });
- static WidthAndMargin inFlowWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { });
+ static HeightAndMargin inFlowHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+ static WidthAndMargin inFlowWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
static Position staticPosition(const LayoutContext&, const Box&);
static Position inFlowPositionedPosition(const LayoutContext&, const Box&);
@@ -101,9 +101,9 @@
static LayoutUnit nonCollapsedMarginTop(const LayoutContext&, const Box&);
};
- static HeightAndMargin inFlowNonReplacedHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedHeight = { });
- static WidthAndMargin inFlowNonReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { });
- static WidthAndMargin inFlowReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = { });
+ static HeightAndMargin inFlowNonReplacedHeightAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedHeight = { });
+ static WidthAndMargin inFlowNonReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
+ static WidthAndMargin inFlowReplacedWidthAndMargin(const LayoutContext&, const Box&, std::optional<LayoutUnit> usedWidth = { });
static Position staticPositionForOutOfFlowPositioned(const LayoutContext&, const Box&);
};
};
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (235786 => 235787)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2018-09-07 17:29:04 UTC (rev 235786)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2018-09-07 17:50:35 UTC (rev 235787)
@@ -77,7 +77,7 @@
return widthAndMargin;
}
-HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedHeight)
+HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
{
ASSERT(layoutBox.isInFlow() && !layoutBox.replaced());
ASSERT(layoutBox.isOverflowVisible());
@@ -106,7 +106,7 @@
VerticalEdges collapsedMargin = { MarginCollapse::marginTop(layoutContext, layoutBox), MarginCollapse::marginBottom(layoutContext, layoutBox) };
auto borderAndPaddingTop = displayBox.borderTop() + displayBox.paddingTop().value_or(0);
- auto height = precomputedHeight ? Length { precomputedHeight.value(), Fixed } : style.logicalHeight();
+ auto height = usedHeight ? Length { usedHeight.value(), Fixed } : style.logicalHeight();
if (!height.isAuto()) {
if (height.isFixed())
return { height.value(), nonCollapsedMargin, collapsedMargin };
@@ -151,7 +151,7 @@
return heightAndMargin;
}
-WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedWidth)
+WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
{
ASSERT(layoutBox.isInFlow() && !layoutBox.replaced());
@@ -183,7 +183,7 @@
auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*containingBlock).contentBoxWidth();
auto& displayBox = layoutContext.displayBoxForLayoutBox(layoutBox);
- auto width = computedValueIfNotAuto(precomputedWidth ? Length { precomputedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth);
+ auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth);
auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth);
auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth);
auto nonComputedMarginLeft = marginLeft.value_or(0);
@@ -251,7 +251,7 @@
return widthAndMargin;
}
-WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedWidth)
+WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
{
ASSERT(layoutBox.isInFlow() && layoutBox.replaced());
@@ -261,7 +261,7 @@
// 2. Then the rules for non-replaced block-level elements are applied to determine the margins.
// #1
- auto width = inlineReplacedWidthAndMargin(layoutContext, layoutBox, precomputedWidth).width;
+ auto width = inlineReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth).width;
// #2
auto nonReplacedWidthAndMargin = inFlowNonReplacedWidthAndMargin(layoutContext, layoutBox, width);
@@ -367,7 +367,7 @@
return { newLeftPosition, newTopPosition };
}
-HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedHeight)
+HeightAndMargin BlockFormattingContext::Geometry::inFlowHeightAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedHeight)
{
ASSERT(layoutBox.isInFlow());
@@ -374,16 +374,16 @@
// 10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block'
// replaced elements in normal flow and floating replaced elements
if (layoutBox.replaced())
- return inlineReplacedHeightAndMargin(layoutContext, layoutBox, precomputedHeight);
+ return inlineReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight);
HeightAndMargin heightAndMargin;
// TODO: Figure out the case for the document element. Let's just complicated-case it for now.
if (layoutBox.isOverflowVisible() && !layoutBox.isDocumentBox())
- heightAndMargin = inFlowNonReplacedHeightAndMargin(layoutContext, layoutBox, precomputedHeight);
+ heightAndMargin = inFlowNonReplacedHeightAndMargin(layoutContext, layoutBox, usedHeight);
else {
// 10.6.6 Complicated cases
// Block-level, non-replaced elements in normal flow when 'overflow' does not compute to 'visible' (except if the 'overflow' property's value has been propagated to the viewport).
- heightAndMargin = complicatedCases(layoutContext, layoutBox, precomputedHeight);
+ heightAndMargin = complicatedCases(layoutContext, layoutBox, usedHeight);
}
if (!isStretchedToInitialContainingBlock(layoutContext, layoutBox))
@@ -396,13 +396,13 @@
return heightAndMargin;
}
-WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> precomputedWidth)
+WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(const LayoutContext& layoutContext, const Box& layoutBox, std::optional<LayoutUnit> usedWidth)
{
ASSERT(layoutBox.isInFlow());
if (!layoutBox.replaced())
- return inFlowNonReplacedWidthAndMargin(layoutContext, layoutBox, precomputedWidth);
- return inFlowReplacedWidthAndMargin(layoutContext, layoutBox, precomputedWidth);
+ return inFlowNonReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth);
+ return inFlowReplacedWidthAndMargin(layoutContext, layoutBox, usedWidth);
}
bool BlockFormattingContext::Geometry::instrinsicWidthConstraintsNeedChildrenWidth(const Box& layoutBox)