WebKit Bugzilla
Attachment 358145 Details for
Bug 193059
: [LFC][BFC] Use computedValue and usedValue consistently
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
Patch.txt (text/plain), 47.51 KB, created by
zalan
on 2018-12-29 20:35:58 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-12-29 20:35:58 PST
Size:
47.51 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f2efd609450..5063293beb4 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,55 @@ >+2018-12-29 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][BFC] Use computedValue and usedValue consistently >+ https://bugs.webkit.org/show_bug.cgi?id=193059 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ https://www.w3.org/TR/CSS22/cascade.html#value-stages >+ >+ 6.1.2 Computed values >+ Specified values are resolved to computed values during the cascade; for example URIs are made absolute and 'em' and 'ex' units >+ are computed to pixel or absolute lengths. Computing a value never requires the user agent to render the document... >+ >+ 6.1.3 Used values >+ Computed values are processed as far as possible without formatting the document. Some values, however, can only be determined when the document >+ is being laid out. For example, if the width of an element is set to be a certain percentage of its containing block, the width cannot be determined until the width of the containing block has been determined. The used value is the result of taking the computed value and resolving any remaining dependencies into an absolute value. >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const): >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::complicatedCases): >+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): >+ * layout/LayoutState.cpp: >+ (WebCore::Layout::LayoutState::LayoutState): >+ * layout/LayoutUnits.h: >+ * layout/Verification.cpp: >+ (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const): >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): >+ * layout/displaytree/DisplayBox.cpp: >+ (WebCore::Display::Box::Box): >+ * layout/displaytree/DisplayBox.h: >+ (WebCore::Display::Box::setHasValidHorizontalComputedMargin): >+ (WebCore::Display::Box::setHorizontalComputedMargin): >+ (WebCore::Display::Box::computedMarginStart const): >+ (WebCore::Display::Box::computedMarginEnd const): >+ (WebCore::Display::Box::setHasValidHorizontalNonComputedMargin): Deleted. >+ (WebCore::Display::Box::setHorizontalNonComputedMargin): Deleted. >+ (WebCore::Display::Box::nonComputedMarginStart const): Deleted. >+ (WebCore::Display::Box::nonComputedMarginEnd const): Deleted. >+ * layout/floats/FloatAvoider.h: >+ (WebCore::Layout::FloatAvoider::marginStart const): >+ (WebCore::Layout::FloatAvoider::marginEnd const): >+ * layout/inlineformatting/InlineFormattingContext.cpp: >+ (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const): >+ > 2018-12-29 Zalan Bujtas <zalan@apple.com> > > [LFC][BFC][MarginCollapsing] Add support for peculiar cases. >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index 11efc4618b9..5e536a8bae7 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -87,10 +87,10 @@ void FormattingContext::computeOutOfFlowHorizontalGeometry(const Box& layoutBox) > } > > auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox); >- displayBox.setLeft(horizontalGeometry.left + horizontalGeometry.widthAndMargin.margin.start); >+ displayBox.setLeft(horizontalGeometry.left + horizontalGeometry.widthAndMargin.usedMargin.start); > displayBox.setContentBoxWidth(horizontalGeometry.widthAndMargin.width); >- displayBox.setHorizontalMargin(horizontalGeometry.widthAndMargin.margin); >- displayBox.setHorizontalNonComputedMargin(horizontalGeometry.widthAndMargin.nonComputedMargin); >+ displayBox.setHorizontalMargin(horizontalGeometry.widthAndMargin.usedMargin); >+ displayBox.setHorizontalComputedMargin(horizontalGeometry.widthAndMargin.computedMargin); > } > > void FormattingContext::computeOutOfFlowVerticalGeometry(const Box& layoutBox) const >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index c339f9780fc..2161118ce74 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -398,10 +398,10 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe > auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth); > auto right = computedValueIfNotAuto(style.logicalRight(), containingBlockWidth); > auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth); >- auto marginStart = computedValueIfNotAuto(style.marginStart(), containingBlockWidth); >- auto marginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth); >- auto nonComputedMarginStart = marginStart.valueOr(0); >- auto nonComputedMarginEnd = marginEnd.valueOr(0); >+ auto computedMarginStart = computedValueIfNotAuto(style.marginStart(), containingBlockWidth); >+ auto computedMarginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth); >+ auto usedMarginStart = computedMarginStart; >+ auto usedMarginEnd = computedMarginEnd; > auto paddingLeft = displayBox.paddingLeft().valueOr(0); > auto paddingRight = displayBox.paddingRight().valueOr(0); > auto borderLeft = displayBox.borderLeft(); >@@ -411,8 +411,8 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe > // If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. > // Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static > // position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below. >- marginStart = marginStart.valueOr(0); >- marginEnd = marginEnd.valueOr(0); >+ usedMarginStart = usedMarginStart.valueOr(0); >+ usedMarginEnd = usedMarginEnd.valueOr(0); > > auto staticHorizontalPosition = staticHorizontalPositionForOutOfFlowPositioned(layoutState, layoutBox); > if (isLeftToRightDirection) >@@ -425,84 +425,84 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe > // solve for 'margin-right' ('margin-left'). If one of 'margin-left' or 'margin-right' is 'auto', solve the equation for that value. > // If the values are over-constrained, ignore the value for 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' > // (in case 'direction' is 'ltr') and solve for that value. >- if (!marginStart && !marginEnd) { >+ if (!usedMarginStart && !usedMarginEnd) { > auto marginStartAndEnd = containingBlockWidth - (*left + borderLeft + paddingLeft + *width + paddingRight + borderRight + *right); > if (marginStartAndEnd >= 0) >- marginStart = marginEnd = marginStartAndEnd / 2; >+ usedMarginStart = usedMarginEnd = marginStartAndEnd / 2; > else { > if (isLeftToRightDirection) { >- marginStart = 0_lu; >- marginEnd = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *right); >+ usedMarginStart = 0_lu; >+ usedMarginEnd = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *right); > } else { >- marginEnd = 0_lu; >- marginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd + *right); >+ usedMarginEnd = 0_lu; >+ usedMarginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd + *right); > } > } >- } else if (!marginStart) { >- marginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd + *right); >+ } else if (!usedMarginStart) { >+ usedMarginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd + *right); > // Overconstrained? Ignore right (left). >- if (*marginStart < 0) { >+ if (*usedMarginStart < 0) { > if (isLeftToRightDirection) >- marginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd); >+ usedMarginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd); > else >- marginStart = containingBlockWidth - (borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd + *right); >+ usedMarginStart = containingBlockWidth - (borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd + *right); > } >- } else if (!marginEnd) { >- marginEnd = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *right); >+ } else if (!usedMarginEnd) { >+ usedMarginEnd = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *right); > // Overconstrained? Ignore right (left). >- if (*marginEnd < 0) { >+ if (*usedMarginEnd < 0) { > if (isLeftToRightDirection) >- marginEnd = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight); >+ usedMarginEnd = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight); > else >- marginEnd = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *right); >+ usedMarginEnd = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *right); > } > } > } else { > // Otherwise, set 'auto' values for 'margin-left' and 'margin-right' to 0, and pick the one of the following six rules that applies. >- marginStart = marginStart.valueOr(0); >- marginEnd = marginEnd.valueOr(0); >+ usedMarginStart = usedMarginStart.valueOr(0); >+ usedMarginEnd = usedMarginEnd.valueOr(0); > } > >- ASSERT(marginStart); >- ASSERT(marginEnd); >+ ASSERT(usedMarginStart); >+ ASSERT(usedMarginEnd); > > if (!left && !width && right) { > // #1 > width = shrinkToFitWidth(layoutState, layoutBox); >- left = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd + *right); >+ left = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd + *right); > } else if (!left && !right && width) { > // #2 > auto staticHorizontalPosition = staticHorizontalPositionForOutOfFlowPositioned(layoutState, layoutBox); > if (isLeftToRightDirection) { > left = staticHorizontalPosition; >- right = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd); >+ right = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd); > } else { > right = staticHorizontalPosition; >- left = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd + *right); >+ left = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd + *right); > } > } else if (!width && !right && left) { > // #3 > width = shrinkToFitWidth(layoutState, layoutBox); >- right = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd); >+ right = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd); > } else if (!left && width && right) { > // #4 >- left = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd + *right); >+ left = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd + *right); > } else if (!width && left && right) { > // #5 >- width = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + paddingRight + borderRight + *marginEnd + *right); >+ width = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + paddingRight + borderRight + *usedMarginEnd + *right); > } else if (!right && left && width) { > // #6 >- right = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd); >+ right = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd); > } > > ASSERT(left); > ASSERT(right); > ASSERT(width); >- ASSERT(marginStart); >- ASSERT(marginEnd); >+ ASSERT(usedMarginStart); >+ ASSERT(usedMarginEnd); > >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Width][Margin] -> out-of-flow non-replaced -> left(" << *left << "px) right(" << *right << "px) width(" << *width << "px) margin(" << *marginStart << "px, " << *marginEnd << "px) layoutBox(" << &layoutBox << ")"); >- return { *left, *right, { *width, { *marginStart, *marginEnd }, { nonComputedMarginStart, nonComputedMarginEnd } } }; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Width][Margin] -> out-of-flow non-replaced -> left(" << *left << "px) right(" << *right << "px) width(" << *width << "px) margin(" << *usedMarginStart << "px, " << *usedMarginEnd << "px) layoutBox(" << &layoutBox << ")"); >+ return { *left, *right, { *width, { *usedMarginStart, *usedMarginEnd }, { computedMarginStart.valueOr(0), computedMarginEnd.valueOr(0) } } }; > } > > VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry(const LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedHeight) >@@ -528,8 +528,8 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry( > auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); > auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); > auto height = inlineReplacedHeightAndMargin(layoutState, layoutBox, usedHeight).height; >- auto marginBefore = computedValueIfNotAuto(style.marginBefore(), containingBlockWidth); >- auto marginAfter = computedValueIfNotAuto(style.marginAfter(), containingBlockWidth); >+ auto usedMarginBefore = computedValueIfNotAuto(style.marginBefore(), containingBlockWidth); >+ auto usedMarginAfter = computedValueIfNotAuto(style.marginAfter(), containingBlockWidth); > auto paddingTop = displayBox.paddingTop().valueOr(0); > auto paddingBottom = displayBox.paddingBottom().valueOr(0); > auto borderTop = displayBox.borderTop(); >@@ -542,36 +542,36 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry( > > if (!bottom) { > // #2 >- marginBefore = marginBefore.valueOr(0); >- marginAfter = marginAfter.valueOr(0); >+ usedMarginBefore = usedMarginBefore.valueOr(0); >+ usedMarginAfter = usedMarginAfter.valueOr(0); > } > >- if (!marginBefore && !marginAfter) { >+ if (!usedMarginBefore && !usedMarginAfter) { > // #3 > auto marginBeforeAndAfter = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); >- marginBefore = marginAfter = marginBeforeAndAfter / 2; >+ usedMarginBefore = usedMarginAfter = marginBeforeAndAfter / 2; > } > > // #4 > if (!top) >- top = containingBlockHeight - (*marginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginAfter + *bottom); >+ top = containingBlockHeight - (*usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter + *bottom); > > if (!bottom) >- bottom = containingBlockHeight - (*top + *marginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginAfter); >+ bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter); > >- if (!marginBefore) >- marginBefore = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginAfter + *bottom); >+ if (!usedMarginBefore) >+ usedMarginBefore = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter + *bottom); > >- if (!marginAfter) >- marginAfter = containingBlockHeight - (*top + *marginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); >+ if (!usedMarginAfter) >+ usedMarginAfter = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); > > // #5 >- auto boxHeight = *top + *marginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginAfter + *bottom; >+ auto boxHeight = *top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter + *bottom; > if (boxHeight > containingBlockHeight) >- bottom = containingBlockHeight - (*top + *marginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginAfter); >+ bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter); > >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << height << "px) margin(" << *marginBefore << "px, " << *marginAfter << "px) layoutBox(" << &layoutBox << ")"); >- return { *top, *bottom, { height, { { *marginBefore, *marginAfter }, { } } } }; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << height << "px) margin(" << *usedMarginBefore << "px, " << *usedMarginAfter << "px) layoutBox(" << &layoutBox << ")"); >+ return { *top, *bottom, { height, { { *usedMarginBefore, *usedMarginAfter }, { } } } }; > } > > HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(const LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedWidth) >@@ -600,10 +600,10 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome > > auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth); > auto right = computedValueIfNotAuto(style.logicalRight(), containingBlockWidth); >- auto marginStart = computedValueIfNotAuto(style.marginStart(), containingBlockWidth); >- auto marginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth); >- auto nonComputedMarginStart = marginStart.valueOr(0); >- auto nonComputedMarginEnd = marginEnd.valueOr(0); >+ auto computedMarginStart = computedValueIfNotAuto(style.marginStart(), containingBlockWidth); >+ auto computedMarginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth); >+ auto usedMarginStart = computedMarginStart; >+ auto usedMarginEnd = computedMarginEnd; > auto width = inlineReplacedWidthAndMargin(layoutState, layoutBox, usedWidth).width; > auto paddingLeft = displayBox.paddingLeft().valueOr(0); > auto paddingRight = displayBox.paddingRight().valueOr(0); >@@ -621,55 +621,55 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome > > if (!left || !right) { > // #2 >- marginStart = marginStart.valueOr(0); >- marginEnd = marginEnd.valueOr(0); >+ usedMarginStart = usedMarginStart.valueOr(0); >+ usedMarginEnd = usedMarginEnd.valueOr(0); > } > >- if (!marginStart && !marginEnd) { >+ if (!usedMarginStart && !usedMarginEnd) { > // #3 > auto marginStartAndEnd = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + *right); > if (marginStartAndEnd >= 0) >- marginStart = marginEnd = marginStartAndEnd / 2; >+ usedMarginStart = usedMarginEnd = marginStartAndEnd / 2; > else { > if (isLeftToRightDirection) { >- marginStart = 0_lu; >- marginEnd = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *right); >+ usedMarginStart = 0_lu; >+ usedMarginEnd = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *right); > } else { >- marginEnd = 0_lu; >- marginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + *marginEnd + *right); >+ usedMarginEnd = 0_lu; >+ usedMarginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right); > } > } > } > > // #4 > if (!left) >- left = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *marginEnd + *right); >+ left = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right); > > if (!right) >- right = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *marginEnd); >+ right = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd); > >- if (!marginStart) >- marginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + *marginEnd + *right); >+ if (!usedMarginStart) >+ usedMarginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right); > >- if (!marginEnd) >- marginEnd = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *right); >+ if (!usedMarginEnd) >+ usedMarginEnd = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *right); > >- auto boxWidth = (*left + *marginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *marginEnd + *right); >+ auto boxWidth = (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right); > if (boxWidth > containingBlockWidth) { > // #5 Over-constrained? > if (isLeftToRightDirection) >- right = containingBlockWidth - (*left + *marginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *marginEnd); >+ right = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd); > else >- left = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *marginEnd + *right); >+ left = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right); > } > > ASSERT(left); > ASSERT(right); >- ASSERT(marginStart); >- ASSERT(marginEnd); >+ ASSERT(usedMarginStart); >+ ASSERT(usedMarginEnd); > >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Width][Margin] -> out-of-flow replaced -> left(" << *left << "px) right(" << *right << "px) width(" << width << "px) margin(" << *marginStart << "px, " << *marginEnd << "px) layoutBox(" << &layoutBox << ")"); >- return { *left, *right, { width, { *marginStart, *marginEnd }, { nonComputedMarginStart, nonComputedMarginEnd } } }; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Width][Margin] -> out-of-flow replaced -> left(" << *left << "px) right(" << *right << "px) width(" << width << "px) margin(" << *usedMarginStart << "px, " << *usedMarginEnd << "px) layoutBox(" << &layoutBox << ")"); >+ return { *left, *right, { width, { *usedMarginStart, *usedMarginEnd }, { computedMarginStart.valueOr(0), computedMarginEnd.valueOr(0) } } }; > } > > HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedHeight) >@@ -693,12 +693,12 @@ HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState& > auto containingBlockWidth = containingBlockDisplayBox.contentBoxWidth(); > > auto height = usedHeight ? usedHeight.value() : computedHeightValue(layoutState, layoutBox, HeightType::Normal); >- auto marginBefore = computedValueIfNotAuto(style.marginBefore(), containingBlockWidth); >- auto marginAfter = computedValueIfNotAuto(style.marginAfter(), containingBlockWidth); >+ auto usedMarginBefore = computedValueIfNotAuto(style.marginBefore(), containingBlockWidth); >+ auto usedMarginAfter = computedValueIfNotAuto(style.marginAfter(), containingBlockWidth); > > // #1 >- marginBefore = marginBefore.valueOr(0); >- marginAfter = marginAfter.valueOr(0); >+ usedMarginBefore = usedMarginBefore.valueOr(0); >+ usedMarginAfter = usedMarginAfter.valueOr(0); > // #2 > if (!height) { > ASSERT(isHeightAuto(layoutBox)); >@@ -706,11 +706,11 @@ HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState& > } > > ASSERT(height); >- ASSERT(marginBefore); >- ASSERT(marginAfter); >+ ASSERT(usedMarginBefore); >+ ASSERT(usedMarginAfter); > >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating non-replaced -> height(" << *height << "px) margin(" << *marginBefore << "px, " << *marginAfter << "px) -> layoutBox(" << &layoutBox << ")"); >- return HeightAndMargin { *height, { { *marginBefore, *marginAfter }, { } } }; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> floating non-replaced -> height(" << *height << "px) margin(" << *usedMarginBefore << "px, " << *usedMarginAfter << "px) -> layoutBox(" << &layoutBox << ")"); >+ return HeightAndMargin { *height, { { *usedMarginBefore, *usedMarginAfter }, { } } }; > } > > WidthAndMargin FormattingContext::Geometry::floatingNonReplacedWidthAndMargin(LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedWidth) >@@ -869,29 +869,24 @@ WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const L > auto& containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()); > auto containingBlockWidth = containingBlockDisplayBox.width(); > >- auto computeMarginEnd = [&]() { >- if (precomputedMarginEnd) >- return precomputedMarginEnd.value(); >- auto marginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth); >- return marginEnd.valueOr(0_lu); >- }; >- >- auto computeMarginStart = [&]() { >+ auto usedMarginStart = [&] { > if (precomputedMarginStart) > return precomputedMarginStart.value(); > auto marginStart = computedValueIfNotAuto(style.marginStart(), containingBlockWidth); > return marginStart.valueOr(0_lu); > }; > >+ auto usedMarginEnd = [&] { >+ if (precomputedMarginEnd) >+ return precomputedMarginEnd.value(); >+ auto marginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth); >+ return marginEnd.valueOr(0_lu); >+ }; >+ > auto replaced = layoutBox.replaced(); > ASSERT(replaced); > >- auto marginStart = computeMarginStart(); >- auto marginEnd = computeMarginEnd(); >- auto nonComputedMarginStart = computedValueIfNotAuto(style.marginStart(), containingBlockWidth).valueOr(0); >- auto nonComputedMarginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth).valueOr(0); > auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth); >- > auto heightIsAuto = isHeightAuto(layoutBox); > auto height = computedHeightValue(layoutState, layoutBox, HeightType::Normal); > >@@ -916,8 +911,10 @@ WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(const L > > ASSERT(width); > >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow replaced -> width(" << *width << "px) margin(" << marginStart << "px, " << marginEnd << "px) -> layoutBox(" << &layoutBox << ")"); >- return { *width, { marginStart, marginEnd }, { nonComputedMarginStart, nonComputedMarginEnd } }; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow replaced -> width(" << *width << "px) margin(" << usedMarginStart() << "px, " << usedMarginEnd() << "px) -> layoutBox(" << &layoutBox << ")"); >+ auto computedMarginStart = computedValueIfNotAuto(style.marginStart(), containingBlockWidth); >+ auto computedMarginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth); >+ return { *width, { usedMarginStart(), usedMarginEnd() }, { computedMarginStart.valueOr(0), computedMarginEnd.valueOr(0) } }; > } > > LayoutSize FormattingContext::Geometry::inFlowPositionedPositionOffset(const LayoutState& layoutState, const Box& layoutBox) >diff --git a/Source/WebCore/layout/LayoutState.cpp b/Source/WebCore/layout/LayoutState.cpp >index cc1dbc034ee..fb644e72ff5 100644 >--- a/Source/WebCore/layout/LayoutState.cpp >+++ b/Source/WebCore/layout/LayoutState.cpp >@@ -54,7 +54,7 @@ LayoutState::LayoutState(const Container& initialContainingBlock, const LayoutSi > > auto& displayBox = displayBoxForLayoutBox(initialContainingBlock); > displayBox.setHorizontalMargin({ }); >- displayBox.setHorizontalNonComputedMargin({ }); >+ displayBox.setHorizontalComputedMargin({ }); > displayBox.setVerticalMargin({ }); > displayBox.setBorder({ }); > displayBox.setPadding({ }); >diff --git a/Source/WebCore/layout/LayoutUnits.h b/Source/WebCore/layout/LayoutUnits.h >index d76b6a38565..70ae2bc4112 100644 >--- a/Source/WebCore/layout/LayoutUnits.h >+++ b/Source/WebCore/layout/LayoutUnits.h >@@ -103,9 +103,8 @@ struct Edges { > > struct WidthAndMargin { > LayoutUnit width; >- HorizontalMargin margin; >- // FIXME: Figure out if we really really need this. >- HorizontalMargin nonComputedMargin; >+ HorizontalMargin usedMargin; >+ HorizontalMargin computedMargin; > }; > > struct HeightAndMargin { >diff --git a/Source/WebCore/layout/Verification.cpp b/Source/WebCore/layout/Verification.cpp >index 8eb054743af..494157a9ee7 100644 >--- a/Source/WebCore/layout/Verification.cpp >+++ b/Source/WebCore/layout/Verification.cpp >@@ -247,8 +247,8 @@ static bool outputMismatchingBlockBoxInformationIfNeeded(TextStream& stream, con > > return Display::Box::Rect { > borderBox.top() - displayBox.nonCollapsedMarginBefore(), >- borderBox.left() - displayBox.nonComputedMarginStart(), >- displayBox.nonComputedMarginStart() + borderBox.width() + displayBox.nonComputedMarginEnd(), >+ borderBox.left() - displayBox.computedMarginStart(), >+ displayBox.computedMarginStart() + borderBox.width() + displayBox.computedMarginEnd(), > displayBox.nonCollapsedMarginBefore() + borderBox.height() + displayBox.nonCollapsedMarginAfter() > }; > }; >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 934bc78b00c..9ccd17e9523 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -332,9 +332,9 @@ void BlockFormattingContext::computeWidthAndMargin(const Box& layoutBox) const > > auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox); > displayBox.setContentBoxWidth(widthAndMargin.width); >- displayBox.moveHorizontally(widthAndMargin.margin.start); >- displayBox.setHorizontalMargin(widthAndMargin.margin); >- displayBox.setHorizontalNonComputedMargin(widthAndMargin.nonComputedMargin); >+ displayBox.moveHorizontally(widthAndMargin.usedMargin.start); >+ displayBox.setHorizontalMargin(widthAndMargin.usedMargin); >+ displayBox.setHorizontalComputedMargin(widthAndMargin.computedMargin); > } > > void BlockFormattingContext::computeHeightAndMargin(const Box& layoutBox) const >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 007f72a3044..df26e78b3eb 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -140,10 +140,10 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin > auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox); > > auto width = computedValueIfNotAuto(usedWidth ? Length { usedWidth.value(), Fixed } : style.logicalWidth(), containingBlockWidth); >- auto marginStart = computedValueIfNotAuto(style.marginStart(), containingBlockWidth); >- auto marginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth); >- auto nonComputedMarginStart = marginStart.valueOr(0); >- auto nonComputedMarginEnd = marginEnd.valueOr(0); >+ auto computedMarginStart = computedValueIfNotAuto(style.marginStart(), containingBlockWidth); >+ auto computedMarginEnd = computedValueIfNotAuto(style.marginEnd(), containingBlockWidth); >+ auto usedMarginStart = computedMarginStart; >+ auto usedMarginEnd = computedMarginEnd; > auto borderLeft = displayBox.borderLeft(); > auto borderRight = displayBox.borderRight(); > auto paddingLeft = displayBox.paddingLeft().valueOr(0); >@@ -151,51 +151,51 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin > > // #1 > if (width) { >- auto horizontalSpaceForMargin = containingBlockWidth - (marginStart.valueOr(0) + borderLeft + paddingLeft + *width + paddingRight + borderRight + marginEnd.valueOr(0)); >+ auto horizontalSpaceForMargin = containingBlockWidth - (usedMarginStart.valueOr(0) + borderLeft + paddingLeft + *width + paddingRight + borderRight + usedMarginEnd.valueOr(0)); > if (horizontalSpaceForMargin < 0) { >- marginStart = marginStart.valueOr(0); >- marginEnd = marginEnd.valueOr(0); >+ usedMarginStart = usedMarginStart.valueOr(0); >+ usedMarginEnd = usedMarginEnd.valueOr(0); > } > } > > // #2 >- if (width && marginStart && marginEnd) { >+ if (width && usedMarginStart && usedMarginEnd) { > if (containingBlock->style().isLeftToRightDirection()) >- marginEnd = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight); >+ usedMarginEnd = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight); > else >- marginStart = containingBlockWidth - (borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd); >+ usedMarginStart = containingBlockWidth - (borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd); > } > > // #3 >- if (!marginStart && width && marginEnd) >- marginStart = containingBlockWidth - (borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginEnd); >- else if (marginStart && !width && marginEnd) >- width = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + paddingRight + borderRight + *marginEnd); >- else if (marginStart && width && !marginEnd) >- marginEnd = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight); >+ if (!usedMarginStart && width && usedMarginEnd) >+ usedMarginStart = containingBlockWidth - (borderLeft + paddingLeft + *width + paddingRight + borderRight + *usedMarginEnd); >+ else if (usedMarginStart && !width && usedMarginEnd) >+ width = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + paddingRight + borderRight + *usedMarginEnd); >+ else if (usedMarginStart && width && !usedMarginEnd) >+ usedMarginEnd = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + *width + paddingRight + borderRight); > > // #4 > if (!width) { >- marginStart = marginStart.valueOr(0); >- marginEnd = marginEnd.valueOr(0); >- width = containingBlockWidth - (*marginStart + borderLeft + paddingLeft + paddingRight + borderRight + *marginEnd); >+ usedMarginStart = usedMarginStart.valueOr(0); >+ usedMarginEnd = usedMarginEnd.valueOr(0); >+ width = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + paddingRight + borderRight + *usedMarginEnd); > } > > // #5 >- if (!marginStart && !marginEnd) { >+ if (!usedMarginStart && !usedMarginEnd) { > auto horizontalSpaceForMargin = containingBlockWidth - (borderLeft + paddingLeft + *width + paddingRight + borderRight); >- marginStart = marginEnd = horizontalSpaceForMargin / 2; >+ usedMarginStart = usedMarginEnd = horizontalSpaceForMargin / 2; > } > > ASSERT(width); >- ASSERT(marginStart); >- ASSERT(marginEnd); >+ ASSERT(usedMarginStart); >+ ASSERT(usedMarginEnd); > >- return WidthAndMargin { *width, { *marginStart, *marginEnd }, { nonComputedMarginStart, nonComputedMarginEnd } }; >+ return WidthAndMargin { *width, { *usedMarginStart, *usedMarginEnd }, { computedMarginStart.valueOr(0), computedMarginEnd.valueOr(0) } }; > }; > > auto widthAndMargin = compute(); >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.start << "px, " << widthAndMargin.margin.end << "px) -> layoutBox(" << &layoutBox << ")"); >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.usedMargin.start << "px, " << widthAndMargin.usedMargin.end << "px) -> layoutBox(" << &layoutBox << ")"); > return widthAndMargin; > } > >@@ -213,8 +213,8 @@ WidthAndMargin BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin(co > // #2 > auto nonReplacedWidthAndMargin = inFlowNonReplacedWidthAndMargin(layoutState, layoutBox, width); > >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow replaced -> width(" << width << "px) margin(" << nonReplacedWidthAndMargin.margin.start << "px, " << nonReplacedWidthAndMargin.margin.end << "px) -> layoutBox(" << &layoutBox << ")"); >- return { width, nonReplacedWidthAndMargin.margin, nonReplacedWidthAndMargin.nonComputedMargin }; >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow replaced -> width(" << width << "px) margin(" << nonReplacedWidthAndMargin.usedMargin.start << "px, " << nonReplacedWidthAndMargin.usedMargin.end << "px) -> layoutBox(" << &layoutBox << ")"); >+ return { width, nonReplacedWidthAndMargin.usedMargin, nonReplacedWidthAndMargin.computedMargin }; > } > > Point BlockFormattingContext::Geometry::staticPosition(const LayoutState& layoutState, const Box& layoutBox) >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.cpp b/Source/WebCore/layout/displaytree/DisplayBox.cpp >index 6db7dedb37a..631ef71b983 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.cpp >+++ b/Source/WebCore/layout/displaytree/DisplayBox.cpp >@@ -59,7 +59,7 @@ Box::Box(const Box& other) > , m_contentHeight(other.m_contentHeight) > , m_horizontalMargin(other.m_horizontalMargin) > , m_verticalMargin(other.m_verticalMargin) >- , m_horizontalNonComputedMargin(other.m_horizontalNonComputedMargin) >+ , m_horizontalComputedMargin(other.m_horizontalComputedMargin) > , m_hasClearance(other.m_hasClearance) > , m_border(other.m_border) > , m_padding(other.m_padding) >@@ -69,7 +69,7 @@ Box::Box(const Box& other) > , m_hasValidHorizontalMargin(other.m_hasValidHorizontalMargin) > , m_hasValidVerticalMargin(other.m_hasValidVerticalMargin) > , m_hasValidVerticalNonCollapsedMargin(other.m_hasValidVerticalNonCollapsedMargin) >- , m_hasValidHorizontalNonComputedMargin(other.m_hasValidHorizontalNonComputedMargin) >+ , m_hasValidHorizontalComputedMargin(other.m_hasValidHorizontalComputedMargin) > , m_hasValidBorder(other.m_hasValidBorder) > , m_hasValidPadding(other.m_hasValidPadding) > , m_hasValidContentHeight(other.m_hasValidContentHeight) >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.h b/Source/WebCore/layout/displaytree/DisplayBox.h >index 5acb087ffab..1746d9f1254 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.h >+++ b/Source/WebCore/layout/displaytree/DisplayBox.h >@@ -147,8 +147,8 @@ public: > > LayoutUnit nonCollapsedMarginBefore() const; > LayoutUnit nonCollapsedMarginAfter() const; >- LayoutUnit nonComputedMarginStart() const; >- LayoutUnit nonComputedMarginEnd() const; >+ LayoutUnit computedMarginStart() const; >+ LayoutUnit computedMarginEnd() const; > > LayoutUnit borderTop() const; > LayoutUnit borderLeft() const; >@@ -197,7 +197,7 @@ private: > > void setHorizontalMargin(Layout::HorizontalMargin); > void setVerticalMargin(Layout::VerticalMargin); >- void setHorizontalNonComputedMargin(Layout::HorizontalMargin); >+ void setHorizontalComputedMargin(Layout::HorizontalMargin); > void setHasClearance() { m_hasClearance = true; } > > void setBorder(Layout::Edges); >@@ -213,7 +213,7 @@ private: > void setHasValidLeft() { m_hasValidLeft = true; } > void setHasValidVerticalMargin() { m_hasValidVerticalMargin = true; } > void setHasValidVerticalNonCollapsedMargin() { m_hasValidVerticalNonCollapsedMargin = true; } >- void setHasValidHorizontalNonComputedMargin() { m_hasValidHorizontalNonComputedMargin = true; } >+ void setHasValidHorizontalComputedMargin() { m_hasValidHorizontalComputedMargin = true; } > void setHasValidHorizontalMargin() { m_hasValidHorizontalMargin = true; } > > void setHasValidBorder() { m_hasValidBorder = true; } >@@ -231,7 +231,7 @@ private: > > Layout::HorizontalMargin m_horizontalMargin; > Layout::VerticalMargin m_verticalMargin; >- Layout::HorizontalMargin m_horizontalNonComputedMargin; >+ Layout::HorizontalMargin m_horizontalComputedMargin; > bool m_hasClearance; > > Layout::Edges m_border; >@@ -243,7 +243,7 @@ private: > bool m_hasValidHorizontalMargin { false }; > bool m_hasValidVerticalMargin { false }; > bool m_hasValidVerticalNonCollapsedMargin { false }; >- bool m_hasValidHorizontalNonComputedMargin { false }; >+ bool m_hasValidHorizontalComputedMargin { false }; > bool m_hasValidBorder { false }; > bool m_hasValidPadding { false }; > bool m_hasValidContentHeight { false }; >@@ -531,12 +531,12 @@ inline void Box::setVerticalMargin(Layout::VerticalMargin margin) > m_verticalMargin = margin; > } > >-inline void Box::setHorizontalNonComputedMargin(Layout::HorizontalMargin margin) >+inline void Box::setHorizontalComputedMargin(Layout::HorizontalMargin margin) > { > #if !ASSERT_DISABLED >- setHasValidHorizontalNonComputedMargin(); >+ setHasValidHorizontalComputedMargin(); > #endif >- m_horizontalNonComputedMargin = margin; >+ m_horizontalComputedMargin = margin; > } > > inline void Box::setBorder(Layout::Edges border) >@@ -605,16 +605,16 @@ inline LayoutUnit Box::nonCollapsedMarginAfter() const > return m_verticalMargin.nonCollapsedValues().after; > } > >-inline LayoutUnit Box::nonComputedMarginStart() const >+inline LayoutUnit Box::computedMarginStart() const > { >- ASSERT(m_hasValidHorizontalNonComputedMargin); >- return m_horizontalNonComputedMargin.start; >+ ASSERT(m_hasValidHorizontalComputedMargin); >+ return m_horizontalComputedMargin.start; > } > >-inline LayoutUnit Box::nonComputedMarginEnd() const >+inline LayoutUnit Box::computedMarginEnd() const > { >- ASSERT(m_hasValidHorizontalNonComputedMargin); >- return m_horizontalNonComputedMargin.end; >+ ASSERT(m_hasValidHorizontalComputedMargin); >+ return m_horizontalComputedMargin.end; > } > > inline Optional<LayoutUnit> Box::paddingTop() const >diff --git a/Source/WebCore/layout/floats/FloatAvoider.h b/Source/WebCore/layout/floats/FloatAvoider.h >index 7d46690494d..8b5cd884058 100644 >--- a/Source/WebCore/layout/floats/FloatAvoider.h >+++ b/Source/WebCore/layout/floats/FloatAvoider.h >@@ -72,8 +72,9 @@ protected: > > LayoutUnit marginBefore() const { return displayBox().marginBefore(); } > LayoutUnit marginAfter() const { return displayBox().marginAfter(); } >- LayoutUnit marginStart() const { return displayBox().nonComputedMarginStart(); } >- LayoutUnit marginEnd() const { return displayBox().nonComputedMarginEnd(); } >+ // Do not use the used values here because they computed as if this box was not a float avoider. >+ LayoutUnit marginStart() const { return displayBox().computedMarginStart(); } >+ LayoutUnit marginEnd() const { return displayBox().computedMarginEnd(); } > > LayoutUnit marginBoxWidth() const { return marginStart() + displayBox().width() + marginEnd(); } > >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >index e21b8740727..5c5f3edb723 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >@@ -342,8 +342,8 @@ void InlineFormattingContext::computeWidthAndMargin(const Box& layoutBox) const > > auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox); > displayBox.setContentBoxWidth(widthAndMargin.width); >- displayBox.setHorizontalMargin(widthAndMargin.margin); >- displayBox.setHorizontalNonComputedMargin(widthAndMargin.nonComputedMargin); >+ displayBox.setHorizontalMargin(widthAndMargin.usedMargin); >+ displayBox.setHorizontalComputedMargin(widthAndMargin.computedMargin); > } > > void InlineFormattingContext::computeHeightAndMargin(const Box& layoutBox) const
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193059
:
358145
|
358258
|
358299