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

Side by Side Diff: Source/core/dom/SelectorQuery.cpp

Issue 69543007: Have NodeTraversal::nextSkippingChildren() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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 | « Source/core/dom/Range.cpp ('k') | Source/core/dom/TreeWalker.cpp » ('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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 : m_className(className) 68 : m_className(className)
69 , m_rootNode(rootNode) 69 , m_rootNode(rootNode)
70 , m_currentElement(nextInternal(ElementTraversal::firstWithin(m_rootNode ))) { } 70 , m_currentElement(nextInternal(ElementTraversal::firstWithin(m_rootNode ))) { }
71 71
72 bool isEmpty() const { return !m_currentElement; } 72 bool isEmpty() const { return !m_currentElement; }
73 73
74 Node* next() 74 Node* next()
75 { 75 {
76 Node* current = m_currentElement; 76 Node* current = m_currentElement;
77 ASSERT(current); 77 ASSERT(current);
78 m_currentElement = nextInternal(ElementTraversal::nextSkippingChildren(m _currentElement, m_rootNode)); 78 m_currentElement = nextInternal(ElementTraversal::nextSkippingChildren(* m_currentElement, m_rootNode));
79 return current; 79 return current;
80 } 80 }
81 81
82 private: 82 private:
83 Element* nextInternal(Element* element) 83 Element* nextInternal(Element* element)
84 { 84 {
85 for (; element; element = ElementTraversal::next(*element, m_rootNode)) { 85 for (; element; element = ElementTraversal::next(*element, m_rootNode)) {
86 if (element->hasClass() && element->classNames().contains(m_classNam e)) 86 if (element->hasClass() && element->classNames().contains(m_classNam e))
87 return element; 87 return element;
88 } 88 }
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 m_entries.add(selectors, selectorQuery.release()); 525 m_entries.add(selectors, selectorQuery.release());
526 return rawSelectorQuery; 526 return rawSelectorQuery;
527 } 527 }
528 528
529 void SelectorQueryCache::invalidate() 529 void SelectorQueryCache::invalidate()
530 { 530 {
531 m_entries.clear(); 531 m_entries.clear();
532 } 532 }
533 533
534 } 534 }
OLDNEW
« no previous file with comments | « Source/core/dom/Range.cpp ('k') | Source/core/dom/TreeWalker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698