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

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

Issue 171513013: Do not add features to classes in rightmost compound selector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Back to using two loops. Created 6 years, 10 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
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 bool RuleFeatureSet::updateClassInvalidationSets(const CSSSelector& selector) 103 bool RuleFeatureSet::updateClassInvalidationSets(const CSSSelector& selector)
104 { 104 {
105 if (!supportsClassDescendantInvalidation(selector)) 105 if (!supportsClassDescendantInvalidation(selector))
106 return false; 106 return false;
107 107
108 Vector<AtomicString> classes; 108 Vector<AtomicString> classes;
109 AtomicString id; 109 AtomicString id;
110 AtomicString tagName; 110 AtomicString tagName;
111 111
112 const CSSSelector* lastSelector = &selector; 112 const CSSSelector* lastSelector = &selector;
113 for (; lastSelector->relation() == CSSSelector::SubSelector; lastSelector = lastSelector->tagHistory()) { 113 for (; lastSelector; lastSelector = lastSelector->tagHistory()) {
114 extractClassIdOrTag(*lastSelector, classes, id, tagName); 114 extractClassIdOrTag(*lastSelector, classes, id, tagName);
115 if (lastSelector->m_match == CSSSelector::Class)
116 ensureClassInvalidationSet(lastSelector->value());
117 if (lastSelector->relation() != CSSSelector::SubSelector)
118 break;
115 } 119 }
116 extractClassIdOrTag(*lastSelector, classes, id, tagName);
117 120
118 for (const CSSSelector* current = &selector ; current; current = current->ta gHistory()) { 121 if (!lastSelector)
122 return true;
123
124 for (const CSSSelector* current = lastSelector->tagHistory(); current; curre nt = current->tagHistory()) {
119 if (current->m_match == CSSSelector::Class) { 125 if (current->m_match == CSSSelector::Class) {
120 DescendantInvalidationSet& invalidationSet = ensureClassInvalidation Set(current->value()); 126 DescendantInvalidationSet& invalidationSet = ensureClassInvalidation Set(current->value());
121 if (!id.isEmpty()) 127 if (!id.isEmpty())
122 invalidationSet.addId(id); 128 invalidationSet.addId(id);
123 if (!tagName.isEmpty()) 129 if (!tagName.isEmpty())
124 invalidationSet.addTagName(tagName); 130 invalidationSet.addTagName(tagName);
125 for (Vector<AtomicString>::const_iterator it = classes.begin(); it ! = classes.end(); ++it) { 131 for (Vector<AtomicString>::const_iterator it = classes.begin(); it ! = classes.end(); ++it) {
126 invalidationSet.addClass(*it); 132 invalidationSet.addClass(*it);
127 } 133 }
128 } 134 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 424 }
419 425
420 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); 426 invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize);
421 element->clearChildNeedsStyleInvalidation(); 427 element->clearChildNeedsStyleInvalidation();
422 element->clearNeedsStyleInvalidation(); 428 element->clearNeedsStyleInvalidation();
423 429
424 return thisElementNeedsStyleRecalc; 430 return thisElementNeedsStyleRecalc;
425 } 431 }
426 432
427 } // namespace WebCore 433 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/virtual/targetedstylerecalc/fast/css/invalidation/targeted-class-style-invalidation-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698