Chromium Code Reviews| Index: Source/core/dom/ContainerNode.cpp |
| diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp |
| index da93bff22de1a2d8571dda61104063e66a1c7c36..f4c7c17bdda0df59e2e36559f968f97b7ba7e456 100644 |
| --- a/Source/core/dom/ContainerNode.cpp |
| +++ b/Source/core/dom/ContainerNode.cpp |
| @@ -72,6 +72,7 @@ static void collectChildrenAndRemoveFromOldParent(Node& node, NodeVector& nodes, |
| toContainerNode(node).removeChildren(); |
| } |
| +#if !ENABLE(OILPAN) |
| void ContainerNode::removeDetachedChildren() |
| { |
| if (connectedSubframeCount()) { |
| @@ -81,6 +82,7 @@ void ContainerNode::removeDetachedChildren() |
| ASSERT(needsAttach()); |
| removeDetachedChildrenInContainer<Node, ContainerNode>(*this); |
| } |
| +#endif |
| void ContainerNode::parserTakeAllChildrenFrom(ContainerNode& oldParent) |
| { |
| @@ -95,8 +97,8 @@ ContainerNode::~ContainerNode() |
| { |
| #if !ENABLE(OILPAN) |
| willBeDeletedFromDocument(); |
| -#endif |
| removeDetachedChildren(); |
| +#endif |
|
haraken
2014/05/06 04:20:16
Shall we add ASSERT(needsAttach()) to oilpan build
Mads Ager (chromium)
2014/05/06 08:26:00
We can probably do that, yes. Done.
|
| } |
| bool ContainerNode::isChildTypeAllowed(const Node& child) const |
| @@ -254,11 +256,11 @@ void ContainerNode::insertBeforeCommon(Node& nextChild, Node& newChild) |
| ASSERT(m_lastChild != prev); |
| nextChild.setPreviousSibling(&newChild); |
| if (prev) { |
| - ASSERT(m_firstChild != nextChild); |
| + ASSERT(firstChild() != nextChild); |
| ASSERT(prev->nextSibling() == nextChild); |
| prev->setNextSibling(&newChild); |
| } else { |
| - ASSERT(m_firstChild == nextChild); |
| + ASSERT(firstChild() == nextChild); |
| m_firstChild = &newChild; |
| } |
| newChild.setParentOrShadowHostNode(this); |
| @@ -409,6 +411,13 @@ void ContainerNode::disconnectDescendantFrames() |
| ChildFrameDisconnector(*this).disconnect(); |
| } |
| +void ContainerNode::trace(Visitor* visitor) |
| +{ |
| + visitor->trace(m_firstChild); |
| + visitor->trace(m_lastChild); |
| + Node::trace(visitor); |
| +} |
| + |
| void ContainerNode::removeChild(Node* oldChild, ExceptionState& exceptionState) |
| { |
| #if !ENABLE(OILPAN) |
| @@ -475,9 +484,9 @@ void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node& ol |
| nextChild->setPreviousSibling(previousChild); |
| if (previousChild) |
| previousChild->setNextSibling(nextChild); |
| - if (m_firstChild == oldChild) |
| + if (m_firstChild == &oldChild) |
| m_firstChild = nextChild; |
| - if (m_lastChild == oldChild) |
| + if (m_lastChild == &oldChild) |
| m_lastChild = previousChild; |
| oldChild.setPreviousSibling(0); |
| @@ -564,16 +573,18 @@ void ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionState& excep |
| { |
| RefPtr<ContainerNode> protect(this); |
| +#if !ENABLE(OILPAN) |
| // Check that this node is not "floating". |
| // If it is, it can be deleted as a side effect of sending mutation events. |
| ASSERT(refCount() || parentOrShadowHostNode()); |
| +#endif |
| // Make sure adding the new child is ok |
| if (!checkAcceptChild(newChild.get(), 0, exceptionState)) |
| return; |
| ASSERT(newChild); |
| - if (newChild == m_lastChild) // nothing to do |
| + if (newChild.get() == m_lastChild) // nothing to do |
|
haraken
2014/05/06 04:20:16
Shall we override == so that we can write this as
Mads Ager (chromium)
2014/05/06 08:26:00
Yes, thanks. Added those too. It is much easier to
|
| return; |
| NodeVector targets; |
| @@ -995,8 +1006,10 @@ static void dispatchChildRemovalEvents(Node& child) |
| void ContainerNode::updateTreeAfterInsertion(Node& child) |
| { |
| +#if !ENABLE(OILPAN) |
| ASSERT(refCount()); |
| ASSERT(child.refCount()); |
| +#endif |
| ChildListMutationScope(*this).childAdded(child); |