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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Now transfer the set of matched rules over to our list of declarations. | 117 // Now transfer the set of matched rules over to our list of declarations. |
118 for (unsigned i = 0; i < matchedRules.size(); i++) { | 118 for (unsigned i = 0; i < matchedRules.size(); i++) { |
119 const RuleData* ruleData = matchedRules[i].ruleData(); | 119 const RuleData* ruleData = matchedRules[i].ruleData(); |
120 m_result.addMatchedProperties(&ruleData->rule()->properties()); | 120 m_result.addMatchedProperties(&ruleData->rule()->properties()); |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData) | 124 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData) |
125 { | 125 { |
126 SelectorChecker checker(*m_context.element()); | 126 SelectorChecker checker(*m_context.element()); |
127 if (checker.match(ruleData.selector())) { | 127 bool matched = checker.match(ruleData.selector()); |
128 if (checker.matchedAttributeSelector()) | 128 |
129 m_style->setUnique(); | 129 if (checker.matchedAttributeSelector()) |
130 if (checker.matchedFocusSelector()) | 130 m_style->setUnique(); |
131 m_style->setAffectedByFocus(); | 131 |
132 if (checker.matchedHoverSelector()) | 132 if (checker.matchedFocusSelector()) |
133 m_style->setAffectedByHover(); | 133 m_style->setAffectedByFocus(); |
134 if (checker.matchedActiveSelector()) | 134 |
135 m_style->setAffectedByActive(); | 135 if (checker.matchedHoverSelector()) |
136 return true; | 136 m_style->setAffectedByHover(); |
137 } | 137 |
138 return false; | 138 if (checker.matchedActiveSelector()) |
| 139 m_style->setAffectedByActive(); |
| 140 |
| 141 return matched; |
139 } | 142 } |
140 | 143 |
141 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad
eOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange) | 144 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad
eOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange) |
142 { | 145 { |
143 StyleRule* rule = ruleData.rule(); | 146 StyleRule* rule = ruleData.rule(); |
144 if (ruleMatches(ruleData)) { | 147 if (ruleMatches(ruleData)) { |
145 // If the rule has no properties to apply, then ignore it in the non-deb
ug mode. | 148 // If the rule has no properties to apply, then ignore it in the non-deb
ug mode. |
146 const StylePropertySet& properties = rule->properties(); | 149 const StylePropertySet& properties = rule->properties(); |
147 if (properties.isEmpty()) | 150 if (properties.isEmpty()) |
148 return; | 151 return; |
(...skipping 13 matching lines...) Expand all Loading... |
162 return matchedRule1.position() < matchedRule2.position(); | 165 return matchedRule1.position() < matchedRule2.position(); |
163 } | 166 } |
164 | 167 |
165 void ElementRuleCollector::sortMatchedRules() | 168 void ElementRuleCollector::sortMatchedRules() |
166 { | 169 { |
167 ASSERT(m_matchedRules); | 170 ASSERT(m_matchedRules); |
168 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules); | 171 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules); |
169 } | 172 } |
170 | 173 |
171 } // namespace blink | 174 } // namespace blink |
OLD | NEW |