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

Unified Diff: Source/core/css/SiblingTraversalStrategies.h

Issue 27217007: Merge 158839 "Reverse style resolution to avoid N^2 walk when bu..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1650/
Patch Set: Created 7 years, 2 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 | « Source/core/core.gypi ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/SiblingTraversalStrategies.h
===================================================================
--- Source/core/css/SiblingTraversalStrategies.h (revision 159683)
+++ Source/core/css/SiblingTraversalStrategies.h (working copy)
@@ -78,14 +78,8 @@
inline int DOMSiblingTraversalStrategy::countElementsBefore(Element* element) const
{
int count = 0;
- for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
- unsigned index = sibling->childIndex();
- if (index) {
- count += index;
- break;
- }
+ for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling())
count++;
- }
return count;
}
@@ -104,8 +98,14 @@
inline int DOMSiblingTraversalStrategy::countElementsAfter(Element* element) const
{
int count = 0;
- for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling())
+ for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) {
+ unsigned index = sibling->childIndex();
+ if (index) {
+ count += index;
+ break;
+ }
++count;
+ }
return count;
}
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698