WebKit Bugzilla
Attachment 372178 Details for
Bug 198878
: [LFC] Convert both the absolutely and statically positioned out-of-flow block level boxes positions relative to the containing block's padding box
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198878-20190615000705.patch (text/plain), 12.05 KB, created by
zalan
on 2019-06-15 00:07:08 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-06-15 00:07:08 PDT
Size:
12.05 KB
patch
obsolete
>Subversion Revision: 246456 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index cb17ca08eea8a692120383de79fd3753a974387a..3b7cc02b3599891fdef6749893e7c08987ff1a4e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2019-06-15 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Convert both the absolutely and statically positioned out-of-flow block level boxes positions relative to the containing block's padding box >+ https://bugs.webkit.org/show_bug.cgi?id=198878 >+ <rdar://problem/51772882> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch ensures that while we compute the vertical/horizontal geometry for an out-of-flow block level box, >+ the static and the absolute positioned values are in the same coordinate system (relative to the containing block's padding box). >+ >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned): >+ (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry): >+ > 2019-06-14 Zalan Bujtas <zalan@apple.com> > > [LFC][IFC] Add support for vertical-align: top and bottom >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index b81796a48ede1d523c1b03a62a8815bd5baea198..ffc5354a46318b786d5bb1e682805a307968c75d 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -201,15 +201,17 @@ static LayoutUnit staticVerticalPositionForOutOfFlowPositioned(const LayoutState > } > > // Resolve top all the way up to the containing block. >- auto* containingBlock = layoutBox.containingBlock(); >+ auto& containingBlock = *layoutBox.containingBlock(); > // Start with the parent since we pretend that this box is normal flow. >- for (auto* container = layoutBox.parent(); container != containingBlock; container = container->containingBlock()) { >+ for (auto* container = layoutBox.parent(); container != &containingBlock; container = container->containingBlock()) { > auto& displayBox = layoutState.displayBoxForLayoutBox(*container); > // Display::Box::top is the border box top position in its containing block's coordinate system. > top += displayBox.top(); > ASSERT(!container->isPositioned() || layoutBox.isFixedPositioned()); > } >- return top; >+ // Move the static position relative to the padding box. This is very specific to abolutely positioned boxes. >+ auto paddingBoxTop = layoutState.displayBoxForLayoutBox(containingBlock).paddingBoxTop(); >+ return top - paddingBoxTop; > } > > static LayoutUnit staticHorizontalPositionForOutOfFlowPositioned(const LayoutState& layoutState, const Box& layoutBox) >@@ -222,15 +224,17 @@ static LayoutUnit staticHorizontalPositionForOutOfFlowPositioned(const LayoutSta > auto left = layoutState.displayBoxForLayoutBox(*layoutBox.parent()).contentBoxLeft(); > > // Resolve left all the way up to the containing block. >- auto* containingBlock = layoutBox.containingBlock(); >+ auto& containingBlock = *layoutBox.containingBlock(); > // Start with the parent since we pretend that this box is normal flow. >- for (auto* container = layoutBox.parent(); container != containingBlock; container = container->containingBlock()) { >+ for (auto* container = layoutBox.parent(); container != &containingBlock; container = container->containingBlock()) { > auto& displayBox = layoutState.displayBoxForLayoutBox(*container); > // Display::Box::left is the border box left position in its containing block's coordinate system. > left += displayBox.left(); > ASSERT(!container->isPositioned() || layoutBox.isFixedPositioned()); > } >- return left; >+ // Move the static position relative to the padding box. This is very specific to abolutely positioned boxes. >+ auto paddingBoxLeft = layoutState.displayBoxForLayoutBox(containingBlock).paddingBoxTop(); >+ return left - paddingBoxLeft; > } > > LayoutUnit FormattingContext::Geometry::shrinkToFitWidth(LayoutState& layoutState, const Box& formattingRoot, UsedHorizontalValues usedValues) >@@ -292,7 +296,6 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet > > auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); > auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); >- auto isStaticallyPositioned = !top && !bottom; > auto height = usedValues.height ? usedValues.height.value() : computedHeightValue(layoutState, layoutBox, HeightType::Normal); > auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutBox, UsedHorizontalValues { containingBlockWidth }); > UsedVerticalMargin::NonCollapsedValues usedVerticalMargin; >@@ -370,12 +373,10 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeomet > ASSERT(height); > > // For out-of-flow elements the containing block is formed by the padding edge of the ancestor. >- // At this point the non-statically positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system. >- if (!isStaticallyPositioned) { >- auto containingBlockPaddingVerticalEdge = containingBlockDisplayBox.paddingBoxTop(); >- *top += containingBlockPaddingVerticalEdge; >- *bottom += containingBlockPaddingVerticalEdge; >- } >+ // At this point the positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system. >+ auto containingBlockPaddingVerticalEdge = containingBlockDisplayBox.paddingBoxTop(); >+ *top += containingBlockPaddingVerticalEdge; >+ *bottom += containingBlockPaddingVerticalEdge; > > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow non-replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << *height << "px) margin(" << usedVerticalMargin.before << "px, " << usedVerticalMargin.after << "px) layoutBox(" << &layoutBox << ")"); > return { *top, *bottom, { contentHeight(), usedVerticalMargin } }; >@@ -420,7 +421,6 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe > > auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth); > auto right = computedValueIfNotAuto(style.logicalRight(), containingBlockWidth); >- auto isStaticallyPositioned = !left && !right; > auto width = computedValueIfNotAuto(usedValues.width ? Length { usedValues.width.value(), Fixed } : style.logicalWidth(), containingBlockWidth); > auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutBox, usedValues); > UsedHorizontalMargin usedHorizontalMargin; >@@ -524,12 +524,10 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGe > ASSERT(width); > > // For out-of-flow elements the containing block is formed by the padding edge of the ancestor. >- // At this point the non-statically positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system. >- if (!isStaticallyPositioned) { >- auto containingBlockPaddingVerticalEdge = containingBlockDisplayBox.paddingBoxLeft(); >- *left += containingBlockPaddingVerticalEdge; >- *right += containingBlockPaddingVerticalEdge; >- } >+ // At this point the positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system. >+ auto containingBlockPaddingVerticalEdge = containingBlockDisplayBox.paddingBoxLeft(); >+ *left += containingBlockPaddingVerticalEdge; >+ *right += containingBlockPaddingVerticalEdge; > > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Width][Margin] -> out-of-flow non-replaced -> left(" << *left << "px) right(" << *right << "px) width(" << *width << "px) margin(" << usedHorizontalMargin.start << "px, " << usedHorizontalMargin.end << "px) layoutBox(" << &layoutBox << ")"); > return { *left, *right, { contentWidth(), usedHorizontalMargin, computedHorizontalMargin } }; >@@ -557,7 +555,6 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry( > > auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); > auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); >- auto isStaticallyPositioned = !top && !bottom; > auto height = inlineReplacedHeightAndMargin(layoutState, layoutBox, usedValues).height; > auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutBox, UsedHorizontalValues { containingBlockWidth }); > Optional<LayoutUnit> usedMarginBefore = computedVerticalMargin.before; >@@ -604,12 +601,10 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry( > bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter); > > // For out-of-flow elements the containing block is formed by the padding edge of the ancestor. >- // At this point the non-statically positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system. >- if (!isStaticallyPositioned) { >- auto containingBlockPaddingVerticalEdge = containingBlockDisplayBox.paddingBoxTop(); >- *top += containingBlockPaddingVerticalEdge; >- *bottom += containingBlockPaddingVerticalEdge; >- } >+ // At this point the positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system. >+ auto containingBlockPaddingVerticalEdge = containingBlockDisplayBox.paddingBoxTop(); >+ *top += containingBlockPaddingVerticalEdge; >+ *bottom += containingBlockPaddingVerticalEdge; > > ASSERT(top); > ASSERT(bottom); >@@ -645,7 +640,6 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome > > auto left = computedValueIfNotAuto(style.logicalLeft(), containingBlockWidth); > auto right = computedValueIfNotAuto(style.logicalRight(), containingBlockWidth); >- auto isStaticallyPositioned = !left && !right; > auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutBox, usedValues); > Optional<LayoutUnit> usedMarginStart = computedHorizontalMargin.start; > Optional<LayoutUnit> usedMarginEnd = computedHorizontalMargin.end; >@@ -715,12 +709,10 @@ HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeome > ASSERT(usedMarginEnd); > > // For out-of-flow elements the containing block is formed by the padding edge of the ancestor. >- // At this point the non-statically positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system. >- if (!isStaticallyPositioned) { >- auto containingBlockPaddingVerticalEdge = layoutState.displayBoxForLayoutBox(containingBlock).paddingBoxLeft(); >- *left += containingBlockPaddingVerticalEdge; >- *right += containingBlockPaddingVerticalEdge; >- } >+ // At this point the positioned value is in the coordinate system of the padding box. Let's convert it to border box coordinate system. >+ auto containingBlockPaddingVerticalEdge = layoutState.displayBoxForLayoutBox(containingBlock).paddingBoxLeft(); >+ *left += containingBlockPaddingVerticalEdge; >+ *right += containingBlockPaddingVerticalEdge; > > 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 }, computedHorizontalMargin } };
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 198878
: 372178