| 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) |
| 365 { |
| 366 ElementShadow* shadow = element.shadow(); |
| 367 if (!shadow) |
| 368 return; |
| 369 |
| 370 for (ShadowRoot* shadowRoot = shadow->oldestShadowRoot(); shadowRoot; shadow
Root = shadowRoot->youngerShadowRoot()) { |
| 371 if (!shadowRoot->numberOfStyles()) |
| 372 continue; |
| 373 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver()) { |
| 374 collector.clearMatchedRules(); |
| 375 resolver->collectMatchingShadowHostRules(collector, includeEmptyRule
s); |
| 376 collector.sortAndTransferMatchedRules(); |
| 377 collector.finishAddingAuthorRulesForTreeScope(); |
| 378 } |
| 379 } |
| 380 } |
| 381 |
| 382 void StyleResolver::matchElementScopeRules(ScopedStyleResolver& elementScopeReso
lver, ElementRuleCollector& collector, bool includeEmptyRules) |
| 380 { | 383 { |
| 381 collector.clearMatchedRules(); | 384 collector.clearMatchedRules(); |
| 385 elementScopeResolver.collectMatchingAuthorRules(collector, includeEmptyRules
); |
| 386 elementScopeResolver.collectMatchingTreeBoundaryCrossingRules(collector, inc
ludeEmptyRules); |
| 387 collector.sortAndTransferMatchedRules(); |
| 388 collector.finishAddingAuthorRulesForTreeScope(); |
| 389 } |
| 382 | 390 |
| 383 CascadeOrder cascadeOrder = 0; | 391 void StyleResolver::matchScopedRules(const Element& element, ElementRuleCollecto
r& collector, bool includeEmptyRules) |
| 384 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolversInShad
owTree; | 392 { |
| 385 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree); | 393 // Match rules from treeScopes in the reverse tree-of-trees order, since the |
| 394 // cascading order for normal rules is such that when comparing rules from |
| 395 // different shadow trees, the rule from the tree which comes first in the |
| 396 // tree-of-trees order wins. From other treeScopes than the element's own |
| 397 // scope, only tree-boundary-crossing rules may match. |
| 386 | 398 |
| 387 // Apply :host and :host-context rules from inner scopes. | 399 ScopedStyleResolver* elementScopeResolver = scopedResolverFor(element); |
| 388 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j) | 400 bool matchElementScopeDone = !elementScopeResolver; |
| 389 resolversInShadowTree.at(j)->collectMatchingShadowHostRules(collector, i
ncludeEmptyRules, ++cascadeOrder); | |
| 390 | 401 |
| 391 // Apply normal rules from element scope. | 402 for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCr
ossingScopes.rend(); ++it) { |
| 392 if (ScopedStyleResolver* resolver = scopedResolverFor(element)) | 403 const TreeScope& scope = (*it)->treeScope(); |
| 393 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, ++cas
cadeOrder); | 404 ScopedStyleResolver* resolver = scope.scopedStyleResolver(); |
| 405 ASSERT(resolver); |
| 394 | 406 |
| 395 // Apply /deep/ and ::shadow rules from outer scopes, and ::content from inn
er. | 407 if (!matchElementScopeDone && scope.isInclusiveAncestorOf(element.treeSc
ope())) { |
| 396 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec
tor, includeEmptyRules); | 408 |
| 397 collector.sortAndTransferMatchedRules(); | 409 matchElementScopeDone = true; |
| 410 |
| 411 // At this point, the iterator has either encountered the scope for
the element |
| 412 // itself (if that scope has boundary-crossing rules), or the iterat
or has moved |
| 413 // to a scope which appears before the element's scope in the tree-o
f-trees order. |
| 414 // Try to match all rules from the element's scope. |
| 415 |
| 416 matchElementScopeRules(*elementScopeResolver, collector, includeEmpt
yRules); |
| 417 if (resolver == elementScopeResolver) { |
| 418 // Boundary-crossing rules already collected in matchElementScop
eRules. |
| 419 continue; |
| 420 } |
| 421 } |
| 422 |
| 423 collector.clearMatchedRules(); |
| 424 resolver->collectMatchingTreeBoundaryCrossingRules(collector, includeEmp
tyRules); |
| 425 collector.sortAndTransferMatchedRules(); |
| 426 collector.finishAddingAuthorRulesForTreeScope(); |
| 427 } |
| 428 |
| 429 if (!matchElementScopeDone) |
| 430 matchElementScopeRules(*elementScopeResolver, collector, includeEmptyRul
es); |
| 431 } |
| 432 |
| 433 void StyleResolver::matchAuthorRules(const Element& element, ElementRuleCollecto
r& collector, bool includeEmptyRules) |
| 434 { |
| 435 matchHostRules(element, collector, includeEmptyRules); |
| 436 matchScopedRules(element, collector, includeEmptyRules); |
| 398 } | 437 } |
| 399 | 438 |
| 400 void StyleResolver::matchUARules(ElementRuleCollector& collector) | 439 void StyleResolver::matchUARules(ElementRuleCollector& collector) |
| 401 { | 440 { |
| 402 collector.setMatchingUARules(true); | 441 collector.setMatchingUARules(true); |
| 403 | 442 |
| 404 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance(
); | 443 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance(
); |
| 405 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default
PrintStyle() : defaultStyleSheets.defaultStyle(); | 444 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default
PrintStyle() : defaultStyleSheets.defaultStyle(); |
| 406 matchRuleSet(collector, userAgentStyleSheet); | 445 matchRuleSet(collector, userAgentStyleSheet); |
| 407 | 446 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 if (state.element()->isHTMLElement()) { | 479 if (state.element()->isHTMLElement()) { |
| 441 bool isAuto; | 480 bool isAuto; |
| 442 TextDirection textDirection = toHTMLElement(state.element())->direct
ionalityIfhasDirAutoAttribute(isAuto); | 481 TextDirection textDirection = toHTMLElement(state.element())->direct
ionalityIfhasDirAutoAttribute(isAuto); |
| 443 if (isAuto) { | 482 if (isAuto) { |
| 444 state.setHasDirAutoAttribute(true); | 483 state.setHasDirAutoAttribute(true); |
| 445 collector.addElementStyleProperties(textDirection == LTR ? leftT
oRightDeclaration() : rightToLeftDeclaration()); | 484 collector.addElementStyleProperties(textDirection == LTR ? leftT
oRightDeclaration() : rightToLeftDeclaration()); |
| 446 } | 485 } |
| 447 } | 486 } |
| 448 } | 487 } |
| 449 | 488 |
| 450 matchAuthorRules(state.element(), collector, false); | 489 matchAuthorRules(*state.element(), collector, false); |
| 451 | 490 |
| 452 if (state.element()->isStyledElement()) { | 491 if (state.element()->isStyledElement()) { |
| 492 // TODO(rune@opera.com): Adding style attribute rules here is probably t
oo late |
| 493 // when you have shadow piercing combinators. When we don't have piercin
g combinators, |
| 494 // the style attribute always belong to the outermost scope whose rules
apply to |
| 495 // the element. Thus, applying inline style here is correct. Fixing this
for piercing |
| 496 // combinators means moving the code below into matchElementScopeRules a
nd _not_ |
| 497 // invoking it for pseudo style requests. |
| 453 if (state.element()->inlineStyle()) { | 498 if (state.element()->inlineStyle()) { |
| 454 // Inline style is immutable as long as there is no CSSOM wrapper. | 499 // Inline style is immutable as long as there is no CSSOM wrapper. |
| 455 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); | 500 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); |
| 456 collector.addElementStyleProperties(state.element()->inlineStyle(),
isInlineStyleCacheable); | 501 collector.addElementStyleProperties(state.element()->inlineStyle(),
isInlineStyleCacheable); |
| 457 } | 502 } |
| 458 | 503 |
| 459 // Now check SMIL animation override style. | 504 // Now check SMIL animation override style. |
| 460 if (includeSMILProperties && state.element()->isSVGElement()) | 505 if (includeSMILProperties && state.element()->isSVGElement()) |
| 461 collector.addElementStyleProperties(toSVGElement(state.element())->a
nimatedSMILStyleProperties(), false /* isCacheable */); | 506 collector.addElementStyleProperties(toSVGElement(state.element())->a
nimatedSMILStyleProperties(), false /* isCacheable */); |
| 462 } | 507 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 | 796 |
| 752 // Since we don't use pseudo-elements in any of our quirk/print | 797 // Since we don't use pseudo-elements in any of our quirk/print |
| 753 // user agent rules, don't waste time walking those rules. | 798 // user agent rules, don't waste time walking those rules. |
| 754 | 799 |
| 755 if (!baseComputedStyle) { | 800 if (!baseComputedStyle) { |
| 756 // Check UA, user and author rules. | 801 // Check UA, user and author rules. |
| 757 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); | 802 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); |
| 758 collector.setPseudoStyleRequest(pseudoStyleRequest); | 803 collector.setPseudoStyleRequest(pseudoStyleRequest); |
| 759 | 804 |
| 760 matchUARules(collector); | 805 matchUARules(collector); |
| 761 matchAuthorRules(state.element(), collector, false); | 806 matchAuthorRules(*state.element(), collector, false); |
| 762 collector.finishAddingAuthorRulesForTreeScope(); | 807 collector.finishAddingAuthorRulesForTreeScope(); |
| 763 | 808 |
| 764 if (!collector.matchedResult().hasMatchedProperties()) | 809 if (!collector.matchedResult().hasMatchedProperties()) |
| 765 return false; | 810 return false; |
| 766 | 811 |
| 767 applyMatchedProperties(state, collector.matchedResult()); | 812 applyMatchedProperties(state, collector.matchedResult()); |
| 768 applyCallbackSelectors(state); | 813 applyCallbackSelectors(state); |
| 769 | 814 |
| 770 // Cache our original display. | 815 // Cache our original display. |
| 771 state.style()->setOriginalDisplay(state.style()->display()); | 816 state.style()->setOriginalDisplay(state.style()->display()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 | 947 |
| 903 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo
llector& collector, PseudoId pseudoId, unsigned rulesToInclude) | 948 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo
llector& collector, PseudoId pseudoId, unsigned rulesToInclude) |
| 904 { | 949 { |
| 905 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); | 950 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); |
| 906 | 951 |
| 907 if (rulesToInclude & UAAndUserCSSRules) | 952 if (rulesToInclude & UAAndUserCSSRules) |
| 908 matchUARules(collector); | 953 matchUARules(collector); |
| 909 | 954 |
| 910 if (rulesToInclude & AuthorCSSRules) { | 955 if (rulesToInclude & AuthorCSSRules) { |
| 911 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); | 956 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); |
| 912 matchAuthorRules(element, collector, rulesToInclude & EmptyCSSRules); | 957 matchAuthorRules(*element, collector, rulesToInclude & EmptyCSSRules); |
| 913 } | 958 } |
| 914 } | 959 } |
| 915 | 960 |
| 916 // -----------------------------------------------------------------------------
-------- | 961 // -----------------------------------------------------------------------------
-------- |
| 917 // this is mostly boring stuff on how to apply a certain rule to the Computedsty
le... | 962 // this is mostly boring stuff on how to apply a certain rule to the Computedsty
le... |
| 918 | 963 |
| 919 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele
ment* animatingElement) | 964 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele
ment* animatingElement) |
| 920 { | 965 { |
| 921 Element* element = state.element(); | 966 Element* element = state.element(); |
| 922 ASSERT(element); | 967 ASSERT(element); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 945 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForT
ransitions); | 990 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForT
ransitions); |
| 946 | 991 |
| 947 // Start loading resources used by animations. | 992 // Start loading resources used by animations. |
| 948 loadPendingResources(state); | 993 loadPendingResources(state); |
| 949 | 994 |
| 950 ASSERT(!state.fontBuilder().fontDirty()); | 995 ASSERT(!state.fontBuilder().fontDirty()); |
| 951 | 996 |
| 952 return true; | 997 return true; |
| 953 } | 998 } |
| 954 | 999 |
| 1000 static void collectScopedResolversForHostedShadowTrees(const Element& element, W
illBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8>& resolvers) |
| 1001 { |
| 1002 ElementShadow* shadow = element.shadow(); |
| 1003 if (!shadow) |
| 1004 return; |
| 1005 |
| 1006 // Adding scoped resolver for active shadow roots for shadow host styling. |
| 1007 for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shad
owRoot = shadowRoot->olderShadowRoot()) { |
| 1008 if (shadowRoot->numberOfStyles() > 0) { |
| 1009 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver(
)) |
| 1010 resolvers.append(resolver); |
| 1011 } |
| 1012 } |
| 1013 } |
| 1014 |
| 955 StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* element, con
st AtomicString& animationName) | 1015 StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* element, con
st AtomicString& animationName) |
| 956 { | 1016 { |
| 957 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; | 1017 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; |
| 958 collectScopedResolversForHostedShadowTrees(element, resolvers); | 1018 collectScopedResolversForHostedShadowTrees(*element, resolvers); |
| 959 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe
solver()) | 1019 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe
solver()) |
| 960 resolvers.append(scopedResolver); | 1020 resolvers.append(scopedResolver); |
| 961 | 1021 |
| 962 for (size_t i = 0; i < resolvers.size(); ++i) { | 1022 for (size_t i = 0; i < resolvers.size(); ++i) { |
| 963 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA
nimation(animationName.impl())) | 1023 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA
nimation(animationName.impl())) |
| 964 return keyframesRule; | 1024 return keyframesRule; |
| 965 } | 1025 } |
| 966 return nullptr; | 1026 return nullptr; |
| 967 } | 1027 } |
| 968 | 1028 |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 { | 1499 { |
| 1440 #if ENABLE(OILPAN) | 1500 #if ENABLE(OILPAN) |
| 1441 visitor->trace(m_matchedPropertiesCache); | 1501 visitor->trace(m_matchedPropertiesCache); |
| 1442 visitor->trace(m_viewportDependentMediaQueryResults); | 1502 visitor->trace(m_viewportDependentMediaQueryResults); |
| 1443 visitor->trace(m_selectorFilter); | 1503 visitor->trace(m_selectorFilter); |
| 1444 visitor->trace(m_viewportStyleResolver); | 1504 visitor->trace(m_viewportStyleResolver); |
| 1445 visitor->trace(m_features); | 1505 visitor->trace(m_features); |
| 1446 visitor->trace(m_siblingRuleSet); | 1506 visitor->trace(m_siblingRuleSet); |
| 1447 visitor->trace(m_uncommonAttributeRuleSet); | 1507 visitor->trace(m_uncommonAttributeRuleSet); |
| 1448 visitor->trace(m_watchedSelectorsRules); | 1508 visitor->trace(m_watchedSelectorsRules); |
| 1449 visitor->trace(m_treeBoundaryCrossingRules); | 1509 visitor->trace(m_treeBoundaryCrossingScopes); |
| 1450 visitor->trace(m_styleResourceLoader); | 1510 visitor->trace(m_styleResourceLoader); |
| 1451 visitor->trace(m_styleSharingLists); | 1511 visitor->trace(m_styleSharingLists); |
| 1452 visitor->trace(m_pendingStyleSheets); | 1512 visitor->trace(m_pendingStyleSheets); |
| 1453 visitor->trace(m_document); | 1513 visitor->trace(m_document); |
| 1454 #endif | 1514 #endif |
| 1455 } | 1515 } |
| 1456 | 1516 |
| 1457 } // namespace blink | 1517 } // namespace blink |
| OLD | NEW |