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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 firstChild()->destroy(); | 56 firstChild()->destroy(); |
57 } else { | 57 } else { |
58 // Destroy any anonymous children remaining in the render tree, as w
ell as implicit (shadow) DOM elements like those used in the engine-based text f
ields. | 58 // Destroy any anonymous children remaining in the render tree, as w
ell as implicit (shadow) DOM elements like those used in the engine-based text f
ields. |
59 if (firstChild()->node()) | 59 if (firstChild()->node()) |
60 firstChild()->node()->setRenderer(0); | 60 firstChild()->node()->setRenderer(0); |
61 firstChild()->destroy(); | 61 firstChild()->destroy(); |
62 } | 62 } |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, Render
Object* oldChild, bool fullRemove) | 66 RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, Render
Object* oldChild, bool notifyRenderer) |
67 { | 67 { |
68 ASSERT(oldChild->parent() == owner); | 68 ASSERT(oldChild->parent() == owner); |
69 | 69 |
70 if (oldChild->isFloatingOrOutOfFlowPositioned()) | 70 if (oldChild->isFloatingOrOutOfFlowPositioned()) |
71 toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); | 71 toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); |
72 | 72 |
73 // So that we'll get the appropriate dirty bit set (either that a normal flo
w child got yanked or | 73 // So that we'll get the appropriate dirty bit set (either that a normal flo
w child got yanked or |
74 // that a positioned child got yanked). We also repaint, so that the area e
xposed when the child | 74 // that a positioned child got yanked). We also repaint, so that the area e
xposed when the child |
75 // disappears gets repainted properly. | 75 // disappears gets repainted properly. |
76 if (!owner->documentBeingDestroyed() && fullRemove && oldChild->everHadLayou
t()) { | 76 if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadL
ayout()) { |
77 oldChild->setNeedsLayoutAndPrefWidthsRecalc(); | 77 oldChild->setNeedsLayoutAndPrefWidthsRecalc(); |
78 if (oldChild->isBody()) | 78 if (oldChild->isBody()) |
79 owner->view()->repaint(); | 79 owner->view()->repaint(); |
80 else | 80 else |
81 oldChild->repaint(); | 81 oldChild->repaint(); |
82 } | 82 } |
83 | 83 |
84 // If we have a line box wrapper, delete it. | 84 // If we have a line box wrapper, delete it. |
85 if (oldChild->isBox()) | 85 if (oldChild->isBox()) |
86 toRenderBox(oldChild)->deleteLineBoxWrapper(); | 86 toRenderBox(oldChild)->deleteLineBoxWrapper(); |
87 | 87 |
88 if (!owner->documentBeingDestroyed() && fullRemove) { | 88 if (!owner->documentBeingDestroyed() && notifyRenderer) |
89 // if we remove visible child from an invisible parent, we don't know th
e layer visibility any more | 89 oldChild->willBeRemovedFromTree(); |
90 RenderLayer* layer = 0; | |
91 if (owner->style()->visibility() != VISIBLE && oldChild->style()->visibi
lity() == 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->enclosingRenderN
amedFlowThread()) | |
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 } | |
129 | 90 |
130 // If oldChild is the start or end of the selection, then clear the selectio
n to | 91 // If oldChild is the start or end of the selection, then clear the selectio
n to |
131 // avoid problems of invalid pointers. | 92 // avoid problems of invalid pointers. |
132 // FIXME: The FrameSelection should be responsible for this when it | 93 // FIXME: The FrameSelection should be responsible for this when it |
133 // is notified of DOM mutations. | 94 // is notified of DOM mutations. |
134 if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) | 95 if (!owner->documentBeingDestroyed() && oldChild->isSelectionBorder()) |
135 owner->view()->clearSelection(); | 96 owner->view()->clearSelection(); |
136 | 97 |
137 // remove the child | 98 // remove the child |
138 if (oldChild->previousSibling()) | 99 if (oldChild->previousSibling()) |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 if (!generatedContentContainer) | 467 if (!generatedContentContainer) |
507 return; | 468 return; |
508 | 469 |
509 // Handle placement of run-ins. We do the run-in placement at the end since
generatedContentContainer can get destroyed. | 470 // Handle placement of run-ins. We do the run-in placement at the end since
generatedContentContainer can get destroyed. |
510 RenderObject* generatedContentContainerImmediateParent = generatedContentCon
tainer->parent(); | 471 RenderObject* generatedContentContainerImmediateParent = generatedContentCon
tainer->parent(); |
511 if (generatedContentContainerImmediateParent->isRenderBlock()) | 472 if (generatedContentContainerImmediateParent->isRenderBlock()) |
512 toRenderBlock(generatedContentContainerImmediateParent)->placeRunInIfNee
ded(generatedContentContainer, PlaceGeneratedRunIn); | 473 toRenderBlock(generatedContentContainerImmediateParent)->placeRunInIfNee
ded(generatedContentContainer, PlaceGeneratedRunIn); |
513 } | 474 } |
514 | 475 |
515 } // namespace WebCore | 476 } // namespace WebCore |
OLD | NEW |