| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 // Now transfer the set of matched rules over to our list of declarations. | 124 // Now transfer the set of matched rules over to our list of declarations. |
| 125 for (unsigned i = 0; i < matchedRules.size(); i++) { | 125 for (unsigned i = 0; i < matchedRules.size(); i++) { |
| 126 const RuleData* ruleData = matchedRules[i].ruleData(); | 126 const RuleData* ruleData = matchedRules[i].ruleData(); |
| 127 m_result.addMatchedProperties(&ruleData->rule()->properties()); | 127 m_result.addMatchedProperties(&ruleData->rule()->properties()); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const Co
ntainerNode* scope) | 131 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const Co
ntainerNode* scope) |
| 132 { | 132 { |
| 133 SelectorChecker selectorChecker; | 133 SelectorChecker checker(*m_context.element()); |
| 134 SelectorChecker::SelectorCheckingContext context(ruleData.selector(), m_cont
ext.element()); | 134 if (checker.match(ruleData.selector(), scope)) { |
| 135 context.scope = scope; | 135 if (checker.matchedAttributeSelector()) |
| 136 if (selectorChecker.match(context)) { | |
| 137 if (selectorChecker.matchedAttributeSelector()) | |
| 138 m_style->setUnique(); | 136 m_style->setUnique(); |
| 139 if (selectorChecker.matchedFocusSelector()) | 137 if (checker.matchedFocusSelector()) |
| 140 m_style->setAffectedByFocus(); | 138 m_style->setAffectedByFocus(); |
| 141 if (selectorChecker.matchedHoverSelector()) | 139 if (checker.matchedHoverSelector()) |
| 142 m_style->setAffectedByHover(); | 140 m_style->setAffectedByHover(); |
| 143 if (selectorChecker.matchedActiveSelector()) | 141 if (checker.matchedActiveSelector()) |
| 144 m_style->setAffectedByActive(); | 142 m_style->setAffectedByActive(); |
| 145 return true; | 143 return true; |
| 146 } | 144 } |
| 147 return false; | 145 return false; |
| 148 } | 146 } |
| 149 | 147 |
| 150 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad
eOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange) | 148 void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Cascad
eOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange) |
| 151 { | 149 { |
| 152 StyleRule* rule = ruleData.rule(); | 150 StyleRule* rule = ruleData.rule(); |
| 153 if (ruleMatches(ruleData, matchRequest.scope)) { | 151 if (ruleMatches(ruleData, matchRequest.scope)) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 171 return matchedRule1.position() < matchedRule2.position(); | 169 return matchedRule1.position() < matchedRule2.position(); |
| 172 } | 170 } |
| 173 | 171 |
| 174 void ElementRuleCollector::sortMatchedRules() | 172 void ElementRuleCollector::sortMatchedRules() |
| 175 { | 173 { |
| 176 ASSERT(m_matchedRules); | 174 ASSERT(m_matchedRules); |
| 177 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules); | 175 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules); |
| 178 } | 176 } |
| 179 | 177 |
| 180 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |