| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 RuleFeatureSet::SelectorPreMatch RuleFeatureSet::collectFeaturesFromRuleData( | 784 RuleFeatureSet::SelectorPreMatch RuleFeatureSet::collectFeaturesFromRuleData( |
| 785 const RuleData& ruleData) { | 785 const RuleData& ruleData) { |
| 786 RELEASE_ASSERT(m_isAlive); | 786 RELEASE_ASSERT(m_isAlive); |
| 787 FeatureMetadata metadata; | 787 FeatureMetadata metadata; |
| 788 if (collectFeaturesFromSelector(ruleData.selector(), metadata) == | 788 if (collectFeaturesFromSelector(ruleData.selector(), metadata) == |
| 789 SelectorNeverMatches) | 789 SelectorNeverMatches) |
| 790 return SelectorNeverMatches; | 790 return SelectorNeverMatches; |
| 791 | 791 |
| 792 m_metadata.add(metadata); | 792 m_metadata.add(metadata); |
| 793 | 793 |
| 794 if (metadata.foundSiblingSelector) | 794 if (metadata.foundSiblingSelector) { |
| 795 siblingRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex(), | 795 m_siblingRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex(), |
| 796 ruleData.hasDocumentSecurityOrigin())); | 796 ruleData.hasDocumentSecurityOrigin())); |
| 797 if (ruleData.containsUncommonAttributeSelector()) | 797 } |
| 798 uncommonAttributeRules.append( | 798 if (ruleData.containsUncommonAttributeSelector()) { |
| 799 m_uncommonAttributeRules.append( |
| 799 RuleFeature(ruleData.rule(), ruleData.selectorIndex(), | 800 RuleFeature(ruleData.rule(), ruleData.selectorIndex(), |
| 800 ruleData.hasDocumentSecurityOrigin())); | 801 ruleData.hasDocumentSecurityOrigin())); |
| 802 } |
| 801 | 803 |
| 802 updateInvalidationSets(ruleData); | 804 updateInvalidationSets(ruleData); |
| 803 return SelectorMayMatch; | 805 return SelectorMayMatch; |
| 804 } | 806 } |
| 805 | 807 |
| 806 RuleFeatureSet::SelectorPreMatch RuleFeatureSet::collectFeaturesFromSelector( | 808 RuleFeatureSet::SelectorPreMatch RuleFeatureSet::collectFeaturesFromSelector( |
| 807 const CSSSelector& selector, | 809 const CSSSelector& selector, |
| 808 RuleFeatureSet::FeatureMetadata& metadata) { | 810 RuleFeatureSet::FeatureMetadata& metadata) { |
| 809 unsigned maxDirectAdjacentSelectors = 0; | 811 unsigned maxDirectAdjacentSelectors = 0; |
| 810 CSSSelector::RelationType relation = CSSSelector::Descendant; | 812 CSSSelector::RelationType relation = CSSSelector::Descendant; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 entry.value->type()) | 919 entry.value->type()) |
| 918 .combine(*entry.value); | 920 .combine(*entry.value); |
| 919 if (other.m_universalSiblingInvalidationSet) | 921 if (other.m_universalSiblingInvalidationSet) |
| 920 ensureUniversalSiblingInvalidationSet().combine( | 922 ensureUniversalSiblingInvalidationSet().combine( |
| 921 *other.m_universalSiblingInvalidationSet); | 923 *other.m_universalSiblingInvalidationSet); |
| 922 if (other.m_nthInvalidationSet) | 924 if (other.m_nthInvalidationSet) |
| 923 ensureNthInvalidationSet().combine(*other.m_nthInvalidationSet); | 925 ensureNthInvalidationSet().combine(*other.m_nthInvalidationSet); |
| 924 | 926 |
| 925 m_metadata.add(other.m_metadata); | 927 m_metadata.add(other.m_metadata); |
| 926 | 928 |
| 927 siblingRules.appendVector(other.siblingRules); | 929 m_siblingRules.appendVector(other.m_siblingRules); |
| 928 uncommonAttributeRules.appendVector(other.uncommonAttributeRules); | 930 m_uncommonAttributeRules.appendVector(other.m_uncommonAttributeRules); |
| 929 } | 931 } |
| 930 | 932 |
| 931 void RuleFeatureSet::clear() { | 933 void RuleFeatureSet::clear() { |
| 932 RELEASE_ASSERT(m_isAlive); | 934 RELEASE_ASSERT(m_isAlive); |
| 933 siblingRules.clear(); | 935 m_siblingRules.clear(); |
| 934 uncommonAttributeRules.clear(); | 936 m_uncommonAttributeRules.clear(); |
| 935 m_metadata.clear(); | 937 m_metadata.clear(); |
| 936 m_classInvalidationSets.clear(); | 938 m_classInvalidationSets.clear(); |
| 937 m_attributeInvalidationSets.clear(); | 939 m_attributeInvalidationSets.clear(); |
| 938 m_idInvalidationSets.clear(); | 940 m_idInvalidationSets.clear(); |
| 939 m_pseudoInvalidationSets.clear(); | 941 m_pseudoInvalidationSets.clear(); |
| 940 m_universalSiblingInvalidationSet.clear(); | 942 m_universalSiblingInvalidationSet.clear(); |
| 941 m_nthInvalidationSet.clear(); | 943 m_nthInvalidationSet.clear(); |
| 942 } | 944 } |
| 943 | 945 |
| 944 void RuleFeatureSet::collectInvalidationSetsForClass( | 946 void RuleFeatureSet::collectInvalidationSetsForClass( |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 siblingFeatures.maxDirectAdjacentSelectors); | 1151 siblingFeatures.maxDirectAdjacentSelectors); |
| 1150 | 1152 |
| 1151 if (&siblingFeatures == &descendantFeatures) | 1153 if (&siblingFeatures == &descendantFeatures) |
| 1152 universalSet.setInvalidatesSelf(); | 1154 universalSet.setInvalidatesSelf(); |
| 1153 else | 1155 else |
| 1154 addFeaturesToInvalidationSet(universalSet.ensureSiblingDescendants(), | 1156 addFeaturesToInvalidationSet(universalSet.ensureSiblingDescendants(), |
| 1155 descendantFeatures); | 1157 descendantFeatures); |
| 1156 } | 1158 } |
| 1157 | 1159 |
| 1158 DEFINE_TRACE(RuleFeatureSet) { | 1160 DEFINE_TRACE(RuleFeatureSet) { |
| 1159 visitor->trace(siblingRules); | 1161 visitor->trace(m_siblingRules); |
| 1160 visitor->trace(uncommonAttributeRules); | 1162 visitor->trace(m_uncommonAttributeRules); |
| 1161 } | 1163 } |
| 1162 | 1164 |
| 1163 void RuleFeatureSet::InvalidationSetFeatures::add( | 1165 void RuleFeatureSet::InvalidationSetFeatures::add( |
| 1164 const InvalidationSetFeatures& other) { | 1166 const InvalidationSetFeatures& other) { |
| 1165 classes.appendVector(other.classes); | 1167 classes.appendVector(other.classes); |
| 1166 attributes.appendVector(other.attributes); | 1168 attributes.appendVector(other.attributes); |
| 1167 ids.appendVector(other.ids); | 1169 ids.appendVector(other.ids); |
| 1168 tagNames.appendVector(other.tagNames); | 1170 tagNames.appendVector(other.tagNames); |
| 1169 maxDirectAdjacentSelectors = | 1171 maxDirectAdjacentSelectors = |
| 1170 std::max(maxDirectAdjacentSelectors, other.maxDirectAdjacentSelectors); | 1172 std::max(maxDirectAdjacentSelectors, other.maxDirectAdjacentSelectors); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1182 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() || | 1184 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() || |
| 1183 !tagNames.isEmpty() || customPseudoElement; | 1185 !tagNames.isEmpty() || customPseudoElement; |
| 1184 } | 1186 } |
| 1185 | 1187 |
| 1186 bool RuleFeatureSet::InvalidationSetFeatures::hasTagIdClassOrAttribute() const { | 1188 bool RuleFeatureSet::InvalidationSetFeatures::hasTagIdClassOrAttribute() const { |
| 1187 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() || | 1189 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() || |
| 1188 !tagNames.isEmpty(); | 1190 !tagNames.isEmpty(); |
| 1189 } | 1191 } |
| 1190 | 1192 |
| 1191 } // namespace blink | 1193 } // namespace blink |
| OLD | NEW |