Title: [233125] trunk/Source/WebCore
- Revision
- 233125
- Author
- [email protected]
- Date
- 2018-06-23 07:38:32 -0700 (Sat, 23 Jun 2018)
Log Message
[LFC] Miscellaneous fixes to fix simple absolute positioning.
https://bugs.webkit.org/show_bug.cgi?id=186962
Reviewed by Antti Koivisto.
1. Collect out-of-flow formatting root descendants.
2. Remove invalid and redundant ASSERTs
invalid because the assertion is missing border, padding etc.
redundant becasue we assert on geometry correctness in validateGeometryConstraintsAfterLayout.
* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
(WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
(WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
* layout/layouttree/LayoutContainer.cpp:
(WebCore::Layout::Container::addOutOfFlowDescendant):
(WebCore::Layout::Container::setOutOfFlowDescendants): Deleted.
* layout/layouttree/LayoutContainer.h:
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createSubTree):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (233124 => 233125)
--- trunk/Source/WebCore/ChangeLog 2018-06-23 10:47:58 UTC (rev 233124)
+++ trunk/Source/WebCore/ChangeLog 2018-06-23 14:38:32 UTC (rev 233125)
@@ -1,3 +1,26 @@
+2018-06-23 Zalan Bujtas <[email protected]>
+
+ [LFC] Miscellaneous fixes to fix simple absolute positioning.
+ https://bugs.webkit.org/show_bug.cgi?id=186962
+
+ Reviewed by Antti Koivisto.
+
+ 1. Collect out-of-flow formatting root descendants.
+ 2. Remove invalid and redundant ASSERTs
+ invalid because the assertion is missing border, padding etc.
+ redundant becasue we assert on geometry correctness in validateGeometryConstraintsAfterLayout.
+
+ * layout/FormattingContext.cpp:
+ (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
+ (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
+ (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
+ * layout/layouttree/LayoutContainer.cpp:
+ (WebCore::Layout::Container::addOutOfFlowDescendant):
+ (WebCore::Layout::Container::setOutOfFlowDescendants): Deleted.
+ * layout/layouttree/LayoutContainer.h:
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::TreeBuilder::createSubTree):
+
2018-06-23 Yusuke Suzuki <[email protected]>
[WTF] Add user-defined literal for ASCIILiteral
Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (233124 => 233125)
--- trunk/Source/WebCore/layout/FormattingContext.cpp 2018-06-23 10:47:58 UTC (rev 233124)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp 2018-06-23 14:38:32 UTC (rev 233125)
@@ -72,7 +72,6 @@
auto horizontalGeometry = Geometry::outOfFlowHorizontalGeometry(layoutContext, layoutBox);
displayBox.setLeft(horizontalGeometry.left);
displayBox.setContentBoxWidth(horizontalGeometry.widthAndMargin.width);
- ASSERT(horizontalGeometry.left + horizontalGeometry.widthAndMargin.width == horizontalGeometry.right);
displayBox.setHorizontalMargin(horizontalGeometry.widthAndMargin.margin);
}
@@ -81,7 +80,6 @@
auto verticalGeometry = Geometry::outOfFlowVerticalGeometry(layoutContext, layoutBox);
displayBox.setTop(verticalGeometry.top);
displayBox.setContentBoxHeight(verticalGeometry.heightAndMargin.height);
- ASSERT(verticalGeometry.top + verticalGeometry.heightAndMargin.height == verticalGeometry.bottom);
displayBox.setVerticalMargin(verticalGeometry.heightAndMargin.margin);
}
@@ -123,6 +121,7 @@
// of a hypothetical box that would have been the first box of the element if its specified 'position' value had been 'static' and
// its specified 'float' had been 'none' and its specified 'clear' had been 'none'.
computeStaticPosition(layoutContext, layoutBox, displayBox);
+ computeBorderAndPadding(layoutContext, layoutBox, displayBox);
computeOutOfFlowHorizontalGeometry(layoutContext, layoutBox, displayBox);
ASSERT(layoutBox.establishesFormattingContext());
Modified: trunk/Source/WebCore/layout/layouttree/LayoutContainer.cpp (233124 => 233125)
--- trunk/Source/WebCore/layout/layouttree/LayoutContainer.cpp 2018-06-23 10:47:58 UTC (rev 233124)
+++ trunk/Source/WebCore/layout/layouttree/LayoutContainer.cpp 2018-06-23 14:38:32 UTC (rev 233125)
@@ -91,9 +91,12 @@
m_lastChild = &childBox;
}
-void Container::setOutOfFlowDescendants(Vector<WeakPtr<Box>>&& descendantList)
+void Container::addOutOfFlowDescendant(const Box& outOfFlowBox)
{
- m_outOfFlowDescendants = WTFMove(descendantList);
+ // Since we layout the out-of-flow boxes at the end of the formatting context layout,
+ // it's okay to store them at the formatting context root level -as opposed to the containing block level.
+ ASSERT(establishesFormattingContext());
+ m_outOfFlowDescendants.append(makeWeakPtr(const_cast<Box&>(outOfFlowBox)));
}
}
Modified: trunk/Source/WebCore/layout/layouttree/LayoutContainer.h (233124 => 233125)
--- trunk/Source/WebCore/layout/layouttree/LayoutContainer.h 2018-06-23 10:47:58 UTC (rev 233124)
+++ trunk/Source/WebCore/layout/layouttree/LayoutContainer.h 2018-06-23 14:38:32 UTC (rev 233125)
@@ -61,7 +61,7 @@
private:
void setFirstChild(Box&);
void setLastChild(Box&);
- void setOutOfFlowDescendants(Vector<WeakPtr<Box>>&&);
+ void addOutOfFlowDescendant(const Box&);
Box* m_firstChild { nullptr };
Box* m_lastChild { nullptr };
Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (233124 => 233125)
--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2018-06-23 10:47:58 UTC (rev 233124)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp 2018-06-23 14:38:32 UTC (rev 233125)
@@ -85,13 +85,11 @@
for (auto& child : childrenOfType<RenderElement>(rootRenderer)) {
Box* box = nullptr;
- if (is<RenderBlock>(child)) {
+ if (is<RenderBlock>(child))
box = new BlockContainer(elementAttributes(child), RenderStyle::clone(child.style()));
- createSubTree(child, downcast<Container>(*box));
- } else if (is<RenderInline>(child)) {
+ else if (is<RenderInline>(child))
box = new InlineContainer(elementAttributes(child), RenderStyle::clone(child.style()));
- createSubTree(child, downcast<Container>(*box));
- } else
+ else
ASSERT_NOT_IMPLEMENTED_YET();
if (!rootContainer.hasChild()) {
@@ -104,6 +102,13 @@
rootContainer.setLastChild(*box);
}
box->setParent(rootContainer);
+
+ if (box->isOutOfFlowPositioned()) {
+ // Not efficient, but this is temporary anyway.
+ // Collect the out-of-flow descendants at the formatting root lever (as opposed to at the containing block level, though they might be the same).
+ const_cast<Container&>(box->formattingContextRoot()).addOutOfFlowDescendant(*box);
+ }
+ createSubTree(child, downcast<Container>(*box));
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes