| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 static StylePropertySet* rightToLeftDeclaration() | 119 static StylePropertySet* rightToLeftDeclaration() |
| 120 { | 120 { |
| 121 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(MutableStylePropertySet, rightToLeftDec
l, (MutableStylePropertySet::create(HTMLQuirksMode))); | 121 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(MutableStylePropertySet, rightToLeftDec
l, (MutableStylePropertySet::create(HTMLQuirksMode))); |
| 122 if (rightToLeftDecl->isEmpty()) | 122 if (rightToLeftDecl->isEmpty()) |
| 123 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); | 123 rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); |
| 124 return rightToLeftDecl; | 124 return rightToLeftDecl; |
| 125 } | 125 } |
| 126 | 126 |
| 127 static void collectScopedResolversForHostedShadowTrees(const Element* element, W
illBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8>& resolvers) |
| 128 { |
| 129 ElementShadow* shadow = element->shadow(); |
| 130 if (!shadow) |
| 131 return; |
| 132 |
| 133 // Adding scoped resolver for active shadow roots for shadow host styling. |
| 134 for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shad
owRoot = shadowRoot->olderShadowRoot()) { |
| 135 if (shadowRoot->numberOfStyles() > 0) { |
| 136 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver(
)) |
| 137 resolvers.append(resolver); |
| 138 } |
| 139 } |
| 140 } |
| 141 |
| 127 StyleResolver::StyleResolver(Document& document) | 142 StyleResolver::StyleResolver(Document& document) |
| 128 : m_document(document) | 143 : m_document(document) |
| 129 , m_viewportStyleResolver(ViewportStyleResolver::create(&document)) | 144 , m_viewportStyleResolver(ViewportStyleResolver::create(&document)) |
| 130 , m_needCollectFeatures(false) | 145 , m_needCollectFeatures(false) |
| 131 , m_printMediaType(false) | 146 , m_printMediaType(false) |
| 132 , m_styleResourceLoader(&document) | 147 , m_styleResourceLoader(&document) |
| 133 , m_styleSharingDepth(0) | 148 , m_styleSharingDepth(0) |
| 134 , m_accessCount(0) | 149 , m_accessCount(0) |
| 135 { | 150 { |
| 136 FrameView* view = document.view(); | 151 FrameView* view = document.view(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 { | 236 { |
| 222 // Need to recreate RuleFeatureSet. | 237 // Need to recreate RuleFeatureSet. |
| 223 m_features.clear(); | 238 m_features.clear(); |
| 224 m_siblingRuleSet.clear(); | 239 m_siblingRuleSet.clear(); |
| 225 m_uncommonAttributeRuleSet.clear(); | 240 m_uncommonAttributeRuleSet.clear(); |
| 226 m_needCollectFeatures = true; | 241 m_needCollectFeatures = true; |
| 227 } | 242 } |
| 228 | 243 |
| 229 void StyleResolver::addTreeBoundaryCrossingScope(ContainerNode& scope) | 244 void StyleResolver::addTreeBoundaryCrossingScope(ContainerNode& scope) |
| 230 { | 245 { |
| 231 m_treeBoundaryCrossingScopes.add(&scope); | 246 m_treeBoundaryCrossingRules.addScope(scope); |
| 232 } | 247 } |
| 233 | 248 |
| 234 void StyleResolver::resetAuthorStyle(TreeScope& treeScope) | 249 void StyleResolver::resetAuthorStyle(TreeScope& treeScope) |
| 235 { | 250 { |
| 236 m_treeBoundaryCrossingScopes.remove(&treeScope.rootNode()); | 251 m_treeBoundaryCrossingRules.removeScope(treeScope.rootNode()); |
| 237 | 252 |
| 238 ScopedStyleResolver* resolver = treeScope.scopedStyleResolver(); | 253 ScopedStyleResolver* resolver = treeScope.scopedStyleResolver(); |
| 239 if (!resolver) | 254 if (!resolver) |
| 240 return; | 255 return; |
| 241 | 256 |
| 242 resetRuleFeatures(); | 257 resetRuleFeatures(); |
| 243 | 258 |
| 244 if (treeScope.rootNode().isDocumentNode()) { | 259 if (treeScope.rootNode().isDocumentNode()) { |
| 245 resolver->resetAuthorStyle(); | 260 resolver->resetAuthorStyle(); |
| 246 return; | 261 return; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 342 |
| 328 void StyleResolver::popParentElement(Element& parent) | 343 void StyleResolver::popParentElement(Element& parent) |
| 329 { | 344 { |
| 330 m_selectorFilter.popParent(parent); | 345 m_selectorFilter.popParent(parent); |
| 331 } | 346 } |
| 332 | 347 |
| 333 StyleResolver::~StyleResolver() | 348 StyleResolver::~StyleResolver() |
| 334 { | 349 { |
| 335 } | 350 } |
| 336 | 351 |
| 337 static inline ScopedStyleResolver* scopedResolverFor(const Element& element) | 352 static inline ScopedStyleResolver* scopedResolverFor(const Element* element) |
| 338 { | 353 { |
| 339 // Ideally, returning element->treeScope().scopedStyleResolver() should be | 354 // Ideally, returning element->treeScope().scopedStyleResolver() should be |
| 340 // enough, but ::cue and custom pseudo elements like ::-webkit-meter-bar pie
rce | 355 // enough, but ::cue and custom pseudo elements like ::-webkit-meter-bar pie
rce |
| 341 // through a shadow dom boundary, yet they are not part of m_treeBoundaryCro
ssingScopes. | 356 // through a shadow dom boundary, yet they are not part of m_treeBoundaryCro
ssingRules. |
| 342 // The assumption here is that these rules only pierce through one boundary
and | 357 // The assumption here is that these rules only pierce through one boundary
and |
| 343 // that the scope of these elements do not have a style resolver due to the
fact | 358 // that the scope of these elements do not have a style resolver due to the
fact |
| 344 // that VTT scopes and UA shadow trees don't have <style> elements. This is | 359 // that VTT scopes and UA shadow trees don't have <style> elements. This is |
| 345 // backed up by the ASSERTs below. | 360 // backed up by the ASSERTs below. |
| 346 // | 361 // |
| 347 // FIXME: Make ::cue and custom pseudo elements part of boundary crossing ru
les | 362 // FIXME: Make ::cue and custom pseudo elements part of boundary crossing ru
les |
| 348 // when moving those rules to ScopedStyleResolver as part of issue 401359. | 363 // when moving those rules to ScopedStyleResolver as part of issue 401359. |
| 349 | 364 |
| 350 TreeScope* treeScope = &element.treeScope(); | 365 TreeScope* treeScope = &element->treeScope(); |
| 351 if (ScopedStyleResolver* resolver = treeScope->scopedStyleResolver()) { | 366 if (ScopedStyleResolver* resolver = treeScope->scopedStyleResolver()) { |
| 352 ASSERT(element.shadowPseudoId().isEmpty()); | 367 ASSERT(element->shadowPseudoId().isEmpty()); |
| 353 ASSERT(!element.isVTTElement()); | 368 ASSERT(!element->isVTTElement()); |
| 354 return resolver; | 369 return resolver; |
| 355 } | 370 } |
| 356 | 371 |
| 357 treeScope = treeScope->parentTreeScope(); | 372 treeScope = treeScope->parentTreeScope(); |
| 358 if (!treeScope) | 373 if (!treeScope) |
| 359 return nullptr; | 374 return nullptr; |
| 360 if (element.shadowPseudoId().isEmpty() && !element.isVTTElement()) | 375 if (element->shadowPseudoId().isEmpty() && !element->isVTTElement()) |
| 361 return nullptr; | 376 return nullptr; |
| 362 return treeScope->scopedStyleResolver(); | 377 return treeScope->scopedStyleResolver(); |
| 363 } | 378 } |
| 364 | 379 |
| 365 void StyleResolver::matchHostRules(const Element& element, ElementRuleCollector&
collector, bool includeEmptyRules) | 380 void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col
lector, bool includeEmptyRules) |
| 366 { | |
| 367 ElementShadow* shadow = element.shadow(); | |
| 368 if (!shadow) | |
| 369 return; | |
| 370 | |
| 371 for (ShadowRoot* shadowRoot = shadow->oldestShadowRoot(); shadowRoot; shadow
Root = shadowRoot->youngerShadowRoot()) { | |
| 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 } | |
| 382 | |
| 383 void StyleResolver::matchElementScopeRules(ScopedStyleResolver& elementScopeReso
lver, ElementRuleCollector& collector, bool includeEmptyRules) | |
| 384 { | 381 { |
| 385 collector.clearMatchedRules(); | 382 collector.clearMatchedRules(); |
| 386 elementScopeResolver.collectMatchingAuthorRules(collector, includeEmptyRules
); | 383 |
| 387 elementScopeResolver.collectMatchingTreeBoundaryCrossingRules(collector, inc
ludeEmptyRules); | 384 CascadeOrder cascadeOrder = 0; |
| 385 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolversInShad
owTree; |
| 386 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree); |
| 387 |
| 388 // Apply :host and :host-context rules from inner scopes. |
| 389 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j) |
| 390 resolversInShadowTree.at(j)->collectMatchingShadowHostRules(collector, i
ncludeEmptyRules, ++cascadeOrder); |
| 391 |
| 392 // Apply normal rules from element scope. |
| 393 if (ScopedStyleResolver* resolver = scopedResolverFor(element)) |
| 394 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, ++cas
cadeOrder); |
| 395 |
| 396 // Apply /deep/ and ::shadow rules from outer scopes, and ::content from inn
er. |
| 397 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec
tor, includeEmptyRules); |
| 388 collector.sortAndTransferMatchedRules(); | 398 collector.sortAndTransferMatchedRules(); |
| 389 collector.finishAddingAuthorRulesForTreeScope(); | |
| 390 } | |
| 391 | |
| 392 void StyleResolver::matchScopedRules(const Element& element, ElementRuleCollecto
r& collector, bool includeEmptyRules) | |
| 393 { | |
| 394 // Match rules from treeScopes in the reverse tree-of-trees order, since the | |
| 395 // cascading order for normal rules is such that when comparing rules from | |
| 396 // different shadow trees, the rule from the tree which comes first in the | |
| 397 // tree-of-trees order wins. From other treeScopes than the element's own | |
| 398 // scope, only tree-boundary-crossing rules may match. | |
| 399 | |
| 400 ScopedStyleResolver* elementScopeResolver = scopedResolverFor(element); | |
| 401 bool matchElementScopeDone = !elementScopeResolver; | |
| 402 | |
| 403 for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCr
ossingScopes.rend(); ++it) { | |
| 404 const TreeScope& scope = (*it)->treeScope(); | |
| 405 ScopedStyleResolver* resolver = scope.scopedStyleResolver(); | |
| 406 ASSERT(resolver); | |
| 407 | |
| 408 if (!matchElementScopeDone && scope.isInclusiveAncestorOf(element.treeSc
ope())) { | |
| 409 | |
| 410 matchElementScopeDone = true; | |
| 411 | |
| 412 // At this point, the iterator has either encountered the scope for
the element | |
| 413 // itself (if that scope has boundary-crossing rules), or the iterat
or has moved | |
| 414 // to a scope which appears before the element's scope in the tree-o
f-trees order. | |
| 415 // Try to match all rules from the element's scope. | |
| 416 | |
| 417 matchElementScopeRules(*elementScopeResolver, collector, includeEmpt
yRules); | |
| 418 if (resolver == elementScopeResolver) { | |
| 419 // Boundary-crossing rules already collected in matchElementScop
eRules. | |
| 420 continue; | |
| 421 } | |
| 422 } | |
| 423 | |
| 424 collector.clearMatchedRules(); | |
| 425 resolver->collectMatchingTreeBoundaryCrossingRules(collector, includeEmp
tyRules); | |
| 426 collector.sortAndTransferMatchedRules(); | |
| 427 collector.finishAddingAuthorRulesForTreeScope(); | |
| 428 } | |
| 429 | |
| 430 if (!matchElementScopeDone) | |
| 431 matchElementScopeRules(*elementScopeResolver, collector, includeEmptyRul
es); | |
| 432 } | |
| 433 | |
| 434 void StyleResolver::matchAuthorRules(const Element& element, ElementRuleCollecto
r& collector, bool includeEmptyRules) | |
| 435 { | |
| 436 matchHostRules(element, collector, includeEmptyRules); | |
| 437 matchScopedRules(element, collector, includeEmptyRules); | |
| 438 } | 399 } |
| 439 | 400 |
| 440 void StyleResolver::matchUARules(ElementRuleCollector& collector) | 401 void StyleResolver::matchUARules(ElementRuleCollector& collector) |
| 441 { | 402 { |
| 442 collector.setMatchingUARules(true); | 403 collector.setMatchingUARules(true); |
| 443 | 404 |
| 444 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance(
); | 405 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance(
); |
| 445 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default
PrintStyle() : defaultStyleSheets.defaultStyle(); | 406 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default
PrintStyle() : defaultStyleSheets.defaultStyle(); |
| 446 matchRuleSet(collector, userAgentStyleSheet); | 407 matchRuleSet(collector, userAgentStyleSheet); |
| 447 | 408 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 if (state.element()->isHTMLElement()) { | 441 if (state.element()->isHTMLElement()) { |
| 481 bool isAuto; | 442 bool isAuto; |
| 482 TextDirection textDirection = toHTMLElement(state.element())->direct
ionalityIfhasDirAutoAttribute(isAuto); | 443 TextDirection textDirection = toHTMLElement(state.element())->direct
ionalityIfhasDirAutoAttribute(isAuto); |
| 483 if (isAuto) { | 444 if (isAuto) { |
| 484 state.setHasDirAutoAttribute(true); | 445 state.setHasDirAutoAttribute(true); |
| 485 collector.addElementStyleProperties(textDirection == LTR ? leftT
oRightDeclaration() : rightToLeftDeclaration()); | 446 collector.addElementStyleProperties(textDirection == LTR ? leftT
oRightDeclaration() : rightToLeftDeclaration()); |
| 486 } | 447 } |
| 487 } | 448 } |
| 488 } | 449 } |
| 489 | 450 |
| 490 matchAuthorRules(*state.element(), collector, false); | 451 matchAuthorRules(state.element(), collector, false); |
| 491 | 452 |
| 492 if (state.element()->isStyledElement()) { | 453 if (state.element()->isStyledElement()) { |
| 493 // TODO(rune@opera.com): Adding style attribute rules here is probably t
oo late | |
| 494 // when you have shadow piercing combinators. When we don't have piercin
g combinators, | |
| 495 // the style attribute always belong to the outermost scope whose rules
apply to | |
| 496 // the element. Thus, applying inline style here is correct. Fixing this
for piercing | |
| 497 // combinators means moving the code below into matchElementScopeRules a
nd _not_ | |
| 498 // invoking it for pseudo style requests. | |
| 499 if (state.element()->inlineStyle()) { | 454 if (state.element()->inlineStyle()) { |
| 500 // Inline style is immutable as long as there is no CSSOM wrapper. | 455 // Inline style is immutable as long as there is no CSSOM wrapper. |
| 501 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); | 456 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut
able(); |
| 502 collector.addElementStyleProperties(state.element()->inlineStyle(),
isInlineStyleCacheable); | 457 collector.addElementStyleProperties(state.element()->inlineStyle(),
isInlineStyleCacheable); |
| 503 } | 458 } |
| 504 | 459 |
| 505 // Now check SMIL animation override style. | 460 // Now check SMIL animation override style. |
| 506 if (includeSMILProperties && state.element()->isSVGElement()) | 461 if (includeSMILProperties && state.element()->isSVGElement()) |
| 507 collector.addElementStyleProperties(toSVGElement(state.element())->a
nimatedSMILStyleProperties(), false /* isCacheable */); | 462 collector.addElementStyleProperties(toSVGElement(state.element())->a
nimatedSMILStyleProperties(), false /* isCacheable */); |
| 508 } | 463 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 | 730 |
| 776 // Since we don't use pseudo-elements in any of our quirk/print | 731 // Since we don't use pseudo-elements in any of our quirk/print |
| 777 // user agent rules, don't waste time walking those rules. | 732 // user agent rules, don't waste time walking those rules. |
| 778 | 733 |
| 779 if (!baseComputedStyle) { | 734 if (!baseComputedStyle) { |
| 780 // Check UA, user and author rules. | 735 // Check UA, user and author rules. |
| 781 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); | 736 ElementRuleCollector collector(state.elementContext(), m_selectorFilter,
state.style()); |
| 782 collector.setPseudoStyleRequest(pseudoStyleRequest); | 737 collector.setPseudoStyleRequest(pseudoStyleRequest); |
| 783 | 738 |
| 784 matchUARules(collector); | 739 matchUARules(collector); |
| 785 matchAuthorRules(*state.element(), collector, false); | 740 matchAuthorRules(state.element(), collector, false); |
| 786 collector.finishAddingAuthorRulesForTreeScope(); | 741 collector.finishAddingAuthorRulesForTreeScope(); |
| 787 | 742 |
| 788 if (!collector.matchedResult().hasMatchedProperties()) | 743 if (!collector.matchedResult().hasMatchedProperties()) |
| 789 return false; | 744 return false; |
| 790 | 745 |
| 791 applyMatchedProperties(state, collector.matchedResult()); | 746 applyMatchedProperties(state, collector.matchedResult()); |
| 792 applyCallbackSelectors(state); | 747 applyCallbackSelectors(state); |
| 793 | 748 |
| 794 // Cache our original display. | 749 // Cache our original display. |
| 795 state.style()->setOriginalDisplay(state.style()->display()); | 750 state.style()->setOriginalDisplay(state.style()->display()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 | 881 |
| 927 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo
llector& collector, PseudoId pseudoId, unsigned rulesToInclude) | 882 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo
llector& collector, PseudoId pseudoId, unsigned rulesToInclude) |
| 928 { | 883 { |
| 929 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); | 884 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); |
| 930 | 885 |
| 931 if (rulesToInclude & UAAndUserCSSRules) | 886 if (rulesToInclude & UAAndUserCSSRules) |
| 932 matchUARules(collector); | 887 matchUARules(collector); |
| 933 | 888 |
| 934 if (rulesToInclude & AuthorCSSRules) { | 889 if (rulesToInclude & AuthorCSSRules) { |
| 935 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); | 890 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); |
| 936 matchAuthorRules(*element, collector, rulesToInclude & EmptyCSSRules); | 891 matchAuthorRules(element, collector, rulesToInclude & EmptyCSSRules); |
| 937 } | 892 } |
| 938 } | 893 } |
| 939 | 894 |
| 940 // -----------------------------------------------------------------------------
-------- | 895 // -----------------------------------------------------------------------------
-------- |
| 941 // this is mostly boring stuff on how to apply a certain rule to the Computedsty
le... | 896 // this is mostly boring stuff on how to apply a certain rule to the Computedsty
le... |
| 942 | 897 |
| 943 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele
ment* animatingElement) | 898 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele
ment* animatingElement) |
| 944 { | 899 { |
| 945 Element* element = state.element(); | 900 Element* element = state.element(); |
| 946 ASSERT(element); | 901 ASSERT(element); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 976 // Start loading resources used by animations. | 931 // Start loading resources used by animations. |
| 977 loadPendingResources(state); | 932 loadPendingResources(state); |
| 978 | 933 |
| 979 ASSERT(!state.fontBuilder().fontDirty()); | 934 ASSERT(!state.fontBuilder().fontDirty()); |
| 980 | 935 |
| 981 state.setApplyPropertyToVisitedLinkStyle(false); | 936 state.setApplyPropertyToVisitedLinkStyle(false); |
| 982 | 937 |
| 983 return true; | 938 return true; |
| 984 } | 939 } |
| 985 | 940 |
| 986 static void collectScopedResolversForHostedShadowTrees(const Element& element, W
illBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8>& resolvers) | |
| 987 { | |
| 988 ElementShadow* shadow = element.shadow(); | |
| 989 if (!shadow) | |
| 990 return; | |
| 991 | |
| 992 // Adding scoped resolver for active shadow roots for shadow host styling. | |
| 993 for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shad
owRoot = shadowRoot->olderShadowRoot()) { | |
| 994 if (shadowRoot->numberOfStyles() > 0) { | |
| 995 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver(
)) | |
| 996 resolvers.append(resolver); | |
| 997 } | |
| 998 } | |
| 999 } | |
| 1000 | |
| 1001 StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* element, con
st AtomicString& animationName) | 941 StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* element, con
st AtomicString& animationName) |
| 1002 { | 942 { |
| 1003 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; | 943 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; |
| 1004 collectScopedResolversForHostedShadowTrees(*element, resolvers); | 944 collectScopedResolversForHostedShadowTrees(element, resolvers); |
| 1005 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe
solver()) | 945 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe
solver()) |
| 1006 resolvers.append(scopedResolver); | 946 resolvers.append(scopedResolver); |
| 1007 | 947 |
| 1008 for (size_t i = 0; i < resolvers.size(); ++i) { | 948 for (size_t i = 0; i < resolvers.size(); ++i) { |
| 1009 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA
nimation(animationName.impl())) | 949 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA
nimation(animationName.impl())) |
| 1010 return keyframesRule; | 950 return keyframesRule; |
| 1011 } | 951 } |
| 1012 return nullptr; | 952 return nullptr; |
| 1013 } | 953 } |
| 1014 | 954 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 { | 1476 { |
| 1537 #if ENABLE(OILPAN) | 1477 #if ENABLE(OILPAN) |
| 1538 visitor->trace(m_matchedPropertiesCache); | 1478 visitor->trace(m_matchedPropertiesCache); |
| 1539 visitor->trace(m_viewportDependentMediaQueryResults); | 1479 visitor->trace(m_viewportDependentMediaQueryResults); |
| 1540 visitor->trace(m_selectorFilter); | 1480 visitor->trace(m_selectorFilter); |
| 1541 visitor->trace(m_viewportStyleResolver); | 1481 visitor->trace(m_viewportStyleResolver); |
| 1542 visitor->trace(m_features); | 1482 visitor->trace(m_features); |
| 1543 visitor->trace(m_siblingRuleSet); | 1483 visitor->trace(m_siblingRuleSet); |
| 1544 visitor->trace(m_uncommonAttributeRuleSet); | 1484 visitor->trace(m_uncommonAttributeRuleSet); |
| 1545 visitor->trace(m_watchedSelectorsRules); | 1485 visitor->trace(m_watchedSelectorsRules); |
| 1546 visitor->trace(m_treeBoundaryCrossingScopes); | 1486 visitor->trace(m_treeBoundaryCrossingRules); |
| 1547 visitor->trace(m_styleResourceLoader); | 1487 visitor->trace(m_styleResourceLoader); |
| 1548 visitor->trace(m_styleSharingLists); | 1488 visitor->trace(m_styleSharingLists); |
| 1549 visitor->trace(m_pendingStyleSheets); | 1489 visitor->trace(m_pendingStyleSheets); |
| 1550 visitor->trace(m_document); | 1490 visitor->trace(m_document); |
| 1551 #endif | 1491 #endif |
| 1552 } | 1492 } |
| 1553 | 1493 |
| 1554 } // namespace blink | 1494 } // namespace blink |
| OLD | NEW |