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 r
ights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
ights reserved. |
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "core/css/RuleFeature.h" | 30 #include "core/css/RuleFeature.h" |
31 | 31 |
32 #include "core/HTMLNames.h" | 32 #include "core/HTMLNames.h" |
33 #include "core/css/CSSSelector.h" | 33 #include "core/css/CSSSelector.h" |
34 #include "core/css/CSSSelectorList.h" | 34 #include "core/css/CSSSelectorList.h" |
35 #include "core/css/RuleSet.h" | 35 #include "core/css/RuleSet.h" |
36 #include "core/css/StyleRule.h" | 36 #include "core/css/StyleRule.h" |
37 #include "core/css/invalidation/DescendantInvalidationSet.h" | 37 #include "core/css/invalidation/DescendantInvalidationSet.h" |
38 #include "core/dom/Element.h" | 38 #include "core/dom/Element.h" |
39 #include "core/dom/Node.h" | 39 #include "core/dom/Node.h" |
40 #include "platform/RuntimeEnabledFeatures.h" | |
41 #include "wtf/BitVector.h" | 40 #include "wtf/BitVector.h" |
42 | 41 |
43 namespace blink { | 42 namespace blink { |
44 | 43 |
45 static bool isSkippableComponentForInvalidation(const CSSSelector& selector) | 44 static bool isSkippableComponentForInvalidation(const CSSSelector& selector) |
46 { | 45 { |
47 if (selector.match() == CSSSelector::Tag) { | 46 if (selector.match() == CSSSelector::Tag) { |
48 ASSERT(selector.tagQName().localName() == starAtom); | 47 ASSERT(selector.tagQName().localName() == starAtom); |
49 return true; | 48 return true; |
50 } | 49 } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec
tor(*current)) { | 298 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec
tor(*current)) { |
300 if (features.treeBoundaryCrossing) | 299 if (features.treeBoundaryCrossing) |
301 invalidationSet->setTreeBoundaryCrossing(); | 300 invalidationSet->setTreeBoundaryCrossing(); |
302 if (features.wholeSubtree) { | 301 if (features.wholeSubtree) { |
303 invalidationSet->setWholeSubtreeInvalid(); | 302 invalidationSet->setWholeSubtreeInvalid(); |
304 } else { | 303 } else { |
305 if (!features.id.isEmpty()) | 304 if (!features.id.isEmpty()) |
306 invalidationSet->addId(features.id); | 305 invalidationSet->addId(features.id); |
307 if (!features.tagName.isEmpty()) | 306 if (!features.tagName.isEmpty()) |
308 invalidationSet->addTagName(features.tagName); | 307 invalidationSet->addTagName(features.tagName); |
309 for (Vector<AtomicString>::const_iterator it = features.classes.
begin(); it != features.classes.end(); ++it) | 308 for (const auto& className : features.classes) |
310 invalidationSet->addClass(*it); | 309 invalidationSet->addClass(className); |
311 for (Vector<AtomicString>::const_iterator it = features.attribut
es.begin(); it != features.attributes.end(); ++it) | 310 for (const auto& attribute : features.attributes) |
312 invalidationSet->addAttribute(*it); | 311 invalidationSet->addAttribute(attribute); |
313 if (features.customPseudoElement) | 312 if (features.customPseudoElement) |
314 invalidationSet->setCustomPseudoInvalid(); | 313 invalidationSet->setCustomPseudoInvalid(); |
315 } | 314 } |
316 } else { | 315 } else { |
317 if (current->pseudoType() == CSSSelector::PseudoHost) | 316 if (current->pseudoType() == CSSSelector::PseudoHost) |
318 features.treeBoundaryCrossing = true; | 317 features.treeBoundaryCrossing = true; |
319 if (const CSSSelectorList* selectorList = current->selectorList()) { | 318 if (const CSSSelectorList* selectorList = current->selectorList()) { |
320 ASSERT(current->pseudoType() == CSSSelector::PseudoHost || curre
nt->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelect
or::PseudoNot); | 319 ASSERT(current->pseudoType() == CSSSelector::PseudoHost || curre
nt->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelect
or::PseudoNot); |
321 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) | 320 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) |
322 addFeaturesToInvalidationSets(*selector, features); | 321 addFeaturesToInvalidationSets(*selector, features); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 441 |
443 void RuleFeatureSet::FeatureMetadata::clear() | 442 void RuleFeatureSet::FeatureMetadata::clear() |
444 { | 443 { |
445 usesFirstLineRules = false; | 444 usesFirstLineRules = false; |
446 foundSiblingSelector = false; | 445 foundSiblingSelector = false; |
447 maxDirectAdjacentSelectors = 0; | 446 maxDirectAdjacentSelectors = 0; |
448 } | 447 } |
449 | 448 |
450 void RuleFeatureSet::add(const RuleFeatureSet& other) | 449 void RuleFeatureSet::add(const RuleFeatureSet& other) |
451 { | 450 { |
452 for (InvalidationSetMap::const_iterator it = other.m_classInvalidationSets.b
egin(); it != other.m_classInvalidationSets.end(); ++it) | 451 for (const auto& invalidationSet : other.m_classInvalidationSets) |
453 ensureClassInvalidationSet(it->key).combine(*it->value); | 452 ensureClassInvalidationSet(invalidationSet.key).combine(*invalidationSet
.value); |
454 for (InvalidationSetMap::const_iterator it = other.m_attributeInvalidationSe
ts.begin(); it != other.m_attributeInvalidationSets.end(); ++it) | 453 for (const auto& invalidationSet : other.m_attributeInvalidationSets) |
455 ensureAttributeInvalidationSet(it->key).combine(*it->value); | 454 ensureAttributeInvalidationSet(invalidationSet.key).combine(*invalidatio
nSet.value); |
456 for (InvalidationSetMap::const_iterator it = other.m_idInvalidationSets.begi
n(); it != other.m_idInvalidationSets.end(); ++it) | 455 for (const auto& invalidationSet : other.m_idInvalidationSets) |
457 ensureIdInvalidationSet(it->key).combine(*it->value); | 456 ensureIdInvalidationSet(invalidationSet.key).combine(*invalidationSet.va
lue); |
458 for (PseudoTypeInvalidationSetMap::const_iterator it = other.m_pseudoInvalid
ationSets.begin(); it != other.m_pseudoInvalidationSets.end(); ++it) | 457 for (const auto& invalidationSet : other.m_pseudoInvalidationSets) |
459 ensurePseudoInvalidationSet(static_cast<CSSSelector::PseudoType>(it->key
)).combine(*it->value); | 458 ensurePseudoInvalidationSet(static_cast<CSSSelector::PseudoType>(invalid
ationSet.key)).combine(*invalidationSet.value); |
460 | 459 |
461 m_metadata.add(other.m_metadata); | 460 m_metadata.add(other.m_metadata); |
462 | 461 |
463 siblingRules.appendVector(other.siblingRules); | 462 siblingRules.appendVector(other.siblingRules); |
464 uncommonAttributeRules.appendVector(other.uncommonAttributeRules); | 463 uncommonAttributeRules.appendVector(other.uncommonAttributeRules); |
465 } | 464 } |
466 | 465 |
467 void RuleFeatureSet::clear() | 466 void RuleFeatureSet::clear() |
468 { | 467 { |
469 siblingRules.clear(); | 468 siblingRules.clear(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 visitor->trace(uncommonAttributeRules); | 563 visitor->trace(uncommonAttributeRules); |
565 visitor->trace(m_classInvalidationSets); | 564 visitor->trace(m_classInvalidationSets); |
566 visitor->trace(m_attributeInvalidationSets); | 565 visitor->trace(m_attributeInvalidationSets); |
567 visitor->trace(m_idInvalidationSets); | 566 visitor->trace(m_idInvalidationSets); |
568 visitor->trace(m_pseudoInvalidationSets); | 567 visitor->trace(m_pseudoInvalidationSets); |
569 visitor->trace(m_styleInvalidator); | 568 visitor->trace(m_styleInvalidator); |
570 #endif | 569 #endif |
571 } | 570 } |
572 | 571 |
573 } // namespace blink | 572 } // namespace blink |
OLD | NEW |