Index: Source/core/dom/Element.cpp |
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
index 527588ec6479904569634411922fa6941f0d4835..6cb67b9fa1bd8983a19a7548382bfb5bcafcd199 100644 |
--- a/Source/core/dom/Element.cpp |
+++ b/Source/core/dom/Element.cpp |
@@ -1324,6 +1324,10 @@ void Element::attach(const AttachContext& context) |
data->resetStyleState(); |
} |
+ // FIXME: Remove this once we lazyAttach everywhere. |
+ if (!document().inStyleRecalc() && (this == document().documentElement() || this == document().body())) |
+ document().setNeedsStyleRecalc(LocalStyleChange); |
+ |
NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIfNeeded(); |
createPseudoElementIfNeeded(BEFORE); |
@@ -1349,7 +1353,11 @@ void Element::attach(const AttachContext& context) |
} |
} |
- InspectorInstrumentation::didRecalculateStyleForElement(this); |
+ // FIXME: It doesn't appear safe to call didRecalculateStyleForElement when |
+ // not in a Document::recalcStyle. Since we're hopefully going to always |
+ // lazyAttach in the future that problem should go away. |
+ if (document().inStyleRecalc()) |
+ InspectorInstrumentation::didRecalculateStyleForElement(this); |
} |
void Element::unregisterNamedFlowContentNode() |
@@ -1758,12 +1766,18 @@ void Element::removeAllEventListeners() |
void Element::beginParsingChildren() |
{ |
clearIsParsingChildrenFinished(); |
+ StyleResolver* styleResolver = document().styleResolverIfExists(); |
+ if (styleResolver && attached()) |
+ styleResolver->pushParentElement(this); |
} |
void Element::finishParsingChildren() |
{ |
+ ContainerNode::finishParsingChildren(); |
setIsParsingChildrenFinished(); |
checkForSiblingStyleChanges(this, renderStyle(), true, lastChild(), 0, 0); |
+ if (StyleResolver* styleResolver = document().styleResolverIfExists()) |
+ styleResolver->popParentElement(this); |
if (isCustomElement()) |
CustomElement::didFinishParsingChildren(this); |
} |