Do less synchronous render tree construction
https://bugs.webkit.org/show_bug.cgi?id=126359

Source/WebCore: 

Reviewed by Anders Carlsson.

Remove some now-unnecessary attachRenderTree calls.

* html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::parseAttribute):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::renderFallbackContent):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::willRecalcStyle):
(WebCore::HTMLPlugInImageElement::createShadowIFrameSubtree):
(WebCore::HTMLPlugInImageElement::restartSnapshottedPlugIn):
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::createContainingTable):
(WebCore::HTMLViewSourceDocument::addSpanWithClassName):
(WebCore::HTMLViewSourceDocument::addLine):
(WebCore::HTMLViewSourceDocument::finishLine):
(WebCore::HTMLViewSourceDocument::addBase):
(WebCore::HTMLViewSourceDocument::addLink):
* xml/XMLErrors.cpp:
(WebCore::XMLErrors::insertErrorMessageBlock):

LayoutTests: 

* fast/html/object-image-nested-fallback.html: Update test to work with asynchronous load failures.
* fast/overflow/overflow-height-float-not-removed-crash3-expected.txt: Whitespace change.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/html/HTMLObjectElement.cpp b/Source/WebCore/html/HTMLObjectElement.cpp
index ddfb0c7..cf9a618 100644
--- a/Source/WebCore/html/HTMLObjectElement.cpp
+++ b/Source/WebCore/html/HTMLObjectElement.cpp
@@ -373,21 +373,19 @@
     if (!inDocument())
         return;
 
+    setNeedsStyleRecalc(ReconstructRenderTree);
+
     // Before we give up and use fallback content, check to see if this is a MIME type issue.
     if (m_imageLoader && m_imageLoader->image() && m_imageLoader->image()->status() != CachedResource::LoadError) {
         m_serviceType = m_imageLoader->image()->response().mimeType();
         if (!isImageType()) {
             // If we don't think we have an image type anymore, then clear the image from the loader.
             m_imageLoader->setImage(0);
-            Style::reattachRenderTree(*this);
             return;
         }
     }
 
     m_useFallbackContent = true;
-
-    // FIXME: Style gets recalculated which is suboptimal.
-    Style::reattachRenderTree(*this);
 }
 
 // FIXME: This should be removed, all callers are almost certainly wrong.