Changeset 125940 in webkit
- Timestamp:
- Aug 17, 2012 2:59:08 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r125939 r125940 1 2012-08-17 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Introduce a will-be-removed-from-tree notification in RenderObject 4 https://bugs.webkit.org/show_bug.cgi?id=94271 5 6 Reviewed by Abhishek Arya. 7 8 Following bug 93874, we have an insertion notification. This change adds the 9 matching removal notification (willBeRemovedFromTree). 10 11 Refactoring covered by existing tests. 12 13 * rendering/RenderObjectChildList.cpp: 14 (WebCore::RenderObjectChildList::removeChildNode): 15 Removed the code from here and moved it below. 16 17 * rendering/RenderObject.cpp: 18 (WebCore::RenderObject::willBeRemovedFromTree): 19 * rendering/RenderObject.h: 20 This is the base function that should be called by every instance. 21 22 * rendering/RenderListItem.cpp: 23 (WebCore::RenderListItem::willBeRemovedFromTree): 24 * rendering/RenderListItem.h: 25 * rendering/RenderQuote.cpp: 26 (WebCore::RenderQuote::willBeRemovedFromTree): 27 * rendering/RenderQuote.h: 28 * rendering/RenderRegion.cpp: 29 (WebCore::RenderRegion::willBeRemovedFromTree): 30 * rendering/RenderRegion.h: 31 Overriden functions. 32 1 33 2012-08-17 Brian Anderson <brianderson@chromium.org> 2 34 -
trunk/Source/WebCore/rendering/RenderListItem.cpp
r125737 r125940 80 80 { 81 81 RenderBlock::insertedIntoTree(); 82 83 updateListMarkerNumbers(); 84 } 85 86 void RenderListItem::willBeRemovedFromTree() 87 { 88 RenderBlock::willBeRemovedFromTree(); 82 89 83 90 updateListMarkerNumbers(); -
trunk/Source/WebCore/rendering/RenderListItem.h
r125737 r125940 60 60 61 61 virtual void insertedIntoTree() OVERRIDE; 62 virtual void willBeRemovedFromTree() OVERRIDE; 62 63 63 64 virtual bool isEmpty() const; -
trunk/Source/WebCore/rendering/RenderObject.cpp
r125794 r125940 2396 2396 } 2397 2397 2398 void RenderObject::willBeRemovedFromTree() 2399 { 2400 ASSERT(isRooted()); 2401 2402 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more. 2403 RenderLayer* layer = 0; 2404 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == VISIBLE && !hasLayer()) { 2405 if ((layer = parent()->enclosingLayer())) 2406 layer->dirtyVisibleContentStatus(); 2407 } 2408 2409 // Keep our layer hierarchy updated. 2410 if (firstChild() || hasLayer()) { 2411 if (!layer) 2412 layer = parent()->enclosingLayer(); 2413 removeLayers(layer); 2414 } 2415 2416 if (isOutOfFlowPositioned() && parent()->childrenInline()) 2417 parent()->dirtyLinesFromChangedChild(this); 2418 2419 if (inRenderFlowThread()) { 2420 if (isBox()) 2421 enclosingRenderFlowThread()->removeRenderBoxRegionInfo(toRenderBox(this)); 2422 enclosingRenderFlowThread()->clearRenderObjectCustomStyle(this); 2423 } 2424 2425 if (RenderNamedFlowThread* containerFlowThread = parent()->enclosingRenderNamedFlowThread()) 2426 containerFlowThread->removeFlowChild(this); 2427 2428 #if ENABLE(SVG) 2429 // Update cached boundaries in SVG renderers, if a child is removed. 2430 parent()->setNeedsBoundariesUpdate(); 2431 #endif 2432 } 2433 2398 2434 void RenderObject::destroyAndCleanupAnonymousWrappers() 2399 2435 { -
trunk/Source/WebCore/rendering/RenderObject.h
r125794 r125940 940 940 941 941 virtual void insertedIntoTree(); 942 virtual void willBeRemovedFromTree(); 942 943 943 944 private: -
trunk/Source/WebCore/rendering/RenderObjectChildList.cpp
r125737 r125940 64 64 } 65 65 66 RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, RenderObject* oldChild, bool fullRemove)66 RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, RenderObject* oldChild, bool notifyRenderer) 67 67 { 68 68 ASSERT(oldChild->parent() == owner); … … 74 74 // that a positioned child got yanked). We also repaint, so that the area exposed when the child 75 75 // disappears gets repainted properly. 76 if (!owner->documentBeingDestroyed() && fullRemove&& oldChild->everHadLayout()) {76 if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadLayout()) { 77 77 oldChild->setNeedsLayoutAndPrefWidthsRecalc(); 78 78 if (oldChild->isBody()) … … 86 86 toRenderBox(oldChild)->deleteLineBoxWrapper(); 87 87 88 if (!owner->documentBeingDestroyed() && fullRemove) { 89 // if we remove visible child from an invisible parent, we don't know the layer visibility any more 90 RenderLayer* layer = 0; 91 if (owner->style()->visibility() != VISIBLE && oldChild->style()->visibility() == VISIBLE && !oldChild->hasLayer()) { 92 if ((layer = owner->enclosingLayer())) 93 layer->dirtyVisibleContentStatus(); 94 } 95 96 // Keep our layer hierarchy updated. 97 if (oldChild->firstChild() || oldChild->hasLayer()) { 98 if (!layer) 99 layer = owner->enclosingLayer(); 100 oldChild->removeLayers(layer); 101 } 102 103 if (oldChild->isListItem()) 104 toRenderListItem(oldChild)->updateListMarkerNumbers(); 105 106 if (oldChild->isOutOfFlowPositioned() && owner->childrenInline()) 107 owner->dirtyLinesFromChangedChild(oldChild); 108 109 if (oldChild->isRenderRegion()) 110 toRenderRegion(oldChild)->detachRegion(); 111 112 if (oldChild->isQuote()) 113 toRenderQuote(oldChild)->detachQuote(); 114 115 if (oldChild->inRenderFlowThread()) { 116 if (oldChild->isBox()) 117 oldChild->enclosingRenderFlowThread()->removeRenderBoxRegionInfo(toRenderBox(oldChild)); 118 oldChild->enclosingRenderFlowThread()->clearRenderObjectCustomStyle(oldChild); 119 } 120 121 if (RenderNamedFlowThread* containerFlowThread = owner->enclosingRenderNamedFlowThread()) 122 containerFlowThread->removeFlowChild(oldChild); 123 124 #if ENABLE(SVG) 125 // Update cached boundaries in SVG renderers, if a child is removed. 126 owner->setNeedsBoundariesUpdate(); 127 #endif 128 } 88 if (!owner->documentBeingDestroyed() && notifyRenderer) 89 oldChild->willBeRemovedFromTree(); 129 90 130 91 // If oldChild is the start or end of the selection, then clear the selection to -
trunk/Source/WebCore/rendering/RenderObjectChildList.h
r125737 r125940 53 53 void destroyLeftoverChildren(); 54 54 55 RenderObject* removeChildNode(RenderObject* owner, RenderObject*, bool fullRemove= true);55 RenderObject* removeChildNode(RenderObject* owner, RenderObject*, bool notifyRenderer = true); 56 56 void appendChildNode(RenderObject* owner, RenderObject*, bool notifyRenderer = true); 57 57 void insertChildNode(RenderObject* owner, RenderObject* child, RenderObject* before, bool notifyRenderer = true); -
trunk/Source/WebCore/rendering/RenderQuote.cpp
r125476 r125940 49 49 detachQuote(); 50 50 RenderText::willBeDestroyed(); 51 } 52 53 void RenderQuote::willBeRemovedFromTree() 54 { 55 RenderText::willBeRemovedFromTree(); 56 57 detachQuote(); 51 58 } 52 59 -
trunk/Source/WebCore/rendering/RenderQuote.h
r125737 r125940 50 50 // is called on an attached tree, we should override it here. 51 51 52 virtual void willBeRemovedFromTree() OVERRIDE; 53 52 54 const QuotesData* quotesData() const; 53 55 void updateDepth(); -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r125737 r125940 365 365 } 366 366 367 void RenderRegion::willBeRemovedFromTree() 368 { 369 RenderReplaced::willBeRemovedFromTree(); 370 371 detachRegion(); 372 } 373 367 374 PassRefPtr<RenderStyle> RenderRegion::computeStyleInRegion(const RenderObject* object) 368 375 { -
trunk/Source/WebCore/rendering/RenderRegion.h
r125737 r125940 102 102 103 103 virtual void insertedIntoTree() OVERRIDE; 104 virtual void willBeRemovedFromTree() OVERRIDE; 104 105 105 106 PassRefPtr<RenderStyle> computeStyleInRegion(const RenderObject*);
Note: See TracChangeset
for help on using the changeset viewer.