[LFC][TFC] Add section renderers to the layout tree (THEAD/TBODY/TFOOT)
https://bugs.webkit.org/show_bug.cgi?id=201114
<rdar://problem/54664992>

Reviewed by Antti Koivisto.

Section renderers (THEAD/TBODY/TFOOT) are direct children of the RenderTable. Let's include them in the layout tree as well.

* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createTableStructure):
(WebCore::Layout::outputInlineRuns):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@249086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index aca7582..bb1693b 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,5 +1,19 @@
 2019-08-24  Zalan Bujtas  <zalan@apple.com>
 
+        [LFC][TFC] Add section renderers to the layout tree (THEAD/TBODY/TFOOT)
+        https://bugs.webkit.org/show_bug.cgi?id=201114
+        <rdar://problem/54664992>
+
+        Reviewed by Antti Koivisto.
+
+        Section renderers (THEAD/TBODY/TFOOT) are direct children of the RenderTable. Let's include them in the layout tree as well.
+
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::TreeBuilder::createTableStructure):
+        (WebCore::Layout::outputInlineRuns):
+
+2019-08-24  Zalan Bujtas  <zalan@apple.com>
+
         [LFC] Box::isAnonymous() can not rely on the lack of ElementType.
         https://bugs.webkit.org/show_bug.cgi?id=201106
         <rdar://problem/54660287>
diff --git a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
index 346dfbd..7567605 100644
--- a/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
+++ b/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp
@@ -215,9 +215,14 @@
 
     auto tableBox = makeUnique<Container>(Box::ElementAttributes { Box::ElementType::TableBox }, RenderStyle::clone(tableRenderer.style()));
     appendChild(tableWrapperBox, *tableBox);
-    while (tableChild) {
-        TreeBuilder::createSubTree(downcast<RenderElement>(*tableChild), *tableBox);
-        tableChild = tableChild->nextSibling();
+    auto* sectionRenderer = tableChild;
+    while (sectionRenderer) {
+        auto sectionBox = createLayoutBox(tableRenderer, *sectionRenderer);
+        appendChild(*tableBox, *sectionBox);
+        auto& sectionContainer = downcast<Container>(*sectionBox);
+        TreeBuilder::createSubTree(downcast<RenderElement>(*sectionRenderer), sectionContainer);
+        sectionBox.release();
+        sectionRenderer = sectionRenderer->nextSibling();
     }
     // Temporary
     tableBox.release();
@@ -259,7 +264,7 @@
             stream << " ";
         if (inlineRun->textContext())
             stream << "inline text box";
-        else  
+        else
             stream << "inline box";
         stream << " at (" << inlineRun->logicalLeft() << "," << inlineRun->logicalTop() << ") size " << inlineRun->logicalWidth() << "x" << inlineRun->logicalHeight();
         if (inlineRun->textContext())