OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // If oldChild is the start or end of the selection, then clear the selectio
n to | 77 // If oldChild is the start or end of the selection, then clear the selectio
n to |
78 // avoid problems of invalid pointers. | 78 // avoid problems of invalid pointers. |
79 // FIXME: The FrameSelection should be responsible for this when it | 79 // FIXME: The FrameSelection should be responsible for this when it |
80 // is notified of DOM mutations. | 80 // is notified of DOM mutations. |
81 if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) | 81 if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) |
82 owner->view()->clearSelection(); | 82 owner->view()->clearSelection(); |
83 | 83 |
84 if (!owner->documentBeingDestroyed()) | 84 if (!owner->documentBeingDestroyed()) |
85 owner->notifyOfSubtreeChange(); | 85 owner->notifyOfSubtreeChange(); |
86 | 86 |
87 if (!owner->documentBeingDestroyed() && notifyLayoutObject) | 87 if (!owner->documentBeingDestroyed() && notifyLayoutObject) { |
| 88 LayoutCounter::layoutObjectSubtreeWillBeDetached(oldChild); |
88 oldChild->willBeRemovedFromTree(); | 89 oldChild->willBeRemovedFromTree(); |
| 90 } |
89 | 91 |
90 // WARNING: There should be no code running between willBeRemovedFromTree an
d the actual removal below. | 92 // WARNING: There should be no code running between willBeRemovedFromTree an
d the actual removal below. |
91 // This is needed to avoid race conditions where willBeRemovedFromTree would
dirty the tree's structure | 93 // This is needed to avoid race conditions where willBeRemovedFromTree would
dirty the tree's structure |
92 // and the code running here would force an untimely rebuilding, leaving |ol
dChild| dangling. | 94 // and the code running here would force an untimely rebuilding, leaving |ol
dChild| dangling. |
93 | 95 |
94 if (oldChild->previousSibling()) | 96 if (oldChild->previousSibling()) |
95 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); | 97 oldChild->previousSibling()->setNextSibling(oldChild->nextSibling()); |
96 if (oldChild->nextSibling()) | 98 if (oldChild->nextSibling()) |
97 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling())
; | 99 oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling())
; |
98 | 100 |
99 if (firstChild() == oldChild) | 101 if (firstChild() == oldChild) |
100 setFirstChild(oldChild->nextSibling()); | 102 setFirstChild(oldChild->nextSibling()); |
101 if (lastChild() == oldChild) | 103 if (lastChild() == oldChild) |
102 setLastChild(oldChild->previousSibling()); | 104 setLastChild(oldChild->previousSibling()); |
103 | 105 |
104 oldChild->setPreviousSibling(0); | 106 oldChild->setPreviousSibling(0); |
105 oldChild->setNextSibling(0); | 107 oldChild->setNextSibling(0); |
106 oldChild->setParent(0); | 108 oldChild->setParent(0); |
107 | 109 |
108 oldChild->registerSubtreeChangeListenerOnDescendants(oldChild->consumesSubtr
eeChangeNotification()); | 110 oldChild->registerSubtreeChangeListenerOnDescendants(oldChild->consumesSubtr
eeChangeNotification()); |
109 | 111 |
110 // layoutObjectRemovedFromTree walks the whole subtree. We can improve perfo
rmance | |
111 // by skipping this step when destroying the entire tree. | |
112 if (!owner->documentBeingDestroyed()) | |
113 LayoutCounter::layoutObjectRemovedFromTree(oldChild); | |
114 | |
115 if (AXObjectCache* cache = owner->document().existingAXObjectCache()) | 112 if (AXObjectCache* cache = owner->document().existingAXObjectCache()) |
116 cache->childrenChanged(owner); | 113 cache->childrenChanged(owner); |
117 | 114 |
118 return oldChild; | 115 return oldChild; |
119 } | 116 } |
120 | 117 |
121 void LayoutObjectChildList::insertChildNode(LayoutObject* owner, LayoutObject* n
ewChild, LayoutObject* beforeChild, bool notifyLayoutObject) | 118 void LayoutObjectChildList::insertChildNode(LayoutObject* owner, LayoutObject* n
ewChild, LayoutObject* beforeChild, bool notifyLayoutObject) |
122 { | 119 { |
123 ASSERT(!newChild->parent()); | 120 ASSERT(!newChild->parent()); |
124 ASSERT(this == owner->virtualChildren()); | 121 ASSERT(this == owner->virtualChildren()); |
(...skipping 22 matching lines...) Expand all Loading... |
147 newChild->setPreviousSibling(previousSibling); | 144 newChild->setPreviousSibling(previousSibling); |
148 newChild->setNextSibling(beforeChild); | 145 newChild->setNextSibling(beforeChild); |
149 beforeChild->setPreviousSibling(newChild); | 146 beforeChild->setPreviousSibling(newChild); |
150 } else { | 147 } else { |
151 if (lastChild()) | 148 if (lastChild()) |
152 lastChild()->setNextSibling(newChild); | 149 lastChild()->setNextSibling(newChild); |
153 newChild->setPreviousSibling(lastChild()); | 150 newChild->setPreviousSibling(lastChild()); |
154 setLastChild(newChild); | 151 setLastChild(newChild); |
155 } | 152 } |
156 | 153 |
157 if (!owner->documentBeingDestroyed() && notifyLayoutObject) | 154 if (!owner->documentBeingDestroyed() && notifyLayoutObject) { |
158 newChild->insertedIntoTree(); | 155 newChild->insertedIntoTree(); |
159 | |
160 if (!owner->documentBeingDestroyed()) { | |
161 LayoutCounter::layoutObjectSubtreeAttached(newChild); | 156 LayoutCounter::layoutObjectSubtreeAttached(newChild); |
162 } | 157 } |
163 | 158 |
164 // Propagate the need to notify ancestors down into any | 159 // Propagate the need to notify ancestors down into any |
165 // child nodes. | 160 // child nodes. |
166 if (owner->hasSubtreeChangeListenerRegistered()) | 161 if (owner->hasSubtreeChangeListenerRegistered()) |
167 newChild->registerSubtreeChangeListenerOnDescendants(true); | 162 newChild->registerSubtreeChangeListenerOnDescendants(true); |
168 | 163 |
169 // If the inserted node is currently marked as needing to notify children th
en | 164 // If the inserted node is currently marked as needing to notify children th
en |
170 // we have to propagate that mark up the tree. | 165 // we have to propagate that mark up the tree. |
(...skipping 24 matching lines...) Expand all Loading... |
195 DisableCompositingQueryAsserts disabler; | 190 DisableCompositingQueryAsserts disabler; |
196 // FIXME: We should not allow paint invalidation out of paint invalidation s
tate. crbug.com/457415 | 191 // FIXME: We should not allow paint invalidation out of paint invalidation s
tate. crbug.com/457415 |
197 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; | 192 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; |
198 const LayoutBoxModelObject* paintInvalidationContainer = oldChild.containerF
orPaintInvalidation(); | 193 const LayoutBoxModelObject* paintInvalidationContainer = oldChild.containerF
orPaintInvalidation(); |
199 oldChild.invalidatePaintUsingContainer(paintInvalidationContainer, oldChild.
previousPaintInvalidationRect(), PaintInvalidationLayoutObjectRemoval); | 194 oldChild.invalidatePaintUsingContainer(paintInvalidationContainer, oldChild.
previousPaintInvalidationRect(), PaintInvalidationLayoutObjectRemoval); |
200 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 195 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
201 oldChild.invalidateDisplayItemClients(*paintInvalidationContainer); | 196 oldChild.invalidateDisplayItemClients(*paintInvalidationContainer); |
202 } | 197 } |
203 | 198 |
204 } // namespace blink | 199 } // namespace blink |
OLD | NEW |