| 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 28 matching lines...) Expand all Loading... |
| 39 #include "RenderView.h" | 39 #include "RenderView.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 void RenderObjectChildList::destroyLeftoverChildren() | 43 void RenderObjectChildList::destroyLeftoverChildren() |
| 44 { | 44 { |
| 45 while (firstChild()) { | 45 while (firstChild()) { |
| 46 if (firstChild()->isListMarker() || (firstChild()->style()->styleType()
== FIRST_LETTER && !firstChild()->isText())) | 46 if (firstChild()->isListMarker() || (firstChild()->style()->styleType()
== FIRST_LETTER && !firstChild()->isText())) |
| 47 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. | 47 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. |
| 48 else if (firstChild()->isRunIn() && firstChild()->node()) { | 48 else if (firstChild()->isRunIn() && firstChild()->node()) { |
| 49 firstChild()->node()->setRenderer(0); |
| 49 firstChild()->node()->setNeedsStyleRecalc(); | 50 firstChild()->node()->setNeedsStyleRecalc(); |
| 50 firstChild()->destroy(); | 51 firstChild()->destroy(); |
| 51 } else { | 52 } else { |
| 52 // 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. | 53 // 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. |
| 54 if (firstChild()->node()) |
| 55 firstChild()->node()->setRenderer(0); |
| 53 firstChild()->destroy(); | 56 firstChild()->destroy(); |
| 54 } | 57 } |
| 55 } | 58 } |
| 56 } | 59 } |
| 57 | 60 |
| 58 RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, Render
Object* oldChild, bool notifyRenderer) | 61 RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, Render
Object* oldChild, bool notifyRenderer) |
| 59 { | 62 { |
| 60 ASSERT(oldChild->parent() == owner); | 63 ASSERT(oldChild->parent() == owner); |
| 61 | 64 |
| 62 if (oldChild->isFloatingOrOutOfFlowPositioned()) | 65 if (oldChild->isFloatingOrOutOfFlowPositioned()) |
| 63 toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); | 66 toRenderBox(oldChild)->removeFloatingOrPositionedChildFromBlockLists(); |
| 64 | 67 |
| 65 // So that we'll get the appropriate dirty bit set (either that a normal flo
w child got yanked or | 68 // So that we'll get the appropriate dirty bit set (either that a normal flo
w child got yanked or |
| 66 // that a positioned child got yanked). | 69 // that a positioned child got yanked). We also repaint, so that the area ex
posed when the child |
| 70 // disappears gets repainted properly. |
| 67 if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadL
ayout()) { | 71 if (!owner->documentBeingDestroyed() && notifyRenderer && oldChild->everHadL
ayout()) { |
| 68 oldChild->setNeedsLayoutAndPrefWidthsRecalc(); | 72 oldChild->setNeedsLayoutAndPrefWidthsRecalc(); |
| 69 // We only repaint |oldChild| if we have a RenderLayer as its visual ove
rflow may not be tracked by its parent. | 73 // We only repaint |oldChild| if we have a RenderLayer as its visual ove
rflow may not be tracked by its parent. |
| 70 if (oldChild->hasLayer()) | 74 if (oldChild->isBody()) |
| 75 owner->view()->repaint(); |
| 76 else |
| 71 oldChild->repaint(); | 77 oldChild->repaint(); |
| 72 } | 78 } |
| 73 | 79 |
| 74 // If we have a line box wrapper, delete it. | 80 // If we have a line box wrapper, delete it. |
| 75 if (oldChild->isBox()) | 81 if (oldChild->isBox()) |
| 76 toRenderBox(oldChild)->deleteLineBoxWrapper(); | 82 toRenderBox(oldChild)->deleteLineBoxWrapper(); |
| 77 | 83 |
| 78 // If oldChild is the start or end of the selection, then clear the selectio
n to | 84 // If oldChild is the start or end of the selection, then clear the selectio
n to |
| 79 // avoid problems of invalid pointers. | 85 // avoid problems of invalid pointers. |
| 80 // FIXME: The FrameSelection should be responsible for this when it | 86 // FIXME: The FrameSelection should be responsible for this when it |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 RenderObject* last = const_cast<RenderObject*>(owner); | 238 RenderObject* last = const_cast<RenderObject*>(owner); |
| 233 do { | 239 do { |
| 234 last = last->lastChild(); | 240 last = last->lastChild(); |
| 235 } while (last && last->isAnonymous() && last->style()->styleType() == NOPSEU
DO && !last->isListMarker()); | 241 } while (last && last->isAnonymous() && last->style()->styleType() == NOPSEU
DO && !last->isListMarker()); |
| 236 if (last && !last->isAfterContent()) | 242 if (last && !last->isAfterContent()) |
| 237 return 0; | 243 return 0; |
| 238 return last; | 244 return last; |
| 239 } | 245 } |
| 240 | 246 |
| 241 } // namespace WebCore | 247 } // namespace WebCore |
| OLD | NEW |