| 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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 if (m_mode == ResolvingStyle) | 953 if (m_mode == ResolvingStyle) |
| 954 element.document().setContainsValidityStyleRules(); | 954 element.document().setContainsValidityStyleRules(); |
| 955 return element.isOutOfRange(); | 955 return element.isOutOfRange(); |
| 956 case CSSSelector::PseudoFutureCue: | 956 case CSSSelector::PseudoFutureCue: |
| 957 return element.isVTTElement() && !toVTTElement(element).isPastNode(); | 957 return element.isVTTElement() && !toVTTElement(element).isPastNode(); |
| 958 case CSSSelector::PseudoPastCue: | 958 case CSSSelector::PseudoPastCue: |
| 959 return element.isVTTElement() && toVTTElement(element).isPastNode(); | 959 return element.isVTTElement() && toVTTElement(element).isPastNode(); |
| 960 case CSSSelector::PseudoScope: | 960 case CSSSelector::PseudoScope: |
| 961 if (m_mode == SharingRules) | 961 if (m_mode == SharingRules) |
| 962 return true; | 962 return true; |
| 963 if (context.scope) | 963 if (context.scope == element.document()) |
| 964 return context.scope == element; | 964 return element == element.document().documentElement(); |
| 965 return element == element.document().documentElement(); | 965 return context.scope == element; |
| 966 case CSSSelector::PseudoUnresolved: | 966 case CSSSelector::PseudoUnresolved: |
| 967 return element.isUnresolvedCustomElement(); | 967 return element.isUnresolvedCustomElement(); |
| 968 case CSSSelector::PseudoHost: | 968 case CSSSelector::PseudoHost: |
| 969 case CSSSelector::PseudoHostContext: | 969 case CSSSelector::PseudoHostContext: |
| 970 return checkPseudoHost(context, result); | 970 return checkPseudoHost(context, result); |
| 971 case CSSSelector::PseudoSpatialNavigationFocus: | 971 case CSSSelector::PseudoSpatialNavigationFocus: |
| 972 return context.isUARule && matchesSpatialNavigationFocusPseudoClass(elem
ent); | 972 return context.isUARule && matchesSpatialNavigationFocusPseudoClass(elem
ent); |
| 973 case CSSSelector::PseudoListBox: | 973 case CSSSelector::PseudoListBox: |
| 974 return context.isUARule && matchesListBoxPseudoClass(element); | 974 return context.isUARule && matchesListBoxPseudoClass(element); |
| 975 case CSSSelector::PseudoWindowInactive: | 975 case CSSSelector::PseudoWindowInactive: |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 bool SelectorChecker::checkPseudoHost(const SelectorCheckingContext& context, Ma
tchResult& result) const | 1045 bool SelectorChecker::checkPseudoHost(const SelectorCheckingContext& context, Ma
tchResult& result) const |
| 1046 { | 1046 { |
| 1047 const CSSSelector& selector = *context.selector; | 1047 const CSSSelector& selector = *context.selector; |
| 1048 Element& element = *context.element; | 1048 Element& element = *context.element; |
| 1049 | 1049 |
| 1050 if (m_mode == SharingRules) | 1050 if (m_mode == SharingRules) |
| 1051 return true; | 1051 return true; |
| 1052 // :host only matches a shadow host when :host is in a shadow tree of the sh
adow host. | 1052 // :host only matches a shadow host when :host is in a shadow tree of the sh
adow host. |
| 1053 if (!context.scope) | |
| 1054 return false; | |
| 1055 const ContainerNode* shadowHost = context.scope->shadowHost(); | 1053 const ContainerNode* shadowHost = context.scope->shadowHost(); |
| 1056 if (!shadowHost || shadowHost != element) | 1054 if (!shadowHost || shadowHost != element) |
| 1057 return false; | 1055 return false; |
| 1058 ASSERT(element.shadow()); | 1056 ASSERT(element.shadow()); |
| 1059 | 1057 |
| 1060 // For empty parameter case, i.e. just :host or :host(). | 1058 // For empty parameter case, i.e. just :host or :host(). |
| 1061 if (!selector.selectorList()) // Use *'s specificity. So just 0. | 1059 if (!selector.selectorList()) // Use *'s specificity. So just 0. |
| 1062 return true; | 1060 return true; |
| 1063 | 1061 |
| 1064 SelectorCheckingContext subContext(context); | 1062 SelectorCheckingContext subContext(context); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 } | 1186 } |
| 1189 | 1187 |
| 1190 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) | 1188 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) |
| 1191 { | 1189 { |
| 1192 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element
), CSSSelector::PseudoFocus)) | 1190 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element
), CSSSelector::PseudoFocus)) |
| 1193 return true; | 1191 return true; |
| 1194 return element.focused() && isFrameFocused(element); | 1192 return element.focused() && isFrameFocused(element); |
| 1195 } | 1193 } |
| 1196 | 1194 |
| 1197 } | 1195 } |
| OLD | NEW |