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

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

Issue 1898403002: [WIP] Implement :dir() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase... other changes too probably Created 4 years, 7 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 case PseudoDisabled: 224 case PseudoDisabled:
225 case PseudoOptional: 225 case PseudoOptional:
226 case PseudoPlaceholderShown: 226 case PseudoPlaceholderShown:
227 case PseudoRequired: 227 case PseudoRequired:
228 case PseudoReadOnly: 228 case PseudoReadOnly:
229 case PseudoReadWrite: 229 case PseudoReadWrite:
230 case PseudoValid: 230 case PseudoValid:
231 case PseudoInvalid: 231 case PseudoInvalid:
232 case PseudoIndeterminate: 232 case PseudoIndeterminate:
233 case PseudoTarget: 233 case PseudoTarget:
234 case PseudoDir:
234 case PseudoLang: 235 case PseudoLang:
235 case PseudoNot: 236 case PseudoNot:
236 case PseudoRoot: 237 case PseudoRoot:
237 case PseudoScope: 238 case PseudoScope:
238 case PseudoWindowInactive: 239 case PseudoWindowInactive:
239 case PseudoCornerPresent: 240 case PseudoCornerPresent:
240 case PseudoDecrement: 241 case PseudoDecrement:
241 case PseudoIncrement: 242 case PseudoIncrement:
242 case PseudoHorizontal: 243 case PseudoHorizontal:
243 case PseudoVertical: 244 case PseudoVertical:
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 {"unresolved", CSSSelector::PseudoUnresolved}, 359 {"unresolved", CSSSelector::PseudoUnresolved},
359 {"valid", CSSSelector::PseudoValid}, 360 {"valid", CSSSelector::PseudoValid},
360 {"vertical", CSSSelector::PseudoVertical}, 361 {"vertical", CSSSelector::PseudoVertical},
361 {"visited", CSSSelector::PseudoVisited}, 362 {"visited", CSSSelector::PseudoVisited},
362 {"window-inactive", CSSSelector::PseudoWindowInactive}, 363 {"window-inactive", CSSSelector::PseudoWindowInactive},
363 }; 364 };
364 365
365 const static NameToPseudoStruct pseudoTypeWithArgumentsMap[] = { 366 const static NameToPseudoStruct pseudoTypeWithArgumentsMap[] = {
366 {"-webkit-any", CSSSelector::PseudoAny}, 367 {"-webkit-any", CSSSelector::PseudoAny},
367 {"cue", CSSSelector::PseudoCue}, 368 {"cue", CSSSelector::PseudoCue},
369 {"dir", CSSSelector::PseudoDir},
368 {"host", CSSSelector::PseudoHost}, 370 {"host", CSSSelector::PseudoHost},
369 {"host-context", CSSSelector::PseudoHostContext}, 371 {"host-context", CSSSelector::PseudoHostContext},
370 {"lang", CSSSelector::PseudoLang}, 372 {"lang", CSSSelector::PseudoLang},
371 {"not", CSSSelector::PseudoNot}, 373 {"not", CSSSelector::PseudoNot},
372 {"nth-child", CSSSelector::PseudoNthChild}, 374 {"nth-child", CSSSelector::PseudoNthChild},
373 {"nth-last-child", CSSSelector::PseudoNthLastChild}, 375 {"nth-last-child", CSSSelector::PseudoNthLastChild},
374 {"nth-last-of-type", CSSSelector::PseudoNthLastOfType}, 376 {"nth-last-of-type", CSSSelector::PseudoNthLastOfType},
375 {"nth-of-type", CSSSelector::PseudoNthOfType}, 377 {"nth-of-type", CSSSelector::PseudoNthOfType},
376 {"slotted", CSSSelector::PseudoSlotted}, 378 {"slotted", CSSSelector::PseudoSlotted},
377 }; 379 };
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 case PseudoFullScreenAncestor: 522 case PseudoFullScreenAncestor:
521 case PseudoFutureCue: 523 case PseudoFutureCue:
522 case PseudoHorizontal: 524 case PseudoHorizontal:
523 case PseudoHost: 525 case PseudoHost:
524 case PseudoHostContext: 526 case PseudoHostContext:
525 case PseudoHover: 527 case PseudoHover:
526 case PseudoInRange: 528 case PseudoInRange:
527 case PseudoIncrement: 529 case PseudoIncrement:
528 case PseudoIndeterminate: 530 case PseudoIndeterminate:
529 case PseudoInvalid: 531 case PseudoInvalid:
532 case PseudoDir:
530 case PseudoLang: 533 case PseudoLang:
531 case PseudoLastChild: 534 case PseudoLastChild:
532 case PseudoLastOfType: 535 case PseudoLastOfType:
533 case PseudoLink: 536 case PseudoLink:
534 case PseudoListBox: 537 case PseudoListBox:
535 case PseudoNoButton: 538 case PseudoNoButton:
536 case PseudoNot: 539 case PseudoNot:
537 case PseudoNthChild: 540 case PseudoNthChild:
538 case PseudoNthLastChild: 541 case PseudoNthLastChild:
539 case PseudoNthLastOfType: 542 case PseudoNthLastOfType:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 else if (b == 0) 638 else if (b == 0)
636 str.append(String::format("%dn", a)); 639 str.append(String::format("%dn", a));
637 else if (b < 0) 640 else if (b < 0)
638 str.append(String::format("%dn%d", a, b)); 641 str.append(String::format("%dn%d", a, b));
639 else 642 else
640 str.append(String::format("%dn+%d", a, b)); 643 str.append(String::format("%dn+%d", a, b));
641 644
642 str.append(')'); 645 str.append(')');
643 break; 646 break;
644 } 647 }
648 case PseudoDir:
645 case PseudoLang: 649 case PseudoLang:
646 str.append('('); 650 str.append('(');
647 str.append(cs->argument()); 651 str.append(cs->argument());
648 str.append(')'); 652 str.append(')');
649 break; 653 break;
650 case PseudoNot: 654 case PseudoNot:
651 ASSERT(cs->selectorList()); 655 ASSERT(cs->selectorList());
652 break; 656 break;
653 case PseudoHost: 657 case PseudoHost:
654 case PseudoHostContext: 658 case PseudoHostContext:
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 if (count < nthBValue()) 923 if (count < nthBValue())
920 return false; 924 return false;
921 return (count - nthBValue()) % nthAValue() == 0; 925 return (count - nthBValue()) % nthAValue() == 0;
922 } 926 }
923 if (count > nthBValue()) 927 if (count > nthBValue())
924 return false; 928 return false;
925 return (nthBValue() - count) % (-nthAValue()) == 0; 929 return (nthBValue() - count) % (-nthAValue()) == 0;
926 } 930 }
927 931
928 } // namespace blink 932 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698