Title: [161195] trunk
Revision
161195
Author
[email protected]
Date
2014-01-01 13:20:51 -0800 (Wed, 01 Jan 2014)

Log Message

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.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (161194 => 161195)


--- trunk/LayoutTests/ChangeLog	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/LayoutTests/ChangeLog	2014-01-01 21:20:51 UTC (rev 161195)
@@ -1,3 +1,11 @@
+2014-01-01  Antti Koivisto  <[email protected]>
+
+        Do less synchronous render tree construction
+        https://bugs.webkit.org/show_bug.cgi?id=126359
+
+        * 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.
+
 2014-01-01  Zan Dobersek  <[email protected]>
 
         Unreviewed GTK gardening.

Modified: trunk/LayoutTests/fast/html/object-image-nested-fallback.html (161194 => 161195)


--- trunk/LayoutTests/fast/html/object-image-nested-fallback.html	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/LayoutTests/fast/html/object-image-nested-fallback.html	2014-01-01 21:20:51 UTC (rev 161195)
@@ -1,12 +1,18 @@
 <html>
     <script>
-        if (window.testRunner)
+        if (window.testRunner) {
             testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+        function done() {
+            if (testRunner)
+                testRunner.notifyDone();
+        }
     </script>
-    <body> 
+    <body>
         <object type="image/png" data=""
             <object type="image/png" data=""
-                <object type="image/png" data="" when no crash occurs.</object>
+                <object type="image/png" data="" _onerror_="done()">PASS when no crash occurs.</object>
             </object>
         </object>
     </body>

Modified: trunk/LayoutTests/fast/overflow/overflow-height-float-not-removed-crash3-expected.txt (161194 => 161195)


--- trunk/LayoutTests/fast/overflow/overflow-height-float-not-removed-crash3-expected.txt	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/LayoutTests/fast/overflow/overflow-height-float-not-removed-crash3-expected.txt	2014-01-01 21:20:51 UTC (rev 161195)
@@ -1,3 +1,3 @@
 Test passes if it does not crash.
  sometextsometextsometextsometextsometextsometext
-
+ 

Modified: trunk/Source/WebCore/ChangeLog (161194 => 161195)


--- trunk/Source/WebCore/ChangeLog	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/Source/WebCore/ChangeLog	2014-01-01 21:20:51 UTC (rev 161195)
@@ -1,3 +1,34 @@
+2014-01-01  Antti Koivisto  <[email protected]>
+
+        Do less synchronous render tree construction
+        https://bugs.webkit.org/show_bug.cgi?id=126359
+
+        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):
+
 2014-01-01  Simon Fraser  <[email protected]>
 
         Updating the scrolling tree should use references to state nodes

Modified: trunk/Source/WebCore/html/HTMLDetailsElement.cpp (161194 => 161195)


--- trunk/Source/WebCore/html/HTMLDetailsElement.cpp	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/Source/WebCore/html/HTMLDetailsElement.cpp	2014-01-01 21:20:51 UTC (rev 161195)
@@ -136,8 +136,8 @@
     if (name == openAttr) {
         bool oldValue = m_isOpen;
         m_isOpen = !value.isNull();
-        if (oldValue != m_isOpen && renderer())
-            Style::reattachRenderTree(*this);
+        if (oldValue != m_isOpen)
+            setNeedsStyleRecalc(ReconstructRenderTree);
     } else
         HTMLElement::parseAttribute(name, value);
 }

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (161194 => 161195)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2014-01-01 21:20:51 UTC (rev 161195)
@@ -682,11 +682,11 @@
     } else if (name == resultsAttr) {
         int oldResults = m_maxResults;
         m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults) : -1;
-        // FIXME: Detaching just for maxResults change is not ideal.  We should figure out the right
-        // time to relayout for this change.
-        if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0) && renderer())
-            Style::reattachRenderTree(*this);
-        setNeedsStyleRecalc();
+
+        if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0))
+            setNeedsStyleRecalc(ReconstructRenderTree);
+        else
+            setNeedsStyleRecalc();
         FeatureObserver::observe(&document(), FeatureObserver::ResultsAttribute);
     } else if (name == autosaveAttr) {
         setNeedsStyleRecalc();
@@ -734,20 +734,15 @@
 #endif
 #if ENABLE(INPUT_SPEECH)
     else if (name == webkitspeechAttr) {
-        if (renderer()) {
-            // This renderer and its children have quite different layouts and styles depending on
-            // whether the speech button is visible or not. So we reset the whole thing and recreate
-            // to get the right styles and layout.
-            Style::detachRenderTree(*this);
-            m_inputType->destroyShadowSubtree();
-            m_inputType->createShadowSubtree();
-            Style::attachRenderTree(*this);
-        } else {
-            m_inputType->destroyShadowSubtree();
-            m_inputType->createShadowSubtree();
-        }
+        m_inputType->destroyShadowSubtree();
+        m_inputType->createShadowSubtree();
+
+        // This renderer and its children have quite different layouts and styles depending on
+        // whether the speech button is visible or not. So we reset the whole thing and recreate
+        // to get the right styles and layout.
+        setNeedsStyleRecalc(ReconstructRenderTree);
+
         setFormControlValueMatchesRenderer(false);
-        setNeedsStyleRecalc();
         FeatureObserver::observe(&document(), FeatureObserver::PrefixedSpeechAttribute);
     } else if (name == onwebkitspeechchangeAttr)
         setAttributeEventListener(eventNames().webkitspeechchangeEvent, name, value);

Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (161194 => 161195)


--- trunk/Source/WebCore/html/HTMLObjectElement.cpp	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp	2014-01-01 21:20:51 UTC (rev 161195)
@@ -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.

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (161194 => 161195)


--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2014-01-01 21:20:51 UTC (rev 161195)
@@ -309,7 +309,7 @@
     root->setResetStyleInheritance(true);
     if (m_pluginReplacement->installReplacement(root)) {
         setDisplayState(DisplayingPluginReplacement);
-        Style::reattachRenderTree(*this);
+        setNeedsStyleRecalc(ReconstructRenderTree);
     }
 }
 

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (161194 => 161195)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2014-01-01 21:20:51 UTC (rev 161195)
@@ -238,9 +238,10 @@
 
 bool HTMLPlugInImageElement::willRecalcStyle(Style::Change)
 {
-    // FIXME: Why is this necessary?  Manual re-attach is almost always wrong.
+    // FIXME: There shoudn't be need to force render tree reconstruction here.
+    // It is only done because loading and load event dispatching is tied to render tree construction.
     if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType() && (displayState() != DisplayingSnapshot))
-        Style::reattachRenderTree(*this);
+        setNeedsStyleRecalc(ReconstructRenderTree);
     return true;
 }
 
@@ -463,9 +464,6 @@
     // Disable frame flattening for this iframe.
     iframeElement->setAttribute(HTMLNames::scrollingAttr, AtomicString("no", AtomicString::ConstructFromLiteral));
     shadowElement->appendChild(iframeElement, ASSERT_NO_EXCEPTION);
-
-    if (renderer())
-        Style::reattachRenderTree(*this);
 }
 #endif
 
@@ -572,7 +570,7 @@
         return;
 
     setDisplayState(Restarting);
-    Style::reattachRenderTree(*this);
+    setNeedsStyleRecalc(ReconstructRenderTree);
 }
 
 void HTMLPlugInImageElement::dispatchPendingMouseClick()

Modified: trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp (161194 => 161195)


--- trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp	2014-01-01 21:20:51 UTC (rev 161195)
@@ -80,8 +80,6 @@
     m_tbody = HTMLTableSectionElement::create(tbodyTag, *this);
     table->parserAppendChild(m_tbody);
     m_current = m_tbody;
-
-    Style::attachRenderTree(*html);
 }
 
 void HTMLViewSourceDocument::addSource(const String& source, HTMLToken& token)
@@ -179,7 +177,6 @@
     RefPtr<HTMLElement> span = HTMLElement::create(spanTag, *this);
     span->setAttribute(classAttr, className);
     m_current->parserAppendChild(span);
-    Style::attachRenderTree(*span);
     return span.release();
 }
 
@@ -188,25 +185,21 @@
     // Create a table row.
     RefPtr<HTMLTableRowElement> trow = HTMLTableRowElement::create(*this);
     m_tbody->parserAppendChild(trow);
-    Style::reattachRenderTree(*trow);
 
     // Create a cell that will hold the line number (it is generated in the stylesheet using counters).
     RefPtr<HTMLTableCellElement> td = HTMLTableCellElement::create(tdTag, *this);
     td->setAttribute(classAttr, "webkit-line-number");
     trow->parserAppendChild(td);
-    Style::attachRenderTree(*td);
 
     // Create a second cell for the line contents
     td = HTMLTableCellElement::create(tdTag, *this);
     td->setAttribute(classAttr, "webkit-line-content");
     trow->parserAppendChild(td);
-    Style::attachRenderTree(*td);
     m_current = m_td = td;
 
 #ifdef DEBUG_LINE_NUMBERS
     RefPtr<Text> lineNumberText = Text::create(*this, String::number(parser()->lineNumber() + 1) + " ");
     td->addChild(lineNumberText);
-    Style::attachRenderTree(lineNumberText.get());
 #endif
 
     // Open up the needed spans.
@@ -222,7 +215,6 @@
     if (!m_current->hasChildNodes()) {
         RefPtr<HTMLBRElement> br = HTMLBRElement::create(*this);
         m_current->parserAppendChild(br);
-        Style::attachRenderTree(*br);
     }
     m_current = m_tbody;
 }
@@ -278,7 +270,6 @@
     RefPtr<HTMLBaseElement> base = HTMLBaseElement::create(baseTag, *this);
     base->setAttribute(hrefAttr, href);
     m_current->parserAppendChild(base);
-    Style::attachRenderTree(*base);
     return base.release();
 }
 
@@ -298,7 +289,6 @@
     anchor->setAttribute(targetAttr, "_blank");
     anchor->setAttribute(hrefAttr, url);
     m_current->parserAppendChild(anchor);
-    Style::attachRenderTree(*anchor);
     return anchor.release();
 }
 

Modified: trunk/Source/WebCore/xml/XMLErrors.cpp (161194 => 161195)


--- trunk/Source/WebCore/xml/XMLErrors.cpp	2014-01-01 19:53:21 UTC (rev 161194)
+++ trunk/Source/WebCore/xml/XMLErrors.cpp	2014-01-01 21:20:51 UTC (rev 161195)
@@ -140,11 +140,6 @@
         body->parserAppendChild(documentElement);
         m_document->parserAppendChild(rootElement.get());
 
-        if (m_document->hasLivingRenderTree())
-            // In general, rootElement shouldn't be attached right now, but it will be if there is a style element
-            // in the SVG content.
-            Style::reattachRenderTree(*rootElement);
-
         documentElement = body.get();
     }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to