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, int childIndex = 0) | 58 SelectorCheckingContext(const CSSSelector* selector, Element* element, V
isitedMatchType visitedMatchType) |
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) | |
72 { } | 71 { } |
73 | 72 |
74 const CSSSelector* selector; | 73 const CSSSelector* selector; |
75 Element* element; | 74 Element* element; |
76 const ContainerNode* scope; | 75 const ContainerNode* scope; |
77 VisitedMatchType visitedMatchType; | 76 VisitedMatchType visitedMatchType; |
78 PseudoId pseudoId; | 77 PseudoId pseudoId; |
79 RenderStyle* elementStyle; | 78 RenderStyle* elementStyle; |
80 RenderScrollbar* scrollbar; | 79 RenderScrollbar* scrollbar; |
81 ScrollbarPart scrollbarPart; | 80 ScrollbarPart scrollbarPart; |
82 bool isSubSelector; | 81 bool isSubSelector; |
83 bool hasScrollbarPseudo; | 82 bool hasScrollbarPseudo; |
84 bool hasSelectionPseudo; | 83 bool hasSelectionPseudo; |
85 BehaviorAtBoundary behaviorAtBoundary; | 84 BehaviorAtBoundary behaviorAtBoundary; |
86 int childIndex; | |
87 }; | 85 }; |
88 | 86 |
89 template<typename SiblingTraversalStrategy> | 87 template<typename SiblingTraversalStrategy> |
90 Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversa
lStrategy&) const; | 88 Match match(const SelectorCheckingContext&, PseudoId&, const SiblingTraversa
lStrategy&) const; |
91 | 89 |
92 template<typename SiblingTraversalStrategy> | 90 template<typename SiblingTraversalStrategy> |
93 Match matchForShadowDistributed(const Element*, const SiblingTraversalStrate
gy&, PseudoId&, SelectorCheckingContext& nextContext) const; | 91 Match matchForShadowDistributed(const Element*, const SiblingTraversalStrate
gy&, PseudoId&, SelectorCheckingContext& nextContext) const; |
94 | 92 |
95 template<typename SiblingTraversalStrategy> | 93 template<typename SiblingTraversalStrategy> |
96 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy
&) const; | 94 bool checkOne(const SelectorCheckingContext&, const SiblingTraversalStrategy
&) const; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 const Attribute* attribute = element->attributeItem(i); | 146 const Attribute* attribute = element->attributeItem(i); |
149 if (attribute->matches(selectorAttributeName) && (!value || attribute->v
alue().impl() == value)) | 147 if (attribute->matches(selectorAttributeName) && (!value || attribute->v
alue().impl() == value)) |
150 return true; | 148 return true; |
151 } | 149 } |
152 return false; | 150 return false; |
153 } | 151 } |
154 | 152 |
155 } | 153 } |
156 | 154 |
157 #endif | 155 #endif |
OLD | NEW |