2018-08-16 Zalan Bujtas <zalan@apple.com>
+ [LFC] Tree builder should construct block and inline containers based on the display type.
+ https://bugs.webkit.org/show_bug.cgi?id=188632
+
+ Reviewed by Antti Koivisto.
+
+ Inline elements can also construct RenderBlock renderers (inline-bloc etc), so use the display type instead when deciding what type of container to construct.
+
+ * layout/layouttree/LayoutTreeBuilder.cpp:
+ (WebCore::Layout::TreeBuilder::createSubTree):
+
+2018-08-16 Zalan Bujtas <zalan@apple.com>
+
[LFC] Bail out of subtree verification when trees are out of sync.
https://bugs.webkit.org/show_bug.cgi?id=188633
if (is<RenderElement>(child)) {
auto& renderer = downcast<RenderElement>(child);
- if (is<RenderBlock>(renderer))
+ auto display = renderer.style().display();
+ if (display == DisplayType::Block)
box = new BlockContainer(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
- else if (is<RenderInline>(renderer))
+ else if (display == DisplayType::Inline)
box = new InlineContainer(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
+ else {
+ ASSERT_NOT_IMPLEMENTED_YET();
+ continue;
+ }
+
} else if (is<RenderText>(child)) {
box = new InlineBox( { }, RenderStyle::createAnonymousStyleWithDisplay(rootRenderer.style(), DisplayType::Inline));
downcast<InlineBox>(*box).setTextContent(downcast<RenderText>(child).originalText());
- } else
+ } else {
ASSERT_NOT_IMPLEMENTED_YET();
+ continue;
+ }
if (!rootContainer.hasChild()) {
rootContainer.setFirstChild(*box);
lastChild->setNextSibling(*box);
rootContainer.setLastChild(*box);
}
+
box->setParent(rootContainer);
if (box->isOutOfFlowPositioned()) {