| Index: Source/core/css/SiblingTraversalStrategies.h
|
| diff --git a/Source/core/css/SiblingTraversalStrategies.h b/Source/core/css/SiblingTraversalStrategies.h
|
| index 1e008dba5fda36e1c053fe4b5b43ba61e10e51af..5f1e0176bce981354f8fd4fefe37fd469553b1ba 100644
|
| --- a/Source/core/css/SiblingTraversalStrategies.h
|
| +++ b/Source/core/css/SiblingTraversalStrategies.h
|
| @@ -48,15 +48,6 @@ public:
|
| int countElementsAfter(Element&) const;
|
| int countElementsOfTypeBefore(Element&, const QualifiedName&) const;
|
| int countElementsOfTypeAfter(Element&, const QualifiedName&) const;
|
| -
|
| -private:
|
| - class HasTagName {
|
| - public:
|
| - explicit HasTagName(const QualifiedName& tagName) : m_tagName(tagName) { }
|
| - bool operator() (const Element& element) const { return element.hasTagName(m_tagName); }
|
| - private:
|
| - const QualifiedName& m_tagName;
|
| - };
|
| };
|
|
|
| inline bool DOMSiblingTraversalStrategy::isFirstChild(Element& element) const
|
| @@ -93,6 +84,8 @@ inline int DOMSiblingTraversalStrategy::countElementsBefore(Element& element) co
|
|
|
| inline int DOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element& element, const QualifiedName& type) const
|
| {
|
| + if (NthIndexCache* nthIndexCache = element.document().nthIndexCache())
|
| + return nthIndexCache->nthChildIndexOfType(element, type) - 1;
|
| int count = 0;
|
| for (const Element* sibling = ElementTraversal::previousSibling(element, HasTagName(type)); sibling; sibling = ElementTraversal::previousSibling(*sibling, HasTagName(type)))
|
| ++count;
|
| @@ -112,6 +105,9 @@ inline int DOMSiblingTraversalStrategy::countElementsAfter(Element& element) con
|
|
|
| inline int DOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element& element, const QualifiedName& type) const
|
| {
|
| + if (NthIndexCache* nthIndexCache = element.document().nthIndexCache())
|
| + return nthIndexCache->nthLastChildIndexOfType(element, type) - 1;
|
| +
|
| int count = 0;
|
| for (const Element* sibling = ElementTraversal::nextSibling(element, HasTagName(type)); sibling; sibling = ElementTraversal::nextSibling(*sibling, HasTagName(type)))
|
| ++count;
|
|
|