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 11 matching lines...) Expand all Loading... |
22 * You should have received a copy of the GNU Library General Public License | 22 * You should have received a copy of the GNU Library General Public License |
23 * along with this library; see the file COPYING.LIB. If not, write to | 23 * along with this library; see the file COPYING.LIB. If not, write to |
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
26 */ | 26 */ |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 #include "core/css/SelectorChecker.h" | 29 #include "core/css/SelectorChecker.h" |
30 | 30 |
31 #include "core/HTMLNames.h" | 31 #include "core/HTMLNames.h" |
| 32 #include "core/css/CSSLocalNameToLowerMaps.h" |
32 #include "core/css/CSSSelectorList.h" | 33 #include "core/css/CSSSelectorList.h" |
33 #include "core/css/SiblingTraversalStrategies.h" | 34 #include "core/css/SiblingTraversalStrategies.h" |
34 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
35 #include "core/dom/ElementTraversal.h" | 36 #include "core/dom/ElementTraversal.h" |
36 #include "core/dom/Fullscreen.h" | 37 #include "core/dom/Fullscreen.h" |
37 #include "core/dom/NodeComputedStyle.h" | 38 #include "core/dom/NodeComputedStyle.h" |
38 #include "core/dom/StyleEngine.h" | 39 #include "core/dom/StyleEngine.h" |
39 #include "core/dom/Text.h" | 40 #include "core/dom/Text.h" |
40 #include "core/dom/shadow/ComposedTreeTraversal.h" | 41 #include "core/dom/shadow/ComposedTreeTraversal.h" |
41 #include "core/dom/shadow/InsertionPoint.h" | 42 #include "core/dom/shadow/InsertionPoint.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 bool elementIsHostInItsShadowTree = isHostInItsShadowTree(element, context.s
cope); | 544 bool elementIsHostInItsShadowTree = isHostInItsShadowTree(element, context.s
cope); |
544 | 545 |
545 // Only :host and :host-context() should match the host: http://drafts.csswg
.org/css-scoping/#host-element | 546 // Only :host and :host-context() should match the host: http://drafts.csswg
.org/css-scoping/#host-element |
546 if (elementIsHostInItsShadowTree && (!selector.isHostPseudoClass() | 547 if (elementIsHostInItsShadowTree && (!selector.isHostPseudoClass() |
547 && !context.treatShadowHostAsNormalScope | 548 && !context.treatShadowHostAsNormalScope |
548 && selector.match() != CSSSelector::PseudoElement)) | 549 && selector.match() != CSSSelector::PseudoElement)) |
549 return false; | 550 return false; |
550 | 551 |
551 switch (selector.match()) { | 552 switch (selector.match()) { |
552 case CSSSelector::Tag: | 553 case CSSSelector::Tag: |
553 return SelectorChecker::tagMatches(element, selector.tagQName()); | 554 return SelectorChecker::tagMatches(element, selector); |
554 case CSSSelector::Class: | 555 case CSSSelector::Class: |
555 return element.hasClass() && element.classNames().contains(selector.valu
e()); | 556 return element.hasClass() && element.classNames().contains(selector.valu
e()); |
556 case CSSSelector::Id: | 557 case CSSSelector::Id: |
557 return element.hasID() && element.idForStyleResolution() == selector.val
ue(); | 558 return element.hasID() && element.idForStyleResolution() == selector.val
ue(); |
558 | 559 |
559 // Attribute selectors | 560 // Attribute selectors |
560 case CSSSelector::AttributeExact: | 561 case CSSSelector::AttributeExact: |
561 case CSSSelector::AttributeSet: | 562 case CSSSelector::AttributeSet: |
562 case CSSSelector::AttributeHyphen: | 563 case CSSSelector::AttributeHyphen: |
563 case CSSSelector::AttributeList: | 564 case CSSSelector::AttributeList: |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 bool SelectorChecker::matchesSpatialNavigationFocusPseudoClass(const Element& el
ement) | 1171 bool SelectorChecker::matchesSpatialNavigationFocusPseudoClass(const Element& el
ement) |
1171 { | 1172 { |
1172 return isHTMLOptionElement(element) && toHTMLOptionElement(element).spatialN
avigationFocused() && isFrameFocused(element); | 1173 return isHTMLOptionElement(element) && toHTMLOptionElement(element).spatialN
avigationFocused() && isFrameFocused(element); |
1173 } | 1174 } |
1174 | 1175 |
1175 bool SelectorChecker::matchesListBoxPseudoClass(const Element& element) | 1176 bool SelectorChecker::matchesListBoxPseudoClass(const Element& element) |
1176 { | 1177 { |
1177 return isHTMLSelectElement(element) && !toHTMLSelectElement(element).usesMen
uList(); | 1178 return isHTMLSelectElement(element) && !toHTMLSelectElement(element).usesMen
uList(); |
1178 } | 1179 } |
1179 | 1180 |
| 1181 bool SelectorChecker::localNameMatchesLower(const AtomicString& elementName, con
st AtomicString& camelCasedType) |
| 1182 { |
| 1183 return elementName != CSSLocalNameToLowerMaps::elementToLower(camelCasedType
); |
| 1184 } |
| 1185 |
1180 template | 1186 template |
1181 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; | 1187 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst DOMSiblingTraversalStrategy&, MatchResult*) const; |
1182 | 1188 |
1183 template | 1189 template |
1184 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; | 1190 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co
nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; |
1185 | 1191 |
1186 } | 1192 } |
OLD | NEW |