Diff
Modified: trunk/Source/WebCore/ChangeLog (228587 => 228588)
--- trunk/Source/WebCore/ChangeLog 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/ChangeLog 2018-02-17 00:05:35 UTC (rev 228588)
@@ -1,3 +1,19 @@
+2018-02-16 Zalan Bujtas <[email protected]>
+
+ [RenderTreeBuilder] Move RenderElement::insertChildInternal() to RenderTreeBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=182885
+ <rdar://problem/37617371>
+
+ Reviewed by Antti Koivisto.
+
+ No change in functionality.
+
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::insertChildInternal): Deleted.
+ * rendering/RenderObject.h:
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::insertChildToRenderElement):
+
2018-02-16 Youenn Fablet <[email protected]>
Allow specifying which plug-ins are supported
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (228587 => 228588)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2018-02-17 00:05:35 UTC (rev 228588)
@@ -2700,7 +2700,7 @@
builder.insertChild(*toBoxModelObject, WTFMove(childToMove), beforeChild);
} else {
auto childToMove = builder.takeChildFromRenderElement(*this, *child);
- toBoxModelObject->insertChildInternal(WTFMove(childToMove), beforeChild);
+ builder.insertChildToRenderElementInternal(*toBoxModelObject, WTFMove(childToMove), beforeChild);
}
}
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (228587 => 228588)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2018-02-17 00:05:35 UTC (rev 228588)
@@ -532,43 +532,6 @@
return RenderPtr<RenderObject>(&renderer);
}
-void RenderElement::insertChildInternal(RenderPtr<RenderObject> newChildPtr, RenderObject* beforeChild)
-{
- RELEASE_ASSERT_WITH_MESSAGE(!view().frameView().layoutContext().layoutState(), "Layout must not mutate render tree");
-
- ASSERT(canHaveChildren() || canHaveGeneratedChildren());
- ASSERT(!newChildPtr->parent());
- ASSERT(!isRenderBlockFlow() || (!newChildPtr->isTableSection() && !newChildPtr->isTableRow() && !newChildPtr->isTableCell()));
-
- while (beforeChild && beforeChild->parent() && beforeChild->parent() != this)
- beforeChild = beforeChild->parent();
-
- ASSERT(!beforeChild || beforeChild->parent() == this);
- ASSERT(!is<RenderText>(beforeChild) || !downcast<RenderText>(*beforeChild).inlineWrapperForDisplayContents());
-
- // Take the ownership.
- auto* newChild = attachRendererInternal(WTFMove(newChildPtr), beforeChild);
-
- newChild->initializeFragmentedFlowStateOnInsertion();
- if (!renderTreeBeingDestroyed()) {
- newChild->insertedIntoTree();
- if (is<RenderElement>(*newChild))
- RenderCounter::rendererSubtreeAttached(downcast<RenderElement>(*newChild));
- }
-
- newChild->setNeedsLayoutAndPrefWidthsRecalc();
- setPreferredLogicalWidthsDirty(true);
- if (!normalChildNeedsLayout())
- setChildNeedsLayout(); // We may supply the static position for an absolute positioned child.
-
- if (AXObjectCache* cache = document().axObjectCache())
- cache->childrenChanged(this, newChild);
- if (is<RenderBlockFlow>(*this))
- downcast<RenderBlockFlow>(*this).invalidateLineLayoutPath();
- if (hasOutlineAutoAncestor() || outlineStyleForRepaint().outlineStyleIsAuto())
- newChild->setHasOutlineAutoAncestor();
-}
-
RenderBlock* RenderElement::containingBlockForFixedPosition() const
{
auto* renderer = parent();
Modified: trunk/Source/WebCore/rendering/RenderElement.h (228587 => 228588)
--- trunk/Source/WebCore/rendering/RenderElement.h 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2018-02-17 00:05:35 UTC (rev 228588)
@@ -98,8 +98,6 @@
void moveLayers(RenderLayer* oldParent, RenderLayer* newParent);
RenderLayer* findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint, bool checkParent = true);
- void insertChildInternal(RenderPtr<RenderObject>, RenderObject* beforeChild);
-
virtual RenderElement* hoverAncestor() const;
virtual void dirtyLinesFromChangedChild(RenderObject&) { }
Modified: trunk/Source/WebCore/rendering/RenderObject.h (228587 => 228588)
--- trunk/Source/WebCore/rendering/RenderObject.h 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2018-02-17 00:05:35 UTC (rev 228588)
@@ -778,6 +778,8 @@
virtual void willBeRemovedFromTree();
void resetFragmentedFlowStateOnRemoval();
+ void initializeFragmentedFlowStateOnInsertion();
+ virtual void insertedIntoTree();
protected:
//////////////////////////////////////////
@@ -793,8 +795,6 @@
virtual void willBeDestroyed(RenderTreeBuilder&);
- virtual void insertedIntoTree();
-
void setNeedsPositionedMovementLayoutBit(bool b) { m_bitfields.setNeedsPositionedMovementLayout(b); }
void setNormalChildNeedsLayoutBit(bool b) { m_bitfields.setNormalChildNeedsLayout(b); }
void setPosChildNeedsLayoutBit(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
@@ -803,7 +803,6 @@
virtual RenderFragmentedFlow* locateEnclosingFragmentedFlow() const;
static void calculateBorderStyleColor(const EBorderStyle&, const BoxSide&, Color&);
- void initializeFragmentedFlowStateOnInsertion();
static FragmentedFlowState computedFragmentedFlowState(const RenderObject&);
private:
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (228587 => 228588)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2018-02-17 00:05:35 UTC (rev 228588)
@@ -336,10 +336,46 @@
return;
}
auto& newChild = *child.get();
- parent.insertChildInternal(WTFMove(child), beforeChild);
+ insertChildToRenderElementInternal(parent, WTFMove(child), beforeChild);
parent.didInsertChild(newChild, beforeChild);
}
+void RenderTreeBuilder::insertChildToRenderElementInternal(RenderElement& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
+{
+ RELEASE_ASSERT_WITH_MESSAGE(!parent.view().frameView().layoutContext().layoutState(), "Layout must not mutate render tree");
+ ASSERT(parent.canHaveChildren() || parent.canHaveGeneratedChildren());
+ ASSERT(!child->parent());
+ ASSERT(!parent.isRenderBlockFlow() || (!child->isTableSection() && !child->isTableRow() && !child->isTableCell()));
+
+ while (beforeChild && beforeChild->parent() && beforeChild->parent() != &parent)
+ beforeChild = beforeChild->parent();
+
+ ASSERT(!beforeChild || beforeChild->parent() == &parent);
+ ASSERT(!is<RenderText>(beforeChild) || !downcast<RenderText>(*beforeChild).inlineWrapperForDisplayContents());
+
+ // Take the ownership.
+ auto* newChild = parent.attachRendererInternal(WTFMove(child), beforeChild);
+
+ newChild->initializeFragmentedFlowStateOnInsertion();
+ if (!parent.renderTreeBeingDestroyed()) {
+ newChild->insertedIntoTree();
+ if (is<RenderElement>(*newChild))
+ RenderCounter::rendererSubtreeAttached(downcast<RenderElement>(*newChild));
+ }
+
+ newChild->setNeedsLayoutAndPrefWidthsRecalc();
+ parent.setPreferredLogicalWidthsDirty(true);
+ if (!parent.normalChildNeedsLayout())
+ parent.setChildNeedsLayout(); // We may supply the static position for an absolute positioned child.
+
+ if (AXObjectCache* cache = parent.document().axObjectCache())
+ cache->childrenChanged(&parent, newChild);
+ if (is<RenderBlockFlow>(parent))
+ downcast<RenderBlockFlow>(parent).invalidateLineLayoutPath();
+ if (parent.hasOutlineAutoAncestor() || parent.outlineStyleForRepaint().outlineStyleIsAuto())
+ newChild->setHasOutlineAutoAncestor();
+}
+
void RenderTreeBuilder::makeChildrenNonInline(RenderBlock& parent, RenderObject* insertionPoint)
{
// makeChildrenNonInline takes a block whose children are *all* inline and it
@@ -372,7 +408,7 @@
auto newBlock = parent.createAnonymousBlock();
auto& block = *newBlock;
- parent.insertChildInternal(WTFMove(newBlock), inlineRunStart);
+ insertChildToRenderElementInternal(parent, WTFMove(newBlock), inlineRunStart);
parent.moveChildrenTo(*this, &block, inlineRunStart, child, RenderBoxModelObject::NormalizeAfterInsertion::No);
}
#ifndef NDEBUG
@@ -401,7 +437,7 @@
// so that the table repainting logic knows the structure is dirty.
// See for example RenderTableCell:clippedOverflowRectForRepaint.
markBoxForRelayoutAfterSplit(*parentBox);
- parentBox->insertChildInternal(WTFMove(newPostBox), boxToSplit.nextSibling());
+ insertChildToRenderElementInternal(*parentBox, WTFMove(newPostBox), boxToSplit.nextSibling());
boxToSplit.moveChildrenTo(*this, &postBox, beforeChild, nullptr, RenderBoxModelObject::NormalizeAfterInsertion::Yes);
markBoxForRelayoutAfterSplit(boxToSplit);
@@ -431,9 +467,9 @@
// An anonymous block must be made to wrap this inline.
auto newBlock = downcast<RenderBlock>(*parent).createAnonymousBlock();
auto& block = *newBlock;
- parent->insertChildInternal(WTFMove(newBlock), &child);
+ insertChildToRenderElementInternal(*parent, WTFMove(newBlock), &child);
auto thisToMove = takeChildFromRenderElement(*parent, child);
- block.insertChildInternal(WTFMove(thisToMove), nullptr);
+ insertChildToRenderElementInternal(block, WTFMove(thisToMove));
}
}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h (228587 => 228588)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h 2018-02-17 00:05:35 UTC (rev 228588)
@@ -65,6 +65,7 @@
// These functions are temporary until after all block/inline/continuation code is moved over.
RenderPtr<RenderObject> takeChildFromRenderElement(RenderElement& parent, RenderObject& child) WARN_UNUSED_RETURN;
+ void insertChildToRenderElementInternal(RenderElement& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild = nullptr);
void childFlowStateChangesAndAffectsParentBlock(RenderElement& child);
void childFlowStateChangesAndNoLongerAffectsParentBlock(RenderElement& child);
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp (228587 => 228588)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp 2018-02-17 00:05:35 UTC (rev 228588)
@@ -297,7 +297,7 @@
// Now just put the inlineChildrenBlock inside the blockChildrenBlock.
RenderObject* beforeChild = prev == &inlineChildrenBlock ? blockChildrenBlock.firstChild() : nullptr;
- blockChildrenBlock.insertChildInternal(WTFMove(blockToMove), beforeChild);
+ m_builder.insertChildToRenderElementInternal(blockChildrenBlock, WTFMove(blockToMove), beforeChild);
next->setNeedsLayoutAndPrefWidthsRecalc();
// inlineChildrenBlock got reparented to blockChildrenBlock, so it is no longer a child
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp (228587 => 228588)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp 2018-02-17 00:05:35 UTC (rev 228588)
@@ -225,9 +225,9 @@
RenderObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nextSibling();
if (createdPre)
- block->insertChildInternal(WTFMove(createdPre), boxFirst);
- block->insertChildInternal(WTFMove(newBlockBox), boxFirst);
- block->insertChildInternal(WTFMove(createdPost), boxFirst);
+ m_builder.insertChildToRenderElementInternal(*block, WTFMove(createdPre), boxFirst);
+ m_builder.insertChildToRenderElementInternal(*block, WTFMove(newBlockBox), boxFirst);
+ m_builder.insertChildToRenderElementInternal(*block, WTFMove(createdPost), boxFirst);
block->setChildrenInline(false);
if (madeNewBeforeBlock) {
@@ -236,7 +236,7 @@
RenderObject* no = o;
o = no->nextSibling();
auto childToMove = m_builder.takeChildFromRenderElement(*block, *no);
- pre->insertChildInternal(WTFMove(childToMove), nullptr);
+ m_builder.insertChildToRenderElementInternal(*pre, WTFMove(childToMove));
no->setNeedsLayoutAndPrefWidthsRecalc();
}
}
@@ -361,7 +361,7 @@
cloneBlockChild.resetEnclosingFragmentedFlowAndChildInfoIncludingDescendants();
// Now we are at the block level. We need to put the clone into the toBlock.
- toBlock->insertChildInternal(WTFMove(cloneInline), nullptr);
+ m_builder.insertChildToRenderElementInternal(*toBlock, WTFMove(cloneInline));
// Now take all the children after currentChild and remove them from the fromBlock
// and put them in the toBlock.
@@ -368,7 +368,7 @@
for (auto* current = currentChild->nextSibling(); current;) {
auto* next = current->nextSibling();
auto childToMove = m_builder.takeChildFromRenderElement(*fromBlock, *current);
- toBlock->insertChildInternal(WTFMove(childToMove), nullptr);
+ m_builder.insertChildToRenderElementInternal(*toBlock, WTFMove(childToMove));
current = next;
}
}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp (228587 => 228588)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp 2018-02-16 23:31:31 UTC (rev 228587)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp 2018-02-17 00:05:35 UTC (rev 228588)
@@ -139,7 +139,7 @@
else {
auto newToBlock = to.createAnonymousBlock();
toBlock = newToBlock.get();
- to.insertChildInternal(WTFMove(newToBlock), nullptr);
+ m_builder.insertChildToRenderElementInternal(to, WTFMove(newToBlock));
}
}
// Move our inline children into the target block we determined above.