[LFC] Tree builder should construct block and inline containers based on the display...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2018 14:32:46 +0000 (14:32 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Aug 2018 14:32:46 +0000 (14:32 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234923 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

index defcaf2..82ae3b0 100644 (file)
@@ -1,5 +1,17 @@
 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
 
index 1e31fe8..a6c8738 100644 (file)
@@ -86,15 +86,23 @@ void TreeBuilder::createSubTree(const RenderElement& rootRenderer, Container& ro
 
         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);
@@ -105,6 +113,7 @@ void TreeBuilder::createSubTree(const RenderElement& rootRenderer, Container& ro
             lastChild->setNextSibling(*box);
             rootContainer.setLastChild(*box);
         }
+
         box->setParent(rootContainer);
 
         if (box->isOutOfFlowPositioned()) {