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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 behaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary; |
119 | 119 |
120 if (!applyAuthorStyles) | 120 if (!applyAuthorStyles) |
121 behaviorAtBoundary |= SelectorChecker::ScopeContainsLastMatchedElement; | 121 behaviorAtBoundary |= SelectorChecker::ScopeContainsLastMatchedElement; |
122 | 122 |
123 if (m_scopingNode.isShadowRoot()) { | 123 if (m_scopingNode.isShadowRoot()) |
124 scopingNode = toShadowRoot(m_scopingNode).host(); | 124 behaviorAtBoundary |= SelectorChecker::ScopeIsShadowRoot; |
125 behaviorAtBoundary |= SelectorChecker::ScopeIsShadowHost; | |
126 } | |
127 | 125 |
128 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); | 126 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); |
129 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 127 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
130 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, scopingNode, m_authorStyleSheets[i], applyAuthorStyles, i); | 128 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, scopingNode, m_authorStyleSheets[i], applyAuthorStyles, i); |
131 collector.collectMatchingRules(matchRequest, ruleRange, static_cast<Sele
ctorChecker::BehaviorAtBoundary>(behaviorAtBoundary), cascadeScope, cascadeOrder
); | 129 collector.collectMatchingRules(matchRequest, ruleRange, static_cast<Sele
ctorChecker::BehaviorAtBoundary>(behaviorAtBoundary), cascadeScope, cascadeOrder
); |
132 } | 130 } |
133 } | 131 } |
134 | 132 |
135 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) | 133 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) |
136 { | 134 { |
137 // Only consider the global author RuleSet for @page rules, as per the HTML5
spec. | 135 // Only consider the global author RuleSet for @page rules, as per the HTML5
spec. |
138 ASSERT(m_scopingNode.isDocumentNode()); | 136 ASSERT(m_scopingNode.isDocumentNode()); |
139 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 137 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
140 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; | 138 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; |
141 } | 139 } |
142 | 140 |
143 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const | 141 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const |
144 { | 142 { |
145 if (!m_scopingNode.isDocumentNode()) | 143 if (!m_scopingNode.isDocumentNode()) |
146 return; | 144 return; |
147 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 145 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
148 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); | 146 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); |
149 } | 147 } |
150 | 148 |
151 } // namespace WebCore | 149 } // namespace WebCore |
OLD | NEW |