Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/Source/core/css/SelectorChecker.cpp

Issue 1602833002: No pseudo elements in SelectorChecker::Mode QueryingRules. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-pseudoelm-check-2-20160118
Patch Set: CORE_EXPORT for unit test in component build Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 ASSERT(selector.selectorList()->first()); 1067 ASSERT(selector.selectorList()->first());
1068 ASSERT(!CSSSelectorList::next(*selector.selectorList()->first())); 1068 ASSERT(!CSSSelectorList::next(*selector.selectorList()->first()));
1069 subContext.selector = selector.selectorList()->first(); 1069 subContext.selector = selector.selectorList()->first();
1070 return match(subContext); 1070 return match(subContext);
1071 } 1071 }
1072 case CSSSelector::PseudoContent: 1072 case CSSSelector::PseudoContent:
1073 return element.isInShadowTree() && element.isInsertionPoint(); 1073 return element.isInShadowTree() && element.isInsertionPoint();
1074 case CSSSelector::PseudoShadow: 1074 case CSSSelector::PseudoShadow:
1075 return element.isInShadowTree() && context.previousElement; 1075 return element.isInShadowTree() && context.previousElement;
1076 default: 1076 default:
1077 break; 1077 if (m_mode == SharingRules)
1078 return true;
1079 ASSERT(m_mode != QueryingRules);
1080 result.dynamicPseudo = CSSSelector::pseudoId(selector.pseudoType());
1081 ASSERT(result.dynamicPseudo != NOPSEUDO);
1082 return true;
1078 } 1083 }
1079
1080 if (m_mode == QueryingRules)
1081 return false;
1082 if (m_mode == SharingRules)
1083 return true;
1084
1085 result.dynamicPseudo = CSSSelector::pseudoId(selector.pseudoType());
1086 ASSERT(result.dynamicPseudo != NOPSEUDO);
1087 return true;
1088 } 1084 }
1089 1085
1090 bool SelectorChecker::checkPseudoHost(const SelectorCheckingContext& context, Ma tchResult& result) const 1086 bool SelectorChecker::checkPseudoHost(const SelectorCheckingContext& context, Ma tchResult& result) const
1091 { 1087 {
1092 const CSSSelector& selector = *context.selector; 1088 const CSSSelector& selector = *context.selector;
1093 Element& element = *context.element; 1089 Element& element = *context.element;
1094 1090
1095 if (m_mode == SharingRules) 1091 if (m_mode == SharingRules)
1096 return true; 1092 return true;
1097 // :host only matches a shadow host when :host is in a shadow tree of the sh adow host. 1093 // :host only matches a shadow host when :host is in a shadow tree of the sh adow host.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1228 }
1233 1229
1234 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1230 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1235 { 1231 {
1236 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1232 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1237 return true; 1233 return true;
1238 return element.focused() && isFrameFocused(element); 1234 return element.focused() && isFrameFocused(element);
1239 } 1235 }
1240 1236
1241 } 1237 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698