Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (241194 => 241195)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2019-02-08 13:57:09 UTC (rev 241194)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2019-02-08 14:46:36 UTC (rev 241195)
@@ -246,7 +246,8 @@
// 'padding-left', 'padding-right', 'border-right-width', 'margin-right', and the widths of any relevant scroll bars.
// Then the shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width).
- auto availableWidth = usedValues.containingBlockWidth;
+ ASSERT(usedValues.containingBlockWidth.hasValue());
+ auto availableWidth = *usedValues.containingBlockWidth;
auto instrinsicWidthConstraints = layoutState.createFormattingContext(formattingRoot)->instrinsicWidthConstraints();
return std::min(std::max(instrinsicWidthConstraints.minimum, availableWidth), instrinsicWidthConstraints.maximum);
}
@@ -410,7 +411,7 @@
auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
auto& containingBlock = *layoutBox.containingBlock();
auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(containingBlock);
- auto containingBlockWidth = usedValues.containingBlockWidth;
+ auto containingBlockWidth = usedValues.containingBlockWidth.valueOr(0);
auto isLeftToRightDirection = containingBlock.style().isLeftToRightDirection();
auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth);
@@ -635,7 +636,7 @@
auto& style = layoutBox.style();
auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
auto& containingBlock = *layoutBox.containingBlock();
- auto containingBlockWidth = usedValues.containingBlockWidth;
+ auto containingBlockWidth = usedValues.containingBlockWidth.valueOr(0);
auto isLeftToRightDirection = containingBlock.style().isLeftToRightDirection();
auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth);
@@ -766,7 +767,7 @@
// #1
auto usedHorizontallMargin = UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) };
// #2
- auto width = computedValueIfNotAuto(usedValues.width ? Length { usedValues.width.value(), Fixed } : layoutBox.style().logicalWidth(), usedValues.containingBlockWidth);
+ auto width = computedValueIfNotAuto(usedValues.width ? Length { usedValues.width.value(), Fixed } : layoutBox.style().logicalWidth(), usedValues.containingBlockWidth.valueOr(0));
if (!width)
width = shrinkToFitWidth(layoutState, layoutBox, usedValues);
@@ -795,7 +796,8 @@
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutBox, usedValues);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating replaced -> redirected to inline replaced");
- return inlineReplacedWidthAndMargin(layoutState, layoutBox, UsedHorizontalValues { usedValues.containingBlockWidth, usedValues.width, UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) } });
+ return inlineReplacedWidthAndMargin(layoutState, layoutBox, UsedHorizontalValues { usedValues.containingBlockWidth.valueOr(0),
+ usedValues.width, UsedHorizontalMargin { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) } });
}
VerticalGeometry FormattingContext::Geometry::outOfFlowVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, UsedVerticalValues usedValues)
@@ -903,7 +905,7 @@
// If 300px is too wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.
auto& style = layoutBox.style();
- auto containingBlockWidth = usedValues.containingBlockWidth;
+ auto containingBlockWidth = usedValues.containingBlockWidth.valueOr(0);
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutBox, usedValues);
auto usedMarginStart = [&] {
@@ -1042,10 +1044,11 @@
return WTF::nullopt;
auto& style = layoutBox.style();
+ auto containingBlockWidth = usedValues.containingBlockWidth.valueOr(0);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Padding] -> layoutBox: " << &layoutBox);
return Edges {
- { valueForLength(style.paddingLeft(), usedValues.containingBlockWidth), valueForLength(style.paddingRight(), usedValues.containingBlockWidth) },
- { valueForLength(style.paddingTop(), usedValues.containingBlockWidth), valueForLength(style.paddingBottom(), usedValues.containingBlockWidth) }
+ { valueForLength(style.paddingLeft(), containingBlockWidth), valueForLength(style.paddingRight(), containingBlockWidth) },
+ { valueForLength(style.paddingTop(), containingBlockWidth), valueForLength(style.paddingBottom(), containingBlockWidth) }
};
}
@@ -1052,7 +1055,8 @@
ComputedHorizontalMargin FormattingContext::Geometry::computedHorizontalMargin(const Box& layoutBox, UsedHorizontalValues usedValues)
{
auto& style = layoutBox.style();
- return { computedValueIfNotAuto(style.marginStart(), usedValues.containingBlockWidth), computedValueIfNotAuto(style.marginEnd(), usedValues.containingBlockWidth) };
+ auto containingBlockWidth = usedValues.containingBlockWidth.valueOr(0);
+ return { computedValueIfNotAuto(style.marginStart(), containingBlockWidth), computedValueIfNotAuto(style.marginEnd(), containingBlockWidth) };
}
ComputedVerticalMargin FormattingContext::Geometry::computedVerticalMargin(const LayoutState& layoutState, const Box& layoutBox)
Modified: trunk/Source/WebCore/layout/LayoutUnits.h (241194 => 241195)
--- trunk/Source/WebCore/layout/LayoutUnits.h 2019-02-08 13:57:09 UTC (rev 241194)
+++ trunk/Source/WebCore/layout/LayoutUnits.h 2019-02-08 14:46:36 UTC (rev 241195)
@@ -125,7 +125,7 @@
};
struct UsedHorizontalValues {
- explicit UsedHorizontalValues(LayoutUnit containingBlockWidth, Optional<LayoutUnit> width, Optional<UsedHorizontalMargin> margin)
+ explicit UsedHorizontalValues(Optional<LayoutUnit> containingBlockWidth, Optional<LayoutUnit> width, Optional<UsedHorizontalMargin> margin)
: containingBlockWidth(containingBlockWidth)
, width(width)
, margin(margin)
@@ -132,7 +132,7 @@
{
}
- LayoutUnit containingBlockWidth;
+ Optional<LayoutUnit> containingBlockWidth;
Optional<LayoutUnit> width;
Optional<UsedHorizontalMargin> margin;
};
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (241194 => 241195)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2019-02-08 13:57:09 UTC (rev 241194)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp 2019-02-08 14:46:36 UTC (rev 241195)
@@ -53,7 +53,7 @@
// If 'width' is 'auto', the used value is the shrink-to-fit width as for floating elements.
// A computed value of 'auto' for 'margin-left' or 'margin-right' becomes a used value of '0'.
// #1
- auto width = computedValueIfNotAuto(formattingContextRoot.style().logicalWidth(), usedValues.containingBlockWidth);
+ auto width = computedValueIfNotAuto(formattingContextRoot.style().logicalWidth(), usedValues.containingBlockWidth.valueOr(0));
if (!width)
width = shrinkToFitWidth(layoutState, formattingContextRoot, usedValues);