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

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

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/dom/WhitespaceChildList.h ('k') | Source/core/rendering/RenderRegion.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/shadow/ShadowRoot.cpp
===================================================================
--- Source/core/dom/shadow/ShadowRoot.cpp (revision 159683)
+++ Source/core/dom/shadow/ShadowRoot.cpp (working copy)
@@ -33,6 +33,7 @@
#include "core/dom/ElementTraversal.h"
#include "core/dom/StyleEngine.h"
#include "core/dom/Text.h"
+#include "core/dom/WhitespaceChildList.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/shadow/InsertionPoint.h"
#include "core/dom/shadow/ShadowRootRareData.h"
@@ -178,25 +179,21 @@
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()) {
- bool didReattach = false;
-
- if (child->renderer())
- forceReattachOfAnyWhitespaceSibling = false;
-
+ WhitespaceChildList whitespaceChildList(change);
+ for (Node* child = lastChild(); child; child = child->previousSibling()) {
if (child->isTextNode()) {
- if (forceReattachOfAnyWhitespaceSibling && toText(child)->containsOnlyWhitespace())
- child->reattach();
+ Text* textChild = toText(child);
+ if (textChild->containsOnlyWhitespace())
+ whitespaceChildList.append(textChild);
else
- didReattach = toText(child)->recalcTextStyle(change);
+ textChild->recalcTextStyle(change);
} else if (child->isElementNode() && shouldRecalcStyle(change, child)) {
- didReattach = toElement(child)->recalcStyle(change);
+ toElement(child)->recalcStyle(change);
}
-
- forceReattachOfAnyWhitespaceSibling = didReattach || forceReattachOfAnyWhitespaceSibling;
}
+ whitespaceChildList.recalcStyle();
+
styleResolver->popParentShadowRoot(*this);
clearNeedsStyleRecalc();
clearChildNeedsStyleRecalc();
« no previous file with comments | « Source/core/dom/WhitespaceChildList.h ('k') | Source/core/rendering/RenderRegion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698