| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 removeDetachedShadowRoots(); | 142 removeDetachedShadowRoots(); |
| 143 #endif | 143 #endif |
| 144 } | 144 } |
| 145 | 145 |
| 146 ShadowRoot& ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::Shadow
RootType type) | 146 ShadowRoot& ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::Shadow
RootType type) |
| 147 { | 147 { |
| 148 EventDispatchForbiddenScope assertNoEventDispatch; | 148 EventDispatchForbiddenScope assertNoEventDispatch; |
| 149 ScriptForbiddenScope forbidScript; | 149 ScriptForbiddenScope forbidScript; |
| 150 | 150 |
| 151 if (type == ShadowRoot::OpenShadowRoot) { | 151 if (type == ShadowRoot::OpenShadowRoot) { |
| 152 if (!youngestShadowRoot() || youngestShadowRoot()->type() == ShadowRoot:
:UserAgentShadowRoot) | 152 if (!youngestShadowRoot()) { |
| 153 shadowHost.willAddFirstOpenShadowRoot(); | 153 shadowHost.willAddFirstOpenShadowRoot(); |
| 154 else | 154 } else if (youngestShadowRoot()->type() == ShadowRoot::UserAgentShadowRo
ot) { |
| 155 UseCounter::count(shadowHost.document(), UseCounter::ElementCreateSh
adowRootMultiple); | 155 shadowHost.willAddFirstOpenShadowRoot(); |
| 156 UseCounter::countDeprecation(shadowHost.document(), UseCounter::Elem
entCreateShadowRootMultipleWithUserAgentShadowRoot); |
| 157 } else { |
| 158 UseCounter::countDeprecation(shadowHost.document(), UseCounter::Elem
entCreateShadowRootMultiple); |
| 159 } |
| 156 } | 160 } |
| 157 | 161 |
| 158 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) | 162 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) |
| 159 root->lazyReattachIfAttached(); | 163 root->lazyReattachIfAttached(); |
| 160 | 164 |
| 161 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = ShadowRoot::create(shadowHost.do
cument(), type); | 165 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = ShadowRoot::create(shadowHost.do
cument(), type); |
| 162 shadowRoot->setParentOrShadowHostNode(&shadowHost); | 166 shadowRoot->setParentOrShadowHostNode(&shadowHost); |
| 163 shadowRoot->setParentTreeScope(shadowHost.treeScope()); | 167 shadowRoot->setParentTreeScope(shadowHost.treeScope()); |
| 164 m_shadowRoots.push(shadowRoot.get()); | 168 m_shadowRoots.push(shadowRoot.get()); |
| 165 setNeedsDistributionRecalc(); | 169 setNeedsDistributionRecalc(); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 visitor->trace(m_nodeToInsertionPoints); | 380 visitor->trace(m_nodeToInsertionPoints); |
| 377 visitor->trace(m_selectFeatures); | 381 visitor->trace(m_selectFeatures); |
| 378 // Shadow roots are linked with previous and next pointers which are traced. | 382 // Shadow roots are linked with previous and next pointers which are traced. |
| 379 // It is therefore enough to trace one of the shadow roots here and the | 383 // It is therefore enough to trace one of the shadow roots here and the |
| 380 // rest will be traced from there. | 384 // rest will be traced from there. |
| 381 visitor->trace(m_shadowRoots.head()); | 385 visitor->trace(m_shadowRoots.head()); |
| 382 #endif | 386 #endif |
| 383 } | 387 } |
| 384 | 388 |
| 385 } // namespace | 389 } // namespace |
| OLD | NEW |