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

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

Issue 2308313002: Clean up RuleSet::addChildRules() (Closed)
Patch Set: Created 4 years, 3 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 | « third_party/WebKit/Source/core/css/CSSSelector.cpp ('k') | third_party/WebKit/Source/core/css/RuleSet.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 0ffca7cf809386a441374e5f1285400df55b194a..041b258d99df29eeb8cf4b172464606ceec1826a 100644
--- a/third_party/WebKit/Source/core/css/CSSSelectorList.h
+++ b/third_party/WebKit/Source/core/css/CSSSelectorList.h
@@ -67,13 +67,18 @@ public:
bool hasOneSelector() const { return m_selectorArray && !next(*m_selectorArray); }
const CSSSelector& selectorAt(size_t index) const { return m_selectorArray[index]; }
+ size_t selectorIndex(const CSSSelector& selector) const
+ {
+ return &selector - m_selectorArray;
+ }
+
size_t indexOfNextSelectorAfter(size_t index) const
{
const CSSSelector& current = selectorAt(index);
const CSSSelector* next = this->next(current);
if (!next)
return kNotFound;
- return next - m_selectorArray;
+ return selectorIndex(*next);
}
String selectorsText() const;
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelector.cpp ('k') | third_party/WebKit/Source/core/css/RuleSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698