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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 if (context.scope && context.scope->treeScope() == context.element-> treeScope() && (context.behaviorAtBoundary & BoundaryBehaviorMask) != StaysWithi nTreeScope) | 205 if (context.scope && context.scope->treeScope() == context.element-> treeScope() && (context.behaviorAtBoundary & BoundaryBehaviorMask) != StaysWithi nTreeScope) |
206 return SelectorFailsCompletely; | 206 return SelectorFailsCompletely; |
207 Element* shadowHostNode = context.element->shadowHost(); | 207 Element* shadowHostNode = context.element->shadowHost(); |
208 if (!shadowHostNode) | 208 if (!shadowHostNode) |
209 return SelectorFailsCompletely; | 209 return SelectorFailsCompletely; |
210 nextContext.element = shadowHostNode; | 210 nextContext.element = shadowHostNode; |
211 nextContext.isSubSelector = false; | 211 nextContext.isSubSelector = false; |
212 nextContext.elementStyle = 0; | 212 nextContext.elementStyle = 0; |
213 return match(nextContext, ignoreDynamicPseudo, siblingTraversalStrat egy); | 213 return match(nextContext, ignoreDynamicPseudo, siblingTraversalStrat egy); |
214 } | 214 } |
215 case CSSSelector::ShadowDistributed: | 215 case CSSSelector::ShadowVirtualDescendant: |
216 { | 216 for (Element* element = context.element; element; element = element->par entElement()) { |
217 Vector<InsertionPoint*, 8> insertionPoints; | 217 if (matchForVirtualChild(element, siblingTraversalStrategy, ignoreDy namicPseudo, nextContext) == SelectorMatches) |
218 for (Element* element = context.element; element; element = element- >parentElement()) { | 218 return SelectorMatches; |
219 insertionPoints.clear(); | |
220 collectInsertionPointsWhereNodeIsDistributed(element, insertionP oints); | |
221 for (size_t i = 0; i < insertionPoints.size(); ++i) { | |
222 nextContext.element = insertionPoints[i]; | |
223 nextContext.isSubSelector = false; | |
224 nextContext.elementStyle = 0; | |
225 if (match(nextContext, ignoreDynamicPseudo, siblingTraversal Strategy) == SelectorMatches) | |
226 return SelectorMatches; | |
227 } | |
228 } | |
229 return SelectorFailsCompletely; | |
230 } | 219 } |
220 return SelectorFailsCompletely; | |
221 case CSSSelector::ShadowVirtualChild: | |
222 return matchForVirtualChild(context.element, siblingTraversalStrategy, i gnoreDynamicPseudo, nextContext); | |
231 } | 223 } |
232 | 224 |
233 ASSERT_NOT_REACHED(); | 225 ASSERT_NOT_REACHED(); |
234 return SelectorFailsCompletely; | 226 return SelectorFailsCompletely; |
235 } | 227 } |
236 | 228 |
229 template<typename SiblingTraversalStrategy> | |
230 SelectorChecker::Match SelectorChecker::matchForVirtualChild(const Element* elem ent, const SiblingTraversalStrategy& siblingTraversalStrategy, PseudoId& dynamic Pseudo, SelectorCheckingContext& nextContext) const | |
dglazkov
2013/05/22 17:43:43
This is interesting. Right now, it's clear that "v
| |
231 { | |
232 Vector<InsertionPoint*, 8> insertionPoints; | |
233 collectInsertionPointsWhereNodeIsDistributed(element, insertionPoints); | |
234 for (size_t i = 0; i < insertionPoints.size(); ++i) { | |
235 nextContext.element = insertionPoints[i]; | |
236 nextContext.isSubSelector = false; | |
237 nextContext.elementStyle = 0; | |
238 if (match(nextContext, dynamicPseudo, siblingTraversalStrategy) == Selec torMatches) | |
239 return SelectorMatches; | |
240 } | |
241 return SelectorFailsCompletely; | |
242 } | |
243 | |
237 static inline bool containsHTMLSpace(const AtomicString& string) | 244 static inline bool containsHTMLSpace(const AtomicString& string) |
238 { | 245 { |
239 for (unsigned i = 0; i < string.length(); i++) | 246 for (unsigned i = 0; i < string.length(); i++) |
240 if (isHTMLSpace(string[i])) | 247 if (isHTMLSpace(string[i])) |
241 return true; | 248 return true; |
242 return false; | 249 return false; |
243 } | 250 } |
244 | 251 |
245 static bool attributeValueMatches(const Attribute* attributeItem, CSSSelector::M atch match, const AtomicString& selectorValue, bool caseSensitive) | 252 static bool attributeValueMatches(const Attribute* attributeItem, CSSSelector::M atch match, const AtomicString& selectorValue, bool caseSensitive) |
246 { | 253 { |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
901 return element->focused() && isFrameFocused(element); | 908 return element->focused() && isFrameFocused(element); |
902 } | 909 } |
903 | 910 |
904 template | 911 template |
905 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const; | 912 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const DOMSiblingTraversalStrategy&) const; |
906 | 913 |
907 template | 914 template |
908 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; | 915 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, Ps eudoId&, const ShadowDOMSiblingTraversalStrategy&) const; |
909 | 916 |
910 } | 917 } |
OLD | NEW |