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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSSelector.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-2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * 1999 Waldo Bastian (bastian@kde.org) 3 * 1999 Waldo Bastian (bastian@kde.org)
4 * 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch) 4 * 2001 Andreas Schlapbach (schlpbch@iam.unibe.ch)
5 * 2001-2003 Dirk Mueller (mueller@kde.org) 5 * 2001-2003 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
7 * reserved. 7 * reserved.
8 * Copyright (C) 2008 David Smith (catfish.man@gmail.com) 8 * Copyright (C) 2008 David Smith (catfish.man@gmail.com)
9 * Copyright (C) 2010 Google Inc. All rights reserved. 9 * Copyright (C) 2010 Google Inc. All rights reserved.
10 * 10 *
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 {"last-child", CSSSelector::PseudoLastChild}, 350 {"last-child", CSSSelector::PseudoLastChild},
351 {"last-of-type", CSSSelector::PseudoLastOfType}, 351 {"last-of-type", CSSSelector::PseudoLastOfType},
352 {"left", CSSSelector::PseudoLeftPage}, 352 {"left", CSSSelector::PseudoLeftPage},
353 {"link", CSSSelector::PseudoLink}, 353 {"link", CSSSelector::PseudoLink},
354 {"no-button", CSSSelector::PseudoNoButton}, 354 {"no-button", CSSSelector::PseudoNoButton},
355 {"only-child", CSSSelector::PseudoOnlyChild}, 355 {"only-child", CSSSelector::PseudoOnlyChild},
356 {"only-of-type", CSSSelector::PseudoOnlyOfType}, 356 {"only-of-type", CSSSelector::PseudoOnlyOfType},
357 {"optional", CSSSelector::PseudoOptional}, 357 {"optional", CSSSelector::PseudoOptional},
358 {"out-of-range", CSSSelector::PseudoOutOfRange}, 358 {"out-of-range", CSSSelector::PseudoOutOfRange},
359 {"past", CSSSelector::PseudoPastCue}, 359 {"past", CSSSelector::PseudoPastCue},
360 {"placeholder", CSSSelector::PseudoWebKitCustomElement},
rune 2016/11/18 09:53:23 Making this a PseudoWebKitCustomElement means this
tkent 2016/11/21 05:36:02 Firefox and Safari don't accept user-action pseudo
360 {"placeholder-shown", CSSSelector::PseudoPlaceholderShown}, 361 {"placeholder-shown", CSSSelector::PseudoPlaceholderShown},
361 {"read-only", CSSSelector::PseudoReadOnly}, 362 {"read-only", CSSSelector::PseudoReadOnly},
362 {"read-write", CSSSelector::PseudoReadWrite}, 363 {"read-write", CSSSelector::PseudoReadWrite},
363 {"required", CSSSelector::PseudoRequired}, 364 {"required", CSSSelector::PseudoRequired},
364 {"right", CSSSelector::PseudoRightPage}, 365 {"right", CSSSelector::PseudoRightPage},
365 {"root", CSSSelector::PseudoRoot}, 366 {"root", CSSSelector::PseudoRoot},
366 {"scope", CSSSelector::PseudoScope}, 367 {"scope", CSSSelector::PseudoScope},
367 {"selection", CSSSelector::PseudoSelection}, 368 {"selection", CSSSelector::PseudoSelection},
368 {"shadow", CSSSelector::PseudoShadow}, 369 {"shadow", CSSSelector::PseudoShadow},
369 {"single-button", CSSSelector::PseudoSingleButton}, 370 {"single-button", CSSSelector::PseudoSingleButton},
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 if (match == pseudoTypeMapEnd || match->string != name.getString()) 431 if (match == pseudoTypeMapEnd || match->string != name.getString())
431 return CSSSelector::PseudoUnknown; 432 return CSSSelector::PseudoUnknown;
432 433
433 if (match->type == CSSSelector::PseudoDefined && 434 if (match->type == CSSSelector::PseudoDefined &&
434 !RuntimeEnabledFeatures::customElementsV1Enabled()) 435 !RuntimeEnabledFeatures::customElementsV1Enabled())
435 return CSSSelector::PseudoUnknown; 436 return CSSSelector::PseudoUnknown;
436 437
437 return static_cast<CSSSelector::PseudoType>(match->type); 438 return static_cast<CSSSelector::PseudoType>(match->type);
438 } 439 }
439 440
441 AtomicString CSSSelector::aliasForShadowPseudoId(const AtomicString& name) {
rune 2016/11/18 09:53:23 Using the term alias here could be confusing since
442 if (name == "-webkit-input-placeholder")
443 return "placeholder";
444 return nullAtom;
445 }
446
440 #ifndef NDEBUG 447 #ifndef NDEBUG
441 void CSSSelector::show(int indent) const { 448 void CSSSelector::show(int indent) const {
442 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data()); 449 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data());
443 printf("%*sm_match: %d\n", indent, "", m_match); 450 printf("%*sm_match: %d\n", indent, "", m_match);
444 if (m_match != Tag) 451 if (m_match != Tag)
445 printf("%*svalue(): %s\n", indent, "", value().ascii().data()); 452 printf("%*svalue(): %s\n", indent, "", value().ascii().data());
446 printf("%*sgetPseudoType(): %d\n", indent, "", getPseudoType()); 453 printf("%*sgetPseudoType(): %d\n", indent, "", getPseudoType());
447 if (m_match == Tag) 454 if (m_match == Tag)
448 printf("%*stagQName().localName: %s\n", indent, "", 455 printf("%*stagQName().localName: %s\n", indent, "",
449 tagQName().localName().ascii().data()); 456 tagQName().localName().ascii().data());
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 if (count < nthBValue()) 1008 if (count < nthBValue())
1002 return false; 1009 return false;
1003 return (count - nthBValue()) % nthAValue() == 0; 1010 return (count - nthBValue()) % nthAValue() == 0;
1004 } 1011 }
1005 if (count > nthBValue()) 1012 if (count > nthBValue())
1006 return false; 1013 return false;
1007 return (nthBValue() - count) % (-nthAValue()) == 0; 1014 return (nthBValue() - count) % (-nthAValue()) == 0;
1008 } 1015 }
1009 1016
1010 } // namespace blink 1017 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelector.h ('k') | third_party/WebKit/Source/core/css/ElementRuleCollector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698