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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::supportsClassDescendantInval
idation(const CSSSelector& selector) | 105 RuleFeatureSet::InvalidationSetMode RuleFeatureSet::supportsClassDescendantInval
idation(const CSSSelector& selector) |
106 { | 106 { |
107 bool foundDescendantRelation = false; | 107 bool foundDescendantRelation = false; |
108 bool foundIdent = false; | 108 bool foundIdent = false; |
109 for (const CSSSelector* component = &selector; component; component = compon
ent->tagHistory()) { | 109 for (const CSSSelector* component = &selector; component; component = compon
ent->tagHistory()) { |
110 | 110 |
111 // FIXME: next up: Tag and Id. | 111 // FIXME: next up: Tag and Id. |
112 if (component->m_match == CSSSelector::Class || component->isAttributeSe
lector()) { | 112 if (component->m_match == CSSSelector::Class || component->isAttributeSe
lector()) { |
113 if (!foundDescendantRelation) | 113 if (!foundDescendantRelation) |
114 foundIdent = true; | 114 foundIdent = true; |
115 } else if (component->pseudoType() == CSSSelector::PseudoHost) { | 115 } else if (component->pseudoType() == CSSSelector::PseudoHost || compone
nt->pseudoType() == CSSSelector::PseudoAny) { |
116 if (const CSSSelectorList* selectorList = component->selectorList())
{ | 116 if (const CSSSelectorList* selectorList = component->selectorList())
{ |
117 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) { | 117 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) { |
118 InvalidationSetMode hostMode = supportsClassDescendantInvali
dation(*selector); | 118 InvalidationSetMode hostMode = supportsClassDescendantInvali
dation(*selector); |
119 if (hostMode == UseSubtreeStyleChange) | 119 if (hostMode == UseSubtreeStyleChange) |
120 return foundDescendantRelation ? UseLocalStyleChange : U
seSubtreeStyleChange; | 120 return foundDescendantRelation ? UseLocalStyleChange : U
seSubtreeStyleChange; |
121 if (hostMode == AddFeatures) | 121 if (hostMode == AddFeatures) |
122 foundIdent = true; | 122 foundIdent = true; |
123 } | 123 } |
124 } | 124 } |
125 } else if (!isSkippableComponentForInvalidation(*component)) { | 125 } else if (!isSkippableComponentForInvalidation(*component)) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return AddFeatures; | 187 return AddFeatures; |
188 } | 188 } |
189 | 189 |
190 const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelec
tor& selector, Vector<AtomicString>& classes, AtomicString& id, AtomicString& ta
gName, Vector<AtomicString>& attributes) | 190 const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelec
tor& selector, Vector<AtomicString>& classes, AtomicString& id, AtomicString& ta
gName, Vector<AtomicString>& attributes) |
191 { | 191 { |
192 const CSSSelector* lastSelector = &selector; | 192 const CSSSelector* lastSelector = &selector; |
193 for (; lastSelector; lastSelector = lastSelector->tagHistory()) { | 193 for (; lastSelector; lastSelector = lastSelector->tagHistory()) { |
194 extractClassIdTagOrAttribute(*lastSelector, classes, id, tagName, attrib
utes); | 194 extractClassIdTagOrAttribute(*lastSelector, classes, id, tagName, attrib
utes); |
195 // Initialize the entry in the invalidation set map, if supported. | 195 // Initialize the entry in the invalidation set map, if supported. |
196 invalidationSetForSelector(*lastSelector); | 196 invalidationSetForSelector(*lastSelector); |
197 if (lastSelector->pseudoType() == CSSSelector::PseudoHost) { | 197 if (lastSelector->pseudoType() == CSSSelector::PseudoHost || lastSelecto
r->pseudoType() == CSSSelector::PseudoAny) { |
198 if (const CSSSelectorList* selectorList = lastSelector->selectorList
()) { | 198 if (const CSSSelectorList* selectorList = lastSelector->selectorList
()) { |
199 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) | 199 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) |
200 extractInvalidationSetFeatures(*selector, classes, id, tagNa
me, attributes); | 200 extractInvalidationSetFeatures(*selector, classes, id, tagNa
me, attributes); |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 if (lastSelector->relation() != CSSSelector::SubSelector) | 204 if (lastSelector->relation() != CSSSelector::SubSelector) |
205 break; | 205 break; |
206 } | 206 } |
207 return lastSelector; | 207 return lastSelector; |
208 } | 208 } |
209 | 209 |
210 void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector,
const Vector<AtomicString>& classes, AtomicString id, AtomicString tagName, cons
t Vector<AtomicString>& attributes) | 210 void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector,
const Vector<AtomicString>& classes, AtomicString id, AtomicString tagName, cons
t Vector<AtomicString>& attributes) |
211 { | 211 { |
212 for (const CSSSelector* current = &selector; current; current = current->tag
History()) { | 212 for (const CSSSelector* current = &selector; current; current = current->tag
History()) { |
213 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec
tor(*current)) { | 213 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec
tor(*current)) { |
214 if (!id.isEmpty()) | 214 if (!id.isEmpty()) |
215 invalidationSet->addId(id); | 215 invalidationSet->addId(id); |
216 if (!tagName.isEmpty()) | 216 if (!tagName.isEmpty()) |
217 invalidationSet->addTagName(tagName); | 217 invalidationSet->addTagName(tagName); |
218 for (Vector<AtomicString>::const_iterator it = classes.begin(); it !
= classes.end(); ++it) | 218 for (Vector<AtomicString>::const_iterator it = classes.begin(); it !
= classes.end(); ++it) |
219 invalidationSet->addClass(*it); | 219 invalidationSet->addClass(*it); |
220 for (Vector<AtomicString>::const_iterator it = attributes.begin(); i
t != attributes.end(); ++it) | 220 for (Vector<AtomicString>::const_iterator it = attributes.begin(); i
t != attributes.end(); ++it) |
221 invalidationSet->addAttribute(*it); | 221 invalidationSet->addAttribute(*it); |
222 } else if (current->pseudoType() == CSSSelector::PseudoHost) { | 222 } else if (current->pseudoType() == CSSSelector::PseudoHost || current->
pseudoType() == CSSSelector::PseudoAny) { |
223 if (const CSSSelectorList* selectorList = current->selectorList()) { | 223 if (const CSSSelectorList* selectorList = current->selectorList()) { |
224 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) | 224 for (const CSSSelector* selector = selectorList->first(); select
or; selector = CSSSelectorList::next(*selector)) |
225 addFeaturesToInvalidationSets(*selector, classes, id, tagNam
e, attributes); | 225 addFeaturesToInvalidationSets(*selector, classes, id, tagNam
e, attributes); |
226 } | 226 } |
227 } | 227 } |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 void RuleFeatureSet::addContentAttr(const AtomicString& attributeName) | 231 void RuleFeatureSet::addContentAttr(const AtomicString& attributeName) |
232 { | 232 { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 if (node->isElementNode()) | 426 if (node->isElementNode()) |
427 m_pendingInvalidationMap.remove(toElement(node)); | 427 m_pendingInvalidationMap.remove(toElement(node)); |
428 } | 428 } |
429 | 429 |
430 RuleFeatureSet::PendingInvalidationMap& RuleFeatureSet::pendingInvalidationMap() | 430 RuleFeatureSet::PendingInvalidationMap& RuleFeatureSet::pendingInvalidationMap() |
431 { | 431 { |
432 return m_pendingInvalidationMap; | 432 return m_pendingInvalidationMap; |
433 } | 433 } |
434 | 434 |
435 } // namespace WebCore | 435 } // namespace WebCore |
OLD | NEW |