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

Side by Side Diff: Source/core/dom/shadow/SelectRuleFeatureSet.h

Issue 598093005: Simplify SelectRuleFeatureSet class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 2 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
« no previous file with comments | « no previous file | Source/core/dom/shadow/SelectRuleFeatureSet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 20 matching lines...) Expand all
31 #ifndef SelectRuleFeatureSet_h 31 #ifndef SelectRuleFeatureSet_h
32 #define SelectRuleFeatureSet_h 32 #define SelectRuleFeatureSet_h
33 33
34 #include "core/css/RuleFeature.h" 34 #include "core/css/RuleFeature.h"
35 #include "core/dom/Element.h" 35 #include "core/dom/Element.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 class SpaceSplitString; 39 class SpaceSplitString;
40 40
41 class SelectRuleFeatureSet { 41 class SelectRuleFeatureSet : public RuleFeatureSet {
42 DISALLOW_ALLOCATION(); 42 DISALLOW_ALLOCATION();
43 public: 43 public:
44 void add(const SelectRuleFeatureSet&);
45 void clear();
46 void collectFeaturesFromSelector(const CSSSelector&);
47
48 bool hasSelectorForId(const AtomicString&) const;
49 bool hasSelectorForClass(const AtomicString&) const;
50 bool hasSelectorForAttribute(const AtomicString&) const;
51 bool hasSelectorForPseudoType(CSSSelector::PseudoType) const;
52
53 bool hasSelectorForChecked() const { return hasSelectorForPseudoType(CSSSele ctor::PseudoChecked); }
54 bool hasSelectorForEnabled() const { return hasSelectorForPseudoType(CSSSele ctor::PseudoEnabled); }
55 bool hasSelectorForDisabled() const { return hasSelectorForPseudoType(CSSSel ector::PseudoDisabled); }
56 bool hasSelectorForIndeterminate() const { return hasSelectorForPseudoType(C SSSelector::PseudoIndeterminate); }
57 bool hasSelectorForLink() const { return hasSelectorForPseudoType(CSSSelecto r::PseudoLink); }
58 bool hasSelectorForTarget() const { return hasSelectorForPseudoType(CSSSelec tor::PseudoTarget); }
59 bool hasSelectorForVisited() const { return hasSelectorForPseudoType(CSSSele ctor::PseudoVisited); }
60
61 bool checkSelectorsForClassChange(const SpaceSplitString& changedClasses) co nst; 44 bool checkSelectorsForClassChange(const SpaceSplitString& changedClasses) co nst;
62 bool checkSelectorsForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses) const; 45 bool checkSelectorsForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses) const;
63
64 void trace(Visitor* visitor) { visitor->trace(m_cssRuleFeatureSet); }
65
66 private:
67 RuleFeatureSet m_cssRuleFeatureSet;
68 }; 46 };
69 47
70 inline bool SelectRuleFeatureSet::hasSelectorForId(const AtomicString& idValue) const
71 {
72 ASSERT(!idValue.isEmpty());
73 return m_cssRuleFeatureSet.hasSelectorForId(idValue);
74 }
75
76 inline bool SelectRuleFeatureSet::hasSelectorForClass(const AtomicString& classV alue) const
77 {
78 ASSERT(!classValue.isEmpty());
79 return m_cssRuleFeatureSet.hasSelectorForClass(classValue);
80 }
81
82 inline bool SelectRuleFeatureSet::hasSelectorForAttribute(const AtomicString& at tributeName) const
83 {
84 ASSERT(!attributeName.isEmpty());
85 return m_cssRuleFeatureSet.hasSelectorForAttribute(attributeName);
86 }
87
88 inline bool SelectRuleFeatureSet::hasSelectorForPseudoType(CSSSelector::PseudoTy pe pseudo) const
89 {
90 return m_cssRuleFeatureSet.hasSelectorForPseudoType(pseudo);
91 }
92
93 } 48 }
94 49
95 #endif 50 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/shadow/SelectRuleFeatureSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698