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

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

Issue 2509593002: Implement ::placeholder CSS selector. (Closed)
Patch Set: Introduce PseudoType::PseudoPlaceholder Created 4 years 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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 subContext.treatShadowHostAsNormalScope = false; 1087 subContext.treatShadowHostAsNormalScope = false;
1088 1088
1089 for (subContext.selector = selector.selectorList()->first(); 1089 for (subContext.selector = selector.selectorList()->first();
1090 subContext.selector; 1090 subContext.selector;
1091 subContext.selector = CSSSelectorList::next(*subContext.selector)) { 1091 subContext.selector = CSSSelectorList::next(*subContext.selector)) {
1092 if (match(subContext)) 1092 if (match(subContext))
1093 return true; 1093 return true;
1094 } 1094 }
1095 return false; 1095 return false;
1096 } 1096 }
1097 case CSSSelector::PseudoPlaceholder:
1098 if (ShadowRoot* root = element.containingShadowRoot()) {
1099 return root->type() == ShadowRootType::UserAgent &&
1100 element.shadowPseudoId() == "-webkit-input-placeholder";
1101 }
1102 return false;
1097 case CSSSelector::PseudoWebKitCustomElement: { 1103 case CSSSelector::PseudoWebKitCustomElement: {
1098 if (ShadowRoot* root = element.containingShadowRoot()) 1104 if (ShadowRoot* root = element.containingShadowRoot())
1099 return root->type() == ShadowRootType::UserAgent && 1105 return root->type() == ShadowRootType::UserAgent &&
1100 element.shadowPseudoId() == selector.value(); 1106 element.shadowPseudoId() == selector.value();
1101 return false; 1107 return false;
1102 } 1108 }
1103 case CSSSelector::PseudoBlinkInternalElement: 1109 case CSSSelector::PseudoBlinkInternalElement:
1104 if (!m_isUARule) 1110 if (!m_isUARule)
1105 return false; 1111 return false;
1106 if (ShadowRoot* root = element.containingShadowRoot()) 1112 if (ShadowRoot* root = element.containingShadowRoot())
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 } 1311 }
1306 1312
1307 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) { 1313 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) {
1308 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element), 1314 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element),
1309 CSSSelector::PseudoFocus)) 1315 CSSSelector::PseudoFocus))
1310 return true; 1316 return true;
1311 return element.isFocused() && isFrameFocused(element); 1317 return element.isFocused() && isFrameFocused(element);
1312 } 1318 }
1313 1319
1314 } // namespace blink 1320 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698