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 12 matching lines...) Expand all Loading... |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "core/dom/shadow/ElementShadow.h" | 27 #include "core/dom/shadow/ElementShadow.h" |
28 | 28 |
29 #include "core/css/StyleSheetList.h" | 29 #include "core/css/StyleSheetList.h" |
30 #include "core/dom/ElementTraversal.h" | 30 #include "core/dom/ElementTraversal.h" |
31 #include "core/dom/NodeTraversal.h" | 31 #include "core/dom/NodeTraversal.h" |
32 #include "core/dom/StyleChangeReason.h" | 32 #include "core/dom/StyleChangeReason.h" |
| 33 #include "core/dom/StyleEngine.h" |
33 #include "core/dom/shadow/DistributedNodes.h" | 34 #include "core/dom/shadow/DistributedNodes.h" |
34 #include "core/frame/Deprecation.h" | 35 #include "core/frame/Deprecation.h" |
35 #include "core/html/HTMLContentElement.h" | 36 #include "core/html/HTMLContentElement.h" |
36 #include "core/html/HTMLShadowElement.h" | 37 #include "core/html/HTMLShadowElement.h" |
37 #include "core/inspector/InspectorInstrumentation.h" | 38 #include "core/inspector/InspectorInstrumentation.h" |
38 #include "platform/EventDispatchForbiddenScope.h" | 39 #include "platform/EventDispatchForbiddenScope.h" |
39 #include "platform/ScriptForbiddenScope.h" | 40 #include "platform/ScriptForbiddenScope.h" |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 164 } |
164 | 165 |
165 for (ShadowRoot* root = m_shadowRoots.head(); root; root = root->olderShadow
Root()) | 166 for (ShadowRoot* root = m_shadowRoots.head(); root; root = root->olderShadow
Root()) |
166 root->lazyReattachIfAttached(); | 167 root->lazyReattachIfAttached(); |
167 | 168 |
168 ShadowRoot* shadowRoot = ShadowRoot::create(shadowHost.document(), type); | 169 ShadowRoot* shadowRoot = ShadowRoot::create(shadowHost.document(), type); |
169 shadowRoot->setParentOrShadowHostNode(&shadowHost); | 170 shadowRoot->setParentOrShadowHostNode(&shadowHost); |
170 shadowRoot->setParentTreeScope(shadowHost.treeScope()); | 171 shadowRoot->setParentTreeScope(shadowHost.treeScope()); |
171 m_shadowRoots.push(shadowRoot); | 172 m_shadowRoots.push(shadowRoot); |
172 setNeedsDistributionRecalc(); | 173 setNeedsDistributionRecalc(); |
| 174 if (shadowHost.document().shadowCascadeOrder() == ShadowCascadeOrder::Shadow
CascadeV1) |
| 175 shadowHost.document().updateAssignment(); |
173 | 176 |
174 shadowRoot->insertedInto(&shadowHost); | 177 shadowRoot->insertedInto(&shadowHost); |
175 shadowHost.setChildNeedsStyleRecalc(); | 178 shadowHost.setChildNeedsStyleRecalc(); |
176 shadowHost.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTraci
ng::create(StyleChangeReason::Shadow)); | 179 shadowHost.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTraci
ng::create(StyleChangeReason::Shadow)); |
177 | 180 |
178 InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot); | 181 InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot); |
179 | 182 |
180 return *shadowRoot; | 183 return *shadowRoot; |
181 } | 184 } |
182 | 185 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 344 } |
342 | 345 |
343 void ElementShadow::willAffectSelector() | 346 void ElementShadow::willAffectSelector() |
344 { | 347 { |
345 for (ElementShadow* shadow = this; shadow; shadow = shadow->containingShadow
()) { | 348 for (ElementShadow* shadow = this; shadow; shadow = shadow->containingShadow
()) { |
346 if (shadow->needsSelectFeatureSet()) | 349 if (shadow->needsSelectFeatureSet()) |
347 break; | 350 break; |
348 shadow->setNeedsSelectFeatureSet(); | 351 shadow->setNeedsSelectFeatureSet(); |
349 } | 352 } |
350 setNeedsDistributionRecalc(); | 353 setNeedsDistributionRecalc(); |
| 354 if (host()->document().shadowCascadeOrder() == ShadowCascadeOrder::ShadowCas
cadeV1) |
| 355 host()->document().updateAssignment(); |
351 } | 356 } |
352 | 357 |
353 void ElementShadow::clearDistribution() | 358 void ElementShadow::clearDistribution() |
354 { | 359 { |
355 m_nodeToInsertionPoints.clear(); | 360 m_nodeToInsertionPoints.clear(); |
356 | 361 |
357 for (ShadowRoot* root = &youngestShadowRoot(); root; root = root->olderShado
wRoot()) | 362 for (ShadowRoot* root = &youngestShadowRoot(); root; root = root->olderShado
wRoot()) |
358 root->setShadowInsertionPointOfYoungerShadowRoot(nullptr); | 363 root->setShadowInsertionPointOfYoungerShadowRoot(nullptr); |
359 } | 364 } |
360 | 365 |
361 DEFINE_TRACE(ElementShadow) | 366 DEFINE_TRACE(ElementShadow) |
362 { | 367 { |
363 visitor->trace(m_nodeToInsertionPoints); | 368 visitor->trace(m_nodeToInsertionPoints); |
364 visitor->trace(m_selectFeatures); | 369 visitor->trace(m_selectFeatures); |
365 // Shadow roots are linked with previous and next pointers which are traced. | 370 // Shadow roots are linked with previous and next pointers which are traced. |
366 // It is therefore enough to trace one of the shadow roots here and the | 371 // It is therefore enough to trace one of the shadow roots here and the |
367 // rest will be traced from there. | 372 // rest will be traced from there. |
368 visitor->trace(m_shadowRoots.head()); | 373 visitor->trace(m_shadowRoots.head()); |
369 } | 374 } |
370 | 375 |
371 } // namespace blink | 376 } // namespace blink |
OLD | NEW |