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

Unified Diff: Source/core/dom/ContainerNode.cpp

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: Missing initializer and incorrect assert. Created 5 years, 8 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/css/SiblingTraversalStrategies.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index c29ee86741d9ac72b35b22d1837de77bc4e4d654..5fb60b672bb8ad9bdcf4e3387d31d11f16a24aff 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -34,6 +34,7 @@
#include "core/dom/NodeComputedStyle.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeTraversal.h"
+#include "core/dom/NthIndexCache.h"
#include "core/dom/SelectorQuery.h"
#include "core/dom/StaticNodeList.h"
#include "core/dom/StyleEngine.h"
@@ -1158,6 +1159,8 @@ PassRefPtrWillBeRawPtr<Element> ContainerNode::querySelector(const AtomicString&
SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors, document(), exceptionState);
if (!selectorQuery)
return nullptr;
+
+ NthIndexCache nthIndexCache(document());
return selectorQuery->queryFirst(*this);
}
@@ -1172,6 +1175,7 @@ PassRefPtrWillBeRawPtr<StaticElementList> ContainerNode::querySelectorAll(const
if (!selectorQuery)
return nullptr;
+ NthIndexCache nthIndexCache(document());
return selectorQuery->queryAll(*this);
}
« no previous file with comments | « Source/core/css/SiblingTraversalStrategies.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698