WebKit Bugzilla
Attachment 342431 Details for
Bug 186524
: [LFC] Merge top, bottom, height and vertical margin computation for out-of-flow replaced elements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186524-20180611081918.patch (text/plain), 5.19 KB, created by
zalan
on 2018-06-11 08:19:18 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-11 08:19:18 PDT
Size:
5.19 KB
patch
obsolete
>Subversion Revision: 232714 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 299404dd4f8d178b50c906573825f6ef77f58e24..22a06061f8b5ec504aa10f9238c417ab5aacf33d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,16 @@ >+2018-06-11 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Merge top, bottom, height and vertical margin computation for out-of-flow replaced elements >+ https://bugs.webkit.org/show_bug.cgi?id=186524 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Implement https://www.w3.org/TR/CSS22/visudet.html#abs-replaced-height >+ (10.6.5 Absolutely positioned, replaced elements) >+ >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): >+ > 2018-06-11 Zalan Bujtas <zalan@apple.com> > > [LFC] Merge left, right, width and horizontal margin computation for out-of-flow replaced elements >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index 45fd5e03440e5fe10f9ba42423174df83c16a8b3..8be52f17e26b9ad592c08b9190add21736a83eea 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -332,9 +332,66 @@ FormattingContext::Geometry::VerticalGeometry FormattingContext::Geometry::outOf > ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.replaced()); > // 10.6.5 Absolutely positioned, replaced elements > // >- // The used value of 'height' is determined as for inline replaced elements. >- auto heightAndMargin = inlineReplacedHeightAndMargin(layoutContext, layoutBox); >- return { { }, { }, heightAndMargin.height, heightAndMargin.margin }; >+ // The used value of 'height' is determined as for inline replaced elements. >+ // If 'margin-top' or 'margin-bottom' is specified as 'auto' its used value is determined by the rules below. >+ // 1. If both 'top' and 'bottom' have the value 'auto', replace 'top' with the element's static position. >+ // 2. If 'bottom' is 'auto', replace any 'auto' on 'margin-top' or 'margin-bottom' with '0'. >+ // 3. If at this point both 'margin-top' and 'margin-bottom' are still 'auto', solve the equation under the extra constraint that the two margins must get equal values. >+ // 4. If at this point there is only one 'auto' left, solve the equation for that value. >+ // 5. If at this point the values are over-constrained, ignore the value for 'bottom' and solve for that value. >+ >+ auto& style = layoutBox.style(); >+ auto& displayBox = *layoutContext.displayBoxForLayoutBox(layoutBox); >+ auto& containingBlock = *layoutBox.containingBlock(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(containingBlock)->width(); >+ auto containingBlockHeight = layoutContext.displayBoxForLayoutBox(containingBlock)->height(); >+ >+ auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth); >+ auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth); >+ auto height = inlineReplacedHeightAndMargin(layoutContext, layoutBox).height; >+ auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth); >+ auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth); >+ auto paddingTop = displayBox.paddingTop(); >+ auto paddingBottom = displayBox.paddingBottom(); >+ auto borderTop = displayBox.borderTop(); >+ auto borderBottom = displayBox.borderBottom(); >+ >+ if (!top && !bottom) { >+ // #1 >+ top = displayBox.top(); >+ } >+ >+ if (!bottom) { >+ // #2 >+ marginTop = marginTop.value_or(0); >+ marginBottom = marginBottom.value_or(0); >+ } >+ >+ if (!marginTop && !marginBottom) { >+ // #3 >+ auto marginTopAndBottom = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); >+ marginTop = marginBottom = marginTopAndBottom / 2; >+ } >+ >+ // #4 >+ if (!top) >+ top = containingBlockHeight - (*marginTop + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginBottom + *bottom); >+ >+ if (!bottom) >+ bottom = containingBlockHeight - (*top + *marginTop + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginBottom); >+ >+ if (!marginTop) >+ marginTop = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginBottom + *bottom); >+ >+ if (!marginBottom) >+ marginBottom = containingBlockHeight - (*top + *marginTop + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); >+ >+ // #5 >+ auto boxHeight = *top + *marginTop + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginBottom + *bottom; >+ if (boxHeight > containingBlockHeight) >+ bottom = containingBlockHeight - (*top + *marginTop + borderTop + paddingTop + height + paddingBottom + borderBottom + *marginBottom); >+ >+ return { *top, *bottom, height, { *marginTop, *marginBottom } }; > } > > FormattingContext::Geometry::HorizontalGeometry FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry(LayoutContext& layoutContext, const Box& layoutBox)
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
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186524
: 342431