Diff
Modified: trunk/Source/WebCore/ChangeLog (149497 => 149498)
--- trunk/Source/WebCore/ChangeLog 2013-05-02 21:33:37 UTC (rev 149497)
+++ trunk/Source/WebCore/ChangeLog 2013-05-02 22:13:56 UTC (rev 149498)
@@ -1,3 +1,36 @@
+2013-05-02 Antti Koivisto <[email protected]>
+
+ Shadow DOM removal: Make SelectorChecker non-generic
+ https://bugs.webkit.org/show_bug.cgi?id=115526
+
+ Reviewed by Andreas Kling.
+
+ Without Shadow DOM distribution we don't need SiblingTraversalStrategies anymore.
+
+ * css/ElementRuleCollector.cpp:
+ (WebCore::ElementRuleCollector::ruleMatches):
+ * css/SelectorChecker.cpp:
+ (WebCore):
+ (WebCore::isFirstChildElement):
+ (WebCore::isLastChildElement):
+ (WebCore::isFirstOfType):
+ (WebCore::isLastOfType):
+ (WebCore::countElementsBefore):
+ (WebCore::countElementsOfTypeBefore):
+ (WebCore::countElementsAfter):
+ (WebCore::countElementsOfTypeAfter):
+ (WebCore::SelectorChecker::match):
+ (WebCore::SelectorChecker::checkOne):
+ * css/SelectorChecker.h:
+ (SelectorChecker):
+ * css/SiblingTraversalStrategies.h:
+ * css/StyleResolver.h:
+ (WebCore::checkRegionSelector):
+ * dom/SelectorQuery.cpp:
+ (WebCore::SelectorDataList::selectorMatches):
+ * html/shadow/ContentSelectorQuery.cpp:
+ (WebCore::ContentSelectorDataList::checkContentSelector):
+
2013-05-02 Anders Carlsson <[email protected]>
Simplify WebCoreObjCExtras by using WTF::bind
Modified: trunk/Source/WebCore/css/ElementRuleCollector.cpp (149497 => 149498)
--- trunk/Source/WebCore/css/ElementRuleCollector.cpp 2013-05-02 21:33:37 UTC (rev 149497)
+++ trunk/Source/WebCore/css/ElementRuleCollector.cpp 2013-05-02 22:13:56 UTC (rev 149498)
@@ -39,7 +39,6 @@
#include "RenderRegion.h"
#include "SVGElement.h"
#include "SelectorCheckerFastPath.h"
-#include "SiblingTraversalStrategies.h"
#include "StylePropertySet.h"
#include "StyledElement.h"
@@ -401,7 +400,7 @@
context.scrollbar = m_pseudoStyleRequest.scrollbar;
context.scrollbarPart = m_pseudoStyleRequest.scrollbarPart;
context.behaviorAtBoundary = m_behaviorAtBoundary;
- SelectorChecker::Match match = selectorChecker.match(context, dynamicPseudo, DOMSiblingTraversalStrategy());
+ SelectorChecker::Match match = selectorChecker.match(context, dynamicPseudo);
if (match != SelectorChecker::SelectorMatches)
return false;
if (m_pseudoStyleRequest.pseudoId != NOPSEUDO && m_pseudoStyleRequest.pseudoId != dynamicPseudo)
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (149497 => 149498)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2013-05-02 21:33:37 UTC (rev 149497)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2013-05-02 22:13:56 UTC (rev 149498)
@@ -51,7 +51,6 @@
#include "ScrollableArea.h"
#include "ScrollbarTheme.h"
#include "ShadowRoot.h"
-#include "SiblingTraversalStrategies.h"
#include "StyledElement.h"
#include "Text.h"
@@ -62,7 +61,77 @@
namespace WebCore {
using namespace HTMLNames;
+
+static inline bool isFirstChildElement(const Element* element)
+{
+ return !element->previousElementSibling();
+}
+static inline bool isLastChildElement(const Element* element)
+{
+ return !element->nextElementSibling();
+}
+
+static inline bool isFirstOfType(const Element* element, const QualifiedName& type)
+{
+ for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
+ if (sibling->hasTagName(type))
+ return false;
+ }
+ return true;
+}
+
+static inline bool isLastOfType(const Element* element, const QualifiedName& type)
+{
+ for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) {
+ if (sibling->hasTagName(type))
+ return false;
+ }
+ return true;
+}
+
+static inline int countElementsBefore(const Element* element)
+{
+ int count = 0;
+ for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
+ unsigned index = sibling->childIndex();
+ if (index) {
+ count += index;
+ break;
+ }
+ count++;
+ }
+ return count;
+}
+
+static inline int countElementsOfTypeBefore(const Element* element, const QualifiedName& type)
+{
+ int count = 0;
+ for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
+ if (sibling->hasTagName(type))
+ ++count;
+ }
+ return count;
+}
+
+static inline int countElementsAfter(const Element* element)
+{
+ int count = 0;
+ for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling())
+ ++count;
+ return count;
+}
+
+static inline int countElementsOfTypeAfter(const Element* element, const QualifiedName& type)
+{
+ int count = 0;
+ for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) {
+ if (sibling->hasTagName(type))
+ ++count;
+ }
+ return count;
+}
+
SelectorChecker::SelectorChecker(Document* document, Mode mode)
: m_strictParsing(!document->inQuirksMode())
, m_documentIsHTML(document->isHTMLDocument())
@@ -76,11 +145,10 @@
// * SelectorFailsLocally - the selector fails for the element e
// * SelectorFailsAllSiblings - the selector fails for e and any sibling of e
// * SelectorFailsCompletely - the selector fails for e and any sibling or ancestor of e
-template<typename SiblingTraversalStrategy>
-SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext& context, PseudoId& dynamicPseudo, const SiblingTraversalStrategy& siblingTraversalStrategy) const
+SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext& context, PseudoId& dynamicPseudo) const
{
// first selector has to match
- if (!checkOne(context, siblingTraversalStrategy))
+ if (!checkOne(context))
return SelectorFailsLocally;
if (context.selector->m_match == CSSSelector::PseudoElement) {
@@ -146,7 +214,7 @@
nextContext.isSubSelector = false;
nextContext.elementStyle = 0;
for (; nextContext.element; nextContext.element = nextContext.element->parentElement()) {
- Match match = this->match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy);
+ Match match = this->match(nextContext, ignoreDynamicPseudo);
if (match == SelectorMatches || match == SelectorFailsCompletely)
return match;
if (nextContext.element == nextContext.scope && nextContext.behaviorAtBoundary != StaysWithinTreeScope)
@@ -160,7 +228,7 @@
return SelectorFailsCompletely;
nextContext.isSubSelector = false;
nextContext.elementStyle = 0;
- return match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy);
+ return match(nextContext, ignoreDynamicPseudo);
case CSSSelector::DirectAdjacent:
if (m_mode == ResolvingStyle) {
@@ -172,7 +240,7 @@
return SelectorFailsAllSiblings;
nextContext.isSubSelector = false;
nextContext.elementStyle = 0;
- return match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy);
+ return match(nextContext, ignoreDynamicPseudo);
case CSSSelector::IndirectAdjacent:
if (m_mode == ResolvingStyle) {
@@ -183,7 +251,7 @@
nextContext.isSubSelector = false;
nextContext.elementStyle = 0;
for (; nextContext.element; nextContext.element = nextContext.element->previousElementSibling()) {
- Match match = this->match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy);
+ Match match = this->match(nextContext, ignoreDynamicPseudo);
if (match == SelectorMatches || match == SelectorFailsAllSiblings || match == SelectorFailsCompletely)
return match;
};
@@ -200,7 +268,7 @@
&& !(nextContext.hasScrollbarPseudo && nextContext.selector->m_match == CSSSelector::PseudoClass))
return SelectorFailsCompletely;
nextContext.isSubSelector = true;
- return match(nextContext, dynamicPseudo, siblingTraversalStrategy);
+ return match(nextContext, dynamicPseudo);
case CSSSelector::ShadowDescendant:
{
@@ -213,7 +281,7 @@
nextContext.element = shadowHostNode;
nextContext.isSubSelector = false;
nextContext.elementStyle = 0;
- return match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy);
+ return match(nextContext, ignoreDynamicPseudo);
}
#if ENABLE(SHADOW_DOM)
case CSSSelector::ShadowDistributed:
@@ -226,7 +294,7 @@
nextContext.element = insertionPoints[i];
nextContext.isSubSelector = false;
nextContext.elementStyle = 0;
- if (match(nextContext, ignoreDynamicPseudo, siblingTraversalStrategy) == SelectorMatches)
+ if (match(nextContext, ignoreDynamicPseudo) == SelectorMatches)
return SelectorMatches;
}
}
@@ -318,8 +386,7 @@
return false;
}
-template<typename SiblingTraversalStrategy>
-bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const SiblingTraversalStrategy& siblingTraversalStrategy) const
+bool SelectorChecker::checkOne(const SelectorCheckingContext& context) const
{
Element* const & element = context.element;
const CSSSelector* const & selector = context.selector;
@@ -366,7 +433,7 @@
// We select between :visited and :link when applying. We don't know which one applied (or not) yet.
if (subContext.selector->pseudoType() == CSSSelector::PseudoVisited || (subContext.selector->pseudoType() == CSSSelector::PseudoLink && subContext.visitedMatchType == VisitedMatchEnabled))
return true;
- if (!checkOne(subContext, DOMSiblingTraversalStrategy()))
+ if (!checkOne(subContext))
return true;
}
} else if (context.hasScrollbarPseudo) {
@@ -411,7 +478,7 @@
case CSSSelector::PseudoFirstChild:
// first-child matches the first child that is an element
if (Element* parentElement = element->parentElement()) {
- bool result = siblingTraversalStrategy.isFirstChild(element);
+ bool result = isFirstChildElement(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element->renderStyle();
parentElement->setChildrenAffectedByFirstChildRules();
@@ -424,7 +491,7 @@
case CSSSelector::PseudoFirstOfType:
// first-of-type matches the first element of its type
if (Element* parentElement = element->parentElement()) {
- bool result = siblingTraversalStrategy.isFirstOfType(element, element->tagQName());
+ bool result = isFirstOfType(element, element->tagQName());
if (m_mode == ResolvingStyle)
parentElement->setChildrenAffectedByForwardPositionalRules();
return result;
@@ -433,7 +500,7 @@
case CSSSelector::PseudoLastChild:
// last-child matches the last child that is an element
if (Element* parentElement = element->parentElement()) {
- bool result = parentElement->isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
+ bool result = parentElement->isFinishedParsingChildren() && isLastChildElement(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element->renderStyle();
parentElement->setChildrenAffectedByLastChildRules();
@@ -450,13 +517,13 @@
parentElement->setChildrenAffectedByBackwardPositionalRules();
if (!parentElement->isFinishedParsingChildren())
return false;
- return siblingTraversalStrategy.isLastOfType(element, element->tagQName());
+ return isLastOfType(element, element->tagQName());
}
break;
case CSSSelector::PseudoOnlyChild:
if (Element* parentElement = element->parentElement()) {
- bool firstChild = siblingTraversalStrategy.isFirstChild(element);
- bool _onlyChild_ = firstChild && parentElement->isFinishedParsingChildren() && siblingTraversalStrategy.isLastChild(element);
+ bool firstChild = isFirstChildElement(element);
+ bool _onlyChild_ = firstChild && parentElement->isFinishedParsingChildren() && isLastChildElement(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element->renderStyle();
parentElement->setChildrenAffectedByFirstChildRules();
@@ -478,14 +545,14 @@
}
if (!parentElement->isFinishedParsingChildren())
return false;
- return siblingTraversalStrategy.isFirstOfType(element, element->tagQName()) && siblingTraversalStrategy.isLastOfType(element, element->tagQName());
+ return isFirstOfType(element, element->tagQName()) && isLastOfType(element, element->tagQName());
}
break;
case CSSSelector::PseudoNthChild:
if (!selector->parseNth())
break;
if (Element* parentElement = element->parentElement()) {
- int count = 1 + siblingTraversalStrategy.countElementsBefore(element);
+ int count = 1 + countElementsBefore(element);
if (m_mode == ResolvingStyle) {
RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element->renderStyle();
element->setChildIndex(count);
@@ -502,7 +569,7 @@
if (!selector->parseNth())
break;
if (Element* parentElement = element->parentElement()) {
- int count = 1 + siblingTraversalStrategy.countElementsOfTypeBefore(element, element->tagQName());
+ int count = 1 + countElementsOfTypeBefore(element, element->tagQName());
if (m_mode == ResolvingStyle)
parentElement->setChildrenAffectedByForwardPositionalRules();
@@ -518,7 +585,7 @@
parentElement->setChildrenAffectedByBackwardPositionalRules();
if (!parentElement->isFinishedParsingChildren())
return false;
- int count = 1 + siblingTraversalStrategy.countElementsAfter(element);
+ int count = 1 + countElementsAfter(element);
if (selector->matchNth(count))
return true;
}
@@ -532,7 +599,7 @@
if (!parentElement->isFinishedParsingChildren())
return false;
- int count = 1 + siblingTraversalStrategy.countElementsOfTypeAfter(element, element->tagQName());
+ int count = 1 + countElementsOfTypeAfter(element, element->tagQName());
if (selector->matchNth(count))
return true;
}
@@ -547,7 +614,7 @@
subContext.isSubSelector = true;
PseudoId ignoreDynamicPseudo = NOPSEUDO;
for (subContext.selector = selector->selectorList()->first(); subContext.selector; subContext.selector = CSSSelectorList::next(subContext.selector)) {
- if (match(subContext, ignoreDynamicPseudo, siblingTraversalStrategy) == SelectorMatches)
+ if (match(subContext, ignoreDynamicPseudo) == SelectorMatches)
return true;
}
}
@@ -755,7 +822,7 @@
PseudoId ignoreDynamicPseudo = NOPSEUDO;
const CSSSelector* const & selector = context.selector;
for (subContext.selector = selector->selectorList()->first(); subContext.selector; subContext.selector = CSSSelectorList::next(subContext.selector)) {
- if (match(subContext, ignoreDynamicPseudo, siblingTraversalStrategy) == SelectorMatches)
+ if (match(subContext, ignoreDynamicPseudo) == SelectorMatches)
return true;
}
return false;
@@ -903,10 +970,4 @@
return element->focused() && isFrameFocused(element);
}
-template
-SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, PseudoId&, const DOMSiblingTraversalStrategy&) const;
-
-template
-SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, PseudoId&, const ShadowDOMSiblingTraversalStrategy&) const;
-
}
Modified: trunk/Source/WebCore/css/SelectorChecker.h (149497 => 149498)
--- trunk/Source/WebCore/css/SelectorChecker.h 2013-05-02 21:33:37 UTC (rev 149497)
+++ trunk/Source/WebCore/css/SelectorChecker.h 2013-05-02 22:13:56 UTC (rev 149498)
@@ -81,10 +81,8 @@
BehaviorAtBoundary behaviorAtBoundary;
};
- template<typename SiblingTraversalStrategy>
- Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversalStrategy&) const;
- template<typename SiblingTraversalStrategy>
- bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy&) const;
+ Match match(const SelectorCheckingContext&, PseudoId&) const;
+ bool checkOne(const SelectorCheckingContext&) const;
bool strictParsing() const { return m_strictParsing; }
Modified: trunk/Source/WebCore/css/SiblingTraversalStrategies.h (149497 => 149498)
--- trunk/Source/WebCore/css/SiblingTraversalStrategies.h 2013-05-02 21:33:37 UTC (rev 149497)
+++ trunk/Source/WebCore/css/SiblingTraversalStrategies.h 2013-05-02 22:13:56 UTC (rev 149498)
@@ -1,273 +1 @@
-/*
- * Copyright (C) 1999 Lars Knoll ([email protected])
- * (C) 2004-2005 Allan Sandfeld Jensen ([email protected])
- * Copyright (C) 2006, 2007 Nicholas Shanks ([email protected])
- * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2007 Alexey Proskuryakov <[email protected]>
- * Copyright (C) 2007, 2008 Eric Seidel <[email protected]>
- * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
- * Copyright (C) Research In Motion Limited 2011. All rights reserved.
- * Copyright (C) 2012, Google, Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef SiblingTraversalStrategies_h
-#define SiblingTraversalStrategies_h
-
-#include "Element.h"
-#include "RenderStyle.h"
-
-#include <wtf/UnusedParam.h>
-
-namespace WebCore {
-
-struct DOMSiblingTraversalStrategy {
- bool isFirstChild(Element*) const;
- bool isLastChild(Element*) const;
- bool isFirstOfType(Element*, const QualifiedName&) const;
- bool isLastOfType(Element*, const QualifiedName&) const;
-
- int countElementsBefore(Element*) const;
- int countElementsAfter(Element*) const;
- int countElementsOfTypeBefore(Element*, const QualifiedName&) const;
- int countElementsOfTypeAfter(Element*, const QualifiedName&) const;
-};
-
-inline bool DOMSiblingTraversalStrategy::isFirstChild(Element* element) const
-{
- return !element->previousElementSibling();
-}
-
-inline bool DOMSiblingTraversalStrategy::isLastChild(Element* element) const
-{
- return !element->nextElementSibling();
-}
-
-inline bool DOMSiblingTraversalStrategy::isFirstOfType(Element* element, const QualifiedName& type) const
-{
- for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
- if (sibling->hasTagName(type))
- return false;
- }
- return true;
-}
-
-inline bool DOMSiblingTraversalStrategy::isLastOfType(Element* element, const QualifiedName& type) const
-{
- for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) {
- if (sibling->hasTagName(type))
- return false;
- }
- return true;
-}
-
-inline int DOMSiblingTraversalStrategy::countElementsBefore(Element* element) const
-{
- int count = 0;
- for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
- unsigned index = sibling->childIndex();
- if (index) {
- count += index;
- break;
- }
- count++;
- }
-
- return count;
-}
-
-inline int DOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element* element, const QualifiedName& type) const
-{
- int count = 0;
- for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
- if (sibling->hasTagName(type))
- ++count;
- }
-
- return count;
-}
-
-inline int DOMSiblingTraversalStrategy::countElementsAfter(Element* element) const
-{
- int count = 0;
- for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling())
- ++count;
-
- return count;
-}
-
-inline int DOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element* element, const QualifiedName& type) const
-{
- int count = 0;
- for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) {
- if (sibling->hasTagName(type))
- ++count;
- }
-
- return count;
-}
-
-struct ShadowDOMSiblingTraversalStrategy {
- ShadowDOMSiblingTraversalStrategy(const Vector<RefPtr<Node> >& siblings, int nth)
- : m_siblings(siblings)
- , m_nth(nth)
- {
- }
-
- bool isFirstChild(Element*) const;
- bool isLastChild(Element*) const;
- bool isFirstOfType(Element*, const QualifiedName&) const;
- bool isLastOfType(Element*, const QualifiedName&) const;
-
- int countElementsBefore(Element*) const;
- int countElementsAfter(Element*) const;
- int countElementsOfTypeBefore(Element*, const QualifiedName&) const;
- int countElementsOfTypeAfter(Element*, const QualifiedName&) const;
-
-private:
- Vector<RefPtr<Node> > m_siblings;
- int m_nth;
-};
-
-inline bool ShadowDOMSiblingTraversalStrategy::isFirstChild(Element* element) const
-{
- UNUSED_PARAM(element);
-
- const Vector<RefPtr<Node> >& siblings = m_siblings;
- ASSERT(element == toElement(siblings[m_nth].get()));
-
- for (int i = m_nth - 1; i >= 0; --i) {
- if (siblings[i] && siblings[i]->isElementNode())
- return false;
- }
-
- return true;
-}
-
-inline bool ShadowDOMSiblingTraversalStrategy::isLastChild(Element* element) const
-{
- UNUSED_PARAM(element);
-
- const Vector<RefPtr<Node> >& siblings = m_siblings;
- ASSERT(element == toElement(siblings[m_nth].get()));
-
- for (size_t i = m_nth + 1; i < siblings.size(); ++i) {
- if (siblings[i] && siblings[i]->isElementNode())
- return false;
- }
-
- return true;
-}
-
-inline bool ShadowDOMSiblingTraversalStrategy::isFirstOfType(Element* element, const QualifiedName& type) const
-{
- UNUSED_PARAM(element);
-
- const Vector<RefPtr<Node> >& siblings = m_siblings;
- ASSERT(element == toElement(siblings[m_nth].get()));
-
- for (int i = m_nth - 1; i >= 0; --i) {
- if (siblings[i] && siblings[i]->isElementNode() && siblings[i]->hasTagName(type))
- return false;
- }
-
- return true;
-}
-
-inline bool ShadowDOMSiblingTraversalStrategy::isLastOfType(Element* element, const QualifiedName& type) const
-{
- UNUSED_PARAM(element);
-
- const Vector<RefPtr<Node> >& siblings = m_siblings;
- ASSERT(element == toElement(siblings[m_nth].get()));
-
- for (size_t i = m_nth + 1; i < siblings.size(); ++i) {
- if (siblings[i] && siblings[i]->isElementNode() && siblings[i]->hasTagName(type))
- return false;
- }
-
- return true;
-}
-
-inline int ShadowDOMSiblingTraversalStrategy::countElementsBefore(Element* element) const
-{
- UNUSED_PARAM(element);
-
- const Vector<RefPtr<Node> >& siblings = m_siblings;
- ASSERT(element == toElement(siblings[m_nth].get()));
-
- int count = 0;
- for (int i = m_nth - 1; i >= 0; --i) {
- if (siblings[i] && siblings[i]->isElementNode())
- ++count;
- }
-
- return count;
-}
-
-inline int ShadowDOMSiblingTraversalStrategy::countElementsAfter(Element* element) const
-{
- UNUSED_PARAM(element);
-
- const Vector<RefPtr<Node> >& siblings = m_siblings;
- ASSERT(element == toElement(siblings[m_nth].get()));
-
- int count = 0;
- for (size_t i = m_nth + 1; i < siblings.size(); ++i) {
- if (siblings[i] && siblings[i]->isElementNode())
- return ++count;
- }
-
- return count;
-}
-
-inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeBefore(Element* element, const QualifiedName& type) const
-{
- UNUSED_PARAM(element);
-
- const Vector<RefPtr<Node> >& siblings = m_siblings;
- ASSERT(element == toElement(siblings[m_nth].get()));
-
- int count = 0;
- for (int i = m_nth - 1; i >= 0; --i) {
- if (siblings[i] && siblings[i]->isElementNode() && siblings[i]->hasTagName(type))
- ++count;
- }
-
- return count;
-}
-
-inline int ShadowDOMSiblingTraversalStrategy::countElementsOfTypeAfter(Element* element, const QualifiedName& type) const
-{
- UNUSED_PARAM(element);
-
- const Vector<RefPtr<Node> >& siblings = m_siblings;
- ASSERT(element == toElement(siblings[m_nth].get()));
-
- int count = 0;
- for (size_t i = m_nth + 1; i < siblings.size(); ++i) {
- if (siblings[i] && siblings[i]->isElementNode() && siblings[i]->hasTagName(type))
- return ++count;
- }
-
- return count;
-}
-
-}
-
-#endif
+// Remove this file.
Modified: trunk/Source/WebCore/css/StyleResolver.h (149497 => 149498)
--- trunk/Source/WebCore/css/StyleResolver.h 2013-05-02 21:33:37 UTC (rev 149497)
+++ trunk/Source/WebCore/css/StyleResolver.h 2013-05-02 22:13:56 UTC (rev 149498)
@@ -36,7 +36,6 @@
#include "ScrollTypes.h"
#include "SelectorChecker.h"
#include "SelectorFilter.h"
-#include "SiblingTraversalStrategies.h"
#include "StyleInheritedData.h"
#include "StyleScopeResolver.h"
#include "ViewportStyleResolver.h"
@@ -671,7 +670,7 @@
for (const CSSSelector* s = regionSelector; s; s = CSSSelectorList::next(s)) {
SelectorChecker::SelectorCheckingContext selectorCheckingContext(s, regionElement, SelectorChecker::VisitedMatchDisabled);
PseudoId ignoreDynamicPseudo = NOPSEUDO;
- if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo, DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches)
+ if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo) == SelectorChecker::SelectorMatches)
return true;
}
return false;
Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (149497 => 149498)
--- trunk/Source/WebCore/dom/SelectorQuery.cpp 2013-05-02 21:33:37 UTC (rev 149497)
+++ trunk/Source/WebCore/dom/SelectorQuery.cpp 2013-05-02 22:13:56 UTC (rev 149498)
@@ -31,7 +31,6 @@
#include "Document.h"
#include "SelectorChecker.h"
#include "SelectorCheckerFastPath.h"
-#include "SiblingTraversalStrategies.h"
#include "StaticNodeList.h"
#include "StyledElement.h"
@@ -64,7 +63,7 @@
selectorCheckingContext.behaviorAtBoundary = SelectorChecker::StaysWithinTreeScope;
selectorCheckingContext.scope = !rootNode->isDocumentNode() && rootNode->isContainerNode() ? toContainerNode(rootNode) : 0;
PseudoId ignoreDynamicPseudo = NOPSEUDO;
- return selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo, DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches;
+ return selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo) == SelectorChecker::SelectorMatches;
}
bool SelectorDataList::matches(Element* targetElement) const
Modified: trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp (149497 => 149498)
--- trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp 2013-05-02 21:33:37 UTC (rev 149497)
+++ trunk/Source/WebCore/html/shadow/ContentSelectorQuery.cpp 2013-05-02 22:13:56 UTC (rev 149498)
@@ -31,7 +31,6 @@
#include "InsertionPoint.h"
#include "SelectorChecker.h"
#include "ShadowRoot.h"
-#include "SiblingTraversalStrategies.h"
namespace WebCore {
@@ -40,9 +39,8 @@
Element* element = toElement(siblings[nth].get());
SelectorChecker selectorChecker(element->document(), SelectorChecker::CollectingRules);
SelectorChecker::SelectorCheckingContext context(selector, element, SelectorChecker::VisitedMatchEnabled);
- ShadowDOMSiblingTraversalStrategy strategy(siblings, nth);
PseudoId ignoreDynamicPseudo = NOPSEUDO;
- return selectorChecker.match(context, ignoreDynamicPseudo, strategy) == SelectorChecker::SelectorMatches;
+ return selectorChecker.match(context, ignoreDynamicPseudo) == SelectorChecker::SelectorMatches;
}
void ContentSelectorDataList::initialize(const CSSSelectorList& selectors)