| Index: Source/core/css/SiblingTraversalStrategies.h
|
| diff --git a/Source/core/css/SiblingTraversalStrategies.h b/Source/core/css/SiblingTraversalStrategies.h
|
| index f648cb9ef84f47a17bd54a0287e3f3988ce6dd16..dc54e97a7fc8d890dcd6e62543bef129308c6b49 100644
|
| --- a/Source/core/css/SiblingTraversalStrategies.h
|
| +++ b/Source/core/css/SiblingTraversalStrategies.h
|
| @@ -31,6 +31,7 @@
|
|
|
| #include "core/dom/Element.h"
|
| #include "core/dom/ElementTraversal.h"
|
| +#include "core/dom/NthIndexCache.h"
|
| #include "core/layout/style/LayoutStyle.h"
|
|
|
| namespace blink {
|
| @@ -79,6 +80,9 @@ inline bool DOMSiblingTraversalStrategy::isLastOfType(Element& element, const Qu
|
|
|
| inline int DOMSiblingTraversalStrategy::countElementsBefore(Element& element) const
|
| {
|
| + if (NthIndexCache::getInstance())
|
| + return NthIndexCache::getInstance()->nthChildIndex(element) - 1;
|
| +
|
| int count = 0;
|
| for (const Element* sibling = ElementTraversal::previousSibling(element); sibling; sibling = ElementTraversal::previousSibling(*sibling))
|
| count++;
|
| @@ -96,6 +100,9 @@ inline int DOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element& eleme
|
|
|
| inline int DOMSiblingTraversalStrategy::countElementsAfter(Element& element) const
|
| {
|
| + if (NthIndexCache::getInstance())
|
| + return NthIndexCache::getInstance()->nthLastChildIndex(element) - 1;
|
| +
|
| int count = 0;
|
| for (const Element* sibling = ElementTraversal::nextSibling(element); sibling; sibling = ElementTraversal::nextSibling(*sibling))
|
| ++count;
|
|
|