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

Side by Side Diff: Source/core/dom/shadow/ShadowRoot.cpp

Issue 15871005: Avoid N^2 walk placing renderers when building the render tree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adding a mitigation for the perf regression to Element::recalcStyle. Created 7 years, 5 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
« no previous file with comments | « Source/core/dom/Text.cpp ('k') | Source/core/html/HTMLInputElement.h » ('j') | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 clearChildNeedsStyleRecalc(); 157 clearChildNeedsStyleRecalc();
158 return; 158 return;
159 } 159 }
160 160
161 // When we're set to lazyAttach we'll have a FullStyleChange and we'll need 161 // When we're set to lazyAttach we'll have a FullStyleChange and we'll need
162 // to promote the change to a Force for all our descendants so they get a 162 // to promote the change to a Force for all our descendants so they get a
163 // recalc and will attach. 163 // recalc and will attach.
164 if (styleChangeType() == FullStyleChange) 164 if (styleChangeType() == FullStyleChange)
165 change = Force; 165 change = Force;
166 166
167 for (Node* child = firstChild(); child; child = child->nextSibling()) { 167 for (Node* child = lastChild(); child; child = child->previousSibling()) {
168 if (child->isElementNode()) 168 if (child->isElementNode())
169 toElement(child)->recalcStyle(change); 169 toElement(child)->recalcStyle(change);
170 else if (child->isTextNode()) 170 else if (child->isTextNode())
171 toText(child)->recalcTextStyle(change); 171 toText(child)->recalcTextStyle(change);
172 } 172 }
173 173
174 styleResolver->popParentShadowRoot(this); 174 styleResolver->popParentShadowRoot(this);
175 clearNeedsStyleRecalc(); 175 clearNeedsStyleRecalc();
176 clearChildNeedsStyleRecalc(); 176 clearChildNeedsStyleRecalc();
177 } 177 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 { 293 {
294 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); 294 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
295 DocumentFragment::reportMemoryUsage(memoryObjectInfo); 295 DocumentFragment::reportMemoryUsage(memoryObjectInfo);
296 TreeScope::reportMemoryUsage(memoryObjectInfo); 296 TreeScope::reportMemoryUsage(memoryObjectInfo);
297 info.addMember(m_prev, "prev"); 297 info.addMember(m_prev, "prev");
298 info.addMember(m_next, "next"); 298 info.addMember(m_next, "next");
299 info.addMember(m_scopeDistribution, "scopeDistribution"); 299 info.addMember(m_scopeDistribution, "scopeDistribution");
300 } 300 }
301 301
302 } 302 }
OLDNEW
« no previous file with comments | « Source/core/dom/Text.cpp ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698