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

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

Issue 2509593002: Implement ::placeholder CSS selector. (Closed)
Patch Set: Created 4 years, 1 month 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. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 1060
1061 for (subContext.selector = selector.selectorList()->first(); 1061 for (subContext.selector = selector.selectorList()->first();
1062 subContext.selector; 1062 subContext.selector;
1063 subContext.selector = CSSSelectorList::next(*subContext.selector)) { 1063 subContext.selector = CSSSelectorList::next(*subContext.selector)) {
1064 if (match(subContext)) 1064 if (match(subContext))
1065 return true; 1065 return true;
1066 } 1066 }
1067 return false; 1067 return false;
1068 } 1068 }
1069 case CSSSelector::PseudoWebKitCustomElement: { 1069 case CSSSelector::PseudoWebKitCustomElement: {
1070 if (ShadowRoot* root = element.containingShadowRoot()) 1070 if (ShadowRoot* root = element.containingShadowRoot()) {
1071 return root->type() == ShadowRootType::UserAgent && 1071 if (root->type() != ShadowRootType::UserAgent)
1072 element.shadowPseudoId() == selector.value(); 1072 return false;
1073 const AtomicString& pseudoName = element.shadowPseudoId();
1074 if (pseudoName == selector.value())
1075 return true;
1076 AtomicString alias = CSSSelector::aliasForShadowPseudoId(pseudoName);
1077 return !alias.isEmpty() && alias == selector.value();
1078 }
1073 return false; 1079 return false;
1074 } 1080 }
1075 case CSSSelector::PseudoBlinkInternalElement: 1081 case CSSSelector::PseudoBlinkInternalElement:
1076 if (!m_isUARule) 1082 if (!m_isUARule)
1077 return false; 1083 return false;
1078 if (ShadowRoot* root = element.containingShadowRoot()) 1084 if (ShadowRoot* root = element.containingShadowRoot())
1079 return root->type() == ShadowRootType::UserAgent && 1085 return root->type() == ShadowRootType::UserAgent &&
1080 element.shadowPseudoId() == selector.value(); 1086 element.shadowPseudoId() == selector.value();
1081 return false; 1087 return false;
1082 case CSSSelector::PseudoSlotted: { 1088 case CSSSelector::PseudoSlotted: {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 } 1283 }
1278 1284
1279 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) { 1285 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) {
1280 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element), 1286 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element),
1281 CSSSelector::PseudoFocus)) 1287 CSSSelector::PseudoFocus))
1282 return true; 1288 return true;
1283 return element.isFocused() && isFrameFocused(element); 1289 return element.isFocused() && isFrameFocused(element);
1284 } 1290 }
1285 1291
1286 } // namespace blink 1292 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698