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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return false; | 74 return false; |
75 | 75 |
76 if (element->shadowPseudoId() != selector.value()) | 76 if (element->shadowPseudoId() != selector.value()) |
77 return false; | 77 return false; |
78 | 78 |
79 return true; | 79 return true; |
80 } | 80 } |
81 | 81 |
82 static Element* parentElement(const SelectorChecker::SelectorCheckingContext& co
ntext) | 82 static Element* parentElement(const SelectorChecker::SelectorCheckingContext& co
ntext) |
83 { | 83 { |
84 // If context.scope is a shadow root, we should walk up to its shadow host. | 84 // - If context.scope is a shadow root, we should walk up to its shadow host
. |
85 if (context.scope && context.scope == context.element->containingShadowRoot(
)) | 85 // - If context.scope is some element in some shadow tree and querySelector
initialized the context, |
| 86 // e.g. shadowRoot.querySelector(':host *'), |
| 87 // (a) context.element has the same treescope as context.scope, need to wa
lk up to its shadow host. |
| 88 // (b) Otherwise, should not walk up from a shadow root to a shadow host. |
| 89 if (context.scope && (context.scope == context.element->containingShadowRoot
() || context.scope->treeScope() == context.element->treeScope())) |
86 return context.element->parentOrShadowHostElement(); | 90 return context.element->parentOrShadowHostElement(); |
87 | |
88 // If context.scope is some element in some shadow tree and querySelector in
itialized the context, | |
89 // e.g. shadowRoot.querySelector(':host *'), | |
90 // (a) context.element has the same treescope as context.scope, need to walk
up to its shadow host. | |
91 // (b) Otherwise, should not walk up from a shadow root to a shadow host. | |
92 if (context.scope && context.scope->treeScope() == context.element->treeScop
e()) | |
93 return context.element->parentOrShadowHostElement(); | |
94 | |
95 return context.element->parentElement(); | 91 return context.element->parentElement(); |
96 } | 92 } |
97 | 93 |
98 static bool scopeContainsLastMatchedElement(const SelectorChecker::SelectorCheck
ingContext& context) | 94 static bool scopeContainsLastMatchedElement(const SelectorChecker::SelectorCheck
ingContext& context) |
99 { | 95 { |
100 if (!(context.contextFlags & SelectorChecker::ScopeContainsLastMatchedElemen
t)) | 96 if (!(context.contextFlags & SelectorChecker::ScopeContainsLastMatchedElemen
t)) |
101 return true; | 97 return true; |
102 | 98 |
103 ASSERT(context.scope); | 99 ASSERT(context.scope); |
104 if (context.scope->treeScope() == context.element->treeScope()) | 100 if (context.scope->treeScope() == context.element->treeScope()) |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 return isHTMLOptionElement(element) && toHTMLOptionElement(element).spatialN
avigationFocused() && isFrameFocused(element); | 1125 return isHTMLOptionElement(element) && toHTMLOptionElement(element).spatialN
avigationFocused() && isFrameFocused(element); |
1130 } | 1126 } |
1131 | 1127 |
1132 template | 1128 template |
1133 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; | 1129 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; |
1134 | 1130 |
1135 template | 1131 template |
1136 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; | 1132 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; |
1137 | 1133 |
1138 } | 1134 } |
OLD | NEW |