| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 void ElementShadow::removeAllShadowRoots() | 79 void ElementShadow::removeAllShadowRoots() |
| 80 { | 80 { |
| 81 // Dont protect this ref count. | 81 // Dont protect this ref count. |
| 82 Element* shadowHost = host(); | 82 Element* shadowHost = host(); |
| 83 | 83 |
| 84 while (RefPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) { | 84 while (RefPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) { |
| 85 InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get()); | 85 InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get()); |
| 86 shadowHost->document().removeFocusedElementOfSubtree(oldRoot.get()); | 86 shadowHost->document().removeFocusedElementOfSubtree(oldRoot.get()); |
| 87 | 87 |
| 88 if (oldRoot->attached()) | 88 if (oldRoot->confusingAndOftenMisusedAttached()) |
| 89 oldRoot->detach(); | 89 oldRoot->detach(); |
| 90 | 90 |
| 91 m_shadowRoots.removeHead(); | 91 m_shadowRoots.removeHead(); |
| 92 oldRoot->setParentOrShadowHostNode(0); | 92 oldRoot->setParentOrShadowHostNode(0); |
| 93 oldRoot->setParentTreeScope(&shadowHost->document()); | 93 oldRoot->setParentTreeScope(&shadowHost->document()); |
| 94 oldRoot->setPrev(0); | 94 oldRoot->setPrev(0); |
| 95 oldRoot->setNext(0); | 95 oldRoot->setNext(0); |
| 96 ChildNodeRemovalNotifier(shadowHost).notify(oldRoot.get()); | 96 ChildNodeRemovalNotifier(shadowHost).notify(oldRoot.get()); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void ElementShadow::attach(const Node::AttachContext& context) | 100 void ElementShadow::attach(const Node::AttachContext& context) |
| 101 { | 101 { |
| 102 Node::AttachContext childrenContext(context); | 102 Node::AttachContext childrenContext(context); |
| 103 childrenContext.resolvedStyle = 0; | 103 childrenContext.resolvedStyle = 0; |
| 104 | 104 |
| 105 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { | 105 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { |
| 106 if (!root->attached()) | 106 if (!root->confusingAndOftenMisusedAttached()) |
| 107 root->attach(childrenContext); | 107 root->attach(childrenContext); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 void ElementShadow::detach(const Node::AttachContext& context) | 111 void ElementShadow::detach(const Node::AttachContext& context) |
| 112 { | 112 { |
| 113 Node::AttachContext childrenContext(context); | 113 Node::AttachContext childrenContext(context); |
| 114 childrenContext.resolvedStyle = 0; | 114 childrenContext.resolvedStyle = 0; |
| 115 | 115 |
| 116 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { | 116 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { |
| 117 if (root->attached()) | 117 if (root->confusingAndOftenMisusedAttached()) |
| 118 root->detach(childrenContext); | 118 root->detach(childrenContext); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 void ElementShadow::removeAllEventListeners() | 122 void ElementShadow::removeAllEventListeners() |
| 123 { | 123 { |
| 124 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { | 124 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { |
| 125 for (Node* node = root; node; node = NodeTraversal::next(node)) | 125 for (Node* node = root; node; node = NodeTraversal::next(node)) |
| 126 node->removeAllEventListeners(); | 126 node->removeAllEventListeners(); |
| 127 } | 127 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 350 |
| 351 void ElementShadow::clearDistribution() | 351 void ElementShadow::clearDistribution() |
| 352 { | 352 { |
| 353 m_nodeToInsertionPoint.clear(); | 353 m_nodeToInsertionPoint.clear(); |
| 354 | 354 |
| 355 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) | 355 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) |
| 356 root->setInsertionPoint(0); | 356 root->setInsertionPoint(0); |
| 357 } | 357 } |
| 358 | 358 |
| 359 } // namespace | 359 } // namespace |
| OLD | NEW |