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

Side by Side Diff: Source/core/css/RuleSet.cpp

Issue 218403012: Check for null selectors when looping in findBestRuleSetAndAdd (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments from ojan@. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSSelector.cpp ('k') | no next file » | 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 AtomicString id; 170 AtomicString id;
171 AtomicString className; 171 AtomicString className;
172 AtomicString customPseudoElementName; 172 AtomicString customPseudoElementName;
173 AtomicString tagName; 173 AtomicString tagName;
174 174
175 #ifndef NDEBUG 175 #ifndef NDEBUG
176 m_allRules.append(ruleData); 176 m_allRules.append(ruleData);
177 #endif 177 #endif
178 178
179 const CSSSelector* it = &component; 179 const CSSSelector* it = &component;
180 for (; it->relation() == CSSSelector::SubSelector; it = it->tagHistory()) { 180 for (; it && it->relation() == CSSSelector::SubSelector; it = it->tagHistory ()) {
181 extractValuesforSelector(it, id, className, customPseudoElementName, tag Name); 181 extractValuesforSelector(it, id, className, customPseudoElementName, tag Name);
182 } 182 }
183 extractValuesforSelector(it, id, className, customPseudoElementName, tagName ); 183 // FIXME: this null check should not be necessary. See crbug.com/358475
184 if (it)
185 extractValuesforSelector(it, id, className, customPseudoElementName, tag Name);
184 186
185 // Prefer rule sets in order of most likely to apply infrequently. 187 // Prefer rule sets in order of most likely to apply infrequently.
186 if (!id.isEmpty()) { 188 if (!id.isEmpty()) {
187 addToRuleSet(id, ensurePendingRules()->idRules, ruleData); 189 addToRuleSet(id, ensurePendingRules()->idRules, ruleData);
188 return true; 190 return true;
189 } 191 }
190 if (!className.isEmpty()) { 192 if (!className.isEmpty()) {
191 addToRuleSet(className, ensurePendingRules()->classRules, ruleData); 193 addToRuleSet(className, ensurePendingRules()->classRules, ruleData);
192 return true; 194 return true;
193 } 195 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 408
407 #ifndef NDEBUG 409 #ifndef NDEBUG
408 void RuleSet::show() 410 void RuleSet::show()
409 { 411 {
410 for (WillBeHeapVector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRules.end(); ++it) 412 for (WillBeHeapVector<RuleData>::const_iterator it = m_allRules.begin(); it != m_allRules.end(); ++it)
411 it->selector().show(); 413 it->selector().show();
412 } 414 }
413 #endif 415 #endif
414 416
415 } // namespace WebCore 417 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSSelector.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698