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

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

Issue 540533004: Use style invalidation for more pseudo classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 3 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 | « Source/core/dom/shadow/SelectRuleFeatureSet.h ('k') | Source/core/html/HTMLAnchorElement.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 19 matching lines...) Expand all
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
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
OLDNEW
« no previous file with comments | « Source/core/dom/shadow/SelectRuleFeatureSet.h ('k') | Source/core/html/HTMLAnchorElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698