| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 template<typename SiblingTraversalStrategy> | 101 template<typename SiblingTraversalStrategy> |
| 102 Match match(const SelectorCheckingContext&, const SiblingTraversalStrategy&,
MatchResult* = 0) const; | 102 Match match(const SelectorCheckingContext&, const SiblingTraversalStrategy&,
MatchResult* = 0) const; |
| 103 | 103 |
| 104 template<typename SiblingTraversalStrategy> | 104 template<typename SiblingTraversalStrategy> |
| 105 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy
&, unsigned* specificity = 0) const; | 105 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy
&, unsigned* specificity = 0) const; |
| 106 | 106 |
| 107 Mode mode() const { return m_mode; } | 107 Mode mode() const { return m_mode; } |
| 108 | 108 |
| 109 static bool tagMatches(const Element&, const QualifiedName&); | 109 static bool tagMatches(const Element&, const CSSSelector&); |
| 110 static bool isCommonPseudoClassSelector(const CSSSelector&); | 110 static bool isCommonPseudoClassSelector(const CSSSelector&); |
| 111 static bool matchesFocusPseudoClass(const Element&); | 111 static bool matchesFocusPseudoClass(const Element&); |
| 112 static bool matchesSpatialNavigationFocusPseudoClass(const Element&); | 112 static bool matchesSpatialNavigationFocusPseudoClass(const Element&); |
| 113 static bool matchesListBoxPseudoClass(const Element&); | 113 static bool matchesListBoxPseudoClass(const Element&); |
| 114 static bool localNameMatchesLower(const AtomicString& elementName, const Ato
micString& camelCasedType); |
| 114 | 115 |
| 115 enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLink |
MatchVisited }; | 116 enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLink |
MatchVisited }; |
| 116 static unsigned determineLinkMatchType(const CSSSelector&); | 117 static unsigned determineLinkMatchType(const CSSSelector&); |
| 117 | 118 |
| 118 static bool isHostInItsShadowTree(const Element&, const ContainerNode* scope
); | 119 static bool isHostInItsShadowTree(const Element&, const ContainerNode* scope
); |
| 119 | 120 |
| 120 private: | 121 private: |
| 121 template<typename SiblingTraversalStrategy> | 122 template<typename SiblingTraversalStrategy> |
| 122 Match matchForSubSelector(const SelectorCheckingContext&, const SiblingTrave
rsalStrategy&, MatchResult*) const; | 123 Match matchForSubSelector(const SelectorCheckingContext&, const SiblingTrave
rsalStrategy&, MatchResult*) const; |
| 123 template<typename SiblingTraversalStrategy> | 124 template<typename SiblingTraversalStrategy> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 144 { | 145 { |
| 145 if (selector.match() != CSSSelector::PseudoClass) | 146 if (selector.match() != CSSSelector::PseudoClass) |
| 146 return false; | 147 return false; |
| 147 CSSSelector::PseudoType pseudoType = selector.pseudoType(); | 148 CSSSelector::PseudoType pseudoType = selector.pseudoType(); |
| 148 return pseudoType == CSSSelector::PseudoLink | 149 return pseudoType == CSSSelector::PseudoLink |
| 149 || pseudoType == CSSSelector::PseudoAnyLink | 150 || pseudoType == CSSSelector::PseudoAnyLink |
| 150 || pseudoType == CSSSelector::PseudoVisited | 151 || pseudoType == CSSSelector::PseudoVisited |
| 151 || pseudoType == CSSSelector::PseudoFocus; | 152 || pseudoType == CSSSelector::PseudoFocus; |
| 152 } | 153 } |
| 153 | 154 |
| 154 inline bool SelectorChecker::tagMatches(const Element& element, const QualifiedN
ame& tagQName) | 155 inline bool SelectorChecker::tagMatches(const Element& element, const CSSSelecto
r& selector) |
| 155 { | 156 { |
| 157 const QualifiedName& tagQName = selector.tagQName(); |
| 156 if (tagQName == anyQName()) | 158 if (tagQName == anyQName()) |
| 157 return true; | 159 return true; |
| 158 const AtomicString& localName = tagQName.localName(); | 160 const AtomicString& localName = tagQName.localName(); |
| 159 if (localName != starAtom && localName != element.localName()) | 161 if (localName != starAtom && localName != element.localName()) { |
| 160 return false; | 162 if (!selector.tagIsCamelCase()) |
| 163 return false; |
| 164 if (!localNameMatchesLower(element.localName(), localName)) |
| 165 return false; |
| 166 } |
| 161 const AtomicString& namespaceURI = tagQName.namespaceURI(); | 167 const AtomicString& namespaceURI = tagQName.namespaceURI(); |
| 162 return namespaceURI == starAtom || namespaceURI == element.namespaceURI(); | 168 return namespaceURI == starAtom || namespaceURI == element.namespaceURI(); |
| 163 } | 169 } |
| 164 | 170 |
| 165 inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const
ContainerNode* scope) | 171 inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const
ContainerNode* scope) |
| 166 { | 172 { |
| 167 return scope && scope->isInShadowTree() && scope->shadowHost() == element; | 173 return scope && scope->isInShadowTree() && scope->shadowHost() == element; |
| 168 } | 174 } |
| 169 | 175 |
| 170 } | 176 } |
| 171 | 177 |
| 172 #endif | 178 #endif |
| OLD | NEW |