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

Unified Diff: third_party/WebKit/Source/core/css/CSSSelectorList.h

Issue 2774663003: Simplify the SelectorQuery constructor and reuse CSSSelectorList::length(). (Closed)
Patch Set: woops Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSSelectorList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/CSSSelectorList.h
diff --git a/third_party/WebKit/Source/core/css/CSSSelectorList.h b/third_party/WebKit/Source/core/css/CSSSelectorList.h
index ad7bc10d37e273383049bcaf2d401a01ad468913..3da863d4db24c4ca8d3558c899e3f446befead71 100644
--- a/third_party/WebKit/Source/core/css/CSSSelectorList.h
+++ b/third_party/WebKit/Source/core/css/CSSSelectorList.h
@@ -81,8 +81,11 @@ class CORE_EXPORT CSSSelectorList {
String selectorsText() const;
+ // Selector lists don't know their length, computing it is O(n) and should be
+ // avoided when possible. Instead iterate from first() and using next().
+ unsigned computeLength() const;
+
private:
- unsigned length() const;
void deleteSelectorsIfNeeded() {
if (m_selectorArray)
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSSelectorList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698