Title: [240654] trunk
- Revision
- 240654
- Author
- [email protected]
- Date
- 2019-01-29 06:55:16 -0800 (Tue, 29 Jan 2019)
Log Message
[LFC][BFC] Do not ignore next sibling box while laying out BFC.
https://bugs.webkit.org/show_bug.cgi?id=193954
Reviewed by Antti Koivisto.
Source/WebCore:
When a block box has no child (<img style="display: block">), we should not ignore the next sibling (move the container check to the function to keep layout logic simple)
Also inFlowNonReplacedWidthAndMargin() is called through inFlowReplacedWidthAndMargin() to compute margins.
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layout const):
(WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren const):
* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
Tools:
* LayoutReloaded/misc/LFC-passing-tests.txt:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (240653 => 240654)
--- trunk/Source/WebCore/ChangeLog 2019-01-29 14:53:03 UTC (rev 240653)
+++ trunk/Source/WebCore/ChangeLog 2019-01-29 14:55:16 UTC (rev 240654)
@@ -1,5 +1,22 @@
2019-01-29 Zalan Bujtas <[email protected]>
+ [LFC][BFC] Do not ignore next sibling box while laying out BFC.
+ https://bugs.webkit.org/show_bug.cgi?id=193954
+
+ Reviewed by Antti Koivisto.
+
+ When a block box has no child (<img style="display: block">), we should not ignore the next sibling (move the container check to the function to keep layout logic simple)
+ Also inFlowNonReplacedWidthAndMargin() is called through inFlowReplacedWidthAndMargin() to compute margins.
+
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::layout const):
+ (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren const):
+ * layout/blockformatting/BlockFormattingContext.h:
+ * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
+
+2019-01-29 Zalan Bujtas <[email protected]>
+
[LFC][BFC][MarginCollapsing] Remove quirk from MarginCollapse::marginsCollapseThrough
https://bugs.webkit.org/show_bug.cgi?id=193948
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (240653 => 240654)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-01-29 14:53:03 UTC (rev 240653)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-01-29 14:55:16 UTC (rev 240654)
@@ -105,12 +105,9 @@
// Formatting root boxes are special-cased and they don't come here.
ASSERT(!layoutBox.establishesFormattingContext());
computeHeightAndMargin(layoutBox);
- if (!is<Container>(layoutBox))
- continue;
- auto& container = downcast<Container>(layoutBox);
// Move in-flow positioned children to their final position.
- placeInFlowPositionedChildren(container);
- if (auto* nextSibling = container.nextInFlowOrFloatingSibling()) {
+ placeInFlowPositionedChildren(layoutBox);
+ if (auto* nextSibling = layoutBox.nextInFlowOrFloatingSibling()) {
layoutQueue.append(nextSibling);
break;
}
@@ -147,18 +144,22 @@
formattingContext->layoutOutOfFlowDescendants(layoutBox);
}
-void BlockFormattingContext::placeInFlowPositionedChildren(const Container& container) const
+void BlockFormattingContext::placeInFlowPositionedChildren(const Box& layoutBox) const
{
- LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: move in-flow positioned children -> parent: " << &container);
- for (auto& layoutBox : childrenOfType<Box>(container)) {
- if (!layoutBox.isInFlowPositioned())
+ if (!is<Container>(layoutBox))
+ return;
+
+ LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: move in-flow positioned children -> parent: " << &layoutBox);
+ auto& container = downcast<Container>(layoutBox);
+ for (auto& childBox : childrenOfType<Box>(container)) {
+ if (!childBox.isInFlowPositioned())
continue;
- auto computeInFlowPositionedPosition = [&](auto& layoutBox) {
+ auto computeInFlowPositionedPosition = [&]() {
auto& layoutState = this->layoutState();
- auto positionOffset = Geometry::inFlowPositionedPositionOffset(layoutState, layoutBox);
+ auto positionOffset = Geometry::inFlowPositionedPositionOffset(layoutState, childBox);
- auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
+ auto& displayBox = layoutState.displayBoxForLayoutBox(childBox);
auto topLeft = displayBox.topLeft();
topLeft.move(positionOffset);
@@ -166,9 +167,9 @@
displayBox.setTopLeft(topLeft);
};
- computeInFlowPositionedPosition(layoutBox);
+ computeInFlowPositionedPosition();
}
- LOG_WITH_STREAM(FormattingContextLayout, stream << "End: move in-flow positioned children -> parent: " << &container);
+ LOG_WITH_STREAM(FormattingContextLayout, stream << "End: move in-flow positioned children -> parent: " << &layoutBox);
}
void BlockFormattingContext::computeStaticPosition(const FloatingContext& floatingContext, const Box& layoutBox) const
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (240653 => 240654)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2019-01-29 14:53:03 UTC (rev 240653)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h 2019-01-29 14:55:16 UTC (rev 240654)
@@ -53,7 +53,7 @@
private:
void layoutFormattingContextRoot(FloatingContext&, const Box&) const;
- void placeInFlowPositionedChildren(const Container&) const;
+ void placeInFlowPositionedChildren(const Box&) const;
void computeWidthAndMargin(const Box&) const;
void computeHeightAndMargin(const Box&) const;
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (240653 => 240654)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2019-01-29 14:53:03 UTC (rev 240653)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2019-01-29 14:55:16 UTC (rev 240654)
@@ -109,7 +109,7 @@
WidthAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin(const LayoutState& layoutState, const Box& layoutBox, Optional<LayoutUnit> usedWidth)
{
- ASSERT(layoutBox.isInFlow() && !layoutBox.replaced());
+ ASSERT(layoutBox.isInFlow());
auto compute = [&]() {
Modified: trunk/Tools/ChangeLog (240653 => 240654)
--- trunk/Tools/ChangeLog 2019-01-29 14:53:03 UTC (rev 240653)
+++ trunk/Tools/ChangeLog 2019-01-29 14:55:16 UTC (rev 240654)
@@ -1,3 +1,12 @@
+2019-01-29 Zalan Bujtas <[email protected]>
+
+ [LFC][BFC] Do not ignore next sibling box while laying out BFC.
+ https://bugs.webkit.org/show_bug.cgi?id=193954
+
+ Reviewed by Antti Koivisto.
+
+ * LayoutReloaded/misc/LFC-passing-tests.txt:
+
2019-01-29 Carlos Garcia Campos <[email protected]>
WebDriver: add support for running subtests
Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (240653 => 240654)
--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2019-01-29 14:53:03 UTC (rev 240653)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2019-01-29 14:55:16 UTC (rev 240654)
@@ -148,6 +148,7 @@
fast/block/margin-collapse/043.html
fast/block/margin-collapse/044.html
fast/block/margin-collapse/063.html
+fast/block/margin-collapse/100.html
fast/block/margin-collapse/collapsed-through-child-simple.html
fast/block/positioning/003.html
fast/block/positioning/004.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes