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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 , m_applyAuthorStyles(false) | 124 , m_applyAuthorStyles(false) |
125 , m_needsSelectFeatureSet(false) | 125 , m_needsSelectFeatureSet(false) |
126 { | 126 { |
127 } | 127 } |
128 | 128 |
129 ElementShadow::~ElementShadow() | 129 ElementShadow::~ElementShadow() |
130 { | 130 { |
131 removeAllShadowRoots(); | 131 removeAllShadowRoots(); |
132 } | 132 } |
133 | 133 |
134 ShadowRoot* ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::Shadow RootType type) | 134 ShadowRoot& ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::Shadow RootType type) |
135 { | 135 { |
136 RefPtr<ShadowRoot> shadowRoot = ShadowRoot::create(&shadowHost.document(), t ype); | 136 RefPtr<ShadowRoot> shadowRoot = ShadowRoot::create(&shadowHost.document(), t ype); |
137 | 137 |
138 shadowRoot->setParentOrShadowHostNode(&shadowHost); | 138 shadowRoot->setParentOrShadowHostNode(&shadowHost); |
139 shadowRoot->setParentTreeScope(&shadowHost.treeScope()); | 139 shadowRoot->setParentTreeScope(&shadowHost.treeScope()); |
140 m_shadowRoots.push(shadowRoot.get()); | 140 m_shadowRoots.push(shadowRoot.get()); |
141 ChildNodeInsertionNotifier(shadowHost).notify(*shadowRoot); | 141 ChildNodeInsertionNotifier(shadowHost).notify(*shadowRoot); |
142 setNeedsDistributionRecalc(); | 142 setNeedsDistributionRecalc(); |
143 shadowHost.lazyReattachIfAttached(); | 143 shadowHost.lazyReattachIfAttached(); |
144 | 144 |
145 // addShadowRoot() affects apply-author-styles. However, we know that the yo ungest shadow root has not had any children yet. | 145 // addShadowRoot() affects apply-author-styles. However, we know that the yo ungest shadow root has not had any children yet. |
146 // The youngest shadow root's apply-author-styles is default (false). So we can just set m_applyAuthorStyles false. | 146 // The youngest shadow root's apply-author-styles is default (false). So we can just set m_applyAuthorStyles false. |
147 m_applyAuthorStyles = false; | 147 m_applyAuthorStyles = false; |
148 | 148 |
149 shadowHost.didAddShadowRoot(*shadowRoot); | 149 shadowHost.didAddShadowRoot(*shadowRoot); |
150 InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot.get()); | 150 InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot.get()); |
151 | 151 |
152 return shadowRoot.get(); | 152 ASSERT(m_shadowRoots.head()); |
eseidel
2013/11/07 23:30:07
Did you want to ASSERT that m_shadowRoots.head() =
adamk
2013/11/08 00:01:51
The ASSERT you suggest will fail, so it can't be a
Inactive
2013/11/08 15:09:38
Well, I really wanted this assertion because I wan
| |
153 return *m_shadowRoots.head(); | |
153 } | 154 } |
154 | 155 |
155 void ElementShadow::removeAllShadowRoots() | 156 void ElementShadow::removeAllShadowRoots() |
156 { | 157 { |
157 // Dont protect this ref count. | 158 // Dont protect this ref count. |
158 Element* shadowHost = host(); | 159 Element* shadowHost = host(); |
159 ASSERT(shadowHost); | 160 ASSERT(shadowHost); |
160 | 161 |
161 while (RefPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) { | 162 while (RefPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) { |
162 InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get()); | 163 InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get()); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 | 361 |
361 void ElementShadow::clearDistribution() | 362 void ElementShadow::clearDistribution() |
362 { | 363 { |
363 m_nodeToInsertionPoints.clear(); | 364 m_nodeToInsertionPoints.clear(); |
364 | 365 |
365 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) | 366 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) |
366 root->setShadowInsertionPointOfYoungerShadowRoot(0); | 367 root->setShadowInsertionPointOfYoungerShadowRoot(0); |
367 } | 368 } |
368 | 369 |
369 } // namespace | 370 } // namespace |
OLD | NEW |