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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 | 505 |
506 if (!document().mayContainV0Shadow()) { | 506 if (!document().mayContainV0Shadow()) { |
507 matchSlottedRules(element, collector); | 507 matchSlottedRules(element, collector); |
508 matchElementScopeRules(element, elementScopeResolver, collector); | 508 matchElementScopeRules(element, elementScopeResolver, collector); |
509 return; | 509 return; |
510 } | 510 } |
511 | 511 |
512 bool matchElementScopeDone = !elementScopeResolver && !element.inlineStyle()
; | 512 bool matchElementScopeDone = !elementScopeResolver && !element.inlineStyle()
; |
513 | 513 |
514 for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCr
ossingScopes.rend(); ++it) { | 514 for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCr
ossingScopes.rend(); ++it) { |
515 const TreeScope& scope = (*it)->treeScope(); | 515 const TreeScope& scope = (*it)->containingTreeScope(); |
516 ScopedStyleResolver* resolver = scope.scopedStyleResolver(); | 516 ScopedStyleResolver* resolver = scope.scopedStyleResolver(); |
517 ASSERT(resolver); | 517 ASSERT(resolver); |
518 | 518 |
519 bool isInnerTreeScope = element.treeScope().isInclusiveAncestorOf(scope)
; | 519 bool isInnerTreeScope = element.containingTreeScope().isInclusiveAncesto
rOf(scope); |
520 if (!shouldCheckScope(element, **it, isInnerTreeScope)) | 520 if (!shouldCheckScope(element, **it, isInnerTreeScope)) |
521 continue; | 521 continue; |
522 | 522 |
523 if (!matchElementScopeDone && scope.isInclusiveAncestorOf(element.treeSc
ope())) { | 523 if (!matchElementScopeDone && scope.isInclusiveAncestorOf(element.contai
ningTreeScope())) { |
524 | 524 |
525 matchElementScopeDone = true; | 525 matchElementScopeDone = true; |
526 | 526 |
527 // At this point, the iterator has either encountered the scope for
the element | 527 // At this point, the iterator has either encountered the scope for
the element |
528 // itself (if that scope has boundary-crossing rules), or the iterat
or has moved | 528 // itself (if that scope has boundary-crossing rules), or the iterat
or has moved |
529 // to a scope which appears before the element's scope in the tree-o
f-trees order. | 529 // to a scope which appears before the element's scope in the tree-o
f-trees order. |
530 // Try to match all rules from the element's scope. | 530 // Try to match all rules from the element's scope. |
531 | 531 |
532 matchElementScopeRules(element, elementScopeResolver, collector); | 532 matchElementScopeRules(element, elementScopeResolver, collector); |
533 if (resolver == elementScopeResolver) { | 533 if (resolver == elementScopeResolver) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 return; | 653 return; |
654 | 654 |
655 // When comparing rules declared in outer treescopes, outer's rules win. | 655 // When comparing rules declared in outer treescopes, outer's rules win. |
656 CascadeOrder outerCascadeOrder = m_treeBoundaryCrossingScopes.size() * 2; | 656 CascadeOrder outerCascadeOrder = m_treeBoundaryCrossingScopes.size() * 2; |
657 // When comparing rules declared in inner treescopes, inner's rules win. | 657 // When comparing rules declared in inner treescopes, inner's rules win. |
658 CascadeOrder innerCascadeOrder = m_treeBoundaryCrossingScopes.size(); | 658 CascadeOrder innerCascadeOrder = m_treeBoundaryCrossingScopes.size(); |
659 | 659 |
660 for (const auto& scopingNode : m_treeBoundaryCrossingScopes) { | 660 for (const auto& scopingNode : m_treeBoundaryCrossingScopes) { |
661 // Skip rule collection for element when tree boundary crossing rules of
scopingNode's | 661 // Skip rule collection for element when tree boundary crossing rules of
scopingNode's |
662 // scope can never apply to it. | 662 // scope can never apply to it. |
663 bool isInnerTreeScope = element.treeScope().isInclusiveAncestorOf(scopin
gNode->treeScope()); | 663 bool isInnerTreeScope = element.containingTreeScope().isInclusiveAncesto
rOf(scopingNode->containingTreeScope()); |
664 if (!shouldCheckScope(element, *scopingNode, isInnerTreeScope)) | 664 if (!shouldCheckScope(element, *scopingNode, isInnerTreeScope)) |
665 continue; | 665 continue; |
666 | 666 |
667 CascadeOrder cascadeOrder = isInnerTreeScope ? innerCascadeOrder : outer
CascadeOrder; | 667 CascadeOrder cascadeOrder = isInnerTreeScope ? innerCascadeOrder : outer
CascadeOrder; |
668 scopingNode->treeScope().scopedStyleResolver()->collectMatchingTreeBound
aryCrossingRules(collector, cascadeOrder); | 668 scopingNode->treeScope().scopedStyleResolver()->collectMatchingTreeBound
aryCrossingRules(collector, cascadeOrder); |
669 | 669 |
670 ++innerCascadeOrder; | 670 ++innerCascadeOrder; |
671 --outerCascadeOrder; | 671 --outerCascadeOrder; |
672 } | 672 } |
673 } | 673 } |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 visitor->trace(m_siblingRuleSet); | 1735 visitor->trace(m_siblingRuleSet); |
1736 visitor->trace(m_uncommonAttributeRuleSet); | 1736 visitor->trace(m_uncommonAttributeRuleSet); |
1737 visitor->trace(m_watchedSelectorsRules); | 1737 visitor->trace(m_watchedSelectorsRules); |
1738 visitor->trace(m_treeBoundaryCrossingScopes); | 1738 visitor->trace(m_treeBoundaryCrossingScopes); |
1739 visitor->trace(m_styleSharingLists); | 1739 visitor->trace(m_styleSharingLists); |
1740 visitor->trace(m_pendingStyleSheets); | 1740 visitor->trace(m_pendingStyleSheets); |
1741 visitor->trace(m_document); | 1741 visitor->trace(m_document); |
1742 } | 1742 } |
1743 | 1743 |
1744 } // namespace blink | 1744 } // namespace blink |
OLD | NEW |