WebKit Bugzilla
Attachment 360580 Details for
Bug 194020
: [LFC] Use the used margin values in outOfFlowReplacedVerticalGeometry consistently
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194020-20190130073213.patch (text/plain), 9.80 KB, created by
zalan
on 2019-01-30 07:32:27 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-01-30 07:32:27 PST
Size:
9.80 KB
patch
obsolete
>Subversion Revision: 240657 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0c1fd2ced14ca4ae3145be2ed07490fd27574c45..9c55aadebcc4193447d0ecdb8bdf267b66f33358 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2019-01-30 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Use the used margin values in outOfFlowReplacedVerticalGeometry consistently >+ https://bugs.webkit.org/show_bug.cgi?id=194020 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Check the used margin variables whether we already computed before/after values. >+ >+ Test: fast/block/block-only/absolute-position-with-margin-auto-simple.html >+ >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry): >+ > 2019-01-29 Zalan Bujtas <zalan@apple.com> > > [LFC][BFC][MarginCollapsing] Remove incorrect downcast<Container> >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index 69731608a8899a7b3d30ab63a423bdf8336c16a2..2f00b55fbe229d221f5381ab08a02401d3d71e1f 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -554,7 +554,8 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry( > auto isStaticallyPositioned = !top && !bottom; > auto height = inlineReplacedHeightAndMargin(layoutState, layoutBox, usedHeight).height; > auto computedVerticalMargin = Geometry::computedVerticalMargin(layoutState, layoutBox); >- UsedVerticalMargin::NonCollapsedValues usedVerticalMargin; >+ Optional<LayoutUnit> usedMarginBefore; >+ Optional<LayoutUnit> usedMarginAfter; > auto paddingTop = displayBox.paddingTop().valueOr(0); > auto paddingBottom = displayBox.paddingBottom().valueOr(0); > auto borderTop = displayBox.borderTop(); >@@ -567,32 +568,34 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry( > > if (!bottom) { > // #2 >- usedVerticalMargin = { computedVerticalMargin.before.valueOr(0), computedVerticalMargin.after.valueOr(0) }; >+ usedMarginBefore = computedVerticalMargin.before.valueOr(0); >+ usedMarginAfter = usedMarginBefore; > } > >- if (!computedVerticalMargin.before && !computedVerticalMargin.after) { >+ if (!usedMarginBefore && !usedMarginAfter) { > // #3 > auto marginBeforeAndAfter = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); >- usedVerticalMargin = { marginBeforeAndAfter / 2, marginBeforeAndAfter / 2 }; >+ usedMarginBefore = marginBeforeAndAfter / 2; >+ usedMarginAfter = usedMarginBefore; > } > > // #4 > if (!top) >- top = containingBlockHeight - (usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom); >+ top = containingBlockHeight - (*usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter + *bottom); > > if (!bottom) >- bottom = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after); >+ bottom = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter); > >- if (!computedVerticalMargin.before) >- usedVerticalMargin.before = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom); >+ if (!usedMarginBefore) >+ usedMarginBefore = containingBlockHeight - (*top + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter + *bottom); > >- if (!computedVerticalMargin.after) >- usedVerticalMargin.after = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); >+ if (!usedMarginAfter) >+ usedMarginAfter = containingBlockHeight - (*top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *bottom); > > // #5 >- auto boxHeight = *top + usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after + *bottom; >+ auto boxHeight = *top + *usedMarginBefore + borderTop + paddingTop + height + paddingBottom + borderBottom + *usedMarginAfter + *bottom; > if (boxHeight > containingBlockHeight) >- bottom = containingBlockHeight - (*top + usedVerticalMargin.before + borderTop + paddingTop + height + paddingBottom + borderBottom + usedVerticalMargin.after); >+ 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. >@@ -602,8 +605,12 @@ VerticalGeometry FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry( > *bottom += containingBlockPaddingVerticalEdge; > } > >- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Height][Margin] -> out-of-flow replaced -> top(" << *top << "px) bottom(" << *bottom << "px) height(" << height << "px) margin(" << usedVerticalMargin.before << "px, " << usedVerticalMargin.after << "px) layoutBox(" << &layoutBox << ")"); >- return { *top, *bottom, { height, usedVerticalMargin } }; >+ ASSERT(top); >+ ASSERT(bottom); >+ ASSERT(usedMarginBefore); >+ ASSERT(usedMarginAfter); >+ 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) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 47ef132c9e170c81335e822dd850183f82887dc2..38501bc006253df96920bd7dafeb21707e811c84 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,12 @@ >+2019-01-30 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Use the used margin values in outOfFlowReplacedVerticalGeometry consistently >+ https://bugs.webkit.org/show_bug.cgi?id=194020 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * LayoutReloaded/misc/LFC-passing-tests.txt: >+ > 2019-01-29 Zalan Bujtas <zalan@apple.com> > > Adding new passing LFC tests. >diff --git a/Tools/LayoutReloaded/misc/LFC-passing-tests.txt b/Tools/LayoutReloaded/misc/LFC-passing-tests.txt >index ffefcca3275da3d8377c88a5c1abf06bbd423400..5d33fbd383e47ca2325fd8b303bfb8f278077bdb 100644 >--- a/Tools/LayoutReloaded/misc/LFC-passing-tests.txt >+++ b/Tools/LayoutReloaded/misc/LFC-passing-tests.txt >@@ -82,6 +82,7 @@ fast/block/block-only/non-auto-top-bottom-left-right-widht-height-out-of-flow.ht > fast/block/block-only/non-auto-top-bottom-height-with-margins.html > fast/block/block-only/non-auto-top-bottom-height-with-auto-margins.html > fast/block/block-only/abs-pos-with-border-padding-and-float-child-expected.html >+fast/block/block-only/absolute-position-with-margin-auto-simple.html > fast/block/basic/002.html > fast/block/basic/003.html > fast/block/basic/004.html >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 9261b6b474a7ea86155d9fb536b175274667e94c..cc3e4d5e85c3b260a607c608cad82b7700ad00ec 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2019-01-30 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Use the used margin values in outOfFlowReplacedVerticalGeometry consistently >+ https://bugs.webkit.org/show_bug.cgi?id=194020 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/block/block-only/absolute-position-with-margin-auto-simple-expected.html: Added. >+ * fast/block/block-only/absolute-position-with-margin-auto-simple.html: Added. >+ > 2019-01-28 Devin Rousso <drousso@apple.com> > > Web Inspector: provide a way to edit page WebRTC settings on a remote target >diff --git a/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple-expected.html b/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..bea034a0e7e7f427d238eb1be6153add1a5b6d1d >--- /dev/null >+++ b/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple-expected.html >@@ -0,0 +1,9 @@ >+<style> >+div { >+ background-color: green; >+ width: 100px; >+ height: 100px; >+} >+</style> >+<div style="position: relative; top: 10px;"></div> >+<div style="position: relative; top: 290px;"></div> >diff --git a/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple.html b/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7e2ab8795b371d136c3fb2da5a61bd6fa2a3a348 >--- /dev/null >+++ b/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple.html >@@ -0,0 +1,15 @@ >+<style> >+div { >+ margin-bottom: auto; >+ margin-top: auto; >+ position: absolute; >+ background-color: green; >+ width: 100px; >+} >+</style> >+<div style="height: 500px; width: 500px; background-color: transparent"> >+ <div style="top: 10px;"></div> >+ <div style="bottom: 10px;"></div> >+ <div style="top: 10px; height: 100px"></div> >+ <div style="bottom: 10px; height: 100px"></div> >+</div> >\ No newline at end of file
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 194020
: 360580