Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: Source/core/css/RuleFeature.cpp

Issue 171663005: Consistently use ElementTraversal API when looking for an Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/dom/Document.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698