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

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

Issue 2778983006: Make /deep/ as no-op and remove ::shadow in dynamic profile (Closed)
Patch Set: rebased Created 3 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 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 13 matching lines...) Expand all
24 * Boston, MA 02110-1301, USA. 24 * Boston, MA 02110-1301, USA.
25 */ 25 */
26 26
27 #include "core/css/CSSSelector.h" 27 #include "core/css/CSSSelector.h"
28 28
29 #include <algorithm> 29 #include <algorithm>
30 #include <memory> 30 #include <memory>
31 #include "core/HTMLNames.h" 31 #include "core/HTMLNames.h"
32 #include "core/css/CSSMarkup.h" 32 #include "core/css/CSSMarkup.h"
33 #include "core/css/CSSSelectorList.h" 33 #include "core/css/CSSSelectorList.h"
34 #include "core/css/parser/CSSParserContext.h"
34 #include "platform/RuntimeEnabledFeatures.h" 35 #include "platform/RuntimeEnabledFeatures.h"
35 #include "platform/wtf/Assertions.h" 36 #include "platform/wtf/Assertions.h"
36 #include "platform/wtf/HashMap.h" 37 #include "platform/wtf/HashMap.h"
37 #include "platform/wtf/StdLibExtras.h" 38 #include "platform/wtf/StdLibExtras.h"
38 #include "platform/wtf/text/StringBuilder.h" 39 #include "platform/wtf/text/StringBuilder.h"
39 40
40 #ifndef NDEBUG 41 #ifndef NDEBUG
41 #include <stdio.h> 42 #include <stdio.h>
42 #endif 43 #endif
43 44
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 } 483 }
483 484
484 PseudoId CSSSelector::ParsePseudoId(const String& name) { 485 PseudoId CSSSelector::ParsePseudoId(const String& name) {
485 unsigned name_without_colons_start = 486 unsigned name_without_colons_start =
486 name[0] == ':' ? (name[1] == ':' ? 2 : 1) : 0; 487 name[0] == ':' ? (name[1] == ':' ? 2 : 1) : 0;
487 return GetPseudoId(ParsePseudoType( 488 return GetPseudoId(ParsePseudoType(
488 AtomicString(name.Substring(name_without_colons_start)), false)); 489 AtomicString(name.Substring(name_without_colons_start)), false));
489 } 490 }
490 491
491 void CSSSelector::UpdatePseudoType(const AtomicString& value, 492 void CSSSelector::UpdatePseudoType(const AtomicString& value,
493 const CSSParserContext& context,
492 bool has_arguments) { 494 bool has_arguments) {
493 DCHECK(match_ == kPseudoClass || match_ == kPseudoElement || 495 DCHECK(match_ == kPseudoClass || match_ == kPseudoElement ||
494 match_ == kPagePseudoClass); 496 match_ == kPagePseudoClass);
495 497
496 SetValue(value); 498 SetValue(value);
497 SetPseudoType(ParsePseudoType(value, has_arguments)); 499 SetPseudoType(ParsePseudoType(value, has_arguments));
498 500
499 switch (pseudo_type_) { 501 switch (pseudo_type_) {
500 case kPseudoAfter: 502 case kPseudoAfter:
501 case kPseudoBefore: 503 case kPseudoBefore:
(...skipping 12 matching lines...) Expand all
514 case kPseudoScrollbar: 516 case kPseudoScrollbar:
515 case kPseudoScrollbarCorner: 517 case kPseudoScrollbarCorner:
516 case kPseudoScrollbarButton: 518 case kPseudoScrollbarButton:
517 case kPseudoScrollbarThumb: 519 case kPseudoScrollbarThumb:
518 case kPseudoScrollbarTrack: 520 case kPseudoScrollbarTrack:
519 case kPseudoScrollbarTrackPiece: 521 case kPseudoScrollbarTrackPiece:
520 case kPseudoSelection: 522 case kPseudoSelection:
521 case kPseudoWebKitCustomElement: 523 case kPseudoWebKitCustomElement:
522 case kPseudoBlinkInternalElement: 524 case kPseudoBlinkInternalElement:
523 case kPseudoContent: 525 case kPseudoContent:
524 case kPseudoShadow:
525 case kPseudoSlotted: 526 case kPseudoSlotted:
526 if (match_ != kPseudoElement) 527 if (match_ != kPseudoElement)
527 pseudo_type_ = kPseudoUnknown; 528 pseudo_type_ = kPseudoUnknown;
528 break; 529 break;
530 case kPseudoShadow:
531 if (match_ != kPseudoElement || context.IsDynamicProfile())
532 pseudo_type_ = kPseudoUnknown;
533 break;
529 case kPseudoFirstPage: 534 case kPseudoFirstPage:
530 case kPseudoLeftPage: 535 case kPseudoLeftPage:
531 case kPseudoRightPage: 536 case kPseudoRightPage:
532 if (match_ != kPagePseudoClass) 537 if (match_ != kPagePseudoClass)
533 pseudo_type_ = kPseudoUnknown; 538 pseudo_type_ = kPseudoUnknown;
534 break; 539 break;
535 case kPseudoActive: 540 case kPseudoActive:
536 case kPseudoAny: 541 case kPseudoAny:
537 case kPseudoAnyLink: 542 case kPseudoAnyLink:
538 case kPseudoAutofill: 543 case kPseudoAutofill:
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 cs = cs->TagHistory(); 767 cs = cs->TagHistory();
763 } 768 }
764 769
765 if (const CSSSelector* tag_history = cs->TagHistory()) { 770 if (const CSSSelector* tag_history = cs->TagHistory()) {
766 switch (cs->Relation()) { 771 switch (cs->Relation()) {
767 case kDescendant: 772 case kDescendant:
768 return tag_history->SelectorText(" " + str.ToString() + right_side); 773 return tag_history->SelectorText(" " + str.ToString() + right_side);
769 case kChild: 774 case kChild:
770 return tag_history->SelectorText(" > " + str.ToString() + right_side); 775 return tag_history->SelectorText(" > " + str.ToString() + right_side);
771 case kShadowDeep: 776 case kShadowDeep:
777 case kShadowDeepAsDescendant:
772 return tag_history->SelectorText(" /deep/ " + str.ToString() + 778 return tag_history->SelectorText(" /deep/ " + str.ToString() +
773 right_side); 779 right_side);
774 case kShadowPiercingDescendant: 780 case kShadowPiercingDescendant:
775 return tag_history->SelectorText(" >>> " + str.ToString() + right_side); 781 return tag_history->SelectorText(" >>> " + str.ToString() + right_side);
776 case kDirectAdjacent: 782 case kDirectAdjacent:
777 return tag_history->SelectorText(" + " + str.ToString() + right_side); 783 return tag_history->SelectorText(" + " + str.ToString() + right_side);
778 case kIndirectAdjacent: 784 case kIndirectAdjacent:
779 return tag_history->SelectorText(" ~ " + str.ToString() + right_side); 785 return tag_history->SelectorText(" ~ " + str.ToString() + right_side);
780 case kSubSelector: 786 case kSubSelector:
781 NOTREACHED(); 787 NOTREACHED();
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 if (count < NthBValue()) 1029 if (count < NthBValue())
1024 return false; 1030 return false;
1025 return (count - NthBValue()) % NthAValue() == 0; 1031 return (count - NthBValue()) % NthAValue() == 0;
1026 } 1032 }
1027 if (count > NthBValue()) 1033 if (count > NthBValue())
1028 return false; 1034 return false;
1029 return (NthBValue() - count) % (-NthAValue()) == 0; 1035 return (NthBValue() - count) % (-NthAValue()) == 0;
1030 } 1036 }
1031 1037
1032 } // namespace blink 1038 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelector.h ('k') | third_party/WebKit/Source/core/css/SelectorChecker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698