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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return true; | 77 return true; |
78 } | 78 } |
79 | 79 |
80 Element* SelectorChecker::parentElement(const SelectorCheckingContext& context,
bool allowToCrossBoundary) const | 80 Element* SelectorChecker::parentElement(const SelectorCheckingContext& context,
bool allowToCrossBoundary) const |
81 { | 81 { |
82 // CrossesBoundary means we don't care any context.scope. So we can walk up
from a shadow root to its shadow host. | 82 // CrossesBoundary means we don't care any context.scope. So we can walk up
from a shadow root to its shadow host. |
83 if (allowToCrossBoundary) | 83 if (allowToCrossBoundary) |
84 return context.element->parentOrShadowHostElement(); | 84 return context.element->parentOrShadowHostElement(); |
85 | 85 |
86 // If context.scope is a shadow host, we should walk up from a shadow root t
o its shadow host. | 86 // If context.scope is a shadow host, we should walk up from a shadow root t
o its shadow host. |
87 if (context.behaviorAtBoundary & SelectorChecker::ScopeIsShadowHost) | 87 if ((context.behaviorAtBoundary & SelectorChecker::ScopeIsShadowHost) && con
text.scope == context.element->shadowHost()) |
88 return context.element->parentOrShadowHostElement(); | 88 return context.element->parentOrShadowHostElement(); |
89 | 89 |
90 if ((context.behaviorAtBoundary & SelectorChecker::BoundaryBehaviorMask) !=
SelectorChecker::StaysWithinTreeScope) | 90 if ((context.behaviorAtBoundary & SelectorChecker::BoundaryBehaviorMask) !=
SelectorChecker::StaysWithinTreeScope) |
91 return context.element->parentElement(); | 91 return context.element->parentElement(); |
92 | 92 |
93 // If context.scope is some element in some shadow tree and querySelector in
itialized the context, | 93 // If context.scope is some element in some shadow tree and querySelector in
itialized the context, |
94 // e.g. shadowRoot.querySelector(':host *'), | 94 // e.g. shadowRoot.querySelector(':host *'), |
95 // (a) context.element has the same treescope as context.scope, need to walk
up to its shadow host. | 95 // (a) context.element has the same treescope as context.scope, need to walk
up to its shadow host. |
96 // (b) Otherwise, should not walk up from a shadow root to a shadow host. | 96 // (b) Otherwise, should not walk up from a shadow root to a shadow host. |
97 if (context.scope && context.scope->treeScope() == context.element->treeScop
e()) | 97 if (context.scope && context.scope->treeScope() == context.element->treeScop
e()) |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 return element.focused() && isFrameFocused(element); | 1142 return element.focused() && isFrameFocused(element); |
1143 } | 1143 } |
1144 | 1144 |
1145 template | 1145 template |
1146 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; | 1146 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; |
1147 | 1147 |
1148 template | 1148 template |
1149 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; | 1149 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; |
1150 | 1150 |
1151 } | 1151 } |
OLD | NEW |