Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(861)

Side by Side Diff: sky/engine/core/css/ElementRuleCollector.cpp

Issue 803113004: Remove containsAttributeSelector() checks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/engine/core/css/RuleSet.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 { 133 {
134 if (!m_matchedRules || m_matchedRules->isEmpty()) 134 if (!m_matchedRules || m_matchedRules->isEmpty())
135 return; 135 return;
136 136
137 sortMatchedRules(); 137 sortMatchedRules();
138 138
139 Vector<MatchedRule, 32>& matchedRules = *m_matchedRules; 139 Vector<MatchedRule, 32>& matchedRules = *m_matchedRules;
140 140
141 // Now transfer the set of matched rules over to our list of declarations. 141 // Now transfer the set of matched rules over to our list of declarations.
142 for (unsigned i = 0; i < matchedRules.size(); i++) { 142 for (unsigned i = 0; i < matchedRules.size(); i++) {
143 // FIXME: Matching should not modify the style directly.
144 const RuleData* ruleData = matchedRules[i].ruleData(); 143 const RuleData* ruleData = matchedRules[i].ruleData();
145 if (m_style && ruleData->containsAttributeSelector())
146 m_style->setUnique();
147 m_result.addMatchedProperties(&ruleData->rule()->properties()); 144 m_result.addMatchedProperties(&ruleData->rule()->properties());
148 } 145 }
149 } 146 }
150 147
151 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const Co ntainerNode* scope, SelectorChecker::ContextFlags contextFlags) 148 inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const Co ntainerNode* scope, SelectorChecker::ContextFlags contextFlags)
152 { 149 {
153 SelectorChecker selectorChecker(m_context.element()->document(), m_mode); 150 SelectorChecker selectorChecker(m_context.element()->document(), m_mode);
154 SelectorChecker::SelectorCheckingContext context(ruleData.selector(), m_cont ext.element()); 151 SelectorChecker::SelectorCheckingContext context(ruleData.selector(), m_cont ext.element());
155 context.elementStyle = m_style.get(); 152 context.elementStyle = m_style.get();
156 context.scope = scope; 153 context.scope = scope;
(...skipping 28 matching lines...) Expand all
185 return matchedRule1.position() < matchedRule2.position(); 182 return matchedRule1.position() < matchedRule2.position();
186 } 183 }
187 184
188 void ElementRuleCollector::sortMatchedRules() 185 void ElementRuleCollector::sortMatchedRules()
189 { 186 {
190 ASSERT(m_matchedRules); 187 ASSERT(m_matchedRules);
191 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules); 188 std::sort(m_matchedRules->begin(), m_matchedRules->end(), compareRules);
192 } 189 }
193 190
194 } // namespace blink 191 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/css/RuleSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698