Diff
Modified: trunk/LayoutTests/ChangeLog (240779 => 240780)
--- trunk/LayoutTests/ChangeLog 2019-01-31 13:38:12 UTC (rev 240779)
+++ trunk/LayoutTests/ChangeLog 2019-01-31 13:39:44 UTC (rev 240780)
@@ -1,3 +1,13 @@
+2019-01-31 Zalan Bujtas <za...@apple.com>
+
+ [LFC] Use the used margin values in outOfFlowReplacedHorizontalGeometry consistently
+ https://bugs.webkit.org/show_bug.cgi?id=194074
+
+ Reviewed by Antti Koivisto.
+
+ * fast/block/block-only/absolute-position-with-margin-auto-simple2-expected.html: Added.
+ * fast/block/block-only/absolute-position-with-margin-auto-simple2.html: Added.
+
2019-01-31 Chris Fleizach <cfleiz...@apple.com>
ASSERTION FAILED: cache under WebCore::AXObjectCache::postTextStateChangePlatformNotification
Added: trunk/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple2-expected.html (0 => 240780)
--- trunk/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple2-expected.html (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple2-expected.html 2019-01-31 13:39:44 UTC (rev 240780)
@@ -0,0 +1,9 @@
+<style>
+div {
+ background-color: green;
+ width: 100px;
+ height: 100px;
+}
+</style>
+<div style="position: relative; left: 10px;"></div>
+<div style="position: relative; top: -100px; left: 390px;"></div>
Added: trunk/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple2.html (0 => 240780)
--- trunk/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple2.html (rev 0)
+++ trunk/LayoutTests/fast/block/block-only/absolute-position-with-margin-auto-simple2.html 2019-01-31 13:39:44 UTC (rev 240780)
@@ -0,0 +1,15 @@
+<style>
+div {
+ margin-left: auto;
+ margin-right: auto;
+ position: absolute;
+ background-color: green;
+ height: 100px;
+}
+</style>
+<div style="height: 500px; width: 500px; background-color: transparent">
+ <div style="left: 10px;"></div>
+ <div style="right: 10px;"></div>
+ <div style="left: 10px; width: 100px"></div>
+ <div style="right: 10px; width: 100px"></div>
+</div>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (240779 => 240780)
--- trunk/Source/WebCore/ChangeLog 2019-01-31 13:38:12 UTC (rev 240779)
+++ trunk/Source/WebCore/ChangeLog 2019-01-31 13:39:44 UTC (rev 240780)
@@ -1,5 +1,19 @@
2019-01-31 Zalan Bujtas <za...@apple.com>
+ [LFC] Use the used margin values in outOfFlowReplacedHorizontalGeometry consistently
+ https://bugs.webkit.org/show_bug.cgi?id=194074
+
+ Reviewed by Antti Koivisto.
+
+ Check the used margin variables whether we already computed start/end values.
+
+ Test: fast/block/block-only/absolute-position-with-margin-auto-simple2.html
+
+ * layout/FormattingContextGeometry.cpp:
+ (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
+
+2019-01-31 Zalan Bujtas <za...@apple.com>
+
[LFC][BFC] Add support for block level replaced box.
https://bugs.webkit.org/show_bug.cgi?id=194071
Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (240779 => 240780)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2019-01-31 13:38:12 UTC (rev 240779)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2019-01-31 13:39:44 UTC (rev 240780)
@@ -642,7 +642,8 @@
auto right = computedValueIfNotAuto(style.logicalRight(), containingBlockWidth);
auto isStaticallyPositioned = !left && !right;
auto computedHorizontalMargin = Geometry::computedHorizontalMargin(layoutState, layoutBox);
- UsedHorizontalMargin usedHorizontalMargin;
+ Optional<LayoutUnit> usedMarginStart;
+ Optional<LayoutUnit> usedMarginEnd;
auto width = inlineReplacedWidthAndMargin(layoutState, layoutBox, usedWidth).width;
auto paddingLeft = displayBox.paddingLeft().valueOr(0);
auto paddingRight = displayBox.paddingRight().valueOr(0);
@@ -660,21 +661,23 @@
if (!left || !right) {
// #2
- usedHorizontalMargin = { computedHorizontalMargin.start.valueOr(0), computedHorizontalMargin.end.valueOr(0) };
+ usedMarginStart = computedHorizontalMargin.start.valueOr(0);
+ usedMarginEnd = computedHorizontalMargin.end.valueOr(0);
}
- if (!computedHorizontalMargin.start && !computedHorizontalMargin.end) {
+ if (!usedMarginStart && !usedMarginEnd) {
// #3
auto marginStartAndEnd = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + *right);
- if (marginStartAndEnd >= 0)
- usedHorizontalMargin = { marginStartAndEnd / 2, marginStartAndEnd / 2 };
- else {
+ if (marginStartAndEnd >= 0) {
+ usedMarginStart = marginStartAndEnd / 2;
+ usedMarginEnd = usedMarginStart;
+ } else {
if (isLeftToRightDirection) {
- usedHorizontalMargin.start = 0_lu;
- usedHorizontalMargin.end = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + width + paddingRight + borderRight + *right);
+ usedMarginStart = 0_lu;
+ usedMarginEnd = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *right);
} else {
- usedHorizontalMargin.end = 0_lu;
- usedHorizontalMargin.start = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + usedHorizontalMargin.end + *right);
+ usedMarginEnd = 0_lu;
+ usedMarginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right);
}
}
}
@@ -681,28 +684,30 @@
// #4
if (!left)
- left = containingBlockWidth - (usedHorizontalMargin.start + borderLeft + paddingLeft + width + paddingRight + borderRight + usedHorizontalMargin.end + *right);
+ left = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right);
if (!right)
- right = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + width + paddingRight + borderRight + usedHorizontalMargin.end);
+ right = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd);
- if (!computedHorizontalMargin.start)
- usedHorizontalMargin.start = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + usedHorizontalMargin.end + *right);
+ if (!usedMarginStart)
+ usedMarginStart = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right);
- if (!computedHorizontalMargin.end)
- usedHorizontalMargin.end = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + width + paddingRight + borderRight + *right);
+ if (!usedMarginEnd)
+ usedMarginEnd = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *right);
- auto boxWidth = (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + width + paddingRight + borderRight + usedHorizontalMargin.end + *right);
+ auto boxWidth = (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right);
if (boxWidth > containingBlockWidth) {
// #5 Over-constrained?
if (isLeftToRightDirection)
- right = containingBlockWidth - (*left + usedHorizontalMargin.start + borderLeft + paddingLeft + width + paddingRight + borderRight + usedHorizontalMargin.end);
+ right = containingBlockWidth - (*left + *usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd);
else
- left = containingBlockWidth - (usedHorizontalMargin.start + borderLeft + paddingLeft + width + paddingRight + borderRight + usedHorizontalMargin.end + *right);
+ left = containingBlockWidth - (*usedMarginStart + borderLeft + paddingLeft + width + paddingRight + borderRight + *usedMarginEnd + *right);
}
ASSERT(left);
ASSERT(right);
+ ASSERT(usedMarginStart);
+ 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.
@@ -712,8 +717,8 @@
*right += containingBlockPaddingVerticalEdge;
}
- LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position][Width][Margin] -> out-of-flow replaced -> left(" << *left << "px) right(" << *right << "px) width(" << width << "px) margin(" << usedHorizontalMargin.start << "px, " << usedHorizontalMargin.end << "px) layoutBox(" << &layoutBox << ")");
- return { *left, *right, { width, usedHorizontalMargin, computedHorizontalMargin } };
+ 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 } };
}
HeightAndMargin FormattingContext::Geometry::complicatedCases(const LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedHeight)
Modified: trunk/Tools/ChangeLog (240779 => 240780)
--- trunk/Tools/ChangeLog 2019-01-31 13:38:12 UTC (rev 240779)
+++ trunk/Tools/ChangeLog 2019-01-31 13:39:44 UTC (rev 240780)
@@ -1,5 +1,14 @@
2019-01-31 Zalan Bujtas <za...@apple.com>
+ [LFC] Use the used margin values in outOfFlowReplacedHorizontalGeometry consistently
+ https://bugs.webkit.org/show_bug.cgi?id=194074
+
+ Reviewed by Antti Koivisto.
+
+ * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2019-01-31 Zalan Bujtas <za...@apple.com>
+
[LFC][BFC] Add support for block level replaced box.
https://bugs.webkit.org/show_bug.cgi?id=194071
Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (240779 => 240780)
--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2019-01-31 13:38:12 UTC (rev 240779)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2019-01-31 13:39:44 UTC (rev 240780)
@@ -83,6 +83,7 @@
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/block-only/absolute-position-with-margin-auto-simple2.html
fast/block/basic/002.html
fast/block/basic/003.html
fast/block/basic/004.html