Index: Source/core/dom/shadow/ShadowRoot.cpp |
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp |
index 95865b8c5213e66dab9cae028e1176a41d3f392d..cc5e8fe6b1f42ddf3b1b56745c1afaec23a8cb25 100644 |
--- a/Source/core/dom/shadow/ShadowRoot.cpp |
+++ b/Source/core/dom/shadow/ShadowRoot.cpp |
@@ -34,7 +34,6 @@ |
#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,21 +177,17 @@ void ShadowRoot::recalcStyle(StyleRecalcChange change) |
change = Force; |
// FIXME: This doesn't handle :hover + div properly like Element::recalcStyle does. |
- WhitespaceChildList whitespaceChildList(change); |
for (Node* child = lastChild(); child; child = child->previousSibling()) { |
- if (child->isTextNode()) { |
- Text* textChild = toText(child); |
- if (textChild->containsOnlyWhitespace()) |
- whitespaceChildList.append(textChild); |
- else |
- textChild->recalcTextStyle(change); |
- } else if (child->isElementNode() && shouldRecalcStyle(change, child)) { |
- toElement(child)->recalcStyle(change); |
- } |
+ bool didReattach = false; |
+ if (child->isTextNode()) |
+ didReattach = toText(child)->recalcTextStyle(change); |
+ else if (child->isElementNode() && shouldRecalcStyle(change, child)) |
+ didReattach = toElement(child)->recalcStyle(change); |
+ |
+ if (didReattach) |
+ child->reattachWhitespaceSiblings(); |
} |
- whitespaceChildList.recalcStyle(); |
- |
styleResolver->popParentShadowRoot(*this); |
clearNeedsStyleRecalc(); |
clearChildNeedsStyleRecalc(); |