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

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

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

Powered by Google App Engine
This is Rietveld 408576698