| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 case CSSSelector::PseudoInRange: | 96 case CSSSelector::PseudoInRange: |
| 97 case CSSSelector::PseudoOutOfRange: | 97 case CSSSelector::PseudoOutOfRange: |
| 98 case CSSSelector::PseudoUnresolved: | 98 case CSSSelector::PseudoUnresolved: |
| 99 return true; | 99 return true; |
| 100 default: | 100 default: |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 // This method is somewhat conservative in what it accepts. | 105 // This method is somewhat conservative in what it accepts. |
| 106 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::supportsClassDescendantInval
idation(const CSSSelector& selector) | 106 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::invalidationSetModeForSelect
or(const CSSSelector& selector) |
| 107 { | 107 { |
| 108 bool foundDescendantRelation = false; | 108 bool foundDescendantRelation = false; |
| 109 bool foundIdent = false; | 109 bool foundIdent = false; |
| 110 for (const CSSSelector* component = &selector; component; component = compon
ent->tagHistory()) { | 110 for (const CSSSelector* component = &selector; component; component = compon
ent->tagHistory()) { |
| 111 | 111 |
| 112 // FIXME: next up: Tag and Id. | 112 // FIXME: next up: Tag and Id. |
| 113 if (component->m_match == CSSSelector::Class || component->isAttributeSe
lector() || component->isCustomPseudoElement()) { | 113 if (component->m_match == CSSSelector::Class || component->isAttributeSe
lector() || component->isCustomPseudoElement()) { |
| 114 if (!foundDescendantRelation) | 114 if (!foundDescendantRelation) |
| 115 foundIdent = true; | 115 foundIdent = true; |
| 116 } else if (component->pseudoType() == CSSSelector::PseudoHost || compone
nt->pseudoType() == CSSSelector::PseudoAny) { | 116 } else if (component->pseudoType() == CSSSelector::PseudoHost || compone
nt->pseudoType() == CSSSelector::PseudoAny) { |
| 117 if (const CSSSelectorList* selectorList = component->selectorList())
{ | 117 if (const CSSSelectorList* selectorList = component->selectorList())
{ |
| 118 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) { | 118 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) { |
| 119 InvalidationSetMode hostMode = supportsClassDescendantInvali
dation(*selector); | 119 InvalidationSetMode hostMode = invalidationSetModeForSelecto
r(*selector); |
| 120 if (hostMode == UseSubtreeStyleChange) | 120 if (hostMode == UseSubtreeStyleChange) |
| 121 return foundDescendantRelation ? UseLocalStyleChange : U
seSubtreeStyleChange; | 121 return foundDescendantRelation ? UseLocalStyleChange : U
seSubtreeStyleChange; |
| 122 if (hostMode == AddFeatures) | 122 if (!foundDescendantRelation && hostMode == AddFeatures) |
| 123 foundIdent = true; | 123 foundIdent = true; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 } else if (!isSkippableComponentForInvalidation(*component)) { | 126 } else if (!isSkippableComponentForInvalidation(*component)) { |
| 127 return foundDescendantRelation ? UseLocalStyleChange : UseSubtreeSty
leChange; | 127 return foundDescendantRelation ? UseLocalStyleChange : UseSubtreeSty
leChange; |
| 128 } | 128 } |
| 129 switch (component->relation()) { | 129 switch (component->relation()) { |
| 130 case CSSSelector::Descendant: | 130 case CSSSelector::Descendant: |
| 131 case CSSSelector::Child: | 131 case CSSSelector::Child: |
| 132 case CSSSelector::ShadowPseudo: | 132 case CSSSelector::ShadowPseudo: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 { | 165 { |
| 166 if (selector.m_match == CSSSelector::Class) | 166 if (selector.m_match == CSSSelector::Class) |
| 167 return &ensureClassInvalidationSet(selector.value()); | 167 return &ensureClassInvalidationSet(selector.value()); |
| 168 if (selector.isAttributeSelector()) | 168 if (selector.isAttributeSelector()) |
| 169 return &ensureAttributeInvalidationSet(selector.attribute().localName())
; | 169 return &ensureAttributeInvalidationSet(selector.attribute().localName())
; |
| 170 return 0; | 170 return 0; |
| 171 } | 171 } |
| 172 | 172 |
| 173 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::updateInvalidationSets(const
CSSSelector& selector) | 173 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::updateInvalidationSets(const
CSSSelector& selector) |
| 174 { | 174 { |
| 175 InvalidationSetMode mode = supportsClassDescendantInvalidation(selector); | 175 InvalidationSetMode mode = invalidationSetModeForSelector(selector); |
| 176 if (mode != AddFeatures) | 176 if (mode != AddFeatures) |
| 177 return mode; | 177 return mode; |
| 178 | 178 |
| 179 InvalidationSetFeatures features; | 179 InvalidationSetFeatures features; |
| 180 const CSSSelector* current = extractInvalidationSetFeatures(selector, featur
es); | 180 const CSSSelector* current = extractInvalidationSetFeatures(selector, featur
es); |
| 181 if (current) | 181 if (current) |
| 182 current = current->tagHistory(); | 182 current = current->tagHistory(); |
| 183 | 183 |
| 184 if (current) | 184 if (current) |
| 185 addFeaturesToInvalidationSets(*current, features); | 185 addFeaturesToInvalidationSets(*current, features); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationS
ets.get(className)) | 407 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationS
ets.get(className)) |
| 408 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); | 408 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
| 409 } | 409 } |
| 410 | 410 |
| 411 StyleInvalidator& RuleFeatureSet::styleInvalidator() | 411 StyleInvalidator& RuleFeatureSet::styleInvalidator() |
| 412 { | 412 { |
| 413 return m_styleInvalidator; | 413 return m_styleInvalidator; |
| 414 } | 414 } |
| 415 | 415 |
| 416 } // namespace WebCore | 416 } // namespace WebCore |
| OLD | NEW |