Index: Source/core/dom/Element.cpp |
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
index 7f7a9a06ab6a6cc3ac920dbf1a2572a23eb3d8a8..b572730ebf46aefbc7cd2d9279dfb29698da9c5b 100644 |
--- a/Source/core/dom/Element.cpp |
+++ b/Source/core/dom/Element.cpp |
@@ -1492,7 +1492,21 @@ void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling) |
// If we reattached we don't need to recalc the style of our descendants anymore. |
if ((change >= UpdatePseudoElements && change < Reattach) || childNeedsStyleRecalc()) { |
- recalcChildStyle(change); |
+ StyleResolverParentScope parentScope(*this); |
+ |
+ updatePseudoElement(BEFORE, change); |
+ |
+ if (change > UpdatePseudoElements || childNeedsStyleRecalc()) { |
+ for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) { |
+ if (root->shouldCallRecalcStyle(change)) |
+ root->recalcStyle(change); |
+ } |
+ recalcChildStyle(change); |
+ } |
+ |
+ updatePseudoElement(AFTER, change); |
+ updatePseudoElement(BACKDROP, change); |
+ |
clearChildNeedsStyleRecalc(); |
} |
@@ -1555,53 +1569,6 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) |
return localChange; |
} |
-void Element::recalcChildStyle(StyleRecalcChange change) |
-{ |
- ASSERT(document().inStyleRecalc()); |
- ASSERT(change >= UpdatePseudoElements || childNeedsStyleRecalc()); |
- ASSERT(!needsStyleRecalc()); |
- |
- StyleResolverParentScope parentScope(*this); |
- |
- updatePseudoElement(BEFORE, change); |
- |
- if (change > UpdatePseudoElements || childNeedsStyleRecalc()) { |
- for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) { |
- if (root->shouldCallRecalcStyle(change)) |
- root->recalcStyle(change); |
- } |
- } |
- |
- if (change < Force && hasRareData() && childNeedsStyleRecalc()) |
- checkForChildrenAdjacentRuleChanges(); |
- |
- if (change > UpdatePseudoElements || childNeedsStyleRecalc()) { |
- // This loop is deliberately backwards because we use insertBefore in the rendering tree, and want to avoid |
- // a potentially n^2 loop to find the insertion point while resolving style. Having us start from the last |
- // child and work our way back means in the common case, we'll find the insertion point in O(1) time. |
- // See crbug.com/288225 |
- StyleResolver& styleResolver = document().ensureStyleResolver(); |
- Text* lastTextNode = 0; |
- for (Node* child = lastChild(); child; child = child->previousSibling()) { |
- if (child->isTextNode()) { |
- toText(child)->recalcTextStyle(change, lastTextNode); |
- lastTextNode = toText(child); |
- } else if (child->isElementNode()) { |
- Element* element = toElement(child); |
- if (element->shouldCallRecalcStyle(change)) |
- element->recalcStyle(change, lastTextNode); |
- else if (element->supportsStyleSharing()) |
- styleResolver.addToStyleSharingList(*element); |
- if (element->renderer()) |
- lastTextNode = 0; |
- } |
- } |
- } |
- |
- updatePseudoElement(AFTER, change); |
- updatePseudoElement(BACKDROP, change); |
-} |
- |
void Element::updateCallbackSelectors(RenderStyle* oldStyle, RenderStyle* newStyle) |
{ |
Vector<String> emptyVector; |