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

Unified Diff: Source/core/dom/Document.h

Issue 1023393002: Cache element indices for :nth-child and :nth-last-child selectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved nth-index-cache scope to updateStyle Created 5 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 | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.h
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index 51a3c60befaffd8c8722eedee272a4a7ce04c092..bf14e6dbb835fbc03e33beceabca0fa03b59cbdb 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -128,6 +128,7 @@ class MediaQueryListListener;
class MediaQueryMatcher;
class NodeFilter;
class NodeIterator;
+class NthIndexCache;
class Page;
class PlatformMouseEvent;
class ProcessingInstruction;
@@ -247,6 +248,7 @@ public:
virtual bool canContainRangeEndPoint() const override { return true; }
SelectorQueryCache& selectorQueryCache();
+ NthIndexCache* nthIndexCache();
// Focus Management.
Element* activeElement() const;
@@ -1061,6 +1063,25 @@ public:
OriginsUsingFeatures::Value& originsUsingFeaturesValue() { return m_originsUsingFeaturesValue; }
+ class UseNthIndexCacheScope {
+ STACK_ALLOCATED();
+ WTF_MAKE_NONCOPYABLE(UseNthIndexCacheScope);
+ public:
+ UseNthIndexCacheScope(Document& document)
+ : m_document(&document)
+ {
+ ASSERT(!document.useNthIndexCache());
sof 2015/03/30 13:27:53 Just to verify: there's no possibility that you ma
rune 2015/03/30 20:14:40 Shouldn't with the current uses of this scope. que
+ document.setUseNthIndexCache(true);
+ }
+ ~UseNthIndexCacheScope()
+ {
+ ASSERT(m_document->useNthIndexCache());
+ m_document->setUseNthIndexCache(false);
+ }
+ private:
+ RawPtrWillBeMember<Document> m_document;
+ };
+
protected:
Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass);
@@ -1317,6 +1338,7 @@ private:
WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement>> m_cssCanvasElements;
OwnPtr<SelectorQueryCache> m_selectorQueryCache;
+ OwnPtrWillBeMember<NthIndexCache> m_nthIndexCache;
bool m_useSecureKeyboardEntryWhenActive;
@@ -1397,6 +1419,11 @@ private:
ParserSynchronizationPolicy m_parserSyncPolicy;
OriginsUsingFeatures::Value m_originsUsingFeaturesValue;
+
+ bool useNthIndexCache() const { return m_useNthIndexCache; }
+ void setUseNthIndexCache(bool);
+
+ bool m_useNthIndexCache;
};
inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin)
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698