void ExpressionNode::init(Operation* operation, ExpressionNode* firstChild) { type = OPERATION; this->operation = operation; activechildren = operation->getArity(); setFirstChild(firstChild); }
void ExpressionNode::replace(const ExpressionNode &newNode) { std::clog << "...<replacing> " << *this << " with " << newNode << std::endl; //ExpressionNode *curOld; //ExpressionNode *curNew; setType(newNode.getType()); setOperation(newNode.getOperation()); // setRight(newNode.getRight()); setFirstChild(newNode.getFirstChild()); // automatically also sets other children //curOld = firstChild; //curNew = newNode.getFirstChild(); //while (curNew != 0) //{ //curOld->setRight(curNew->getRight()); //curOld = curOld->getRight(); //curNew = curNew->getRight(); //} setVariable(newNode.getVariable()); setValue(newNode.getValue()); std::clog << "...</replacing>" << std::endl; }
Void testlist::Parent::reset() const { setExists(true); setFirstChild(Child()); setLastChild(Child()); setNextParentFreeParent(Parent()); setNumChilds(0); }
void RenderObjectChildList::insertChildNode(RenderObject* owner, RenderObject* child, RenderObject* beforeChild, bool fullInsert) { if (!beforeChild) { appendChildNode(owner, child, fullInsert); return; } ASSERT(!child->parent()); while (beforeChild->parent() != owner && beforeChild->parent()->isAnonymousBlock()) beforeChild = beforeChild->parent(); ASSERT(beforeChild->parent() == owner); ASSERT(!owner->isBlockFlow() || (!child->isTableSection() && !child->isTableRow() && !child->isTableCell())); if (beforeChild == firstChild()) setFirstChild(child); RenderObject* prev = beforeChild->previousSibling(); child->setNextSibling(beforeChild); beforeChild->setPreviousSibling(child); if (prev) prev->setNextSibling(child); child->setPreviousSibling(prev); child->setParent(owner); if (fullInsert) { // Keep our layer hierarchy updated. Optimize for the common case where we don't have any children // and don't have a layer attached to ourselves. RenderLayer* layer = 0; if (child->firstChild() || child->hasLayer()) { layer = owner->enclosingLayer(); child->addLayers(layer, child); } // if the new child is visible but this object was not, tell the layer it has some visible content // that needs to be drawn and layer visibility optimization can't be used if (owner->style()->visibility() != VISIBLE && child->style()->visibility() == VISIBLE && !child->hasLayer()) { if (!layer) layer = owner->enclosingLayer(); if (layer) layer->setHasVisibleContent(true); } if (child->isListItem()) toRenderListItem(child)->updateListMarkerNumbers(); if (!child->isFloating() && owner->childrenInline()) owner->dirtyLinesFromChangedChild(child); } RenderCounter::rendererSubtreeAttached(child); RenderQuote::rendererSubtreeAttached(child); child->setNeedsLayoutAndPrefWidthsRecalc(); if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child. if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); }
void RenderObjectChildList::appendChildNode(RenderObject* owner, RenderObject* newChild, bool notifyRenderer) { ASSERT(newChild->parent() == 0); ASSERT(!owner->isBlockFlow() || (!newChild->isTableSection() && !newChild->isTableRow() && !newChild->isTableCell())); newChild->setParent(owner); RenderObject* lChild = lastChild(); if (lChild) { newChild->setPreviousSibling(lChild); lChild->setNextSibling(newChild); } else setFirstChild(newChild); setLastChild(newChild); if (!owner->documentBeingDestroyed() && notifyRenderer) newChild->insertedIntoTree(); if (!owner->documentBeingDestroyed()) { RenderCounter::rendererSubtreeAttached(newChild); } newChild->setNeedsLayoutAndPrefWidthsRecalc(); // Goes up the containing block hierarchy. if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child. if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); }
ExpressionNode::ExpressionNode(const ExpressionNode & other): //copy constructor type(other.getType()), operation(other.getOperation()), activechildren(other.getOperation()->getArity()), right(0), firstChild(0), variable(other.getVariable()), value(other.getValue()) { setRight(other.getRight()); setFirstChild(other.getFirstChild()); // automatically also sets other children }
RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, RenderObject* oldChild, bool notifyRenderer) { ASSERT(oldChild->parent() == owner); if (oldChild->isFloatingOrOutOfFlowPositioned()) toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); // So that we'll get the appropriate dirty bit set (either that a normal flow child got yanked or // that a positioned child got yanked). if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadLayout()) { oldChild->setNeedsLayoutAndPrefWidthsRecalc(); // We only repaint |oldChild| if we have a RenderLayer as its visual overflow may not be tracked by its parent. if (oldChild->hasLayer()) oldChild->repaint(); } // If we have a line box wrapper, delete it. if (oldChild->isBox()) toRenderBox(oldChild)->deleteLineBoxWrapper(); // If oldChild is the start or end of the selection, then clear the selection to // avoid problems of invalid pointers. // FIXME: The FrameSelection should be responsible for this when it // is notified of DOM mutations. if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) owner->view()->clearSelection(); if (!owner->documentBeingDestroyed() && notifyRenderer) oldChild->willBeRemovedFromTree(); // WARNING: There should be no code running between willBeRemovedFromTree and the actual removal below. // This is needed to avoid race conditions where willBeRemovedFromTree would dirty the tree's structure // and the code running here would force an untimely rebuilding, leaving |oldChild| dangling. if (oldChild->previousSibling()) oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); if (oldChild->nextSibling()) oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()); if (firstChild() == oldChild) setFirstChild(oldChild->nextSibling()); if (lastChild() == oldChild) setLastChild(oldChild->previousSibling()); oldChild->setPreviousSibling(0); oldChild->setNextSibling(0); oldChild->setParent(0); // rendererRemovedFromTree walks the whole subtree. We can improve performance // by skipping this step when destroying the entire tree. if (!owner->documentBeingDestroyed()) { RenderCounter::rendererRemovedFromTree(oldChild); } if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); return oldChild; }
RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, RenderObject* oldChild, bool notifyRenderer) { ASSERT(oldChild->parent() == owner); if (oldChild->isFloatingOrOutOfFlowPositioned()) toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); // So that we'll get the appropriate dirty bit set (either that a normal flow child got yanked or // that a positioned child got yanked). We also repaint, so that the area exposed when the child // disappears gets repainted properly. if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadLayout()) { oldChild->setNeedsLayoutAndPrefWidthsRecalc(); if (oldChild->isBody()) owner->view()->repaint(); else oldChild->repaint(); } // If we have a line box wrapper, delete it. if (oldChild->isBox()) toRenderBox(oldChild)->deleteLineBoxWrapper(); if (!owner->documentBeingDestroyed() && notifyRenderer) oldChild->willBeRemovedFromTree(); // If oldChild is the start or end of the selection, then clear the selection to // avoid problems of invalid pointers. // FIXME: The FrameSelection should be responsible for this when it // is notified of DOM mutations. if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) owner->view()->clearSelection(); // remove the child if (oldChild->previousSibling()) oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); if (oldChild->nextSibling()) oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()); if (firstChild() == oldChild) setFirstChild(oldChild->nextSibling()); if (lastChild() == oldChild) setLastChild(oldChild->previousSibling()); oldChild->setPreviousSibling(0); oldChild->setNextSibling(0); oldChild->setParent(0); // rendererRemovedFromTree walks the whole subtree. We can improve performance // by skipping this step when destroying the entire tree. if (!owner->documentBeingDestroyed()) { RenderCounter::rendererRemovedFromTree(oldChild); } if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); return oldChild; }
void RenderObjectChildList::appendChildNode(RenderObject* owner, RenderObject* newChild, bool fullAppend) { ASSERT(newChild->parent() == 0); ASSERT(!owner->isBlockFlow() || (!newChild->isTableSection() && !newChild->isTableRow() && !newChild->isTableCell())); newChild->setParent(owner); RenderObject* lChild = lastChild(); if (lChild) { newChild->setPreviousSibling(lChild); lChild->setNextSibling(newChild); } else setFirstChild(newChild); setLastChild(newChild); if (fullAppend) { // Keep our layer hierarchy updated. Optimize for the common case where we don't have any children // and don't have a layer attached to ourselves. RenderLayer* layer = 0; if (newChild->firstChild() || newChild->hasLayer()) { layer = owner->enclosingLayer(); newChild->addLayers(layer); } // if the new child is visible but this object was not, tell the layer it has some visible content // that needs to be drawn and layer visibility optimization can't be used if (owner->style()->visibility() != VISIBLE && newChild->style()->visibility() == VISIBLE && !newChild->hasLayer()) { if (!layer) layer = owner->enclosingLayer(); if (layer) layer->setHasVisibleContent(true); } if (newChild->isListItem()) toRenderListItem(newChild)->updateListMarkerNumbers(); if (!newChild->isFloating() && owner->childrenInline()) owner->dirtyLinesFromChangedChild(newChild); if (newChild->isRenderRegion()) toRenderRegion(newChild)->attachRegion(); if (RenderNamedFlowThread* containerFlowThread = renderNamedFlowThreadContainer(owner)) containerFlowThread->addFlowChild(newChild); } RenderCounter::rendererSubtreeAttached(newChild); RenderQuote::rendererSubtreeAttached(newChild); newChild->setNeedsLayoutAndPrefWidthsRecalc(); // Goes up the containing block hierarchy. if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child. if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); }
void Shape::addChild(Shape *child) { WH_ASSERT(child->nextSibling() == nullptr); WH_ASSERT(child->firstChild() == nullptr); WH_ASSERT(child->parent() == this); WH_ASSERT(!child->name()->isNull()); child->setNextSibling(firstChild()); setFirstChild(child); }
RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, RenderObject* oldChild, bool notifyRenderer) { ASSERT(oldChild->parent() == owner); if (oldChild->isFloatingOrOutOfFlowPositioned()) toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); { // FIXME: We should not be allowing paint invalidation during layout. crbug.com/336250 AllowPaintInvalidationScope scoper(owner->frameView()); // So that we'll get the appropriate dirty bit set (either that a normal flow child got yanked or // that a positioned child got yanked). We also issue paint invalidations, so that the area exposed when the child // disappears gets paint invalidated properly. if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadLayout()) { oldChild->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); oldChild->invalidatePaintForWholeRenderer(); } } // If we have a line box wrapper, delete it. if (oldChild->isBox()) toRenderBox(oldChild)->deleteLineBoxWrapper(); // If oldChild is the start or end of the selection, then clear the selection to // avoid problems of invalid pointers. // FIXME: The FrameSelection should be responsible for this when it // is notified of DOM mutations. if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) owner->view()->clearSelection(); if (!owner->documentBeingDestroyed() && notifyRenderer) oldChild->willBeRemovedFromTree(); // WARNING: There should be no code running between willBeRemovedFromTree and the actual removal below. // This is needed to avoid race conditions where willBeRemovedFromTree would dirty the tree's structure // and the code running here would force an untimely rebuilding, leaving |oldChild| dangling. if (oldChild->previousSibling()) oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); if (oldChild->nextSibling()) oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()); if (firstChild() == oldChild) setFirstChild(oldChild->nextSibling()); if (lastChild() == oldChild) setLastChild(oldChild->previousSibling()); oldChild->setPreviousSibling(0); oldChild->setNextSibling(0); oldChild->setParent(0); return oldChild; }
void RenderObjectChildList::insertChildNode(RenderObject* owner, RenderObject* newChild, RenderObject* beforeChild, bool notifyRenderer) { ASSERT(!newChild->parent()); ASSERT(!owner->isBlockFlow() || (!newChild->isTableSection() && !newChild->isTableRow() && !newChild->isTableCell())); while (beforeChild && beforeChild->parent() && beforeChild->parent() != owner) beforeChild = beforeChild->parent(); // This should never happen, but if it does prevent render tree corruption // where child->parent() ends up being owner but child->nextSibling()->parent() // is not owner. if (beforeChild && beforeChild->parent() != owner) { ASSERT_NOT_REACHED(); return; } newChild->setParent(owner); if (firstChild() == beforeChild) setFirstChild(newChild); if (beforeChild) { RenderObject* previousSibling = beforeChild->previousSibling(); if (previousSibling) previousSibling->setNextSibling(newChild); newChild->setPreviousSibling(previousSibling); newChild->setNextSibling(beforeChild); beforeChild->setPreviousSibling(newChild); } else { if (lastChild()) lastChild()->setNextSibling(newChild); newChild->setPreviousSibling(lastChild()); setLastChild(newChild); } if (!owner->documentBeingDestroyed() && notifyRenderer) newChild->insertedIntoTree(); if (!owner->documentBeingDestroyed()) { RenderCounter::rendererSubtreeAttached(newChild); } newChild->setNeedsLayoutAndPrefWidthsRecalc(); owner->setPreferredLogicalWidthsDirty(true); if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child. if (AXObjectCache* cache = owner->document().axObjectCache()) cache->childrenChanged(owner); }
ExpressionNode & ExpressionNode::operator= (const ExpressionNode &newNode) { if (this == &newNode) { return *this; } setType(newNode.getType()); setOperation(newNode.getOperation()); setRight(newNode.getRight()); //automatically sets other siblings setFirstChild(newNode.getFirstChild()); // automatically also sets other children setVariable(newNode.getVariable()); setValue(newNode.getValue()); return *this; }
Bool testlist::Parent::pushBackChild(const Child & child) const { if(!child.isExists() || child.getParent().isValid()) return false; Child last_child = getLastChild(); child.setPrevParentChild(last_child); if(last_child.isValid()) last_child.setNextParentChild(child); else setFirstChild(child); child.setNextParentChild(Child()); setLastChild(child); setNumChilds(getNumChilds() + 1); child.setParent(*this); child.setupParentHandler(); return true; }
testlist::Child testlist::Parent::popFrontChild() const { Child result = getFirstChild(); if(result.isValid()) { result.removeParentHandler(); Child next = result.getNextParentChild(); result.setNextParentChild(Child()); result.setPrevParentChild(Child()); setFirstChild(next); if(!next.isValid()) setLastChild(Child()); else next.setPrevParentChild(Child()); setNumChilds(getNumChilds() - 1); result.setParent(Parent()); } return result; }
testlist::Child testlist::Parent::popBackChild() const { Child result = getLastChild(); if(result.isValid()) { result.removeParentHandler(); Child prev = result.getPrevParentChild(); result.setPrevParentChild(Child()); result.setNextParentChild(Child()); setLastChild(prev); if(!prev.isValid()) setFirstChild(Child()); else prev.setNextParentChild(Child()); setNumChilds(getNumChilds() - 1); result.setParent(Parent()); } return result; }
Bool testlist::Parent::insertBeforeChild(const Child & child, const Child & next) const { if(!child.isExists() || !next.isExists() || next.getParent() != *this || child.getParent().isValid()) return false; Child prev = next.getPrevParentChild(); next.setPrevParentChild(child); child.setNextParentChild(next); child.setPrevParentChild(prev); if(prev.isValid()) prev.setNextParentChild(child); else setFirstChild(child); child.setParent(*this); setNumChilds(getNumChilds() + 1); child.setupParentHandler(); return true; }
void Node::append(Node* node) { assert(!node->parent()); assert(!node->previousSibling()); assert(!node->nextSibling()); node->setParent(this); if (!firstChild()) { assert(!lastChild()); setFirstChild(node); setLastChild(node); } else { assert(lastChild()); Node* lastChild = this->lastChild(); assert(!lastChild->nextSibling()); lastChild->setNextSibling(node); node->setPreviousSibling(lastChild); setLastChild(node); } }
void RenderObjectChildList::insertChildNode(RenderObject* owner, RenderObject* newChild, RenderObject* beforeChild, bool notifyRenderer) { ASSERT(!newChild->parent()); while (beforeChild && beforeChild->parent() && beforeChild->parent() != owner) beforeChild = beforeChild->parent(); // This should never happen, but if it does prevent render tree corruption // where child->parent() ends up being owner but child->nextSibling()->parent() // is not owner. if (beforeChild && beforeChild->parent() != owner) { ASSERT_NOT_REACHED(); return; } newChild->setParent(owner); if (firstChild() == beforeChild) setFirstChild(newChild); if (beforeChild) { RenderObject* previousSibling = beforeChild->previousSibling(); if (previousSibling) previousSibling->setNextSibling(newChild); newChild->setPreviousSibling(previousSibling); newChild->setNextSibling(beforeChild); beforeChild->setPreviousSibling(newChild); } else { if (lastChild()) lastChild()->setNextSibling(newChild); newChild->setPreviousSibling(lastChild()); setLastChild(newChild); } if (!owner->documentBeingDestroyed() && notifyRenderer) newChild->insertedIntoTree(); newChild->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(); // We may supply the static position for an absolute positioned child. }
void RenderObjectChildList::insertChildNode(RenderObject* owner, RenderObject* child, RenderObject* beforeChild, bool notifyRenderer) { if (!beforeChild) { appendChildNode(owner, child, notifyRenderer); return; } ASSERT(!child->parent()); while (beforeChild->parent() != owner && beforeChild->parent()->isAnonymousBlock()) beforeChild = beforeChild->parent(); ASSERT(beforeChild->parent() == owner); ASSERT(!owner->isBlockFlow() || (!child->isTableSection() && !child->isTableRow() && !child->isTableCell())); if (beforeChild == firstChild()) setFirstChild(child); RenderObject* prev = beforeChild->previousSibling(); child->setNextSibling(beforeChild); beforeChild->setPreviousSibling(child); if (prev) prev->setNextSibling(child); child->setPreviousSibling(prev); child->setParent(owner); if (!owner->documentBeingDestroyed() && notifyRenderer) child->insertedIntoTree(); if (!owner->documentBeingDestroyed()) { RenderCounter::rendererSubtreeAttached(child); } child->setNeedsLayoutAndPrefWidthsRecalc(); if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child. if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); }
Bool testlist::Parent::removeChild(const Child & child) const { if( !child.isExists() || child.getParent() != *this) return false; child.removeParentHandler(); Child next = child.getNextParentChild(), prev = child.getPrevParentChild(); if(next.isValid()) next.setPrevParentChild(prev); else if (getLastChild() == child) setLastChild(prev); else return false; if(prev.isValid()) prev.setNextParentChild(next); else if (getFirstChild() == child) setFirstChild(next); else return false; child.setNextParentChild(Child()); child.setPrevParentChild(Child()); child.setParent(Parent()); setNumChilds(getNumChilds() - 1); return true; }
LayoutObject* LayoutObjectChildList::removeChildNode(LayoutObject* owner, LayoutObject* oldChild, bool notifyLayoutObject) { ASSERT(oldChild->parent() == owner); ASSERT(this == owner->virtualChildren()); if (oldChild->isFloatingOrOutOfFlowPositioned()) toLayoutBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); { // So that we'll get the appropriate dirty bit set (either that a normal flow child got yanked or // that a positioned child got yanked). We also issue paint invalidations, so that the area exposed when the child // disappears gets paint invalidated properly. if (!owner->documentBeingDestroyed() && notifyLayoutObject && oldChild->everHadLayout()) { oldChild->setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::RemovedFromLayout); invalidatePaintOnRemoval(*oldChild); } } // If we have a line box wrapper, delete it. if (oldChild->isBox()) toLayoutBox(oldChild)->deleteLineBoxWrapper(); // If oldChild is the start or end of the selection, then clear the selection to // avoid problems of invalid pointers. // FIXME: The FrameSelection should be responsible for this when it // is notified of DOM mutations. if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) owner->view()->clearSelection(); if (!owner->documentBeingDestroyed()) owner->notifyOfSubtreeChange(); if (!owner->documentBeingDestroyed() && notifyLayoutObject) { LayoutCounter::layoutObjectSubtreeWillBeDetached(oldChild); oldChild->willBeRemovedFromTree(); } // WARNING: There should be no code running between willBeRemovedFromTree and the actual removal below. // This is needed to avoid race conditions where willBeRemovedFromTree would dirty the tree's structure // and the code running here would force an untimely rebuilding, leaving |oldChild| dangling. if (oldChild->previousSibling()) oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); if (oldChild->nextSibling()) oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()); if (firstChild() == oldChild) setFirstChild(oldChild->nextSibling()); if (lastChild() == oldChild) setLastChild(oldChild->previousSibling()); oldChild->setPreviousSibling(nullptr); oldChild->setNextSibling(nullptr); oldChild->setParent(nullptr); oldChild->registerSubtreeChangeListenerOnDescendants(oldChild->consumesSubtreeChangeNotification()); if (AXObjectCache* cache = owner->document().existingAXObjectCache()) cache->childrenChanged(owner); return oldChild; }
void LayoutObjectChildList::insertChildNode(LayoutObject* owner, LayoutObject* newChild, LayoutObject* beforeChild, bool notifyLayoutObject) { ASSERT(!newChild->parent()); ASSERT(this == owner->virtualChildren()); ASSERT(!owner->isLayoutBlockFlow() || (!newChild->isTableSection() && !newChild->isTableRow() && !newChild->isTableCell())); while (beforeChild && beforeChild->parent() && beforeChild->parent() != owner) beforeChild = beforeChild->parent(); // This should never happen, but if it does prevent layout tree corruption // where child->parent() ends up being owner but child->nextSibling()->parent() // is not owner. if (beforeChild && beforeChild->parent() != owner) { ASSERT_NOT_REACHED(); return; } newChild->setParent(owner); if (firstChild() == beforeChild) setFirstChild(newChild); if (beforeChild) { LayoutObject* previousSibling = beforeChild->previousSibling(); if (previousSibling) previousSibling->setNextSibling(newChild); newChild->setPreviousSibling(previousSibling); newChild->setNextSibling(beforeChild); beforeChild->setPreviousSibling(newChild); } else { if (lastChild()) lastChild()->setNextSibling(newChild); newChild->setPreviousSibling(lastChild()); setLastChild(newChild); } if (!owner->documentBeingDestroyed() && notifyLayoutObject) { newChild->insertedIntoTree(); LayoutCounter::layoutObjectSubtreeAttached(newChild); } // Propagate the need to notify ancestors down into any // child nodes. if (owner->hasSubtreeChangeListenerRegistered()) newChild->registerSubtreeChangeListenerOnDescendants(true); // If the inserted node is currently marked as needing to notify children then // we have to propagate that mark up the tree. if (newChild->wasNotifiedOfSubtreeChange()) owner->notifyAncestorsOfSubtreeChange(); newChild->setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::AddedToLayout); newChild->setShouldDoFullPaintInvalidation(PaintInvalidationLayoutObjectInsertion); if (!owner->normalChildNeedsLayout()) owner->setChildNeedsLayout(); // We may supply the static position for an absolute positioned child. if (!owner->documentBeingDestroyed()) owner->notifyOfSubtreeChange(); if (AXObjectCache* cache = owner->document().axObjectCache()) cache->childrenChanged(owner); }
RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, RenderObject* oldChild, bool fullRemove) { ASSERT(oldChild->parent() == owner); if (oldChild->isFloatingOrOutOfFlowPositioned()) toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); // So that we'll get the appropriate dirty bit set (either that a normal flow child got yanked or // that a positioned child got yanked). We also repaint, so that the area exposed when the child // disappears gets repainted properly. if (!owner->documentBeingDestroyed() && fullRemove && oldChild->everHadLayout()) { oldChild->setNeedsLayoutAndPrefWidthsRecalc(); if (oldChild->isBody()) owner->view()->repaint(); else oldChild->repaint(); } // If we have a line box wrapper, delete it. if (oldChild->isBox()) toRenderBox(oldChild)->deleteLineBoxWrapper(); if (!owner->documentBeingDestroyed() && fullRemove) { // if we remove visible child from an invisible parent, we don't know the layer visibility any more RenderLayer* layer = 0; if (owner->style()->visibility() != VISIBLE && oldChild->style()->visibility() == VISIBLE && !oldChild->hasLayer()) { if ((layer = owner->enclosingLayer())) layer->dirtyVisibleContentStatus(); } // Keep our layer hierarchy updated. if (oldChild->firstChild() || oldChild->hasLayer()) { if (!layer) layer = owner->enclosingLayer(); oldChild->removeLayers(layer); } if (oldChild->isListItem()) toRenderListItem(oldChild)->updateListMarkerNumbers(); if (oldChild->isOutOfFlowPositioned() && owner->childrenInline()) owner->dirtyLinesFromChangedChild(oldChild); if (oldChild->isRenderRegion()) toRenderRegion(oldChild)->detachRegion(); if (oldChild->isQuote()) toRenderQuote(oldChild)->detachQuote(); if (oldChild->inRenderFlowThread()) { if (oldChild->isBox()) oldChild->enclosingRenderFlowThread()->removeRenderBoxRegionInfo(toRenderBox(oldChild)); oldChild->enclosingRenderFlowThread()->clearRenderObjectCustomStyle(oldChild); } if (RenderNamedFlowThread* containerFlowThread = renderNamedFlowThreadContainer(owner)) containerFlowThread->removeFlowChild(oldChild); #if ENABLE(SVG) // Update cached boundaries in SVG renderers, if a child is removed. owner->setNeedsBoundariesUpdate(); #endif } // If oldChild is the start or end of the selection, then clear the selection to // avoid problems of invalid pointers. // FIXME: The FrameSelection should be responsible for this when it // is notified of DOM mutations. if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) owner->view()->clearSelection(); // remove the child if (oldChild->previousSibling()) oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); if (oldChild->nextSibling()) oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()); if (firstChild() == oldChild) setFirstChild(oldChild->nextSibling()); if (lastChild() == oldChild) setLastChild(oldChild->previousSibling()); oldChild->setPreviousSibling(0); oldChild->setNextSibling(0); oldChild->setParent(0); // rendererRemovedFromTree walks the whole subtree. We can improve performance // by skipping this step when destroying the entire tree. if (!owner->documentBeingDestroyed()) { RenderCounter::rendererRemovedFromTree(oldChild); } if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); return oldChild; }
RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, RenderObject* oldChild, bool fullRemove) { ASSERT(oldChild->parent() == owner); // So that we'll get the appropriate dirty bit set (either that a normal flow child got yanked or // that a positioned child got yanked). We also repaint, so that the area exposed when the child // disappears gets repainted properly. if (!owner->documentBeingDestroyed() && fullRemove && oldChild->m_everHadLayout) { oldChild->setNeedsLayoutAndPrefWidthsRecalc(); oldChild->repaint(); } // If we have a line box wrapper, delete it. if (oldChild->isBox()) toRenderBox(oldChild)->deleteLineBoxWrapper(); if (!owner->documentBeingDestroyed() && fullRemove) { // if we remove visible child from an invisible parent, we don't know the layer visibility any more RenderLayer* layer = 0; if (owner->style()->visibility() != VISIBLE && oldChild->style()->visibility() == VISIBLE && !oldChild->hasLayer()) { layer = owner->enclosingLayer(); layer->dirtyVisibleContentStatus(); } // Keep our layer hierarchy updated. if (oldChild->firstChild() || oldChild->hasLayer()) { if (!layer) layer = owner->enclosingLayer(); oldChild->removeLayers(layer); } if (oldChild->isListItem()) toRenderListItem(oldChild)->updateListMarkerNumbers(); if (oldChild->isPositioned() && owner->childrenInline()) owner->dirtyLinesFromChangedChild(oldChild); } // If oldChild is the start or end of the selection, then clear the selection to // avoid problems of invalid pointers. // FIXME: The SelectionController should be responsible for this when it // is notified of DOM mutations. if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) owner->view()->clearSelection(); // remove the child if (oldChild->previousSibling()) oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); if (oldChild->nextSibling()) oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling()); if (firstChild() == oldChild) setFirstChild(oldChild->nextSibling()); if (lastChild() == oldChild) setLastChild(oldChild->previousSibling()); oldChild->setPreviousSibling(0); oldChild->setNextSibling(0); oldChild->setParent(0); if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); return oldChild; }