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

Unified Diff: Source/core/css/SelectorChecker.cpp

Issue 298253009: Add iterator object to iterate efficiently over an Element's attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/SelectorChecker.cpp
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 0e38d6fbe39d3bbf228323b4f6f2d4c6f74c9f2c..1aca118f0cd14dc10686796cad6194bdb724d680 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -492,9 +492,10 @@ static bool anyAttributeMatches(Element& element, CSSSelector::Match match, cons
const AtomicString& selectorValue = selector.value();
- unsigned attributeCount = element.attributeCount();
- for (size_t i = 0; i < attributeCount; ++i) {
- const Attribute& attributeItem = element.attributeItem(i);
+ AttributeIteratorAccessor attributes = element.attributesIterator();
esprehn 2014/05/28 20:03:54 This accessor thing is kind of weird, why can't El
+ AttributeConstIterator end = attributes.end();
+ for (AttributeConstIterator it = attributes.begin(); it != end; ++it) {
+ const Attribute& attributeItem = **it;
if (!attributeItem.matches(selectorAttr))
continue;

Powered by Google App Engine
This is Rietveld 408576698