| 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, 2013 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "core/rendering/RenderView.h" | 53 #include "core/rendering/RenderView.h" |
| 54 #include "platform/ScriptForbiddenScope.h" | 54 #include "platform/ScriptForbiddenScope.h" |
| 55 | 55 |
| 56 namespace WebCore { | 56 namespace WebCore { |
| 57 | 57 |
| 58 using namespace HTMLNames; | 58 using namespace HTMLNames; |
| 59 | 59 |
| 60 static void dispatchChildInsertionEvents(Node&); | 60 static void dispatchChildInsertionEvents(Node&); |
| 61 static void dispatchChildRemovalEvents(Node&); | 61 static void dispatchChildRemovalEvents(Node&); |
| 62 | 62 |
| 63 #ifndef NDEBUG | 63 #if ENABLE(ASSERT) |
| 64 unsigned NoEventDispatchAssertion::s_count = 0; | 64 unsigned NoEventDispatchAssertion::s_count = 0; |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 static void collectChildrenAndRemoveFromOldParent(Node& node, NodeVector& nodes,
ExceptionState& exceptionState) | 67 static void collectChildrenAndRemoveFromOldParent(Node& node, NodeVector& nodes,
ExceptionState& exceptionState) |
| 68 { | 68 { |
| 69 if (!node.isDocumentFragment()) { | 69 if (!node.isDocumentFragment()) { |
| 70 nodes.append(&node); | 70 nodes.append(&node); |
| 71 if (ContainerNode* oldParent = node.parentNode()) | 71 if (ContainerNode* oldParent = node.parentNode()) |
| 72 oldParent->removeChild(&node, exceptionState); | 72 oldParent->removeChild(&node, exceptionState); |
| 73 return; | 73 return; |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 ASSERT_WITH_SECURITY_IMPLICATION(!n->m_deletionHasBegun); | 479 ASSERT_WITH_SECURITY_IMPLICATION(!n->m_deletionHasBegun); |
| 480 | 480 |
| 481 next = n->nextSibling(); | 481 next = n->nextSibling(); |
| 482 n->setNextSibling(0); | 482 n->setNextSibling(0); |
| 483 n->setParentOrShadowHostNode(0); | 483 n->setParentOrShadowHostNode(0); |
| 484 container.setFirstChild(next); | 484 container.setFirstChild(next); |
| 485 if (next) | 485 if (next) |
| 486 next->setPreviousSibling(0); | 486 next->setPreviousSibling(0); |
| 487 | 487 |
| 488 if (!n->refCount()) { | 488 if (!n->refCount()) { |
| 489 #if SECURITY_ASSERT_ENABLED | 489 #if ENABLE(SECURITY_ASSERT) |
| 490 n->m_deletionHasBegun = true; | 490 n->m_deletionHasBegun = true; |
| 491 #endif | 491 #endif |
| 492 // Add the node to the list of nodes to be deleted. | 492 // Add the node to the list of nodes to be deleted. |
| 493 // Reuse the nextSibling pointer for this purpose. | 493 // Reuse the nextSibling pointer for this purpose. |
| 494 if (tail) | 494 if (tail) |
| 495 tail->setNextSibling(n); | 495 tail->setNextSibling(n); |
| 496 else | 496 else |
| 497 head = n; | 497 head = n; |
| 498 | 498 |
| 499 tail = n; | 499 tail = n; |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 // Fall back to traversing our subtree. In case of duplicate ids, the first
element found will be returned. | 1372 // Fall back to traversing our subtree. In case of duplicate ids, the first
element found will be returned. |
| 1373 for (Element* element = ElementTraversal::firstWithin(*this); element; eleme
nt = ElementTraversal::next(*element, this)) { | 1373 for (Element* element = ElementTraversal::firstWithin(*this); element; eleme
nt = ElementTraversal::next(*element, this)) { |
| 1374 if (element->getIdAttribute() == id) | 1374 if (element->getIdAttribute() == id) |
| 1375 return element; | 1375 return element; |
| 1376 } | 1376 } |
| 1377 return 0; | 1377 return 0; |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 #ifndef NDEBUG | 1380 #if ENABLE(ASSERT) |
| 1381 bool childAttachedAllowedWhenAttachingChildren(ContainerNode* node) | 1381 bool childAttachedAllowedWhenAttachingChildren(ContainerNode* node) |
| 1382 { | 1382 { |
| 1383 if (node->isShadowRoot()) | 1383 if (node->isShadowRoot()) |
| 1384 return true; | 1384 return true; |
| 1385 | 1385 |
| 1386 if (node->isInsertionPoint()) | 1386 if (node->isInsertionPoint()) |
| 1387 return true; | 1387 return true; |
| 1388 | 1388 |
| 1389 if (node->isElementNode() && toElement(node)->shadow()) | 1389 if (node->isElementNode() && toElement(node)->shadow()) |
| 1390 return true; | 1390 return true; |
| 1391 | 1391 |
| 1392 return false; | 1392 return false; |
| 1393 } | 1393 } |
| 1394 #endif | 1394 #endif |
| 1395 | 1395 |
| 1396 } // namespace WebCore | 1396 } // namespace WebCore |
| OLD | NEW |