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

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

Issue 1614343002: Implement CSS4 pseudo-class :dir() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated layout tests Created 4 years, 10 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 PseudoLang: 234 case PseudoLang:
235 case PseudoDir:
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:
244 case PseudoStart: 245 case PseudoStart:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 {"unresolved", CSSSelector::PseudoUnresolved}, 354 {"unresolved", CSSSelector::PseudoUnresolved},
354 {"valid", CSSSelector::PseudoValid}, 355 {"valid", CSSSelector::PseudoValid},
355 {"vertical", CSSSelector::PseudoVertical}, 356 {"vertical", CSSSelector::PseudoVertical},
356 {"visited", CSSSelector::PseudoVisited}, 357 {"visited", CSSSelector::PseudoVisited},
357 {"window-inactive", CSSSelector::PseudoWindowInactive}, 358 {"window-inactive", CSSSelector::PseudoWindowInactive},
358 }; 359 };
359 360
360 const static NameToPseudoStruct pseudoTypeWithArgumentsMap[] = { 361 const static NameToPseudoStruct pseudoTypeWithArgumentsMap[] = {
361 {"-webkit-any", CSSSelector::PseudoAny}, 362 {"-webkit-any", CSSSelector::PseudoAny},
362 {"cue", CSSSelector::PseudoCue}, 363 {"cue", CSSSelector::PseudoCue},
364 {"dir", CSSSelector::PseudoDir},
363 {"host", CSSSelector::PseudoHost}, 365 {"host", CSSSelector::PseudoHost},
364 {"host-context", CSSSelector::PseudoHostContext}, 366 {"host-context", CSSSelector::PseudoHostContext},
365 {"lang", CSSSelector::PseudoLang}, 367 {"lang", CSSSelector::PseudoLang},
366 {"not", CSSSelector::PseudoNot}, 368 {"not", CSSSelector::PseudoNot},
367 {"nth-child", CSSSelector::PseudoNthChild}, 369 {"nth-child", CSSSelector::PseudoNthChild},
368 {"nth-last-child", CSSSelector::PseudoNthLastChild}, 370 {"nth-last-child", CSSSelector::PseudoNthLastChild},
369 {"nth-last-of-type", CSSSelector::PseudoNthLastOfType}, 371 {"nth-last-of-type", CSSSelector::PseudoNthLastOfType},
370 {"nth-of-type", CSSSelector::PseudoNthOfType}, 372 {"nth-of-type", CSSSelector::PseudoNthOfType},
371 {"slotted", CSSSelector::PseudoSlotted}, 373 {"slotted", CSSSelector::PseudoSlotted},
372 }; 374 };
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 case PseudoFutureCue: 518 case PseudoFutureCue:
517 case PseudoHorizontal: 519 case PseudoHorizontal:
518 case PseudoHost: 520 case PseudoHost:
519 case PseudoHostContext: 521 case PseudoHostContext:
520 case PseudoHover: 522 case PseudoHover:
521 case PseudoInRange: 523 case PseudoInRange:
522 case PseudoIncrement: 524 case PseudoIncrement:
523 case PseudoIndeterminate: 525 case PseudoIndeterminate:
524 case PseudoInvalid: 526 case PseudoInvalid:
525 case PseudoLang: 527 case PseudoLang:
528 case PseudoDir:
526 case PseudoLastChild: 529 case PseudoLastChild:
527 case PseudoLastOfType: 530 case PseudoLastOfType:
528 case PseudoLink: 531 case PseudoLink:
529 case PseudoListBox: 532 case PseudoListBox:
530 case PseudoNoButton: 533 case PseudoNoButton:
531 case PseudoNot: 534 case PseudoNot:
532 case PseudoNthChild: 535 case PseudoNthChild:
533 case PseudoNthLastChild: 536 case PseudoNthLastChild:
534 case PseudoNthLastOfType: 537 case PseudoNthLastOfType:
535 case PseudoNthOfType: 538 case PseudoNthOfType:
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 str.append(String::format("%dn+%d", a, b)); 638 str.append(String::format("%dn+%d", a, b));
636 639
637 str.append(')'); 640 str.append(')');
638 break; 641 break;
639 } 642 }
640 case PseudoLang: 643 case PseudoLang:
641 str.append('('); 644 str.append('(');
642 str.append(cs->argument()); 645 str.append(cs->argument());
643 str.append(')'); 646 str.append(')');
644 break; 647 break;
648 case PseudoDir:
649 str.append('(');
650 str.append(cs->argument());
651 str.append(')');
645 case PseudoNot: 652 case PseudoNot:
646 ASSERT(cs->selectorList()); 653 ASSERT(cs->selectorList());
647 break; 654 break;
648 case PseudoHost: 655 case PseudoHost:
649 case PseudoHostContext: 656 case PseudoHostContext:
650 case PseudoAny: 657 case PseudoAny:
651 break; 658 break;
652 default: 659 default:
653 break; 660 break;
654 } 661 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 if (count < nthBValue()) 910 if (count < nthBValue())
904 return false; 911 return false;
905 return (count - nthBValue()) % nthAValue() == 0; 912 return (count - nthBValue()) % nthAValue() == 0;
906 } 913 }
907 if (count > nthBValue()) 914 if (count > nthBValue())
908 return false; 915 return false;
909 return (nthBValue() - count) % (-nthAValue()) == 0; 916 return (nthBValue() - count) % (-nthAValue()) == 0;
910 } 917 }
911 918
912 } // namespace blink 919 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698