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

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

Issue 1108783002: Don't cache nth-indices of pseudo elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Early return for pseudo elements in NthIndexCache. 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
Index: Source/core/dom/NthIndexCache.h
diff --git a/Source/core/dom/NthIndexCache.h b/Source/core/dom/NthIndexCache.h
index 99c0ef19bc0493165a73bf57533eba10fb49f6e2..19923a06c51693bd33ed9fa45812f0bfe8817466 100644
--- a/Source/core/dom/NthIndexCache.h
+++ b/Source/core/dom/NthIndexCache.h
@@ -56,6 +56,8 @@ private:
inline unsigned NthIndexCache::NthIndexData::nthIndex(Element& element)
{
+ if (element.isPseudoElement())
+ return 1;
if (!m_count)
return cacheNthIndices(element);
@@ -70,6 +72,8 @@ inline unsigned NthIndexCache::NthIndexData::nthIndex(Element& element)
inline unsigned NthIndexCache::NthIndexData::nthLastIndex(Element& element)
{
+ if (element.isPseudoElement())
+ return 1;
unsigned index = nthIndex(element);
return m_count - index + 1;
}
« no previous file with comments | « LayoutTests/fast/css/nth-child-of-pseudo-element-assert-expected.txt ('k') | Source/core/dom/NthIndexCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698