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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 , previousElement(0) | 62 , previousElement(0) |
63 , scope(0) | 63 , scope(0) |
64 , visitedMatchType(visitedMatchType) | 64 , visitedMatchType(visitedMatchType) |
65 , pseudoId(NOPSEUDO) | 65 , pseudoId(NOPSEUDO) |
66 , elementStyle(0) | 66 , elementStyle(0) |
67 , scrollbar(0) | 67 , scrollbar(0) |
68 , scrollbarPart(NoPart) | 68 , scrollbarPart(NoPart) |
69 , isSubSelector(false) | 69 , isSubSelector(false) |
70 , hasScrollbarPseudo(false) | 70 , hasScrollbarPseudo(false) |
71 , hasSelectionPseudo(false) | 71 , hasSelectionPseudo(false) |
| 72 , isUARule(false) |
72 , contextFlags(DefaultBehavior) | 73 , contextFlags(DefaultBehavior) |
73 { } | 74 { } |
74 | 75 |
75 const CSSSelector* selector; | 76 const CSSSelector* selector; |
76 Element* element; | 77 Element* element; |
77 Element* previousElement; | 78 Element* previousElement; |
78 const ContainerNode* scope; | 79 const ContainerNode* scope; |
79 VisitedMatchType visitedMatchType; | 80 VisitedMatchType visitedMatchType; |
80 PseudoId pseudoId; | 81 PseudoId pseudoId; |
81 RenderStyle* elementStyle; | 82 RenderStyle* elementStyle; |
82 RenderScrollbar* scrollbar; | 83 RenderScrollbar* scrollbar; |
83 ScrollbarPart scrollbarPart; | 84 ScrollbarPart scrollbarPart; |
84 bool isSubSelector; | 85 bool isSubSelector; |
85 bool hasScrollbarPseudo; | 86 bool hasScrollbarPseudo; |
86 bool hasSelectionPseudo; | 87 bool hasSelectionPseudo; |
| 88 bool isUARule; |
87 ContextFlags contextFlags; | 89 ContextFlags contextFlags; |
88 }; | 90 }; |
89 | 91 |
90 struct MatchResult { | 92 struct MatchResult { |
91 MatchResult() | 93 MatchResult() |
92 : dynamicPseudo(NOPSEUDO) | 94 : dynamicPseudo(NOPSEUDO) |
93 , specificity(0) { } | 95 , specificity(0) { } |
94 | 96 |
95 PseudoId dynamicPseudo; | 97 PseudoId dynamicPseudo; |
96 unsigned specificity; | 98 unsigned specificity; |
97 }; | 99 }; |
98 | 100 |
99 template<typename SiblingTraversalStrategy> | 101 template<typename SiblingTraversalStrategy> |
100 Match match(const SelectorCheckingContext&, const SiblingTraversalStrategy&,
MatchResult* = 0) const; | 102 Match match(const SelectorCheckingContext&, const SiblingTraversalStrategy&,
MatchResult* = 0) const; |
101 | 103 |
102 template<typename SiblingTraversalStrategy> | 104 template<typename SiblingTraversalStrategy> |
103 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy
&, unsigned* specificity = 0) const; | 105 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy
&, unsigned* specificity = 0) const; |
104 | 106 |
105 bool strictParsing() const { return m_strictParsing; } | 107 bool strictParsing() const { return m_strictParsing; } |
106 | 108 |
107 Mode mode() const { return m_mode; } | 109 Mode mode() const { return m_mode; } |
108 | 110 |
109 static bool tagMatches(const Element&, const QualifiedName&); | 111 static bool tagMatches(const Element&, const QualifiedName&); |
110 static bool isCommonPseudoClassSelector(const CSSSelector&); | 112 static bool isCommonPseudoClassSelector(const CSSSelector&); |
111 static bool matchesFocusPseudoClass(const Element&); | 113 static bool matchesFocusPseudoClass(const Element&); |
| 114 static bool matchesSpatialNavigationFocusPseudoClass(const Element&); |
112 static bool checkExactAttribute(const Element&, const QualifiedName& selecto
rAttributeName, const StringImpl* value); | 115 static bool checkExactAttribute(const Element&, const QualifiedName& selecto
rAttributeName, const StringImpl* value); |
113 | 116 |
114 enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLink |
MatchVisited }; | 117 enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLink |
MatchVisited }; |
115 static unsigned determineLinkMatchType(const CSSSelector&); | 118 static unsigned determineLinkMatchType(const CSSSelector&); |
116 | 119 |
117 static bool isHostInItsShadowTree(const Element&, const ContainerNode* scope
); | 120 static bool isHostInItsShadowTree(const Element&, const ContainerNode* scope
); |
118 | 121 |
119 private: | 122 private: |
120 template<typename SiblingTraversalStrategy> | 123 template<typename SiblingTraversalStrategy> |
121 Match matchForSubSelector(const SelectorCheckingContext&, const SiblingTrave
rsalStrategy&, MatchResult*) const; | 124 Match matchForSubSelector(const SelectorCheckingContext&, const SiblingTrave
rsalStrategy&, MatchResult*) const; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 174 } |
172 | 175 |
173 inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const
ContainerNode* scope) | 176 inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const
ContainerNode* scope) |
174 { | 177 { |
175 return scope && scope->isInShadowTree() && scope->shadowHost() == element; | 178 return scope && scope->isInShadowTree() && scope->shadowHost() == element; |
176 } | 179 } |
177 | 180 |
178 } | 181 } |
179 | 182 |
180 #endif | 183 #endif |
OLD | NEW |