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::getInvalidationSetMode(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()) { | 113 if (component->m_match == CSSSelector::Class || component->isAttributeSe
lector()) { |
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 = getInvalidationSetMode(*selec
tor); |
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 30 matching lines...) Expand all Loading... |
163 { | 163 { |
164 if (selector.m_match == CSSSelector::Class) | 164 if (selector.m_match == CSSSelector::Class) |
165 return &ensureClassInvalidationSet(selector.value()); | 165 return &ensureClassInvalidationSet(selector.value()); |
166 if (selector.isAttributeSelector()) | 166 if (selector.isAttributeSelector()) |
167 return &ensureAttributeInvalidationSet(selector.attribute().localName())
; | 167 return &ensureAttributeInvalidationSet(selector.attribute().localName())
; |
168 return 0; | 168 return 0; |
169 } | 169 } |
170 | 170 |
171 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::updateInvalidationSets(const
CSSSelector& selector) | 171 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::updateInvalidationSets(const
CSSSelector& selector) |
172 { | 172 { |
173 InvalidationSetMode mode = supportsClassDescendantInvalidation(selector); | 173 InvalidationSetMode mode = getInvalidationSetMode(selector); |
174 if (mode != AddFeatures) | 174 if (mode != AddFeatures) |
175 return mode; | 175 return mode; |
176 | 176 |
177 InvalidationSetFeatures features; | 177 InvalidationSetFeatures features; |
178 const CSSSelector* current = extractInvalidationSetFeatures(selector, featur
es); | 178 const CSSSelector* current = extractInvalidationSetFeatures(selector, featur
es); |
179 if (current) | 179 if (current) |
180 current = current->tagHistory(); | 180 current = current->tagHistory(); |
181 | 181 |
182 if (current) | 182 if (current) |
183 addFeaturesToInvalidationSets(*current, features); | 183 addFeaturesToInvalidationSets(*current, features); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationS
ets.get(className)) | 403 if (RefPtr<DescendantInvalidationSet> invalidationSet = m_classInvalidationS
ets.get(className)) |
404 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); | 404 m_styleInvalidator.scheduleInvalidation(invalidationSet, element); |
405 } | 405 } |
406 | 406 |
407 StyleInvalidator& RuleFeatureSet::styleInvalidator() | 407 StyleInvalidator& RuleFeatureSet::styleInvalidator() |
408 { | 408 { |
409 return m_styleInvalidator; | 409 return m_styleInvalidator; |
410 } | 410 } |
411 | 411 |
412 } // namespace WebCore | 412 } // namespace WebCore |
OLD | NEW |