Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 30 matching lines...) Expand all Loading... | |
| 41 SelectRuleFeatureSet(); | 41 SelectRuleFeatureSet(); |
| 42 | 42 |
| 43 void add(const SelectRuleFeatureSet&); | 43 void add(const SelectRuleFeatureSet&); |
| 44 void clear(); | 44 void clear(); |
| 45 void collectFeaturesFromSelector(const CSSSelector*); | 45 void collectFeaturesFromSelector(const CSSSelector*); |
| 46 | 46 |
| 47 bool hasSelectorForId(const AtomicString&) const; | 47 bool hasSelectorForId(const AtomicString&) const; |
| 48 bool hasSelectorForClass(const AtomicString&) const; | 48 bool hasSelectorForClass(const AtomicString&) const; |
| 49 bool hasSelectorForAttribute(const AtomicString&) const; | 49 bool hasSelectorForAttribute(const AtomicString&) const; |
| 50 | 50 |
| 51 const RuleSetAnalyzer* getRuleSetAnalyzer() const; | |
|
esprehn
2014/01/15 04:27:32
wrong name.
chrishtr
2014/01/15 18:29:16
Done.
| |
| 52 | |
| 51 bool hasSelectorForChecked() const { return hasSelectorFor(AffectedSelectorC hecked); } | 53 bool hasSelectorForChecked() const { return hasSelectorFor(AffectedSelectorC hecked); } |
| 52 bool hasSelectorForEnabled() const { return hasSelectorFor(AffectedSelectorE nabled); } | 54 bool hasSelectorForEnabled() const { return hasSelectorFor(AffectedSelectorE nabled); } |
| 53 bool hasSelectorForDisabled() const { return hasSelectorFor(AffectedSelector Disabled); } | 55 bool hasSelectorForDisabled() const { return hasSelectorFor(AffectedSelector Disabled); } |
| 54 bool hasSelectorForIndeterminate() const { return hasSelectorFor(AffectedSel ectorIndeterminate); } | 56 bool hasSelectorForIndeterminate() const { return hasSelectorFor(AffectedSel ectorIndeterminate); } |
| 55 bool hasSelectorForLink() const { return hasSelectorFor(AffectedSelectorLink ); } | 57 bool hasSelectorForLink() const { return hasSelectorFor(AffectedSelectorLink ); } |
| 56 bool hasSelectorForTarget() const { return hasSelectorFor(AffectedSelectorTa rget); } | 58 bool hasSelectorForTarget() const { return hasSelectorFor(AffectedSelectorTa rget); } |
| 57 bool hasSelectorForVisited() const { return hasSelectorFor(AffectedSelectorV isited); } | 59 bool hasSelectorForVisited() const { return hasSelectorFor(AffectedSelectorV isited); } |
| 58 | 60 |
| 59 bool hasSelectorFor(AffectedSelectorMask features) const { return m_featureF lags & features; } | 61 bool hasSelectorFor(AffectedSelectorMask features) const { return m_featureF lags & features; } |
| 60 | 62 |
| 61 private: | 63 private: |
| 62 void setSelectRuleFeature(AffectedSelectorType feature) { m_featureFlags |= feature; } | 64 void setSelectRuleFeature(AffectedSelectorType feature) { m_featureFlags |= feature; } |
| 63 | 65 |
| 64 RuleFeatureSet m_cssRuleFeatureSet; | 66 RuleFeatureSet m_cssRuleFeatureSet; |
| 65 int m_featureFlags; | 67 int m_featureFlags; |
| 66 }; | 68 }; |
| 67 | 69 |
| 70 // FIXME: make the shadow DOM smarter about analyzing select rules. | |
| 71 inline const RuleSetAnalyzer* SelectRuleFeatureSet::getRuleSetAnalyzer() const | |
| 72 { | |
| 73 return 0; | |
| 74 } | |
| 75 | |
| 68 inline bool SelectRuleFeatureSet::hasSelectorForId(const AtomicString& idValue) const | 76 inline bool SelectRuleFeatureSet::hasSelectorForId(const AtomicString& idValue) const |
| 69 { | 77 { |
| 70 ASSERT(!idValue.isEmpty()); | 78 ASSERT(!idValue.isEmpty()); |
| 71 return m_cssRuleFeatureSet.idsInRules.contains(idValue); | 79 return m_cssRuleFeatureSet.idsInRules.contains(idValue); |
| 72 } | 80 } |
| 73 | 81 |
| 74 inline bool SelectRuleFeatureSet::hasSelectorForClass(const AtomicString& classV alue) const | 82 inline bool SelectRuleFeatureSet::hasSelectorForClass(const AtomicString& classV alue) const |
| 75 { | 83 { |
| 76 ASSERT(!classValue.isEmpty()); | 84 ASSERT(!classValue.isEmpty()); |
| 77 return m_cssRuleFeatureSet.classesInRules.contains(classValue); | 85 return m_cssRuleFeatureSet.classesInRules.contains(classValue); |
| 78 } | 86 } |
| 79 | 87 |
| 80 inline bool SelectRuleFeatureSet::hasSelectorForAttribute(const AtomicString& at tributeName) const | 88 inline bool SelectRuleFeatureSet::hasSelectorForAttribute(const AtomicString& at tributeName) const |
| 81 { | 89 { |
| 82 ASSERT(!attributeName.isEmpty()); | 90 ASSERT(!attributeName.isEmpty()); |
| 83 return m_cssRuleFeatureSet.attrsInRules.contains(attributeName); | 91 return m_cssRuleFeatureSet.attrsInRules.contains(attributeName); |
| 84 } | 92 } |
| 85 | 93 |
| 86 } | 94 } |
| 87 | 95 |
| 88 #endif | 96 #endif |
| OLD | NEW |