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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 enum BehaviorAtBoundary { | 48 enum BehaviorAtBoundary { |
49 DoesNotCrossBoundary = 0, | 49 DoesNotCrossBoundary = 0, |
50 CrossesBoundary = 1, | 50 CrossesBoundary = 1, |
51 StaysWithinTreeScope = 2, | 51 StaysWithinTreeScope = 2, |
52 BoundaryBehaviorMask = 3, // 2bit for boundary behavior | 52 BoundaryBehaviorMask = 3, // 2bit for boundary behavior |
53 ScopeContainsLastMatchedElement = 4, | 53 ScopeContainsLastMatchedElement = 4, |
54 }; | 54 }; |
55 | 55 |
56 struct SelectorCheckingContext { | 56 struct SelectorCheckingContext { |
57 // Initial selector constructor | 57 // Initial selector constructor |
58 SelectorCheckingContext(const CSSSelector* selector, Element* element, V
isitedMatchType visitedMatchType) | 58 SelectorCheckingContext(const CSSSelector* selector, Element* element, V
isitedMatchType visitedMatchType, int childIndex = 0) |
59 : selector(selector) | 59 : selector(selector) |
60 , element(element) | 60 , element(element) |
61 , scope(0) | 61 , scope(0) |
62 , visitedMatchType(visitedMatchType) | 62 , visitedMatchType(visitedMatchType) |
63 , pseudoId(NOPSEUDO) | 63 , pseudoId(NOPSEUDO) |
64 , elementStyle(0) | 64 , elementStyle(0) |
65 , scrollbar(0) | 65 , scrollbar(0) |
66 , scrollbarPart(NoPart) | 66 , scrollbarPart(NoPart) |
67 , isSubSelector(false) | 67 , isSubSelector(false) |
68 , hasScrollbarPseudo(false) | 68 , hasScrollbarPseudo(false) |
69 , hasSelectionPseudo(false) | 69 , hasSelectionPseudo(false) |
70 , behaviorAtBoundary(DoesNotCrossBoundary) | 70 , behaviorAtBoundary(DoesNotCrossBoundary) |
| 71 , childIndex(childIndex) |
71 { } | 72 { } |
72 | 73 |
73 const CSSSelector* selector; | 74 const CSSSelector* selector; |
74 Element* element; | 75 Element* element; |
75 const ContainerNode* scope; | 76 const ContainerNode* scope; |
76 VisitedMatchType visitedMatchType; | 77 VisitedMatchType visitedMatchType; |
77 PseudoId pseudoId; | 78 PseudoId pseudoId; |
78 RenderStyle* elementStyle; | 79 RenderStyle* elementStyle; |
79 RenderScrollbar* scrollbar; | 80 RenderScrollbar* scrollbar; |
80 ScrollbarPart scrollbarPart; | 81 ScrollbarPart scrollbarPart; |
81 bool isSubSelector; | 82 bool isSubSelector; |
82 bool hasScrollbarPseudo; | 83 bool hasScrollbarPseudo; |
83 bool hasSelectionPseudo; | 84 bool hasSelectionPseudo; |
84 BehaviorAtBoundary behaviorAtBoundary; | 85 BehaviorAtBoundary behaviorAtBoundary; |
| 86 int childIndex; |
85 }; | 87 }; |
86 | 88 |
87 template<typename SiblingTraversalStrategy> | 89 template<typename SiblingTraversalStrategy> |
88 Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversa
lStrategy&) const; | 90 Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversa
lStrategy&) const; |
89 | 91 |
90 template<typename SiblingTraversalStrategy> | 92 template<typename SiblingTraversalStrategy> |
91 Match matchForShadowDistributed(const Element*, const SiblingTraversalStrate
gy&, PseudoId&, SelectorCheckingContext& nextContext) const; | 93 Match matchForShadowDistributed(const Element*, const SiblingTraversalStrate
gy&, PseudoId&, SelectorCheckingContext& nextContext) const; |
92 | 94 |
93 template<typename SiblingTraversalStrategy> | 95 template<typename SiblingTraversalStrategy> |
94 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy
&) const; | 96 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy
&) const; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 const Attribute* attribute = element->attributeItem(i); | 148 const Attribute* attribute = element->attributeItem(i); |
147 if (attribute->matches(selectorAttributeName) && (!value || attribute->v
alue().impl() == value)) | 149 if (attribute->matches(selectorAttributeName) && (!value || attribute->v
alue().impl() == value)) |
148 return true; | 150 return true; |
149 } | 151 } |
150 return false; | 152 return false; |
151 } | 153 } |
152 | 154 |
153 } | 155 } |
154 | 156 |
155 #endif | 157 #endif |
OLD | NEW |