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

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

Issue 1989343002: Implement :defined pseudo-class selector for Custom Elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ce-state
Patch Set: rune and dominicc review, test updated Created 4 years, 6 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-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 reserv ed. 6 * Copyright (C) 2002, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2008 David Smith (catfish.man@gmail.com) 7 * Copyright (C) 2008 David Smith (catfish.man@gmail.com)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 case PseudoLeftPage: 250 case PseudoLeftPage:
251 case PseudoRightPage: 251 case PseudoRightPage:
252 case PseudoInRange: 252 case PseudoInRange:
253 case PseudoOutOfRange: 253 case PseudoOutOfRange:
254 case PseudoWebKitCustomElement: 254 case PseudoWebKitCustomElement:
255 case PseudoBlinkInternalElement: 255 case PseudoBlinkInternalElement:
256 case PseudoCue: 256 case PseudoCue:
257 case PseudoFutureCue: 257 case PseudoFutureCue:
258 case PseudoPastCue: 258 case PseudoPastCue:
259 case PseudoUnresolved: 259 case PseudoUnresolved:
260 case PseudoDefined:
260 case PseudoContent: 261 case PseudoContent:
261 case PseudoHost: 262 case PseudoHost:
262 case PseudoHostContext: 263 case PseudoHostContext:
263 case PseudoShadow: 264 case PseudoShadow:
264 case PseudoFullScreen: 265 case PseudoFullScreen:
265 case PseudoFullScreenAncestor: 266 case PseudoFullScreenAncestor:
266 case PseudoSpatialNavigationFocus: 267 case PseudoSpatialNavigationFocus:
267 case PseudoListBox: 268 case PseudoListBox:
268 case PseudoHostHasAppearance: 269 case PseudoHostHasAppearance:
269 case PseudoSlotted: 270 case PseudoSlotted:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 {"active", CSSSelector::PseudoActive}, 311 {"active", CSSSelector::PseudoActive},
311 {"after", CSSSelector::PseudoAfter}, 312 {"after", CSSSelector::PseudoAfter},
312 {"backdrop", CSSSelector::PseudoBackdrop}, 313 {"backdrop", CSSSelector::PseudoBackdrop},
313 {"before", CSSSelector::PseudoBefore}, 314 {"before", CSSSelector::PseudoBefore},
314 {"checked", CSSSelector::PseudoChecked}, 315 {"checked", CSSSelector::PseudoChecked},
315 {"content", CSSSelector::PseudoContent}, 316 {"content", CSSSelector::PseudoContent},
316 {"corner-present", CSSSelector::PseudoCornerPresent}, 317 {"corner-present", CSSSelector::PseudoCornerPresent},
317 {"cue", CSSSelector::PseudoWebKitCustomElement}, 318 {"cue", CSSSelector::PseudoWebKitCustomElement},
318 {"decrement", CSSSelector::PseudoDecrement}, 319 {"decrement", CSSSelector::PseudoDecrement},
319 {"default", CSSSelector::PseudoDefault}, 320 {"default", CSSSelector::PseudoDefault},
321 {"defined", CSSSelector::PseudoDefined},
320 {"disabled", CSSSelector::PseudoDisabled}, 322 {"disabled", CSSSelector::PseudoDisabled},
321 {"double-button", CSSSelector::PseudoDoubleButton}, 323 {"double-button", CSSSelector::PseudoDoubleButton},
322 {"empty", CSSSelector::PseudoEmpty}, 324 {"empty", CSSSelector::PseudoEmpty},
323 {"enabled", CSSSelector::PseudoEnabled}, 325 {"enabled", CSSSelector::PseudoEnabled},
324 {"end", CSSSelector::PseudoEnd}, 326 {"end", CSSSelector::PseudoEnd},
325 {"first", CSSSelector::PseudoFirstPage}, 327 {"first", CSSSelector::PseudoFirstPage},
326 {"first-child", CSSSelector::PseudoFirstChild}, 328 {"first-child", CSSSelector::PseudoFirstChild},
327 {"first-letter", CSSSelector::PseudoFirstLetter}, 329 {"first-letter", CSSSelector::PseudoFirstLetter},
328 {"first-line", CSSSelector::PseudoFirstLine}, 330 {"first-line", CSSSelector::PseudoFirstLine},
329 {"first-of-type", CSSSelector::PseudoFirstOfType}, 331 {"first-of-type", CSSSelector::PseudoFirstOfType},
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 pseudoTypeMapEnd = pseudoTypeWithArgumentsMap + WTF_ARRAY_LENGTH(pseudoT ypeWithArgumentsMap); 409 pseudoTypeMapEnd = pseudoTypeWithArgumentsMap + WTF_ARRAY_LENGTH(pseudoT ypeWithArgumentsMap);
408 } else { 410 } else {
409 pseudoTypeMap = pseudoTypeWithoutArgumentsMap; 411 pseudoTypeMap = pseudoTypeWithoutArgumentsMap;
410 pseudoTypeMapEnd = pseudoTypeWithoutArgumentsMap + WTF_ARRAY_LENGTH(pseu doTypeWithoutArgumentsMap); 412 pseudoTypeMapEnd = pseudoTypeWithoutArgumentsMap + WTF_ARRAY_LENGTH(pseu doTypeWithoutArgumentsMap);
411 } 413 }
412 NameToPseudoStruct dummyKey = { 0, CSSSelector::PseudoUnknown }; 414 NameToPseudoStruct dummyKey = { 0, CSSSelector::PseudoUnknown };
413 const NameToPseudoStruct* match = std::lower_bound(pseudoTypeMap, pseudoType MapEnd, dummyKey, NameToPseudoCompare(name)); 415 const NameToPseudoStruct* match = std::lower_bound(pseudoTypeMap, pseudoType MapEnd, dummyKey, NameToPseudoCompare(name));
414 if (match == pseudoTypeMapEnd || match->string != name.getString()) 416 if (match == pseudoTypeMapEnd || match->string != name.getString())
415 return CSSSelector::PseudoUnknown; 417 return CSSSelector::PseudoUnknown;
416 418
419 if (match->type == CSSSelector::PseudoDefined && !RuntimeEnabledFeatures::cu stomElementsV1Enabled())
420 return CSSSelector::PseudoUnknown;
421
417 return static_cast<CSSSelector::PseudoType>(match->type); 422 return static_cast<CSSSelector::PseudoType>(match->type);
418 } 423 }
419 424
420 #ifndef NDEBUG 425 #ifndef NDEBUG
421 void CSSSelector::show(int indent) const 426 void CSSSelector::show(int indent) const
422 { 427 {
423 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data()) ; 428 printf("%*sselectorText(): %s\n", indent, "", selectorText().ascii().data()) ;
424 printf("%*sm_match: %d\n", indent, "", m_match); 429 printf("%*sm_match: %d\n", indent, "", m_match);
425 if (m_match != Tag) 430 if (m_match != Tag)
426 printf("%*svalue(): %s\n", indent, "", value().ascii().data()); 431 printf("%*svalue(): %s\n", indent, "", value().ascii().data());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 m_pseudoType = PseudoUnknown; 510 m_pseudoType = PseudoUnknown;
506 break; 511 break;
507 case PseudoActive: 512 case PseudoActive:
508 case PseudoAny: 513 case PseudoAny:
509 case PseudoAnyLink: 514 case PseudoAnyLink:
510 case PseudoAutofill: 515 case PseudoAutofill:
511 case PseudoChecked: 516 case PseudoChecked:
512 case PseudoCornerPresent: 517 case PseudoCornerPresent:
513 case PseudoDecrement: 518 case PseudoDecrement:
514 case PseudoDefault: 519 case PseudoDefault:
520 case PseudoDefined:
515 case PseudoDisabled: 521 case PseudoDisabled:
516 case PseudoDoubleButton: 522 case PseudoDoubleButton:
517 case PseudoDrag: 523 case PseudoDrag:
518 case PseudoEmpty: 524 case PseudoEmpty:
519 case PseudoEnabled: 525 case PseudoEnabled:
520 case PseudoEnd: 526 case PseudoEnd:
521 case PseudoFirstChild: 527 case PseudoFirstChild:
522 case PseudoFirstOfType: 528 case PseudoFirstOfType:
523 case PseudoFocus: 529 case PseudoFocus:
524 case PseudoFullPageMedia: 530 case PseudoFullPageMedia:
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 if (count < nthBValue()) 933 if (count < nthBValue())
928 return false; 934 return false;
929 return (count - nthBValue()) % nthAValue() == 0; 935 return (count - nthBValue()) % nthAValue() == 0;
930 } 936 }
931 if (count > nthBValue()) 937 if (count > nthBValue())
932 return false; 938 return false;
933 return (nthBValue() - count) % (-nthAValue()) == 0; 939 return (nthBValue() - count) % (-nthAValue()) == 0;
934 } 940 }
935 941
936 } // namespace blink 942 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelector.h ('k') | third_party/WebKit/Source/core/css/RuleFeature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698