| Index: third_party/WebKit/Source/core/css/SelectorChecker.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/SelectorChecker.cpp b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
|
| index 771468302c6177825cb2a1575bbdfb6f0a2807ac..54bdea3e302aa62b729635c33aac86f49e86cf0b 100644
|
| --- a/third_party/WebKit/Source/core/css/SelectorChecker.cpp
|
| +++ b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
|
| @@ -180,50 +180,6 @@ static bool isLastOfType(Element& element, const QualifiedName& type)
|
| return !ElementTraversal::nextSibling(element, HasTagName(type));
|
| }
|
|
|
| -static int nthChildIndex(Element& element)
|
| -{
|
| - if (NthIndexCache* nthIndexCache = element.document().nthIndexCache())
|
| - return nthIndexCache->nthChildIndex(element);
|
| -
|
| - int index = 1;
|
| - for (const Element* sibling = ElementTraversal::previousSibling(element); sibling; sibling = ElementTraversal::previousSibling(*sibling))
|
| - index++;
|
| -
|
| - return index;
|
| -}
|
| -
|
| -static int nthOfTypeIndex(Element& element, const QualifiedName& type)
|
| -{
|
| - if (NthIndexCache* nthIndexCache = element.document().nthIndexCache())
|
| - return nthIndexCache->nthChildIndexOfType(element, type);
|
| - int index = 1;
|
| - for (const Element* sibling = ElementTraversal::previousSibling(element, HasTagName(type)); sibling; sibling = ElementTraversal::previousSibling(*sibling, HasTagName(type)))
|
| - ++index;
|
| - return index;
|
| -}
|
| -
|
| -static int nthLastChildIndex(Element& element)
|
| -{
|
| - if (NthIndexCache* nthIndexCache = element.document().nthIndexCache())
|
| - return nthIndexCache->nthLastChildIndex(element);
|
| -
|
| - int index = 1;
|
| - for (const Element* sibling = ElementTraversal::nextSibling(element); sibling; sibling = ElementTraversal::nextSibling(*sibling))
|
| - ++index;
|
| - return index;
|
| -}
|
| -
|
| -static int nthLastOfTypeIndex(Element& element, const QualifiedName& type)
|
| -{
|
| - if (NthIndexCache* nthIndexCache = element.document().nthIndexCache())
|
| - return nthIndexCache->nthLastChildIndexOfType(element, type);
|
| -
|
| - int index = 1;
|
| - for (const Element* sibling = ElementTraversal::nextSibling(element, HasTagName(type)); sibling; sibling = ElementTraversal::nextSibling(*sibling, HasTagName(type)))
|
| - ++index;
|
| - return index;
|
| -}
|
| -
|
| // Recursive check of selectors and combinators
|
| // It can return 4 different values:
|
| // * SelectorMatches - the selector matches the element e
|
| @@ -770,14 +726,14 @@ bool SelectorChecker::checkPseudoClass(const SelectorCheckingContext& context, M
|
| if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
|
| if (m_mode == ResolvingStyle)
|
| parent->setChildrenAffectedByForwardPositionalRules();
|
| - return selector.matchNth(nthChildIndex(element));
|
| + return selector.matchNth(NthIndexCache::nthChildIndex(element));
|
| }
|
| break;
|
| case CSSSelector::PseudoNthOfType:
|
| if (ContainerNode* parent = element.parentElementOrDocumentFragment()) {
|
| if (m_mode == ResolvingStyle)
|
| parent->setChildrenAffectedByForwardPositionalRules();
|
| - return selector.matchNth(nthOfTypeIndex(element, element.tagQName()));
|
| + return selector.matchNth(NthIndexCache::nthOfTypeIndex(element));
|
| }
|
| break;
|
| case CSSSelector::PseudoNthLastChild:
|
| @@ -786,7 +742,7 @@ bool SelectorChecker::checkPseudoClass(const SelectorCheckingContext& context, M
|
| parent->setChildrenAffectedByBackwardPositionalRules();
|
| if (!parent->isFinishedParsingChildren())
|
| return false;
|
| - return selector.matchNth(nthLastChildIndex(element));
|
| + return selector.matchNth(NthIndexCache::nthLastChildIndex(element));
|
| }
|
| break;
|
| case CSSSelector::PseudoNthLastOfType:
|
| @@ -795,7 +751,7 @@ bool SelectorChecker::checkPseudoClass(const SelectorCheckingContext& context, M
|
| parent->setChildrenAffectedByBackwardPositionalRules();
|
| if (!parent->isFinishedParsingChildren())
|
| return false;
|
| - return selector.matchNth(nthLastOfTypeIndex(element, element.tagQName()));
|
| + return selector.matchNth(NthIndexCache::nthLastOfTypeIndex(element));
|
| }
|
| break;
|
| case CSSSelector::PseudoTarget:
|
|
|