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

Unified Diff: Source/core/dom/ContainerNode.cpp

Issue 316173007: Use ElementTraversal API in ContainerNode::checkForChildrenAdjacentRuleChanges() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename to child Created 6 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index 19d79ab8704453a72d111d5a649e1d7f66f26f27..fed648dbb0002f7a4a4f906e439df3f33500c162 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -1116,20 +1116,16 @@ void ContainerNode::checkForChildrenAdjacentRuleChanges()
bool forceCheckOfAnyElementSibling = false;
Document& document = this->document();
- for (Node* child = firstChild(); child; child = child->nextSibling()) {
- if (!child->isElementNode())
- continue;
- Element* element = toElement(child);
- bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() >= SubtreeStyleChange;
+ for (Element* child = ElementTraversal::firstChild(*this); child; child = ElementTraversal::nextSibling(*child)) {
+ bool childRulesChanged = child->needsStyleRecalc() && child->styleChangeType() >= SubtreeStyleChange;
if (forceCheckOfNextElementCount || forceCheckOfAnyElementSibling)
- element->setNeedsStyleRecalc(SubtreeStyleChange);
-
- if (forceCheckOfNextElementCount)
- forceCheckOfNextElementCount--;
+ child->setNeedsStyleRecalc(SubtreeStyleChange);
if (childRulesChanged && hasDirectAdjacentRules)
forceCheckOfNextElementCount = document.styleEngine()->maxDirectAdjacentSelectors();
+ else if (forceCheckOfNextElementCount)
+ --forceCheckOfNextElementCount;
forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childRulesChanged && hasIndirectAdjacentRules);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698