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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 bool hasDirectAdjacentRules = childrenAffectedByDirectAdjacentRules(); 1109 bool hasDirectAdjacentRules = childrenAffectedByDirectAdjacentRules();
1110 bool hasIndirectAdjacentRules = childrenAffectedByIndirectAdjacentRules(); 1110 bool hasIndirectAdjacentRules = childrenAffectedByIndirectAdjacentRules();
1111 1111
1112 if (!hasDirectAdjacentRules && !hasIndirectAdjacentRules) 1112 if (!hasDirectAdjacentRules && !hasIndirectAdjacentRules)
1113 return; 1113 return;
1114 1114
1115 unsigned forceCheckOfNextElementCount = 0; 1115 unsigned forceCheckOfNextElementCount = 0;
1116 bool forceCheckOfAnyElementSibling = false; 1116 bool forceCheckOfAnyElementSibling = false;
1117 Document& document = this->document(); 1117 Document& document = this->document();
1118 1118
1119 for (Node* child = firstChild(); child; child = child->nextSibling()) { 1119 for (Element* child = ElementTraversal::firstChild(*this); child; child = El ementTraversal::nextSibling(*child)) {
1120 if (!child->isElementNode()) 1120 bool childRulesChanged = child->needsStyleRecalc() && child->styleChange Type() >= SubtreeStyleChange;
1121 continue;
1122 Element* element = toElement(child);
1123 bool childRulesChanged = element->needsStyleRecalc() && element->styleCh angeType() >= SubtreeStyleChange;
1124 1121
1125 if (forceCheckOfNextElementCount || forceCheckOfAnyElementSibling) 1122 if (forceCheckOfNextElementCount || forceCheckOfAnyElementSibling)
1126 element->setNeedsStyleRecalc(SubtreeStyleChange); 1123 child->setNeedsStyleRecalc(SubtreeStyleChange);
1127
1128 if (forceCheckOfNextElementCount)
1129 forceCheckOfNextElementCount--;
1130 1124
1131 if (childRulesChanged && hasDirectAdjacentRules) 1125 if (childRulesChanged && hasDirectAdjacentRules)
1132 forceCheckOfNextElementCount = document.styleEngine()->maxDirectAdja centSelectors(); 1126 forceCheckOfNextElementCount = document.styleEngine()->maxDirectAdja centSelectors();
1127 else if (forceCheckOfNextElementCount)
1128 --forceCheckOfNextElementCount;
1133 1129
1134 forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childR ulesChanged && hasIndirectAdjacentRules); 1130 forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childR ulesChanged && hasIndirectAdjacentRules);
1135 } 1131 }
1136 } 1132 }
1137 1133
1138 void ContainerNode::checkForSiblingStyleChanges(bool finishedParsingCallback, No de* beforeChange, Node* afterChange, int childCountDelta) 1134 void ContainerNode::checkForSiblingStyleChanges(bool finishedParsingCallback, No de* beforeChange, Node* afterChange, int childCountDelta)
1139 { 1135 {
1140 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() || style ChangeType() >= SubtreeStyleChange) 1136 if (!inActiveDocument() || document().hasPendingForcedStyleRecalc() || style ChangeType() >= SubtreeStyleChange)
1141 return; 1137 return;
1142 1138
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 return true; 1274 return true;
1279 1275
1280 if (node->isElementNode() && toElement(node)->shadow()) 1276 if (node->isElementNode() && toElement(node)->shadow())
1281 return true; 1277 return true;
1282 1278
1283 return false; 1279 return false;
1284 } 1280 }
1285 #endif 1281 #endif
1286 1282
1287 } // namespace WebCore 1283 } // namespace WebCore
OLDNEW
« 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