Index: Source/core/css/RuleFeature.cpp |
diff --git a/Source/core/css/RuleFeature.cpp b/Source/core/css/RuleFeature.cpp |
index b52569a0034cea47262ee54d626699f31eaf38c5..9614e75f5a5deafd53d01867e485303c9b370016 100644 |
--- a/Source/core/css/RuleFeature.cpp |
+++ b/Source/core/css/RuleFeature.cpp |
@@ -36,6 +36,7 @@ |
#include "core/css/RuleSet.h" |
#include "core/dom/Document.h" |
#include "core/dom/Element.h" |
+#include "core/dom/ElementTraversal.h" |
#include "core/dom/Node.h" |
#include "core/dom/shadow/ElementShadow.h" |
#include "core/dom/shadow/ShadowRoot.h" |
@@ -360,21 +361,15 @@ bool RuleFeatureSet::invalidateStyleForClassChangeOnChildren(Element* element, V |
{ |
bool someChildrenNeedStyleRecalc = false; |
for (ShadowRoot* root = element->youngestShadowRoot(); root; root = root->olderShadowRoot()) { |
- for (Node* child = root->firstChild(); child; child = child->nextSibling()) { |
- if (child->isElementNode()) { |
- Element* childElement = toElement(child); |
- bool childRecalced = invalidateStyleForClassChange(childElement, invalidationClasses, foundInvalidationSet); |
- someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRecalced; |
- } |
- } |
- } |
- for (Node* child = element->firstChild(); child; child = child->nextSibling()) { |
- if (child->isElementNode()) { |
- Element* childElement = toElement(child); |
- bool childRecalced = invalidateStyleForClassChange(childElement, invalidationClasses, foundInvalidationSet); |
+ for (Element* child = ElementTraversal::firstWithin(*root); child; child = ElementTraversal::nextSibling(*child)) { |
+ bool childRecalced = invalidateStyleForClassChange(child, invalidationClasses, foundInvalidationSet); |
someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRecalced; |
} |
} |
+ for (Element* child = ElementTraversal::firstWithin(*element); child; child = ElementTraversal::nextSibling(*child)) { |
+ bool childRecalced = invalidateStyleForClassChange(child, invalidationClasses, foundInvalidationSet); |
+ someChildrenNeedStyleRecalc = someChildrenNeedStyleRecalc || childRecalced; |
+ } |
return someChildrenNeedStyleRecalc; |
} |