Chromium Code Reviews| 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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 910 return context.scope == &element; | 910 return context.scope == &element; |
| 911 case CSSSelector::PseudoUnresolved: | 911 case CSSSelector::PseudoUnresolved: |
| 912 return element.isUnresolvedCustomElement(); | 912 return element.isUnresolvedCustomElement(); |
| 913 case CSSSelector::PseudoHost: | 913 case CSSSelector::PseudoHost: |
| 914 case CSSSelector::PseudoHostContext: | 914 case CSSSelector::PseudoHostContext: |
| 915 return checkPseudoHost(context, result); | 915 return checkPseudoHost(context, result); |
| 916 case CSSSelector::PseudoSpatialNavigationFocus: | 916 case CSSSelector::PseudoSpatialNavigationFocus: |
| 917 return m_isUARule && matchesSpatialNavigationFocusPseudoClass(element); | 917 return m_isUARule && matchesSpatialNavigationFocusPseudoClass(element); |
| 918 case CSSSelector::PseudoListBox: | 918 case CSSSelector::PseudoListBox: |
| 919 return m_isUARule && matchesListBoxPseudoClass(element); | 919 return m_isUARule && matchesListBoxPseudoClass(element); |
| 920 case CSSSelector::PseudoHostHasAppearance: | |
| 921 if (!m_isUARule) | |
| 922 return false; | |
| 923 if (ShadowRoot* root = element.containingShadowRoot()) { | |
| 924 if (root->type() != ShadowRootType::UserAgent || !root->host()) | |
|
esprehn
2016/05/13 22:18:40
host() can't be null on a ShadowRoot
tkent
2016/05/16 00:21:25
Removed the null check.
| |
| 925 return false; | |
| 926 const ComputedStyle* style = root->host()->computedStyle(); | |
| 927 return style && style->hasAppearance(); | |
| 928 } | |
| 929 return false; | |
| 920 case CSSSelector::PseudoWindowInactive: | 930 case CSSSelector::PseudoWindowInactive: |
| 921 if (!context.hasSelectionPseudo) | 931 if (!context.hasSelectionPseudo) |
| 922 return false; | 932 return false; |
| 923 return !element.document().page()->focusController().isActive(); | 933 return !element.document().page()->focusController().isActive(); |
| 924 case CSSSelector::PseudoHorizontal: | 934 case CSSSelector::PseudoHorizontal: |
| 925 case CSSSelector::PseudoVertical: | 935 case CSSSelector::PseudoVertical: |
| 926 case CSSSelector::PseudoDecrement: | 936 case CSSSelector::PseudoDecrement: |
| 927 case CSSSelector::PseudoIncrement: | 937 case CSSSelector::PseudoIncrement: |
| 928 case CSSSelector::PseudoStart: | 938 case CSSSelector::PseudoStart: |
| 929 case CSSSelector::PseudoEnd: | 939 case CSSSelector::PseudoEnd: |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 958 return true; | 968 return true; |
| 959 } | 969 } |
| 960 return false; | 970 return false; |
| 961 } | 971 } |
| 962 case CSSSelector::PseudoWebKitCustomElement: | 972 case CSSSelector::PseudoWebKitCustomElement: |
| 963 { | 973 { |
| 964 if (ShadowRoot* root = element.containingShadowRoot()) | 974 if (ShadowRoot* root = element.containingShadowRoot()) |
| 965 return root->type() == ShadowRootType::UserAgent && element.shad owPseudoId() == selector.value(); | 975 return root->type() == ShadowRootType::UserAgent && element.shad owPseudoId() == selector.value(); |
| 966 return false; | 976 return false; |
| 967 } | 977 } |
| 978 case CSSSelector::PseudoBlinkInternalElement: | |
| 979 if (!m_isUARule) | |
| 980 return false; | |
| 981 if (ShadowRoot* root = element.containingShadowRoot()) | |
| 982 return root->type() == ShadowRootType::UserAgent && element.shadowPs eudoId() == selector.value(); | |
| 983 return false; | |
| 968 case CSSSelector::PseudoSlotted: | 984 case CSSSelector::PseudoSlotted: |
| 969 { | 985 { |
| 970 SelectorCheckingContext subContext(context); | 986 SelectorCheckingContext subContext(context); |
| 971 subContext.isSubSelector = true; | 987 subContext.isSubSelector = true; |
| 972 subContext.scope = nullptr; | 988 subContext.scope = nullptr; |
| 973 subContext.treatShadowHostAsNormalScope = false; | 989 subContext.treatShadowHostAsNormalScope = false; |
| 974 | 990 |
| 975 // ::slotted() only allows one compound selector. | 991 // ::slotted() only allows one compound selector. |
| 976 ASSERT(selector.selectorList()->first()); | 992 ASSERT(selector.selectorList()->first()); |
| 977 ASSERT(!CSSSelectorList::next(*selector.selectorList()->first())); | 993 ASSERT(!CSSSelectorList::next(*selector.selectorList()->first())); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1135 } | 1151 } |
| 1136 | 1152 |
| 1137 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) | 1153 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) |
| 1138 { | 1154 { |
| 1139 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) | 1155 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) |
| 1140 return true; | 1156 return true; |
| 1141 return element.focused() && isFrameFocused(element); | 1157 return element.focused() && isFrameFocused(element); |
| 1142 } | 1158 } |
| 1143 | 1159 |
| 1144 } // namespace blink | 1160 } // namespace blink |
| OLD | NEW |