| 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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights |
| 6 * reserved. | 6 * reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 "node."); | 205 "node."); |
| 206 return false; | 206 return false; |
| 207 } | 207 } |
| 208 return true; | 208 return true; |
| 209 } | 209 } |
| 210 | 210 |
| 211 template <typename Functor> | 211 template <typename Functor> |
| 212 void ContainerNode::insertNodeVector(const NodeVector& targets, | 212 void ContainerNode::insertNodeVector(const NodeVector& targets, |
| 213 Node* next, | 213 Node* next, |
| 214 const Functor& mutator) { | 214 const Functor& mutator) { |
| 215 InspectorInstrumentation::willInsertDOMNode(this); | 215 probe::willInsertDOMNode(this); |
| 216 NodeVector postInsertionNotificationTargets; | 216 NodeVector postInsertionNotificationTargets; |
| 217 { | 217 { |
| 218 EventDispatchForbiddenScope assertNoEventDispatch; | 218 EventDispatchForbiddenScope assertNoEventDispatch; |
| 219 ScriptForbiddenScope forbidScript; | 219 ScriptForbiddenScope forbidScript; |
| 220 for (const auto& targetNode : targets) { | 220 for (const auto& targetNode : targets) { |
| 221 DCHECK(targetNode); | 221 DCHECK(targetNode); |
| 222 DCHECK(!targetNode->parentNode()); | 222 DCHECK(!targetNode->parentNode()); |
| 223 Node& child = *targetNode; | 223 Node& child = *targetNode; |
| 224 mutator(*this, child, next); | 224 mutator(*this, child, next); |
| 225 ChildListMutationScope(*this).childAdded(child); | 225 ChildListMutationScope(*this).childAdded(child); |
| 226 if (document().containsV1ShadowTree()) | 226 if (document().containsV1ShadowTree()) |
| 227 child.checkSlotChangeAfterInserted(); | 227 child.checkSlotChangeAfterInserted(); |
| 228 InspectorInstrumentation::didInsertDOMNode(&child); | 228 probe::didInsertDOMNode(&child); |
| 229 notifyNodeInsertedInternal(child, postInsertionNotificationTargets); | 229 notifyNodeInsertedInternal(child, postInsertionNotificationTargets); |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 for (const auto& targetNode : targets) | 232 for (const auto& targetNode : targets) |
| 233 childrenChanged( | 233 childrenChanged( |
| 234 ChildrenChange::forInsertion(*targetNode, ChildrenChangeSourceAPI)); | 234 ChildrenChange::forInsertion(*targetNode, ChildrenChangeSourceAPI)); |
| 235 for (const auto& descendant : postInsertionNotificationTargets) { | 235 for (const auto& descendant : postInsertionNotificationTargets) { |
| 236 if (descendant->isConnected()) | 236 if (descendant->isConnected()) |
| 237 descendant->didNotifySubtreeInsertionsToDocument(); | 237 descendant->didNotifySubtreeInsertionsToDocument(); |
| 238 } | 238 } |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 void ContainerNode::notifyNodeInserted(Node& root, | 702 void ContainerNode::notifyNodeInserted(Node& root, |
| 703 ChildrenChangeSource source) { | 703 ChildrenChangeSource source) { |
| 704 #if DCHECK_IS_ON() | 704 #if DCHECK_IS_ON() |
| 705 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 705 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 706 #endif | 706 #endif |
| 707 DCHECK(!root.isShadowRoot()); | 707 DCHECK(!root.isShadowRoot()); |
| 708 | 708 |
| 709 if (document().containsV1ShadowTree()) | 709 if (document().containsV1ShadowTree()) |
| 710 root.checkSlotChangeAfterInserted(); | 710 root.checkSlotChangeAfterInserted(); |
| 711 | 711 |
| 712 InspectorInstrumentation::didInsertDOMNode(&root); | 712 probe::didInsertDOMNode(&root); |
| 713 | 713 |
| 714 NodeVector postInsertionNotificationTargets; | 714 NodeVector postInsertionNotificationTargets; |
| 715 notifyNodeInsertedInternal(root, postInsertionNotificationTargets); | 715 notifyNodeInsertedInternal(root, postInsertionNotificationTargets); |
| 716 | 716 |
| 717 childrenChanged(ChildrenChange::forInsertion(root, source)); | 717 childrenChanged(ChildrenChange::forInsertion(root, source)); |
| 718 | 718 |
| 719 for (const auto& targetNode : postInsertionNotificationTargets) { | 719 for (const auto& targetNode : postInsertionNotificationTargets) { |
| 720 if (targetNode->isConnected()) | 720 if (targetNode->isConnected()) |
| 721 targetNode->didNotifySubtreeInsertionsToDocument(); | 721 targetNode->didNotifySubtreeInsertionsToDocument(); |
| 722 } | 722 } |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 document->hasListenerType( | 1225 document->hasListenerType( |
| 1226 Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) { | 1226 Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) { |
| 1227 for (; c; c = NodeTraversal::next(*c, &child)) | 1227 for (; c; c = NodeTraversal::next(*c, &child)) |
| 1228 c->dispatchScopedEvent(MutationEvent::create( | 1228 c->dispatchScopedEvent(MutationEvent::create( |
| 1229 EventTypeNames::DOMNodeInsertedIntoDocument, false)); | 1229 EventTypeNames::DOMNodeInsertedIntoDocument, false)); |
| 1230 } | 1230 } |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 static void dispatchChildRemovalEvents(Node& child) { | 1233 static void dispatchChildRemovalEvents(Node& child) { |
| 1234 if (child.isInShadowTree()) { | 1234 if (child.isInShadowTree()) { |
| 1235 InspectorInstrumentation::willRemoveDOMNode(&child); | 1235 probe::willRemoveDOMNode(&child); |
| 1236 return; | 1236 return; |
| 1237 } | 1237 } |
| 1238 | 1238 |
| 1239 #if DCHECK_IS_ON() | 1239 #if DCHECK_IS_ON() |
| 1240 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 1240 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 1241 #endif | 1241 #endif |
| 1242 | 1242 |
| 1243 InspectorInstrumentation::willRemoveDOMNode(&child); | 1243 probe::willRemoveDOMNode(&child); |
| 1244 | 1244 |
| 1245 Node* c = &child; | 1245 Node* c = &child; |
| 1246 Document* document = &child.document(); | 1246 Document* document = &child.document(); |
| 1247 | 1247 |
| 1248 // Dispatch pre-removal mutation events. | 1248 // Dispatch pre-removal mutation events. |
| 1249 if (c->parentNode() && | 1249 if (c->parentNode() && |
| 1250 document->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) { | 1250 document->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) { |
| 1251 NodeChildRemovalTracker scope(child); | 1251 NodeChildRemovalTracker scope(child); |
| 1252 c->dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMNodeRemoved, | 1252 c->dispatchScopedEvent(MutationEvent::create(EventTypeNames::DOMNodeRemoved, |
| 1253 true, c->parentNode())); | 1253 true, c->parentNode())); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 return true; | 1477 return true; |
| 1478 | 1478 |
| 1479 if (node->isElementNode() && toElement(node)->shadow()) | 1479 if (node->isElementNode() && toElement(node)->shadow()) |
| 1480 return true; | 1480 return true; |
| 1481 | 1481 |
| 1482 return false; | 1482 return false; |
| 1483 } | 1483 } |
| 1484 #endif | 1484 #endif |
| 1485 | 1485 |
| 1486 } // namespace blink | 1486 } // namespace blink |
| OLD | NEW |