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

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

Issue 1565263003: Implement CSS parser part for ::slotted pseudo element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, fix layout test. Created 4 years, 11 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 case PseudoPastCue: 257 case PseudoPastCue:
258 case PseudoUnresolved: 258 case PseudoUnresolved:
259 case PseudoContent: 259 case PseudoContent:
260 case PseudoHost: 260 case PseudoHost:
261 case PseudoHostContext: 261 case PseudoHostContext:
262 case PseudoShadow: 262 case PseudoShadow:
263 case PseudoFullScreen: 263 case PseudoFullScreen:
264 case PseudoFullScreenAncestor: 264 case PseudoFullScreenAncestor:
265 case PseudoSpatialNavigationFocus: 265 case PseudoSpatialNavigationFocus:
266 case PseudoListBox: 266 case PseudoListBox:
267 case PseudoSlotted:
267 return NOPSEUDO; 268 return NOPSEUDO;
268 } 269 }
269 270
270 ASSERT_NOT_REACHED(); 271 ASSERT_NOT_REACHED();
271 return NOPSEUDO; 272 return NOPSEUDO;
272 } 273 }
273 274
274 // Could be made smaller and faster by replacing pointer with an 275 // Could be made smaller and faster by replacing pointer with an
275 // offset into a string buffer and making the bit fields smaller but 276 // offset into a string buffer and making the bit fields smaller but
276 // that could not be maintained by hand. 277 // that could not be maintained by hand.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 {"-webkit-any", CSSSelector::PseudoAny}, 361 {"-webkit-any", CSSSelector::PseudoAny},
361 {"cue", CSSSelector::PseudoCue}, 362 {"cue", CSSSelector::PseudoCue},
362 {"host", CSSSelector::PseudoHost}, 363 {"host", CSSSelector::PseudoHost},
363 {"host-context", CSSSelector::PseudoHostContext}, 364 {"host-context", CSSSelector::PseudoHostContext},
364 {"lang", CSSSelector::PseudoLang}, 365 {"lang", CSSSelector::PseudoLang},
365 {"not", CSSSelector::PseudoNot}, 366 {"not", CSSSelector::PseudoNot},
366 {"nth-child", CSSSelector::PseudoNthChild}, 367 {"nth-child", CSSSelector::PseudoNthChild},
367 {"nth-last-child", CSSSelector::PseudoNthLastChild}, 368 {"nth-last-child", CSSSelector::PseudoNthLastChild},
368 {"nth-last-of-type", CSSSelector::PseudoNthLastOfType}, 369 {"nth-last-of-type", CSSSelector::PseudoNthLastOfType},
369 {"nth-of-type", CSSSelector::PseudoNthOfType}, 370 {"nth-of-type", CSSSelector::PseudoNthOfType},
371 {"slotted", CSSSelector::PseudoSlotted},
370 }; 372 };
371 373
372 class NameToPseudoCompare { 374 class NameToPseudoCompare {
373 public: 375 public:
374 NameToPseudoCompare(const AtomicString& key) : m_key(key) { ASSERT(m_key.is8 Bit()); } 376 NameToPseudoCompare(const AtomicString& key) : m_key(key) { ASSERT(m_key.is8 Bit()); }
375 377
376 bool operator()(const NameToPseudoStruct& entry, const NameToPseudoStruct&) 378 bool operator()(const NameToPseudoStruct& entry, const NameToPseudoStruct&)
377 { 379 {
378 ASSERT(entry.string); 380 ASSERT(entry.string);
379 const char* key = reinterpret_cast<const char*>(m_key.characters8()); 381 const char* key = reinterpret_cast<const char*>(m_key.characters8());
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 case PseudoScrollbar: 476 case PseudoScrollbar:
475 case PseudoScrollbarCorner: 477 case PseudoScrollbarCorner:
476 case PseudoScrollbarButton: 478 case PseudoScrollbarButton:
477 case PseudoScrollbarThumb: 479 case PseudoScrollbarThumb:
478 case PseudoScrollbarTrack: 480 case PseudoScrollbarTrack:
479 case PseudoScrollbarTrackPiece: 481 case PseudoScrollbarTrackPiece:
480 case PseudoSelection: 482 case PseudoSelection:
481 case PseudoWebKitCustomElement: 483 case PseudoWebKitCustomElement:
482 case PseudoContent: 484 case PseudoContent:
483 case PseudoShadow: 485 case PseudoShadow:
486 case PseudoSlotted:
484 if (m_match != PseudoElement) 487 if (m_match != PseudoElement)
485 m_pseudoType = PseudoUnknown; 488 m_pseudoType = PseudoUnknown;
486 break; 489 break;
487 case PseudoFirstPage: 490 case PseudoFirstPage:
488 case PseudoLeftPage: 491 case PseudoLeftPage:
489 case PseudoRightPage: 492 case PseudoRightPage:
490 if (m_match != PagePseudoClass) 493 if (m_match != PagePseudoClass)
491 m_pseudoType = PseudoUnknown; 494 m_pseudoType = PseudoUnknown;
492 break; 495 break;
493 case PseudoActive: 496 case PseudoActive:
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 return tagHistory->selectorText(" > " + str.toString() + rightSide); 721 return tagHistory->selectorText(" > " + str.toString() + rightSide);
719 case ShadowDeep: 722 case ShadowDeep:
720 return tagHistory->selectorText(" /deep/ " + str.toString() + rightS ide); 723 return tagHistory->selectorText(" /deep/ " + str.toString() + rightS ide);
721 case DirectAdjacent: 724 case DirectAdjacent:
722 return tagHistory->selectorText(" + " + str.toString() + rightSide); 725 return tagHistory->selectorText(" + " + str.toString() + rightSide);
723 case IndirectAdjacent: 726 case IndirectAdjacent:
724 return tagHistory->selectorText(" ~ " + str.toString() + rightSide); 727 return tagHistory->selectorText(" ~ " + str.toString() + rightSide);
725 case SubSelector: 728 case SubSelector:
726 ASSERT_NOT_REACHED(); 729 ASSERT_NOT_REACHED();
727 case ShadowPseudo: 730 case ShadowPseudo:
731 case ShadowSlot:
728 return tagHistory->selectorText(str.toString() + rightSide); 732 return tagHistory->selectorText(str.toString() + rightSide);
729 } 733 }
730 } 734 }
731 return str.toString() + rightSide; 735 return str.toString() + rightSide;
732 } 736 }
733 737
734 void CSSSelector::setAttribute(const QualifiedName& value, AttributeMatchType ma tchType) 738 void CSSSelector::setAttribute(const QualifiedName& value, AttributeMatchType ma tchType)
735 { 739 {
736 createRareData(); 740 createRareData();
737 m_data.m_rareData->m_attribute = value; 741 m_data.m_rareData->m_attribute = value;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 if (count < nthBValue()) 903 if (count < nthBValue())
900 return false; 904 return false;
901 return (count - nthBValue()) % nthAValue() == 0; 905 return (count - nthBValue()) % nthAValue() == 0;
902 } 906 }
903 if (count > nthBValue()) 907 if (count > nthBValue())
904 return false; 908 return false;
905 return (nthBValue() - count) % (-nthAValue()) == 0; 909 return (nthBValue() - count) % (-nthAValue()) == 0;
906 } 910 }
907 911
908 } // namespace blink 912 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelector.h ('k') | third_party/WebKit/Source/core/css/CSSSelectorList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698