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 { |
| 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) | |
|
kochi
2015/08/20 13:10:02
You should pass reference instead of pointer to
om
rune
2015/08/21 07:37:46
Done.
| |
| 383 { | |
| 384 ASSERT(elementScopeResolver); | |
| 381 collector.clearMatchedRules(); | 385 collector.clearMatchedRules(); |
| 386 elementScopeResolver->collectMatchingAuthorRules(collector, includeEmptyRule s); | |
| 387 elementScopeResolver->collectMatchingTreeBoundaryCrossingRules(collector, in cludeEmptyRules); | |
| 388 collector.sortAndTransferMatchedRules(); | |
| 389 collector.finishAddingAuthorRulesForTreeScope(); | |
| 390 } | |
| 382 | 391 |
| 383 CascadeOrder cascadeOrder = 0; | 392 void StyleResolver::matchScopedRules(const Element& element, ElementRuleCollecto r& collector, bool includeEmptyRules) |
| 384 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolversInShad owTree; | 393 { |
| 385 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree); | 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. | |
| 386 | 399 |
| 387 // Apply :host and :host-context rules from inner scopes. | 400 ScopedStyleResolver* elementScopeResolver = scopedResolverFor(element); |
| 388 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j) | 401 bool matchElementScopeDone = !elementScopeResolver; |
| 389 resolversInShadowTree.at(j)->collectMatchingShadowHostRules(collector, i ncludeEmptyRules, ++cascadeOrder); | |
| 390 | 402 |
| 391 // Apply normal rules from element scope. | 403 for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCr ossingScopes.rend(); ++it) { |
| 392 if (ScopedStyleResolver* resolver = scopedResolverFor(element)) | 404 const TreeScope& scope = (*it)->treeScope(); |
| 393 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, ++cas cadeOrder); | 405 ScopedStyleResolver* resolver = scope.scopedStyleResolver(); |
| 406 ASSERT(resolver); | |
| 394 | 407 |
| 395 // Apply /deep/ and ::shadow rules from outer scopes, and ::content from inn er. | 408 if (!matchElementScopeDone && scope.isInclusiveAncestorOf(element.treeSc ope())) { |
| 396 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec tor, includeEmptyRules); | 409 |
| 397 collector.sortAndTransferMatchedRules(); | 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, includeEmpty Rules); | |
| 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, includeEmptyRule s); | |
| 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); | |
| 398 } | 438 } |
| 399 | 439 |
| 400 void StyleResolver::matchUARules(ElementRuleCollector& collector) | 440 void StyleResolver::matchUARules(ElementRuleCollector& collector) |
| 401 { | 441 { |
| 402 collector.setMatchingUARules(true); | 442 collector.setMatchingUARules(true); |
| 403 | 443 |
| 404 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance( ); | 444 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance( ); |
| 405 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default PrintStyle() : defaultStyleSheets.defaultStyle(); | 445 RuleSet* userAgentStyleSheet = m_printMediaType ? defaultStyleSheets.default PrintStyle() : defaultStyleSheets.defaultStyle(); |
| 406 matchRuleSet(collector, userAgentStyleSheet); | 446 matchRuleSet(collector, userAgentStyleSheet); |
| 407 | 447 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 if (state.element()->isHTMLElement()) { | 480 if (state.element()->isHTMLElement()) { |
| 441 bool isAuto; | 481 bool isAuto; |
| 442 TextDirection textDirection = toHTMLElement(state.element())->direct ionalityIfhasDirAutoAttribute(isAuto); | 482 TextDirection textDirection = toHTMLElement(state.element())->direct ionalityIfhasDirAutoAttribute(isAuto); |
| 443 if (isAuto) { | 483 if (isAuto) { |
| 444 state.setHasDirAutoAttribute(true); | 484 state.setHasDirAutoAttribute(true); |
| 445 collector.addElementStyleProperties(textDirection == LTR ? leftT oRightDeclaration() : rightToLeftDeclaration()); | 485 collector.addElementStyleProperties(textDirection == LTR ? leftT oRightDeclaration() : rightToLeftDeclaration()); |
| 446 } | 486 } |
| 447 } | 487 } |
| 448 } | 488 } |
| 449 | 489 |
| 450 matchAuthorRules(state.element(), collector, false); | 490 matchAuthorRules(*state.element(), collector, false); |
| 451 | 491 |
| 452 if (state.element()->isStyledElement()) { | 492 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. | |
| 453 if (state.element()->inlineStyle()) { | 499 if (state.element()->inlineStyle()) { |
| 454 // Inline style is immutable as long as there is no CSSOM wrapper. | 500 // Inline style is immutable as long as there is no CSSOM wrapper. |
| 455 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut able(); | 501 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut able(); |
| 456 collector.addElementStyleProperties(state.element()->inlineStyle(), isInlineStyleCacheable); | 502 collector.addElementStyleProperties(state.element()->inlineStyle(), isInlineStyleCacheable); |
| 457 } | 503 } |
| 458 | 504 |
| 459 // Now check SMIL animation override style. | 505 // Now check SMIL animation override style. |
| 460 if (includeSMILProperties && state.element()->isSVGElement()) | 506 if (includeSMILProperties && state.element()->isSVGElement()) |
| 461 collector.addElementStyleProperties(toSVGElement(state.element())->a nimatedSMILStyleProperties(), false /* isCacheable */); | 507 collector.addElementStyleProperties(toSVGElement(state.element())->a nimatedSMILStyleProperties(), false /* isCacheable */); |
| 462 } | 508 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 751 | 797 |
| 752 // Since we don't use pseudo-elements in any of our quirk/print | 798 // Since we don't use pseudo-elements in any of our quirk/print |
| 753 // user agent rules, don't waste time walking those rules. | 799 // user agent rules, don't waste time walking those rules. |
| 754 | 800 |
| 755 if (!baseComputedStyle) { | 801 if (!baseComputedStyle) { |
| 756 // Check UA, user and author rules. | 802 // Check UA, user and author rules. |
| 757 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); | 803 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, state.style()); |
| 758 collector.setPseudoStyleRequest(pseudoStyleRequest); | 804 collector.setPseudoStyleRequest(pseudoStyleRequest); |
| 759 | 805 |
| 760 matchUARules(collector); | 806 matchUARules(collector); |
| 761 matchAuthorRules(state.element(), collector, false); | 807 matchAuthorRules(*state.element(), collector, false); |
| 762 collector.finishAddingAuthorRulesForTreeScope(); | 808 collector.finishAddingAuthorRulesForTreeScope(); |
| 763 | 809 |
| 764 if (!collector.matchedResult().hasMatchedProperties()) | 810 if (!collector.matchedResult().hasMatchedProperties()) |
| 765 return false; | 811 return false; |
| 766 | 812 |
| 767 applyMatchedProperties(state, collector.matchedResult()); | 813 applyMatchedProperties(state, collector.matchedResult()); |
| 768 applyCallbackSelectors(state); | 814 applyCallbackSelectors(state); |
| 769 | 815 |
| 770 // Cache our original display. | 816 // Cache our original display. |
| 771 state.style()->setOriginalDisplay(state.style()->display()); | 817 state.style()->setOriginalDisplay(state.style()->display()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 902 | 948 |
| 903 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo llector& collector, PseudoId pseudoId, unsigned rulesToInclude) | 949 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo llector& collector, PseudoId pseudoId, unsigned rulesToInclude) |
| 904 { | 950 { |
| 905 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); | 951 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); |
| 906 | 952 |
| 907 if (rulesToInclude & UAAndUserCSSRules) | 953 if (rulesToInclude & UAAndUserCSSRules) |
| 908 matchUARules(collector); | 954 matchUARules(collector); |
| 909 | 955 |
| 910 if (rulesToInclude & AuthorCSSRules) { | 956 if (rulesToInclude & AuthorCSSRules) { |
| 911 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); | 957 collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); |
| 912 matchAuthorRules(element, collector, rulesToInclude & EmptyCSSRules); | 958 matchAuthorRules(*element, collector, rulesToInclude & EmptyCSSRules); |
| 913 } | 959 } |
| 914 } | 960 } |
| 915 | 961 |
| 916 // ----------------------------------------------------------------------------- -------- | 962 // ----------------------------------------------------------------------------- -------- |
| 917 // this is mostly boring stuff on how to apply a certain rule to the Computedsty le... | 963 // this is mostly boring stuff on how to apply a certain rule to the Computedsty le... |
| 918 | 964 |
| 919 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele ment* animatingElement) | 965 bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele ment* animatingElement) |
| 920 { | 966 { |
| 921 Element* element = state.element(); | 967 Element* element = state.element(); |
| 922 ASSERT(element); | 968 ASSERT(element); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 945 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForT ransitions); | 991 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForT ransitions); |
| 946 | 992 |
| 947 // Start loading resources used by animations. | 993 // Start loading resources used by animations. |
| 948 loadPendingResources(state); | 994 loadPendingResources(state); |
| 949 | 995 |
| 950 ASSERT(!state.fontBuilder().fontDirty()); | 996 ASSERT(!state.fontBuilder().fontDirty()); |
| 951 | 997 |
| 952 return true; | 998 return true; |
| 953 } | 999 } |
| 954 | 1000 |
| 1001 static void collectScopedResolversForHostedShadowTrees(const Element& element, W illBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8>& resolvers) | |
| 1002 { | |
| 1003 ElementShadow* shadow = element.shadow(); | |
| 1004 if (!shadow) | |
| 1005 return; | |
| 1006 | |
| 1007 // Adding scoped resolver for active shadow roots for shadow host styling. | |
| 1008 for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shad owRoot = shadowRoot->olderShadowRoot()) { | |
| 1009 if (shadowRoot->numberOfStyles() > 0) { | |
| 1010 if (ScopedStyleResolver* resolver = shadowRoot->scopedStyleResolver( )) | |
| 1011 resolvers.append(resolver); | |
| 1012 } | |
| 1013 } | |
| 1014 } | |
| 1015 | |
| 955 StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* element, con st AtomicString& animationName) | 1016 StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* element, con st AtomicString& animationName) |
| 956 { | 1017 { |
| 957 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; | 1018 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; |
| 958 collectScopedResolversForHostedShadowTrees(element, resolvers); | 1019 collectScopedResolversForHostedShadowTrees(*element, resolvers); |
| 959 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver()) | 1020 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver()) |
| 960 resolvers.append(scopedResolver); | 1021 resolvers.append(scopedResolver); |
| 961 | 1022 |
| 962 for (size_t i = 0; i < resolvers.size(); ++i) { | 1023 for (size_t i = 0; i < resolvers.size(); ++i) { |
| 963 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA nimation(animationName.impl())) | 1024 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA nimation(animationName.impl())) |
| 964 return keyframesRule; | 1025 return keyframesRule; |
| 965 } | 1026 } |
| 966 return nullptr; | 1027 return nullptr; |
| 967 } | 1028 } |
| 968 | 1029 |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1439 { | 1500 { |
| 1440 #if ENABLE(OILPAN) | 1501 #if ENABLE(OILPAN) |
| 1441 visitor->trace(m_matchedPropertiesCache); | 1502 visitor->trace(m_matchedPropertiesCache); |
| 1442 visitor->trace(m_viewportDependentMediaQueryResults); | 1503 visitor->trace(m_viewportDependentMediaQueryResults); |
| 1443 visitor->trace(m_selectorFilter); | 1504 visitor->trace(m_selectorFilter); |
| 1444 visitor->trace(m_viewportStyleResolver); | 1505 visitor->trace(m_viewportStyleResolver); |
| 1445 visitor->trace(m_features); | 1506 visitor->trace(m_features); |
| 1446 visitor->trace(m_siblingRuleSet); | 1507 visitor->trace(m_siblingRuleSet); |
| 1447 visitor->trace(m_uncommonAttributeRuleSet); | 1508 visitor->trace(m_uncommonAttributeRuleSet); |
| 1448 visitor->trace(m_watchedSelectorsRules); | 1509 visitor->trace(m_watchedSelectorsRules); |
| 1449 visitor->trace(m_treeBoundaryCrossingRules); | 1510 visitor->trace(m_treeBoundaryCrossingScopes); |
| 1450 visitor->trace(m_styleResourceLoader); | 1511 visitor->trace(m_styleResourceLoader); |
| 1451 visitor->trace(m_styleSharingLists); | 1512 visitor->trace(m_styleSharingLists); |
| 1452 visitor->trace(m_pendingStyleSheets); | 1513 visitor->trace(m_pendingStyleSheets); |
| 1453 visitor->trace(m_document); | 1514 visitor->trace(m_document); |
| 1454 #endif | 1515 #endif |
| 1455 } | 1516 } |
| 1456 | 1517 |
| 1457 } // namespace blink | 1518 } // namespace blink |
| OLD | NEW |