OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 else if (it->value->isVendorPrefixed()) | 108 else if (it->value->isVendorPrefixed()) |
109 m_keyframesRuleMap.set(s.impl(), rule); | 109 m_keyframesRuleMap.set(s.impl(), rule); |
110 } else { | 110 } else { |
111 m_keyframesRuleMap.set(s.impl(), rule); | 111 m_keyframesRuleMap.set(s.impl(), rule); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle
ctor, bool includeEmptyRules, bool applyAuthorStyles, CascadeScope cascadeScope,
CascadeOrder cascadeOrder) | 115 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle
ctor, bool includeEmptyRules, bool applyAuthorStyles, CascadeScope cascadeScope,
CascadeOrder cascadeOrder) |
116 { | 116 { |
117 const ContainerNode* scopingNode = &m_scopingNode; | 117 const ContainerNode* scopingNode = &m_scopingNode; |
118 unsigned behaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary; | 118 unsigned contextFlags = SelectorChecker::DefaultBehavior; |
119 | 119 |
120 if (!applyAuthorStyles) | 120 if (!applyAuthorStyles) |
121 behaviorAtBoundary |= SelectorChecker::ScopeContainsLastMatchedElement; | 121 contextFlags |= SelectorChecker::ScopeContainsLastMatchedElement; |
122 | |
123 if (m_scopingNode.isShadowRoot()) | |
124 behaviorAtBoundary |= SelectorChecker::ScopeIsShadowRoot; | |
125 | 122 |
126 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); | 123 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); |
127 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 124 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
128 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, scopingNode, m_authorStyleSheets[i], applyAuthorStyles, i); | 125 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, scopingNode, m_authorStyleSheets[i], applyAuthorStyles, i); |
129 collector.collectMatchingRules(matchRequest, ruleRange, static_cast<Sele
ctorChecker::BehaviorAtBoundary>(behaviorAtBoundary), cascadeScope, cascadeOrder
); | 126 collector.collectMatchingRules(matchRequest, ruleRange, static_cast<Sele
ctorChecker::ContextFlags>(contextFlags), cascadeScope, cascadeOrder); |
130 } | 127 } |
131 } | 128 } |
132 | 129 |
133 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) | 130 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) |
134 { | 131 { |
135 // Only consider the global author RuleSet for @page rules, as per the HTML5
spec. | 132 // Only consider the global author RuleSet for @page rules, as per the HTML5
spec. |
136 ASSERT(m_scopingNode.isDocumentNode()); | 133 ASSERT(m_scopingNode.isDocumentNode()); |
137 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 134 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
138 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; | 135 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; |
139 } | 136 } |
140 | 137 |
141 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const | 138 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const |
142 { | 139 { |
143 if (!m_scopingNode.isDocumentNode()) | 140 if (!m_scopingNode.isDocumentNode()) |
144 return; | 141 return; |
145 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 142 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
146 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); | 143 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); |
147 } | 144 } |
148 | 145 |
149 } // namespace WebCore | 146 } // namespace WebCore |
OLD | NEW |