| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/dom/shadow/SelectRuleFeatureSet.h" | 32 #include "core/dom/shadow/SelectRuleFeatureSet.h" |
| 33 | 33 |
| 34 #include "core/css/CSSSelector.h" | 34 #include "core/css/CSSSelector.h" |
| 35 | 35 |
| 36 #include "wtf/BitVector.h" | 36 #include "wtf/BitVector.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 SelectRuleFeatureSet::SelectRuleFeatureSet() | |
| 41 : m_featureFlags(0) | |
| 42 { | |
| 43 } | |
| 44 | |
| 45 void SelectRuleFeatureSet::add(const SelectRuleFeatureSet& featureSet) | 40 void SelectRuleFeatureSet::add(const SelectRuleFeatureSet& featureSet) |
| 46 { | 41 { |
| 47 m_cssRuleFeatureSet.add(featureSet.m_cssRuleFeatureSet); | 42 m_cssRuleFeatureSet.add(featureSet.m_cssRuleFeatureSet); |
| 48 m_featureFlags |= featureSet.m_featureFlags; | |
| 49 } | 43 } |
| 50 | 44 |
| 51 void SelectRuleFeatureSet::clear() | 45 void SelectRuleFeatureSet::clear() |
| 52 { | 46 { |
| 53 m_cssRuleFeatureSet.clear(); | 47 m_cssRuleFeatureSet.clear(); |
| 54 m_featureFlags = 0; | |
| 55 } | 48 } |
| 56 | 49 |
| 57 void SelectRuleFeatureSet::collectFeaturesFromSelector(const CSSSelector& select
or) | 50 void SelectRuleFeatureSet::collectFeaturesFromSelector(const CSSSelector& select
or) |
| 58 { | 51 { |
| 59 m_cssRuleFeatureSet.collectFeaturesFromSelector(selector); | 52 m_cssRuleFeatureSet.collectFeaturesFromSelector(selector); |
| 60 | |
| 61 switch (selector.pseudoType()) { | |
| 62 case CSSSelector::PseudoChecked: | |
| 63 setSelectRuleFeature(AffectedSelectorChecked); | |
| 64 break; | |
| 65 case CSSSelector::PseudoEnabled: | |
| 66 setSelectRuleFeature(AffectedSelectorEnabled); | |
| 67 break; | |
| 68 case CSSSelector::PseudoDisabled: | |
| 69 setSelectRuleFeature(AffectedSelectorDisabled); | |
| 70 break; | |
| 71 case CSSSelector::PseudoIndeterminate: | |
| 72 setSelectRuleFeature(AffectedSelectorIndeterminate); | |
| 73 break; | |
| 74 case CSSSelector::PseudoLink: | |
| 75 setSelectRuleFeature(AffectedSelectorLink); | |
| 76 break; | |
| 77 case CSSSelector::PseudoTarget: | |
| 78 setSelectRuleFeature(AffectedSelectorTarget); | |
| 79 break; | |
| 80 case CSSSelector::PseudoVisited: | |
| 81 setSelectRuleFeature(AffectedSelectorVisited); | |
| 82 break; | |
| 83 default: | |
| 84 break; | |
| 85 } | |
| 86 } | 53 } |
| 87 | 54 |
| 88 bool SelectRuleFeatureSet::checkSelectorsForClassChange(const SpaceSplitString&
changedClasses) const | 55 bool SelectRuleFeatureSet::checkSelectorsForClassChange(const SpaceSplitString&
changedClasses) const |
| 89 { | 56 { |
| 90 unsigned changedSize = changedClasses.size(); | 57 unsigned changedSize = changedClasses.size(); |
| 91 for (unsigned i = 0; i < changedSize; ++i) { | 58 for (unsigned i = 0; i < changedSize; ++i) { |
| 92 if (hasSelectorForClass(changedClasses[i])) | 59 if (hasSelectorForClass(changedClasses[i])) |
| 93 return true; | 60 return true; |
| 94 } | 61 } |
| 95 return false; | 62 return false; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 95 |
| 129 // Class was removed. | 96 // Class was removed. |
| 130 if (hasSelectorForClass(oldClasses[i])) | 97 if (hasSelectorForClass(oldClasses[i])) |
| 131 return true; | 98 return true; |
| 132 } | 99 } |
| 133 return false; | 100 return false; |
| 134 } | 101 } |
| 135 | 102 |
| 136 } | 103 } |
| 137 | 104 |
| OLD | NEW |