OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } | 379 } |
380 | 380 |
381 dispatchSubtreeModifiedEvent(); | 381 dispatchSubtreeModifiedEvent(); |
382 return true; | 382 return true; |
383 } | 383 } |
384 | 384 |
385 void ContainerNode::willRemove() | 385 void ContainerNode::willRemove() |
386 { | 386 { |
387 RefPtr<Node> protect(this); | 387 RefPtr<Node> protect(this); |
388 | 388 |
389 for (RefPtr<Node> child = firstChild(); child; child = child->nextSibling())
{ | 389 NodeVector children; |
390 if (child->parentNode() != this) // Check for child being removed from s
ubtree while removing. | 390 collectNodes(this, children); |
391 break; | 391 for (size_t i = 0; i < children.size(); ++i) { |
392 child->willRemove(); | 392 if (children[i]->parentNode() != this) // Check for child being removed
from subtree while removing. |
| 393 continue; |
| 394 children[i]->willRemove(); |
393 } | 395 } |
| 396 |
394 Node::willRemove(); | 397 Node::willRemove(); |
395 } | 398 } |
396 | 399 |
397 static void willRemoveChild(Node* child) | 400 static void willRemoveChild(Node* child) |
398 { | 401 { |
399 // update auxiliary doc info (e.g. iterators) to note that node is being rem
oved | 402 // update auxiliary doc info (e.g. iterators) to note that node is being rem
oved |
400 child->document()->nodeWillBeRemoved(child); | 403 child->document()->nodeWillBeRemoved(child); |
401 child->document()->incDOMTreeVersion(); | 404 child->document()->incDOMTreeVersion(); |
402 | 405 |
403 // fire removed from document mutation events. | 406 // fire removed from document mutation events. |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 if (!document()->hasListenerType(Document::BEFORELOAD_LISTENER)) | 1175 if (!document()->hasListenerType(Document::BEFORELOAD_LISTENER)) |
1173 return true; | 1176 return true; |
1174 | 1177 |
1175 RefPtr<ContainerNode> protector(this); | 1178 RefPtr<ContainerNode> protector(this); |
1176 RefPtr<BeforeLoadEvent> beforeLoadEvent = BeforeLoadEvent::create(sourceURL)
; | 1179 RefPtr<BeforeLoadEvent> beforeLoadEvent = BeforeLoadEvent::create(sourceURL)
; |
1177 dispatchEvent(beforeLoadEvent.get()); | 1180 dispatchEvent(beforeLoadEvent.get()); |
1178 return !beforeLoadEvent->defaultPrevented(); | 1181 return !beforeLoadEvent->defaultPrevented(); |
1179 } | 1182 } |
1180 | 1183 |
1181 } // namespace WebCore | 1184 } // namespace WebCore |
OLD | NEW |