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

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: 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 5fdfa0c736a25f75642599581f2e6fcf84cf2eaa..4686036b207c006a215a7ebbbd0311170ae3ae8a 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* childElement = ElementTraversal::firstChild(*this); childElement; childElement = ElementTraversal::nextSibling(*childElement)) {
esprehn 2014/06/06 01:19:41 Just call it child, you don't need to rename it.
Inactive 2014/06/06 01:27:59 Done.
+ bool childRulesChanged = childElement->needsStyleRecalc() && childElement->styleChangeType() >= SubtreeStyleChange;
if (forceCheckOfNextElementCount || forceCheckOfAnyElementSibling)
- element->setNeedsStyleRecalc(SubtreeStyleChange);
-
- if (forceCheckOfNextElementCount)
- forceCheckOfNextElementCount--;
+ childElement->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