Move Element::attach recursion to the end.

The animation style change logic only needs to be after
the RenderTreeBuilder, not after attaching all descendants.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/733283002
diff --git a/sky/engine/core/dom/Element.cpp b/sky/engine/core/dom/Element.cpp
index 2ff0dcc..04f19a0 100644
--- a/sky/engine/core/dom/Element.cpp
+++ b/sky/engine/core/dom/Element.cpp
@@ -812,18 +812,18 @@
 
     RenderTreeBuilder(this, context.resolvedStyle).createRendererForElementIfNeeded();
 
-    // When a shadow root exists, it does the work of attaching the children.
-    if (ElementShadow* shadow = this->shadow())
-        shadow->attach(context);
-
-    ContainerNode::attach(context);
-
     if (hasRareData() && !renderer()) {
         if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations()) {
             activeAnimations->cssAnimations().cancel();
             activeAnimations->setAnimationStyleChange(false);
         }
     }
+
+    // When a shadow root exists, it does the work of attaching the children.
+    if (ElementShadow* shadow = this->shadow())
+        shadow->attach(context);
+
+    ContainerNode::attach(context);
 }
 
 void Element::detach(const AttachContext& context)