| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(rule->name().imp
l()); | 114 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(rule->name().imp
l()); |
| 115 if (it == m_keyframesRuleMap.end()) | 115 if (it == m_keyframesRuleMap.end()) |
| 116 m_keyframesRuleMap.set(s.impl(), rule); | 116 m_keyframesRuleMap.set(s.impl(), rule); |
| 117 else if (it->value->isVendorPrefixed()) | 117 else if (it->value->isVendorPrefixed()) |
| 118 m_keyframesRuleMap.set(s.impl(), rule); | 118 m_keyframesRuleMap.set(s.impl(), rule); |
| 119 } else { | 119 } else { |
| 120 m_keyframesRuleMap.set(s.impl(), rule); | 120 m_keyframesRuleMap.set(s.impl(), rule); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle
ctor, bool includeEmptyRules, bool applyAuthorStyles, CascadeScope cascadeScope,
CascadeOrder cascadeOrder) | 124 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle
ctor, bool includeEmptyRules, bool isInShadowTree, CascadeScope cascadeScope, Ca
scadeOrder cascadeOrder) |
| 125 { | 125 { |
| 126 unsigned contextFlags = SelectorChecker::DefaultBehavior; | |
| 127 | |
| 128 if (!applyAuthorStyles) | |
| 129 contextFlags |= SelectorChecker::ScopeContainsLastMatchedElement; | |
| 130 | |
| 131 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); | 126 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); |
| 132 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 127 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
| 133 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], applyAuthorSt
yles, i); | 128 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i, isInShadow
Tree); |
| 134 collector.collectMatchingRules(matchRequest, ruleRange, static_cast<Sele
ctorChecker::ContextFlags>(contextFlags), cascadeScope, cascadeOrder); | 129 collector.collectMatchingRules(matchRequest, ruleRange, cascadeScope, ca
scadeOrder); |
| 135 } | 130 } |
| 136 } | 131 } |
| 137 | 132 |
| 138 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) | 133 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) |
| 139 { | 134 { |
| 140 // 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. |
| 141 ASSERT(m_scope->rootNode().isDocumentNode()); | 136 ASSERT(m_scope->rootNode().isDocumentNode()); |
| 142 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 137 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
| 143 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; | 138 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; |
| 144 } | 139 } |
| 145 | 140 |
| 146 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const | 141 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const |
| 147 { | 142 { |
| 148 if (!m_scope->rootNode().isDocumentNode()) | 143 if (!m_scope->rootNode().isDocumentNode()) |
| 149 return; | 144 return; |
| 150 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 145 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
| 151 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); | 146 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); |
| 152 } | 147 } |
| 153 | 148 |
| 154 void ScopedStyleResolver::trace(Visitor* visitor) | 149 void ScopedStyleResolver::trace(Visitor* visitor) |
| 155 { | 150 { |
| 156 #if ENABLE(OILPAN) | 151 #if ENABLE(OILPAN) |
| 157 visitor->trace(m_scope); | 152 visitor->trace(m_scope); |
| 158 visitor->trace(m_authorStyleSheets); | 153 visitor->trace(m_authorStyleSheets); |
| 159 visitor->trace(m_keyframesRuleMap); | 154 visitor->trace(m_keyframesRuleMap); |
| 160 #endif | 155 #endif |
| 161 } | 156 } |
| 162 | 157 |
| 163 } // namespace blink | 158 } // namespace blink |
| OLD | NEW |