Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 } | 116 } |
| 117 | 117 |
| 118 static StylePropertySet* rightToLeftDeclaration() | 118 static StylePropertySet* rightToLeftDeclaration() |
| 119 { | 119 { |
| 120 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(MutableStylePropertySet, rightToLeftDec l, (MutableStylePropertySet::create())); | 120 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(MutableStylePropertySet, rightToLeftDec l, (MutableStylePropertySet::create())); |
| 121 if (rightToLeftDecl->isEmpty()) | 121 if (rightToLeftDecl->isEmpty()) |
| 122 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); | 122 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); |
| 123 return rightToLeftDecl; | 123 return rightToLeftDecl; |
| 124 } | 124 } |
| 125 | 125 |
| 126 static void collectScopedResolversForHostedShadowTrees(const Element* element, W illBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8>& resolvers) | |
| 127 { | |
| 128 ElementShadow* shadow = element->shadow(); | |
| 129 if (!shadow) | |
| 130 return; | |
| 131 | |
| 132 // Adding scoped resolver for active shadow roots for shadow host styling. | |
| 133 for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shad owRoot = shadowRoot->olderShadowRoot()) { | |
| 134 if (shadowRoot->numberOfStyles() > 0) { | |
| 135 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver( )) | |
| 136 resolvers.append(resolver); | |
| 137 } | |
| 138 } | |
| 139 } | |
| 140 | |
| 141 StyleResolver::StyleResolver(Document& document) | 126 StyleResolver::StyleResolver(Document& document) |
| 142 : m_document(document) | 127 : m_document(document) |
| 143 , m_viewportStyleResolver(ViewportStyleResolver::create(&document)) | 128 , m_viewportStyleResolver(ViewportStyleResolver::create(&document)) |
| 144 , m_needCollectFeatures(false) | 129 , m_needCollectFeatures(false) |
| 145 , m_printMediaType(false) | 130 , m_printMediaType(false) |
| 146 , m_styleResourceLoader(&document) | 131 , m_styleResourceLoader(&document) |
| 147 , m_styleSharingDepth(0) | 132 , m_styleSharingDepth(0) |
| 148 , m_accessCount(0) | 133 , m_accessCount(0) |
| 149 { | 134 { |
| 150 FrameView* view = document.view(); | 135 FrameView* view = document.view(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 { | 220 { |
| 236 // Need to recreate RuleFeatureSet. | 221 // Need to recreate RuleFeatureSet. |
| 237 m_features.clear(); | 222 m_features.clear(); |
| 238 m_siblingRuleSet.clear(); | 223 m_siblingRuleSet.clear(); |
| 239 m_uncommonAttributeRuleSet.clear(); | 224 m_uncommonAttributeRuleSet.clear(); |
| 240 m_needCollectFeatures = true; | 225 m_needCollectFeatures = true; |
| 241 } | 226 } |
| 242 | 227 |
| 243 void StyleResolver::addTreeBoundaryCrossingScope(ContainerNode& scope) | 228 void StyleResolver::addTreeBoundaryCrossingScope(ContainerNode& scope) |
| 244 { | 229 { |
| 245 m_treeBoundaryCrossingRules.addScope(scope); | 230 m_treeBoundaryCrossingScopes.add(&scope); |
| 246 } | 231 } |
| 247 | 232 |
| 248 void StyleResolver::resetAuthorStyle(TreeScope& treeScope) | 233 void StyleResolver::resetAuthorStyle(TreeScope& treeScope) |
| 249 { | 234 { |
| 250 m_treeBoundaryCrossingRules.removeScope(treeScope.rootNode()); | 235 m_treeBoundaryCrossingScopes.remove(&treeScope.rootNode()); |
| 251 | 236 |
| 252 ScopedStyleResolver* resolver = treeScope.scopedStyleResolver(); | 237 ScopedStyleResolver* resolver = treeScope.scopedStyleResolver(); |
| 253 if (!resolver) | 238 if (!resolver) |
| 254 return; | 239 return; |
| 255 | 240 |
| 256 resetRuleFeatures(); | 241 resetRuleFeatures(); |
| 257 | 242 |
| 258 if (treeScope.rootNode().isDocumentNode()) { | 243 if (treeScope.rootNode().isDocumentNode()) { |
| 259 resolver->resetAuthorStyle(); | 244 resolver->resetAuthorStyle(); |
| 260 return; | 245 return; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 341 | 326 |
| 342 void StyleResolver::popParentElement(Element& parent) | 327 void StyleResolver::popParentElement(Element& parent) |
| 343 { | 328 { |
| 344 m_selectorFilter.popParent(parent); | 329 m_selectorFilter.popParent(parent); |
| 345 } | 330 } |
| 346 | 331 |
| 347 StyleResolver::~StyleResolver() | 332 StyleResolver::~StyleResolver() |
| 348 { | 333 { |
| 349 } | 334 } |
| 350 | 335 |
| 351 static inline ScopedStyleResolver* scopedResolverFor(const Element* element) | 336 static inline ScopedStyleResolver* scopedResolverFor(const Element& element) |
| 352 { | 337 { |
| 353 // Ideally, returning element->treeScope().scopedStyleResolver() should be | 338 // Ideally, returning element->treeScope().scopedStyleResolver() should be |
| 354 // enough, but ::cue and custom pseudo elements like ::-webkit-meter-bar pie rce | 339 // enough, but ::cue and custom pseudo elements like ::-webkit-meter-bar pie rce |
| 355 // through a shadow dom boundary, yet they are not part of m_treeBoundaryCro ssingRules. | 340 // through a shadow dom boundary, yet they are not part of m_treeBoundaryCro ssingScopes. |
| 356 // The assumption here is that these rules only pierce through one boundary and | 341 // The assumption here is that these rules only pierce through one boundary and |
| 357 // that the scope of these elements do not have a style resolver due to the fact | 342 // that the scope of these elements do not have a style resolver due to the fact |
| 358 // that VTT scopes and UA shadow trees don't have <style> elements. This is | 343 // that VTT scopes and UA shadow trees don't have <style> elements. This is |
| 359 // backed up by the ASSERTs below. | 344 // backed up by the ASSERTs below. |
| 360 // | 345 // |
| 361 // FIXME: Make ::cue and custom pseudo elements part of boundary crossing ru les | 346 // FIXME: Make ::cue and custom pseudo elements part of boundary crossing ru les |
| 362 // when moving those rules to ScopedStyleResolver as part of issue 401359. | 347 // when moving those rules to ScopedStyleResolver as part of issue 401359. |
| 363 | 348 |
| 364 TreeScope* treeScope = &element->treeScope(); | 349 TreeScope* treeScope = &element.treeScope(); |
| 365 if (ScopedStyleResolver* resolver = treeScope->scopedStyleResolver()) { | 350 if (ScopedStyleResolver* resolver = treeScope->scopedStyleResolver()) { |
| 366 ASSERT(element->shadowPseudoId().isEmpty()); | 351 ASSERT(element.shadowPseudoId().isEmpty()); |
| 367 ASSERT(!element->isVTTElement()); | 352 ASSERT(!element.isVTTElement()); |
| 368 return resolver; | 353 return resolver; |
| 369 } | 354 } |
| 370 | 355 |
| 371 treeScope = treeScope->parentTreeScope(); | 356 treeScope = treeScope->parentTreeScope(); |
| 372 if (!treeScope) | 357 if (!treeScope) |
| 373 return nullptr; | 358 return nullptr; |
| 374 if (element->shadowPseudoId().isEmpty() && !element->isVTTElement()) | 359 if (element.shadowPseudoId().isEmpty() && !element.isVTTElement()) |
| 375 return nullptr; | 360 return nullptr; |
| 376 return treeScope->scopedStyleResolver(); | 361 return treeScope->scopedStyleResolver(); |
| 377 } | 362 } |
| 378 | 363 |
| 379 void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col lector, bool includeEmptyRules) | 364 void StyleResolver::matchHostRules(const Element& element, ElementRuleCollector& collector, bool includeEmptyRules) |
| 380 { | 365 { |
| 381 collector.clearMatchedRules(); | 366 ElementShadow* shadow = element.shadow(); |
| 367 if (!shadow) | |
| 368 return; | |
| 382 | 369 |
| 383 CascadeOrder cascadeOrder = 0; | 370 // Adding scoped resolvers for active shadow roots for shadow host styling. |
|
kochi
2015/08/19 10:29:24
Nit: This comment seems copied from collectScopedR
rune
2015/08/19 16:37:22
I've just dropped the comment.
| |
| 384 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolversInShad owTree; | 371 for (ShadowRoot* shadowRoot = shadow->oldestShadowRoot(); shadowRoot; shadow Root = shadowRoot->youngerShadowRoot()) { |
| 385 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree); | 372 if (!shadowRoot->numberOfStyles()) |
| 373 continue; | |
| 374 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver()) { | |
| 375 collector.clearMatchedRules(); | |
| 376 resolver->collectMatchingShadowHostRules(collector, includeEmptyRule s); | |
| 377 collector.sortAndTransferMatchedRules(); | |
| 378 collector.finishAddingAuthorRulesForTreeScope(); | |
| 379 } | |
| 380 } | |
| 381 } | |
| 386 | 382 |
| 387 // Apply :host and :host-context rules from inner scopes. | 383 ScopedStyleResolver* StyleResolver::matchElementScopeRules(const Element& elemen t, ElementRuleCollector& collector, bool includeEmptyRules) |
| 388 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j) | 384 { |
| 389 resolversInShadowTree.at(j)->collectMatchingShadowHostRules(collector, i ncludeEmptyRules, ++cascadeOrder); | 385 ScopedStyleResolver* resolver = scopedResolverFor(element); |
| 386 if (resolver) { | |
| 387 collector.clearMatchedRules(); | |
| 388 resolver->collectMatchingAuthorRules(collector, includeEmptyRules); | |
| 389 resolver->collectMatchingTreeBoundaryCrossingRules(collector, includeEmp tyRules); | |
| 390 collector.sortAndTransferMatchedRules(); | |
| 391 } | |
| 392 collector.finishAddingAuthorRulesForTreeScope(); | |
|
kochi
2015/08/19 10:29:24
Why this line can't be in the if() {} above?
rune
2015/08/19 16:37:22
Yes it could. I've restructured the code in patch
| |
| 393 return resolver; | |
| 394 } | |
| 390 | 395 |
| 391 // Apply normal rules from element scope. | 396 void StyleResolver::matchScopedRules(const Element& element, ElementRuleCollecto r& collector, bool includeEmptyRules) |
| 392 if (ScopedStyleResolver* resolver = scopedResolverFor(element)) | 397 { |
| 393 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, ++cas cadeOrder); | 398 bool matchElementScope = true; |
|
kochi
2015/08/19 10:29:24
nit: how about bool matchElementScopeDone = false;
rune
2015/08/19 16:37:22
Done.
| |
| 394 | 399 |
| 395 // Apply /deep/ and ::shadow rules from outer scopes, and ::content from inn er. | 400 for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCr ossingScopes.rend(); ++it) { |
| 396 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec tor, includeEmptyRules); | 401 const TreeScope& scope = (*it)->treeScope(); |
| 397 collector.sortAndTransferMatchedRules(); | 402 ScopedStyleResolver* resolver = scope.scopedStyleResolver(); |
| 403 ASSERT(resolver); | |
| 404 | |
| 405 if (matchElementScope && scope.isInclusiveAncestorOf(element.treeScope() )) { | |
| 406 matchElementScope = false; | |
| 407 if (matchElementScopeRules(element, collector, includeEmptyRules) == resolver) | |
|
kochi
2015/08/19 10:29:24
This looks tricky. Could you add comment why the s
rune
2015/08/19 16:37:22
I've restructured the code a bit, and added docume
| |
| 408 continue; | |
| 409 } | |
| 410 | |
| 411 collector.clearMatchedRules(); | |
| 412 resolver->collectMatchingTreeBoundaryCrossingRules(collector, includeEmp tyRules); | |
| 413 collector.sortAndTransferMatchedRules(); | |
| 414 collector.finishAddingAuthorRulesForTreeScope(); | |
| 415 } | |
| 416 | |
| 417 if (matchElementScope) | |
| 418 matchElementScopeRules(element, collector, includeEmptyRules); | |
| 419 } | |
| 420 | |
| 421 void StyleResolver::matchAuthorRules(const Element& element, ElementRuleCollecto r& collector, bool includeEmptyRules) | |
| 422 { | |
| 423 matchHostRules(element, collector, includeEmptyRules); | |
| 424 matchScopedRules(element, collector, includeEmptyRules); | |
| 398 } | 425 } |
| 399 | 426 |
| 400 void StyleResolver::matchUARules(ElementRuleCollector& collector) | 427 void StyleResolver::matchUARules(ElementRuleCollector& collector) |
| 401 { | 428 { |
| 402 collector.setMatchingUARules(true); | 429 collector.setMatchingUARules(true); |
| 403 | 430 |
| 404 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance( ); | 431 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance( ); |
| 405 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default PrintStyle() : defaultStyleSheets.defaultStyle(); | 432 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default PrintStyle() : defaultStyleSheets.defaultStyle(); |
| 406 matchRuleSet(collector, userAgentStyleSheet); | 433 matchRuleSet(collector, userAgentStyleSheet); |
| 407 | 434 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 if (state.element()->isHTMLElement()) { | 467 if (state.element()->isHTMLElement()) { |
| 441 bool isAuto; | 468 bool isAuto; |
| 442 TextDirection textDirection = toHTMLElement(state.element())->direct ionalityIfhasDirAutoAttribute(isAuto); | 469 TextDirection textDirection = toHTMLElement(state.element())->direct ionalityIfhasDirAutoAttribute(isAuto); |
| 443 if (isAuto) { | 470 if (isAuto) { |
| 444 state.setHasDirAutoAttribute(true); | 471 state.setHasDirAutoAttribute(true); |
| 445 collector.addElementStyleProperties(textDirection == LTR ? leftT oRightDeclaration() : rightToLeftDeclaration()); | 472 collector.addElementStyleProperties(textDirection == LTR ? leftT oRightDeclaration() : rightToLeftDeclaration()); |
| 446 } | 473 } |
| 447 } | 474 } |
| 448 } | 475 } |
| 449 | 476 |
| 450 matchAuthorRules(state.element(), collector, false); | 477 matchAuthorRules(*state.element(), collector, false); |
| 451 | 478 |
| 452 if (state.element()->isStyledElement()) { | 479 if (state.element()->isStyledElement()) { |
| 480 // TODO(rune@opera.com): Adding style attribute rules here is probably t oo late | |
| 481 // when you have shadow piercing combinators. When we don't have piercin g combinators, | |
| 482 // the style attribute always belong to the outermost scope whose rules apply to | |
| 483 // the element. Thus, applying inline style here is correct. Fixing this for piercing | |
| 484 // combinators means moving the code below into matchElementScopeRules a nd _not_ | |
| 485 // invoking it for pseudo style requests. | |
| 453 if (state.element()->inlineStyle()) { | 486 if (state.element()->inlineStyle()) { |
| 454 // Inline style is immutable as long as there is no CSSOM wrapper. | 487 // Inline style is immutable as long as there is no CSSOM wrapper. |
| 455 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut able(); | 488 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut able(); |
| 456 collector.addElementStyleProperties(state.element()->inlineStyle(), isInlineStyleCacheable); | 489 collector.addElementStyleProperties(state.element()->inlineStyle(), isInlineStyleCacheable); |
| 457 } | 490 } |
| 458 | 491 |
| 459 // Now check SMIL animation override style. | 492 // Now check SMIL animation override style. |
| 460 if (includeSMILProperties && state.element()->isSVGElement()) | 493 if (includeSMILProperties && state.element()->isSVGElement()) |
| 461 collector.addElementStyleProperties(toSVGElement(state.element())->a nimatedSMILStyleProperties(), false /* isCacheable */); | 494 collector.addElementStyleProperties(toSVGElement(state.element())->a nimatedSMILStyleProperties(), false /* isCacheable */); |
| 462 } | 495 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 751 | 784 |
| 752 // Since we don't use pseudo-elements in any of our quirk/print | 785 // Since we don't use pseudo-elements in any of our quirk/print |
| 753 // user agent rules, don't waste time walking those rules. | 786 // user agent rules, don't waste time walking those rules. |
| 754 | 787 |
| 755 if (!baseComputedStyle) { | 788 if (!baseComputedStyle) { |
| 756 // Check UA, user and author rules. | 789 // Check UA, user and author rules. |
| 757 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); | 790 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); |
| 758 collector.setPseudoStyleRequest(pseudoStyleRequest); | 791 collector.setPseudoStyleRequest(pseudoStyleRequest); |
| 759 | 792 |
| 760 matchUARules(collector); | 793 matchUARules(collector); |
| 761 matchAuthorRules(state.element(), collector, false); | 794 matchAuthorRules(*state.element(), collector, false); |
| 762 collector.finishAddingAuthorRulesForTreeScope(); | 795 collector.finishAddingAuthorRulesForTreeScope(); |
| 763 | 796 |
| 764 if (!collector.matchedResult().hasMatchedProperties()) | 797 if (!collector.matchedResult().hasMatchedProperties()) |
| 765 return false; | 798 return false; |
| 766 | 799 |
| 767 applyMatchedProperties(state, collector.matchedResult()); | 800 applyMatchedProperties(state, collector.matchedResult()); |
| 768 applyCallbackSelectors(state); | 801 applyCallbackSelectors(state); |
| 769 | 802 |
| 770 // Cache our original display. | 803 // Cache our original display. |
| 771 state.style()->setOriginalDisplay(state.style()->display()); | 804 state.style()->setOriginalDisplay(state.style()->display()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 902 | 935 |
| 903 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo llector& collector, PseudoId pseudoId, unsigned rulesToInclude) | 936 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo llector& collector, PseudoId pseudoId, unsigned rulesToInclude) |
| 904 { | 937 { |
| 905 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); | 938 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); |
| 906 | 939 |
| 907 if (rulesToInclude & UAAndUserCSSRules) | 940 if (rulesToInclude & UAAndUserCSSRules) |
| 908 matchUARules(collector); | 941 matchUARules(collector); |
| 909 | 942 |
| 910 if (rulesToInclude & AuthorCSSRules) { | 943 if (rulesToInclude & AuthorCSSRules) { |
| 911 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); | 944 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); |
| 912 matchAuthorRules(element, collector, rulesToInclude & EmptyCSSRules); | 945 matchAuthorRules(*element, collector, rulesToInclude & EmptyCSSRules); |
| 913 } | 946 } |
| 914 } | 947 } |
| 915 | 948 |
| 916 // ----------------------------------------------------------------------------- -------- | 949 // ----------------------------------------------------------------------------- -------- |
| 917 // this is mostly boring stuff on how to apply a certain rule to the Computedsty le... | 950 // this is mostly boring stuff on how to apply a certain rule to the Computedsty le... |
| 918 | 951 |
| 919 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele ment* animatingElement) | 952 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele ment* animatingElement) |
| 920 { | 953 { |
| 921 Element* element = state.element(); | 954 Element* element = state.element(); |
| 922 ASSERT(element); | 955 ASSERT(element); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 945 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForT ransitions); | 978 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForT ransitions); |
| 946 | 979 |
| 947 // Start loading resources used by animations. | 980 // Start loading resources used by animations. |
| 948 loadPendingResources(state); | 981 loadPendingResources(state); |
| 949 | 982 |
| 950 ASSERT(!state.fontBuilder().fontDirty()); | 983 ASSERT(!state.fontBuilder().fontDirty()); |
| 951 | 984 |
| 952 return true; | 985 return true; |
| 953 } | 986 } |
| 954 | 987 |
| 988 static void collectScopedResolversForHostedShadowTrees(const Element& element, W illBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8>& resolvers) | |
| 989 { | |
| 990 ElementShadow* shadow = element.shadow(); | |
| 991 if (!shadow) | |
| 992 return; | |
| 993 | |
| 994 // Adding scoped resolver for active shadow roots for shadow host styling. | |
| 995 for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shad owRoot = shadowRoot->olderShadowRoot()) { | |
| 996 if (shadowRoot->numberOfStyles() > 0) { | |
| 997 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver( )) | |
| 998 resolvers.append(resolver); | |
| 999 } | |
| 1000 } | |
| 1001 } | |
| 1002 | |
| 955 StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* element, con st AtomicString& animationName) | 1003 StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* element, con st AtomicString& animationName) |
| 956 { | 1004 { |
| 957 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; | 1005 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; |
| 958 collectScopedResolversForHostedShadowTrees(element, resolvers); | 1006 collectScopedResolversForHostedShadowTrees(*element, resolvers); |
| 959 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver()) | 1007 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver()) |
| 960 resolvers.append(scopedResolver); | 1008 resolvers.append(scopedResolver); |
| 961 | 1009 |
| 962 for (size_t i = 0; i < resolvers.size(); ++i) { | 1010 for (size_t i = 0; i < resolvers.size(); ++i) { |
| 963 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA nimation(animationName.impl())) | 1011 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA nimation(animationName.impl())) |
| 964 return keyframesRule; | 1012 return keyframesRule; |
| 965 } | 1013 } |
| 966 return nullptr; | 1014 return nullptr; |
| 967 } | 1015 } |
| 968 | 1016 |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1439 { | 1487 { |
| 1440 #if ENABLE(OILPAN) | 1488 #if ENABLE(OILPAN) |
| 1441 visitor->trace(m_matchedPropertiesCache); | 1489 visitor->trace(m_matchedPropertiesCache); |
| 1442 visitor->trace(m_viewportDependentMediaQueryResults); | 1490 visitor->trace(m_viewportDependentMediaQueryResults); |
| 1443 visitor->trace(m_selectorFilter); | 1491 visitor->trace(m_selectorFilter); |
| 1444 visitor->trace(m_viewportStyleResolver); | 1492 visitor->trace(m_viewportStyleResolver); |
| 1445 visitor->trace(m_features); | 1493 visitor->trace(m_features); |
| 1446 visitor->trace(m_siblingRuleSet); | 1494 visitor->trace(m_siblingRuleSet); |
| 1447 visitor->trace(m_uncommonAttributeRuleSet); | 1495 visitor->trace(m_uncommonAttributeRuleSet); |
| 1448 visitor->trace(m_watchedSelectorsRules); | 1496 visitor->trace(m_watchedSelectorsRules); |
| 1449 visitor->trace(m_treeBoundaryCrossingRules); | 1497 visitor->trace(m_treeBoundaryCrossingScopes); |
| 1450 visitor->trace(m_styleResourceLoader); | 1498 visitor->trace(m_styleResourceLoader); |
| 1451 visitor->trace(m_styleSharingLists); | 1499 visitor->trace(m_styleSharingLists); |
| 1452 visitor->trace(m_pendingStyleSheets); | 1500 visitor->trace(m_pendingStyleSheets); |
| 1453 visitor->trace(m_document); | 1501 visitor->trace(m_document); |
| 1454 #endif | 1502 #endif |
| 1455 } | 1503 } |
| 1456 | 1504 |
| 1457 } // namespace blink | 1505 } // namespace blink |
| OLD | NEW |