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) | |
|
esprehn
2016/05/09 19:39:50
this should check that containingShadowRoot()->typ
tkent
2016/05/10 04:29:29
Done.
| |
| 922 return false; | |
| 923 if (!element.shadowHost()) | |
| 924 return false; | |
| 925 if (!element.shadowHost()->computedStyle()) | |
|
esprehn
2016/05/09 19:39:50
Don't call computedStyle repeatedly, save to a loc
tkent
2016/05/10 04:29:29
Done.
| |
| 926 return false; | |
| 927 return element.shadowHost()->computedStyle()->hasAppearance(); | |
| 920 case CSSSelector::PseudoWindowInactive: | 928 case CSSSelector::PseudoWindowInactive: |
| 921 if (!context.hasSelectionPseudo) | 929 if (!context.hasSelectionPseudo) |
| 922 return false; | 930 return false; |
| 923 return !element.document().page()->focusController().isActive(); | 931 return !element.document().page()->focusController().isActive(); |
| 924 case CSSSelector::PseudoHorizontal: | 932 case CSSSelector::PseudoHorizontal: |
| 925 case CSSSelector::PseudoVertical: | 933 case CSSSelector::PseudoVertical: |
| 926 case CSSSelector::PseudoDecrement: | 934 case CSSSelector::PseudoDecrement: |
| 927 case CSSSelector::PseudoIncrement: | 935 case CSSSelector::PseudoIncrement: |
| 928 case CSSSelector::PseudoStart: | 936 case CSSSelector::PseudoStart: |
| 929 case CSSSelector::PseudoEnd: | 937 case CSSSelector::PseudoEnd: |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 953 subContext.scope = nullptr; | 961 subContext.scope = nullptr; |
| 954 subContext.treatShadowHostAsNormalScope = false; | 962 subContext.treatShadowHostAsNormalScope = false; |
| 955 | 963 |
| 956 for (subContext.selector = selector.selectorList()->first(); subCont ext.selector; subContext.selector = CSSSelectorList::next(*subContext.selector)) { | 964 for (subContext.selector = selector.selectorList()->first(); subCont ext.selector; subContext.selector = CSSSelectorList::next(*subContext.selector)) { |
| 957 if (match(subContext)) | 965 if (match(subContext)) |
| 958 return true; | 966 return true; |
| 959 } | 967 } |
| 960 return false; | 968 return false; |
| 961 } | 969 } |
| 962 case CSSSelector::PseudoWebKitCustomElement: | 970 case CSSSelector::PseudoWebKitCustomElement: |
| 963 { | 971 if (ShadowRoot* root = element.containingShadowRoot()) { |
| 964 if (ShadowRoot* root = element.containingShadowRoot()) | 972 if (selector.value().startsWith("-webkit-internal-") && !m_isUARule) |
|
esprehn
2016/05/09 19:39:50
why do we need this? We should just make the pseud
tkent
2016/05/10 04:29:29
We should avoid to expose new vendor-specific pseu
| |
| 965 return root->type() == ShadowRootType::UserAgent && element.shad owPseudoId() == selector.value(); | 973 return false; |
| 966 return false; | 974 return root->type() == ShadowRootType::UserAgent && element.shadowPs eudoId() == selector.value(); |
| 967 } | 975 } |
| 976 return false; | |
| 968 case CSSSelector::PseudoSlotted: | 977 case CSSSelector::PseudoSlotted: |
| 969 { | 978 { |
| 970 SelectorCheckingContext subContext(context); | 979 SelectorCheckingContext subContext(context); |
| 971 subContext.isSubSelector = true; | 980 subContext.isSubSelector = true; |
| 972 subContext.scope = nullptr; | 981 subContext.scope = nullptr; |
| 973 subContext.treatShadowHostAsNormalScope = false; | 982 subContext.treatShadowHostAsNormalScope = false; |
| 974 | 983 |
| 975 // ::slotted() only allows one compound selector. | 984 // ::slotted() only allows one compound selector. |
| 976 ASSERT(selector.selectorList()->first()); | 985 ASSERT(selector.selectorList()->first()); |
| 977 ASSERT(!CSSSelectorList::next(*selector.selectorList()->first())); | 986 ASSERT(!CSSSelectorList::next(*selector.selectorList()->first())); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1135 } | 1144 } |
| 1136 | 1145 |
| 1137 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) | 1146 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) |
| 1138 { | 1147 { |
| 1139 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) | 1148 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) |
| 1140 return true; | 1149 return true; |
| 1141 return element.focused() && isFrameFocused(element); | 1150 return element.focused() && isFrameFocused(element); |
| 1142 } | 1151 } |
| 1143 | 1152 |
| 1144 } // namespace blink | 1153 } // namespace blink |
| OLD | NEW |