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

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

Issue 848493003: Don't scope check in SelectorChecker. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months 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 | « sky/engine/core/css/RuleSet.h ('k') | sky/engine/core/css/SelectorChecker.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 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 AtomicString id; 86 AtomicString id;
87 AtomicString className; 87 AtomicString className;
88 AtomicString customPseudoElementName; 88 AtomicString customPseudoElementName;
89 AtomicString tagName; 89 AtomicString tagName;
90 90
91 #ifndef NDEBUG 91 #ifndef NDEBUG
92 m_allRules.append(ruleData); 92 m_allRules.append(ruleData);
93 #endif 93 #endif
94 94
95 const CSSSelector* it = &component; 95 const CSSSelector* it = &component;
96
97 if (it->pseudoType() == CSSSelector::PseudoHost) {
98 m_hostRules.append(ruleData);
99 return true;
100 }
101
96 for (; it; it = it->tagHistory()) { 102 for (; it; it = it->tagHistory()) {
103 // Host rules can't match when combined with other selectors, so we just
104 // ignore them.
105 if (it->pseudoType() == CSSSelector::PseudoHost)
106 return true;
97 extractValuesforSelector(it, id, className, customPseudoElementName, tag Name); 107 extractValuesforSelector(it, id, className, customPseudoElementName, tag Name);
98 } 108 }
99 // FIXME: this null check should not be necessary. See crbug.com/358475
100 if (it)
101 extractValuesforSelector(it, id, className, customPseudoElementName, tag Name);
102 109
103 // Prefer rule sets in order of most likely to apply infrequently. 110 // Prefer rule sets in order of most likely to apply infrequently.
104 if (!id.isEmpty()) { 111 if (!id.isEmpty()) {
105 addToRuleSet(id, ensurePendingRules()->idRules, ruleData); 112 addToRuleSet(id, ensurePendingRules()->idRules, ruleData);
106 return true; 113 return true;
107 } 114 }
108 if (!className.isEmpty()) { 115 if (!className.isEmpty()) {
109 addToRuleSet(className, ensurePendingRules()->classRules, ruleData); 116 addToRuleSet(className, ensurePendingRules()->classRules, ruleData);
110 return true; 117 return true;
111 } 118 }
112
113 if (!tagName.isEmpty()) { 119 if (!tagName.isEmpty()) {
114 addToRuleSet(tagName, ensurePendingRules()->tagRules, ruleData); 120 addToRuleSet(tagName, ensurePendingRules()->tagRules, ruleData);
115 return true; 121 return true;
116 } 122 }
117 123
118 return false; 124 return false;
119 } 125 }
120 126
121 void RuleSet::addRule(StyleRule* rule, unsigned selectorIndex) 127 void RuleSet::addRule(StyleRule* rule, unsigned selectorIndex)
122 { 128 {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 213
208 #ifndef NDEBUG 214 #ifndef NDEBUG
209 void RuleSet::show() 215 void RuleSet::show()
210 { 216 {
211 for (Vector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRu les.end(); ++it) 217 for (Vector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRu les.end(); ++it)
212 it->selector().show(); 218 it->selector().show();
213 } 219 }
214 #endif 220 #endif
215 221
216 } // namespace blink 222 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/RuleSet.h ('k') | sky/engine/core/css/SelectorChecker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698