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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 if (lastInCompound) | 473 if (lastInCompound) |
474 updateFeaturesFromCombinator(*lastInCompound, nullptr, features, | 474 updateFeaturesFromCombinator(*lastInCompound, nullptr, features, |
475 siblingFeatures, features); | 475 siblingFeatures, features); |
476 | 476 |
477 addFeaturesToInvalidationSets(*nextCompound, siblingFeatures, features); | 477 addFeaturesToInvalidationSets(*nextCompound, siblingFeatures, features); |
478 updateRuleSetInvalidation(features); | 478 updateRuleSetInvalidation(features); |
479 } | 479 } |
480 | 480 |
481 void RuleFeatureSet::updateRuleSetInvalidation( | 481 void RuleFeatureSet::updateRuleSetInvalidation( |
482 const InvalidationSetFeatures& features) { | 482 const InvalidationSetFeatures& features) { |
483 if (!features.hasFeaturesForRuleSetInvalidation) { | 483 if (features.hasFeaturesForRuleSetInvalidation) |
484 if (features.forceSubtree || features.tagNames.isEmpty()) | 484 return; |
485 m_metadata.needsFullRecalcForRuleSetInvalidation = true; | 485 if (features.forceSubtree || |
486 else | 486 (!features.customPseudoElement && features.tagNames.isEmpty())) { |
487 addTagNamesToTypeRuleInvalidationSet(features.tagNames); | 487 m_metadata.needsFullRecalcForRuleSetInvalidation = true; |
| 488 return; |
488 } | 489 } |
| 490 |
| 491 ensureTypeRuleInvalidationSet(); |
| 492 |
| 493 if (features.customPseudoElement) { |
| 494 m_typeRuleInvalidationSet->setCustomPseudoInvalid(); |
| 495 m_typeRuleInvalidationSet->setTreeBoundaryCrossing(); |
| 496 } |
| 497 |
| 498 for (auto tagName : features.tagNames) |
| 499 m_typeRuleInvalidationSet->addTagName(tagName); |
489 } | 500 } |
490 | 501 |
491 void RuleFeatureSet::updateInvalidationSetsForContentAttribute( | 502 void RuleFeatureSet::updateInvalidationSetsForContentAttribute( |
492 const RuleData& ruleData) { | 503 const RuleData& ruleData) { |
493 // If any ::before and ::after rules specify 'content: attr(...)', we | 504 // If any ::before and ::after rules specify 'content: attr(...)', we |
494 // need to create invalidation sets for those attributes to have content | 505 // need to create invalidation sets for those attributes to have content |
495 // changes applied through style recalc. | 506 // changes applied through style recalc. |
496 | 507 |
497 const StylePropertySet& propertySet = ruleData.rule()->properties(); | 508 const StylePropertySet& propertySet = ruleData.rule()->properties(); |
498 | 509 |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 universalSet.updateMaxDirectAdjacentSelectors( | 1171 universalSet.updateMaxDirectAdjacentSelectors( |
1161 siblingFeatures.maxDirectAdjacentSelectors); | 1172 siblingFeatures.maxDirectAdjacentSelectors); |
1162 | 1173 |
1163 if (&siblingFeatures == &descendantFeatures) | 1174 if (&siblingFeatures == &descendantFeatures) |
1164 universalSet.setInvalidatesSelf(); | 1175 universalSet.setInvalidatesSelf(); |
1165 else | 1176 else |
1166 addFeaturesToInvalidationSet(universalSet.ensureSiblingDescendants(), | 1177 addFeaturesToInvalidationSet(universalSet.ensureSiblingDescendants(), |
1167 descendantFeatures); | 1178 descendantFeatures); |
1168 } | 1179 } |
1169 | 1180 |
1170 void RuleFeatureSet::addTagNamesToTypeRuleInvalidationSet( | |
1171 const Vector<AtomicString>& tagNames) { | |
1172 DCHECK(!tagNames.isEmpty()); | |
1173 ensureTypeRuleInvalidationSet(); | |
1174 for (auto tagName : tagNames) | |
1175 m_typeRuleInvalidationSet->addTagName(tagName); | |
1176 } | |
1177 | |
1178 DEFINE_TRACE(RuleFeatureSet) { | 1181 DEFINE_TRACE(RuleFeatureSet) { |
1179 visitor->trace(m_siblingRules); | 1182 visitor->trace(m_siblingRules); |
1180 visitor->trace(m_uncommonAttributeRules); | 1183 visitor->trace(m_uncommonAttributeRules); |
1181 visitor->trace(m_viewportDependentMediaQueryResults); | 1184 visitor->trace(m_viewportDependentMediaQueryResults); |
1182 visitor->trace(m_deviceDependentMediaQueryResults); | 1185 visitor->trace(m_deviceDependentMediaQueryResults); |
1183 } | 1186 } |
1184 | 1187 |
1185 void RuleFeatureSet::InvalidationSetFeatures::add( | 1188 void RuleFeatureSet::InvalidationSetFeatures::add( |
1186 const InvalidationSetFeatures& other) { | 1189 const InvalidationSetFeatures& other) { |
1187 classes.appendVector(other.classes); | 1190 classes.appendVector(other.classes); |
(...skipping 15 matching lines...) Expand all Loading... |
1203 bool RuleFeatureSet::InvalidationSetFeatures::hasFeatures() const { | 1206 bool RuleFeatureSet::InvalidationSetFeatures::hasFeatures() const { |
1204 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() || | 1207 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() || |
1205 !tagNames.isEmpty() || customPseudoElement; | 1208 !tagNames.isEmpty() || customPseudoElement; |
1206 } | 1209 } |
1207 | 1210 |
1208 bool RuleFeatureSet::InvalidationSetFeatures::hasIdClassOrAttribute() const { | 1211 bool RuleFeatureSet::InvalidationSetFeatures::hasIdClassOrAttribute() const { |
1209 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty(); | 1212 return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty(); |
1210 } | 1213 } |
1211 | 1214 |
1212 } // namespace blink | 1215 } // namespace blink |
OLD | NEW |