Index: Source/core/css/RuleFeature.cpp |
diff --git a/Source/core/css/RuleFeature.cpp b/Source/core/css/RuleFeature.cpp |
index b52569a0034cea47262ee54d626699f31eaf38c5..1395acf0e6f59aca9dfcef749802b97bc3626a39 100644 |
--- a/Source/core/css/RuleFeature.cpp |
+++ b/Source/core/css/RuleFeature.cpp |
@@ -380,24 +380,26 @@ bool RuleFeatureSet::invalidateStyleForClassChangeOnChildren(Element* element, V |
bool RuleFeatureSet::invalidateStyleForClassChange(Element* element, Vector<AtomicString>& invalidationClasses, bool foundInvalidationSet) |
{ |
+ bool thisElementNeedsStyleRecalc = false; |
int oldSize = invalidationClasses.size(); |
+ |
if (element->needsStyleInvalidation()) { |
- if (InvalidationList* invalidationList = m_pendingInvalidationMap.get(element)) { |
- foundInvalidationSet = true; |
- for (InvalidationList::const_iterator it = invalidationList->begin(); it != invalidationList->end(); ++it) { |
- if ((*it)->wholeSubtreeInvalid()) { |
- element->setNeedsStyleRecalc(SubtreeStyleChange); |
- invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); |
- element->clearChildNeedsStyleInvalidation(); |
- return true; |
- } |
- (*it)->getClasses(invalidationClasses); |
+ InvalidationList* invalidationList = m_pendingInvalidationMap.get(element); |
+ ASSERT(invalidationList); |
+ // FIXME: it's really only necessary to clone the render style for this element, not full style recalc. |
+ thisElementNeedsStyleRecalc = true; |
+ foundInvalidationSet = true; |
+ for (InvalidationList::const_iterator it = invalidationList->begin(); it != invalidationList->end(); ++it) { |
+ if ((*it)->wholeSubtreeInvalid()) { |
+ element->setNeedsStyleRecalc(SubtreeStyleChange); |
+ invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); |
+ element->clearChildNeedsStyleInvalidation(); |
+ return true; |
} |
+ (*it)->getClasses(invalidationClasses); |
} |
} |
- bool thisElementNeedsStyleRecalc = false; |
- |
if (element->hasClass()) { |
const SpaceSplitString& classNames = element->classNames(); |
for (Vector<AtomicString>::const_iterator it = invalidationClasses.begin(); it != invalidationClasses.end(); ++it) { |
@@ -413,6 +415,7 @@ bool RuleFeatureSet::invalidateStyleForClassChange(Element* element, Vector<Atom |
if (foundInvalidationSet || element->childNeedsStyleInvalidation()) { |
bool someChildrenNeedStyleRecalc = invalidateStyleForClassChangeOnChildren(element, invalidationClasses, foundInvalidationSet); |
// We only need to possibly recalc style if this node is in the subtree of a node with a DescendantInvalidationSet on it. |
+ // FIXME: it's really only necessary to clone the render style for this element, not full style recalc. |
if (foundInvalidationSet) |
thisElementNeedsStyleRecalc = thisElementNeedsStyleRecalc || someChildrenNeedStyleRecalc; |
} |
@@ -422,6 +425,8 @@ bool RuleFeatureSet::invalidateStyleForClassChange(Element* element, Vector<Atom |
invalidationClasses.remove(oldSize, invalidationClasses.size() - oldSize); |
element->clearChildNeedsStyleInvalidation(); |
+ element->clearNeedsStyleInvalidation(); |
+ |
return thisElementNeedsStyleRecalc; |
} |