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

Unified Diff: Source/core/dom/shadow/ShadowRoot.cpp

Issue 18276003: Avoid N^2 walk placing renderers when building the render tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removing extra parens (whoops) 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Text.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/shadow/ShadowRoot.cpp
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp
index 42152f77434ef40edf900ad02d3ff83e2c2b9077..df20327f8e0f6e019fa8113d6a85195d6a9ae223 100644
--- a/Source/core/dom/shadow/ShadowRoot.cpp
+++ b/Source/core/dom/shadow/ShadowRoot.cpp
@@ -165,23 +165,16 @@ void ShadowRoot::recalcStyle(StyleChange change)
change = Force;
// FIXME: This doesn't handle :hover + div properly like Element::recalcStyle does.
- bool forceReattachOfAnyWhitespaceSibling = false;
- for (Node* child = firstChild(); child; child = child->nextSibling()) {
+ for (Node* child = lastChild(); child; child = child->previousSibling()) {
bool didReattach = false;
- if (child->renderer())
- forceReattachOfAnyWhitespaceSibling = false;
-
- if (child->isTextNode()) {
- if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOnlyWhitespace())
- child->reattach();
- else
- didReattach = toText(child)->recalcTextStyle(change);
- } else if (child->isElementNode() && shouldRecalcStyle(change, child)) {
+ if (child->isTextNode())
+ didReattach = toText(child)->recalcTextStyle(change);
+ else if (child->isElementNode() && shouldRecalcStyle(change, child))
didReattach = toElement(child)->recalcStyle(change);
- }
- forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyWhitespaceSibling;
+ if (didReattach)
+ child->reattachWhitespaceSiblings();
}
styleResolver->popParentShadowRoot(this);
« no previous file with comments | « Source/core/dom/Text.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698