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 23 matching lines...) Expand all Loading... |
34 #include "RenderView.h" | 34 #include "RenderView.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 void RenderObjectChildList::destroyLeftoverChildren() | 38 void RenderObjectChildList::destroyLeftoverChildren() |
39 { | 39 { |
40 while (firstChild()) { | 40 while (firstChild()) { |
41 if (firstChild()->isListMarker() || (firstChild()->style()->styleType()
== FIRST_LETTER && !firstChild()->isText())) | 41 if (firstChild()->isListMarker() || (firstChild()->style()->styleType()
== FIRST_LETTER && !firstChild()->isText())) |
42 firstChild()->remove(); // List markers are owned by their enclosin
g list and so don't get destroyed by this container. Similarly, first letters ar
e destroyed by their remaining text fragment. | 42 firstChild()->remove(); // List markers are owned by their enclosin
g list and so don't get destroyed by this container. Similarly, first letters ar
e destroyed by their remaining text fragment. |
43 else if (firstChild()->isRunIn() && firstChild()->node()) { | 43 else if (firstChild()->isRunIn() && firstChild()->node()) { |
| 44 firstChild()->node()->setRenderer(0); |
44 firstChild()->node()->setNeedsStyleRecalc(); | 45 firstChild()->node()->setNeedsStyleRecalc(); |
45 firstChild()->destroy(); | 46 firstChild()->destroy(); |
46 } else { | 47 } else { |
47 // 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. | 48 // 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. |
| 49 if (firstChild()->node()) |
| 50 firstChild()->node()->setRenderer(0); |
48 firstChild()->destroy(); | 51 firstChild()->destroy(); |
49 } | 52 } |
50 } | 53 } |
51 } | 54 } |
52 | 55 |
53 RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, Render
Object* oldChild, bool notifyRenderer) | 56 RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, Render
Object* oldChild, bool notifyRenderer) |
54 { | 57 { |
55 ASSERT(oldChild->parent() == owner); | 58 ASSERT(oldChild->parent() == owner); |
56 | 59 |
57 if (oldChild->isFloatingOrOutOfFlowPositioned()) | 60 if (oldChild->isFloatingOrOutOfFlowPositioned()) |
58 toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); | 61 toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); |
59 | 62 |
60 // So that we'll get the appropriate dirty bit set (either that a normal flo
w child got yanked or | 63 // So that we'll get the appropriate dirty bit set (either that a normal flo
w child got yanked or |
61 // that a positioned child got yanked). | 64 // that a positioned child got yanked). We also repaint, so that the area ex
posed when the child |
| 65 // disappears gets repainted properly. |
62 if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadL
ayout()) { | 66 if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadL
ayout()) { |
63 oldChild->setNeedsLayoutAndPrefWidthsRecalc(); | 67 oldChild->setNeedsLayoutAndPrefWidthsRecalc(); |
64 // We only repaint |oldChild| if we have a RenderLayer as its visual ove
rflow may not be tracked by its parent. | 68 // We only repaint |oldChild| if we have a RenderLayer as its visual ove
rflow may not be tracked by its parent. |
65 if (oldChild->hasLayer()) | 69 if (oldChild->isBody()) |
| 70 owner->view()->repaint(); |
| 71 else |
66 oldChild->repaint(); | 72 oldChild->repaint(); |
67 } | 73 } |
68 | 74 |
69 // If we have a line box wrapper, delete it. | 75 // If we have a line box wrapper, delete it. |
70 if (oldChild->isBox()) | 76 if (oldChild->isBox()) |
71 toRenderBox(oldChild)->deleteLineBoxWrapper(); | 77 toRenderBox(oldChild)->deleteLineBoxWrapper(); |
72 | 78 |
73 // If oldChild is the start or end of the selection, then clear the selectio
n to | 79 // If oldChild is the start or end of the selection, then clear the selectio
n to |
74 // avoid problems of invalid pointers. | 80 // avoid problems of invalid pointers. |
75 // FIXME: The FrameSelection should be responsible for this when it | 81 // FIXME: The FrameSelection should be responsible for this when it |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 159 |
154 newChild->setNeedsLayoutAndPrefWidthsRecalc(); | 160 newChild->setNeedsLayoutAndPrefWidthsRecalc(); |
155 if (!owner->normalChildNeedsLayout()) | 161 if (!owner->normalChildNeedsLayout()) |
156 owner->setChildNeedsLayout(true); // We may supply the static position f
or an absolute positioned child. | 162 owner->setChildNeedsLayout(true); // We may supply the static position f
or an absolute positioned child. |
157 | 163 |
158 if (AXObjectCache::accessibilityEnabled()) | 164 if (AXObjectCache::accessibilityEnabled()) |
159 owner->document()->axObjectCache()->childrenChanged(owner); | 165 owner->document()->axObjectCache()->childrenChanged(owner); |
160 } | 166 } |
161 | 167 |
162 } // namespace WebCore | 168 } // namespace WebCore |
OLD | NEW |