Title: [226834] branches/safari-605-branch/Source/WebCore

Diff

Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (226833 => 226834)


--- branches/safari-605-branch/Source/WebCore/ChangeLog	2018-01-12 01:50:46 UTC (rev 226833)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog	2018-01-12 01:50:49 UTC (rev 226834)
@@ -1,5 +1,9 @@
 2018-01-11  Jason Marcell  <[email protected]>
 
+        Revert r226181. rdar://problem/36148601
+
+2018-01-11  Jason Marcell  <[email protected]>
+
         Revert r226196. rdar://problem/36157613
 
 2018-01-11  Jason Marcell  <[email protected]>

Modified: branches/safari-605-branch/Source/WebCore/rendering/RenderBlock.cpp (226833 => 226834)


--- branches/safari-605-branch/Source/WebCore/rendering/RenderBlock.cpp	2018-01-12 01:50:46 UTC (rev 226833)
+++ branches/safari-605-branch/Source/WebCore/rendering/RenderBlock.cpp	2018-01-12 01:50:49 UTC (rev 226834)
@@ -572,7 +572,7 @@
 
             if (newChild->isTablePart()) {
                 // Insert into the anonymous table.
-                builder.insertChild(*beforeChildAnonymousContainer, WTFMove(newChild), beforeChild);
+                beforeChildAnonymousContainer->addChild(builder, WTFMove(newChild), beforeChild);
                 return;
             }
 

Modified: branches/safari-605-branch/Source/WebCore/rendering/RenderTable.cpp (226833 => 226834)


--- branches/safari-605-branch/Source/WebCore/rendering/RenderTable.cpp	2018-01-12 01:50:46 UTC (rev 226833)
+++ branches/safari-605-branch/Source/WebCore/rendering/RenderTable.cpp	2018-01-12 01:50:49 UTC (rev 226834)
@@ -135,8 +135,13 @@
 
 void RenderTable::addChild(RenderTreeBuilder& builder, RenderPtr<RenderObject> child, RenderObject* beforeChild)
 {
-    if (is<RenderTableCol>(*child)) {
+    bool wrapInAnonymousSection = !child->isOutOfFlowPositioned();
+
+    if (is<RenderTableCaption>(*child))
+        wrapInAnonymousSection = false;
+    else if (is<RenderTableCol>(*child)) {
         m_hasColElements = true;
+        wrapInAnonymousSection = false;
     } else if (is<RenderTableSection>(*child)) {
         switch (child->style().display()) {
             case TABLE_HEADER_GROUP:
@@ -148,11 +153,13 @@
                     if (!m_firstBody) 
                         m_firstBody = makeWeakPtr(downcast<RenderTableSection>(child.get()));
                 }
+                wrapInAnonymousSection = false;
                 break;
             case TABLE_FOOTER_GROUP:
                 resetSectionPointerIfNotBefore(m_foot, beforeChild);
                 if (!m_foot) {
                     m_foot = makeWeakPtr(downcast<RenderTableSection>(child.get()));
+                    wrapInAnonymousSection = false;
                     break;
                 }
                 FALLTHROUGH;
@@ -160,19 +167,58 @@
                 resetSectionPointerIfNotBefore(m_firstBody, beforeChild);
                 if (!m_firstBody)
                     m_firstBody = makeWeakPtr(downcast<RenderTableSection>(child.get()));
+                wrapInAnonymousSection = false;
                 break;
             default:
                 ASSERT_NOT_REACHED();
         }
-    }
+    } else if (is<RenderTableCell>(*child) || is<RenderTableRow>(*child))
+        wrapInAnonymousSection = true;
+    else
+        wrapInAnonymousSection = true;
 
     if (is<RenderTableSection>(*child))
         setNeedsSectionRecalc();
 
-    if (beforeChild && beforeChild->parent() != this)
-        beforeChild = splitAnonymousBoxesAroundChild(beforeChild);
+    if (!wrapInAnonymousSection) {
+        if (beforeChild && beforeChild->parent() != this)
+            beforeChild = splitAnonymousBoxesAroundChild(beforeChild);
 
-    RenderBox::addChild(builder, WTFMove(child), beforeChild);
+        RenderBox::addChild(builder, WTFMove(child), beforeChild);
+        return;
+    }
+
+    if (!beforeChild && is<RenderTableSection>(lastChild()) && lastChild()->isAnonymous() && !lastChild()->isBeforeContent()) {
+        builder.insertChild(downcast<RenderTableSection>(*lastChild()), WTFMove(child));
+        return;
+    }
+
+    if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == this) {
+        RenderObject* section = beforeChild->previousSibling();
+        if (is<RenderTableSection>(section) && section->isAnonymous()) {
+            builder.insertChild(downcast<RenderTableSection>(*section), WTFMove(child));
+            return;
+        }
+    }
+
+    RenderObject* lastBox = beforeChild;
+    while (lastBox && lastBox->parent()->isAnonymous() && !is<RenderTableSection>(*lastBox) && lastBox->style().display() != TABLE_CAPTION && lastBox->style().display() != TABLE_COLUMN_GROUP)
+        lastBox = lastBox->parent();
+    if (lastBox && lastBox->isAnonymous() && !isAfterContent(lastBox) && lastBox->isTableSection()) {
+        RenderTableSection& section = downcast<RenderTableSection>(*lastBox);
+        if (beforeChild == &section)
+            beforeChild = section.firstRow();
+        builder.insertChild(section, WTFMove(child), beforeChild);
+        return;
+    }
+
+    if (beforeChild && !is<RenderTableSection>(*beforeChild) && beforeChild->style().display() != TABLE_CAPTION && beforeChild->style().display() != TABLE_COLUMN_GROUP)
+        beforeChild = nullptr;
+
+    auto newSection = RenderTableSection::createAnonymousWithParentRenderer(*this);
+    auto& section = *newSection;
+    builder.insertChild(*this, WTFMove(newSection), beforeChild);
+    builder.insertChild(section, WTFMove(child));
 }
 
 void RenderTable::addCaption(RenderTableCaption& caption)

Modified: branches/safari-605-branch/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (226833 => 226834)


--- branches/safari-605-branch/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-01-12 01:50:46 UTC (rev 226833)
+++ branches/safari-605-branch/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-01-12 01:50:49 UTC (rev 226834)
@@ -68,12 +68,7 @@
     }
 
     if (is<RenderTableRow>(parent)) {
-        auto& parentCandidate = tableBuilder().findOrCreateParentForChild(downcast<RenderTableRow>(parent), *child, beforeChild);
-        if (&parent != &parentCandidate) {
-            insertChild(parentCandidate, WTFMove(child), beforeChild);
-            return;
-        }
-        parent.addChild(*this, WTFMove(child), beforeChild);
+        tableBuilder().findOrCreateParentForChild(downcast<RenderTableRow>(parent), *child, beforeChild).addChild(*this, WTFMove(child), beforeChild);
         return;
     }
 
@@ -87,16 +82,6 @@
         return;
     }
 
-    if (is<RenderTable>(parent)) {
-        auto& parentCandidate = tableBuilder().findOrCreateParentForChild(downcast<RenderTable>(parent), *child, beforeChild);
-        if (&parent != &parentCandidate) {
-            insertChild(parentCandidate, WTFMove(child), beforeChild);
-            return;
-        }
-        parent.addChild(*this, WTFMove(child), beforeChild);
-        return;
-    }
-
     if (is<RenderRubyRun>(parent)) {
         rubyRunInsertChild(downcast<RenderRubyRun>(parent), WTFMove(child), beforeChild);
         return;

Modified: branches/safari-605-branch/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp (226833 => 226834)


--- branches/safari-605-branch/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp	2018-01-12 01:50:46 UTC (rev 226833)
+++ branches/safari-605-branch/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp	2018-01-12 01:50:49 UTC (rev 226834)
@@ -26,9 +26,7 @@
 #include "config.h"
 #include "RenderTreeBuilderTable.h"
 
-#include "RenderTableCaption.h"
 #include "RenderTableCell.h"
-#include "RenderTableCol.h"
 #include "RenderTableRow.h"
 #include "RenderTreeBuilder.h"
 
@@ -119,46 +117,4 @@
     return row;
 }
 
-RenderElement& RenderTreeBuilder::Table::findOrCreateParentForChild(RenderTable& parent, const RenderObject& child, RenderObject*& beforeChild)
-{
-    if (is<RenderTableCaption>(child) || is<RenderTableCol>(child) || is<RenderTableSection>(child))
-        return parent;
-
-    auto* lastChild = parent.lastChild();
-    if (!beforeChild && is<RenderTableSection>(lastChild) && lastChild->isAnonymous() && !lastChild->isBeforeContent())
-        return downcast<RenderElement>(*lastChild);
-
-    if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == &parent) {
-        auto* section = beforeChild->previousSibling();
-        if (is<RenderTableSection>(section) && section->isAnonymous()) {
-            beforeChild = nullptr;
-            return downcast<RenderElement>(*section);
-        }
-    }
-
-    auto* parentCandidate = beforeChild;
-    while (parentCandidate && parentCandidate->parent()->isAnonymous()
-        && !is<RenderTableSection>(*parentCandidate)
-        && parentCandidate->style().display() != TABLE_CAPTION
-        && parentCandidate->style().display() != TABLE_COLUMN_GROUP)
-        parentCandidate = parentCandidate->parent();
-
-    if (parentCandidate && is<RenderTableSection>(*parentCandidate) && parentCandidate->isAnonymous() && !parent.isAfterContent(parentCandidate)) {
-        if (beforeChild == parentCandidate)
-            beforeChild = downcast<RenderTableSection>(*parentCandidate).firstRow();
-        return downcast<RenderElement>(*parentCandidate);
-    }
-
-    if (beforeChild && !is<RenderTableSection>(*beforeChild)
-        && beforeChild->style().display() != TABLE_CAPTION
-        && beforeChild->style().display() != TABLE_COLUMN_GROUP)
-        beforeChild = nullptr;
-
-    auto newSection = RenderTableSection::createAnonymousWithParentRenderer(parent);
-    auto& section = *newSection;
-    m_builder.insertChild(parent, WTFMove(newSection), beforeChild);
-    beforeChild = nullptr;
-    return section;
 }
-
-}

Modified: branches/safari-605-branch/Source/WebCore/rendering/updating/RenderTreeBuilderTable.h (226833 => 226834)


--- branches/safari-605-branch/Source/WebCore/rendering/updating/RenderTreeBuilderTable.h	2018-01-12 01:50:46 UTC (rev 226833)
+++ branches/safari-605-branch/Source/WebCore/rendering/updating/RenderTreeBuilderTable.h	2018-01-12 01:50:49 UTC (rev 226834)
@@ -40,7 +40,6 @@
 
     RenderElement& findOrCreateParentForChild(RenderTableRow& parent, const RenderObject& child, RenderObject*& beforeChild);
     RenderElement& findOrCreateParentForChild(RenderTableSection& parent, const RenderObject& child, RenderObject*& beforeChild);
-    RenderElement& findOrCreateParentForChild(RenderTable& parent, const RenderObject& child, RenderObject*& beforeChild);
 
 private:
     RenderTreeBuilder& m_builder;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to