Title: [161140] trunk
Revision
161140
Author
an...@apple.com
Date
2013-12-30 06:04:44 -0800 (Mon, 30 Dec 2013)

Log Message

XML document builder should create render tree asynchronously
https://bugs.webkit.org/show_bug.cgi?id=126285

Source/WebCore: 

Reviewed by Andreas Kling.
        
Stop creating renderers explicitly. 
Fix SVG <use> element to not rely on parse time render tree construction.

* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::svgAttributeChanged):
        
    Remove renderer check, we may not have created the render tree yet.

(WebCore::SVGUseElement::willAttachRenderers):
        
    Switch to willAttachRenderers from willRecalcStyle. The latter is only called as long as style
    recalc doesn't start creating new renderers.

(WebCore::SVGUseElement::invalidateShadowTree):
        
    Remove renderer check, we may not have created the render tree yet. 
    Invalidate with ReconstructRenderTree so willAttachRenderers will always get called.

* svg/SVGUseElement.h:
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::exitText):
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::startElementNs):
(WebCore::XMLDocumentParser::cdataBlock):
        
    Remove explicit call to attachRenderTree. The render tree will be created lazily.

LayoutTests: 

Reviewed by Andreas Kling.

* platform/mac/fast/table/dynamic-caption-add-before-child-expected.png:
* platform/mac/fast/table/dynamic-caption-add-before-child-expected.txt:
        
    This is progression. Captions are now correctly in document order.

* svg/custom/object-no-size-attributes-expected.txt:
        
    Unnecessary text renderer disappears.

* svg/custom/resource-invalidation-crash-expected.txt:
        
    Progression, the dump has the correct fill.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (161139 => 161140)


--- trunk/LayoutTests/ChangeLog	2013-12-30 10:26:00 UTC (rev 161139)
+++ trunk/LayoutTests/ChangeLog	2013-12-30 14:04:44 UTC (rev 161140)
@@ -1,3 +1,23 @@
+2013-12-30  Antti Koivisto  <an...@apple.com>
+
+        XML document builder should create render tree asynchronously
+        https://bugs.webkit.org/show_bug.cgi?id=126285
+
+        Reviewed by Andreas Kling.
+
+        * platform/mac/fast/table/dynamic-caption-add-before-child-expected.png:
+        * platform/mac/fast/table/dynamic-caption-add-before-child-expected.txt:
+        
+            This is progression. Captions are now correctly in document order.
+
+        * svg/custom/object-no-size-attributes-expected.txt:
+        
+            Unnecessary text renderer disappears.
+
+        * svg/custom/resource-invalidation-crash-expected.txt:
+        
+            Progression, the dump has the correct fill.
+
 2013-12-29  Joone Hur  <joone....@intel.com>
 
         Reverted r156742. The same fix was reverted from Blink due to heap-use-after-free on ClusterFuzz.

Modified: trunk/LayoutTests/platform/mac/fast/table/dynamic-caption-add-before-child-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/table/dynamic-caption-add-before-child-expected.txt (161139 => 161140)


--- trunk/LayoutTests/platform/mac/fast/table/dynamic-caption-add-before-child-expected.txt	2013-12-30 10:26:00 UTC (rev 161139)
+++ trunk/LayoutTests/platform/mac/fast/table/dynamic-caption-add-before-child-expected.txt	2013-12-30 14:04:44 UTC (rev 161140)
@@ -4,28 +4,28 @@
   RenderBlock {html} at (0,0) size 800x232
     RenderBody {body} at (8,8) size 784x216
       RenderTable {table} at (0,0) size 81x216
-        RenderBlock {caption} at (0,144) size 81x72
+        RenderBlock {caption} at (0,0) size 81x72
           RenderText {#text} at (19,0) size 81x72
             text run at (19,0) width 43: "PASS:"
             text run at (0,18) width 81: "Dynamically"
             text run at (21,36) width 39: "added"
             text run at (17,54) width 47: "caption"
-        RenderBlock {caption} at (0,0) size 81x36
+        RenderBlock {caption} at (0,72) size 81x36
           RenderText {#text} at (2,0) size 77x36
             text run at (2,0) width 77: "PASS: Text"
             text run at (3,18) width 75: "in caption 1"
-layer at (8,44) size 81x36
-  RenderBlock {caption} at (0,36) size 81x36
+layer at (8,116) size 81x36
+  RenderBlock {caption} at (0,108) size 81x36
     RenderText {#text} at (2,0) size 77x36
       text run at (2,0) width 77: "PASS: Text"
       text run at (3,18) width 75: "in caption 2"
-layer at (8,80) size 81x36
-  RenderBlock {caption} at (0,72) size 81x36
+layer at (8,152) size 81x36
+  RenderBlock {caption} at (0,144) size 81x36
     RenderText {#text} at (2,0) size 77x36
       text run at (2,0) width 77: "PASS: Text"
       text run at (3,18) width 75: "in caption 3"
-layer at (8,116) size 81x36
-  RenderBlock {caption} at (0,108) size 81x36
+layer at (8,188) size 81x36
+  RenderBlock {caption} at (0,180) size 81x36
     RenderText {#text} at (2,0) size 77x36
       text run at (2,0) width 77: "PASS: Text"
       text run at (3,18) width 75: "in caption 4"

Modified: trunk/LayoutTests/svg/custom/object-no-size-attributes-expected.txt (161139 => 161140)


--- trunk/LayoutTests/svg/custom/object-no-size-attributes-expected.txt	2013-12-30 10:26:00 UTC (rev 161139)
+++ trunk/LayoutTests/svg/custom/object-no-size-attributes-expected.txt	2013-12-30 14:04:44 UTC (rev 161140)
@@ -10,4 +10,3 @@
           RenderSVGRoot {svg} at (0,0) size 100x100
             RenderSVGRect {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
       RenderText {#text} at (0,0) size 0x0
-      RenderText {#text} at (0,0) size 0x0

Modified: trunk/LayoutTests/svg/custom/resource-invalidation-crash-expected.txt (161139 => 161140)


--- trunk/LayoutTests/svg/custom/resource-invalidation-crash-expected.txt	2013-12-30 10:26:00 UTC (rev 161139)
+++ trunk/LayoutTests/svg/custom/resource-invalidation-crash-expected.txt	2013-12-30 14:04:44 UTC (rev 161140)
@@ -8,6 +8,6 @@
         RenderSVGRect {rect} at (0,0) size 0x0 [fill={[type=PATTERN] [id="a"]}] [x=0.00] [y=0.00] [width=0.00] [height=0.00]
       RenderSVGResourcePattern {pattern} [id="a"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
       RenderSVGResourcePattern {pattern} [id="b"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
-        RenderSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#000000]}] [x=0.00] [y=0.00] [width=0.00] [height=0.00]
+        RenderSVGRect {rect} at (0,0) size 0x0 [fill={[type=PATTERN] [id="a"]}] [x=0.00] [y=0.00] [width=0.00] [height=0.00]
       RenderSVGResourcePattern {pattern} [id="a"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
       RenderSVGRect {rect} at (0,0) size 0x0 [fill={[type=PATTERN] [id="a"]}] [x=0.00] [y=0.00] [width=0.00] [height=0.00]

Modified: trunk/Source/WebCore/ChangeLog (161139 => 161140)


--- trunk/Source/WebCore/ChangeLog	2013-12-30 10:26:00 UTC (rev 161139)
+++ trunk/Source/WebCore/ChangeLog	2013-12-30 14:04:44 UTC (rev 161140)
@@ -1,3 +1,37 @@
+2013-12-30  Antti Koivisto  <an...@apple.com>
+
+        XML document builder should create render tree asynchronously
+        https://bugs.webkit.org/show_bug.cgi?id=126285
+
+        Reviewed by Andreas Kling.
+        
+        Stop creating renderers explicitly. 
+        Fix SVG <use> element to not rely on parse time render tree construction.
+
+        * svg/SVGUseElement.cpp:
+        (WebCore::SVGUseElement::svgAttributeChanged):
+        
+            Remove renderer check, we may not have created the render tree yet.
+
+        (WebCore::SVGUseElement::willAttachRenderers):
+        
+            Switch to willAttachRenderers from willRecalcStyle. The latter is only called as long as style
+            recalc doesn't start creating new renderers.
+
+        (WebCore::SVGUseElement::invalidateShadowTree):
+        
+            Remove renderer check, we may not have created the render tree yet. 
+            Invalidate with ReconstructRenderTree so willAttachRenderers will always get called.
+
+        * svg/SVGUseElement.h:
+        * xml/parser/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::exitText):
+        * xml/parser/XMLDocumentParserLibxml2.cpp:
+        (WebCore::XMLDocumentParser::startElementNs):
+        (WebCore::XMLDocumentParser::cdataBlock):
+        
+            Remove explicit call to attachRenderTree. The render tree will be created lazily.
+
 2013-12-29  Joone Hur  <joone....@intel.com>
 
         Reverted r156742. The same fix was reverted from Blink due to heap-use-after-free on ClusterFuzz.

Modified: trunk/Source/WebCore/svg/SVGUseElement.cpp (161139 => 161140)


--- trunk/Source/WebCore/svg/SVGUseElement.cpp	2013-12-30 10:26:00 UTC (rev 161139)
+++ trunk/Source/WebCore/svg/SVGUseElement.cpp	2013-12-30 14:04:44 UTC (rev 161140)
@@ -257,9 +257,6 @@
         return;
     }
 
-    if (!renderer)
-        return;
-
     if (SVGLangSpace::isKnownAttribute(attrName)
         || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
         invalidateShadowTree();
@@ -269,11 +266,10 @@
     ASSERT_NOT_REACHED();
 }
 
-bool SVGUseElement::willRecalcStyle(Style::Change)
+void SVGUseElement::willAttachRenderers()
 {
-    if (!m_wasInsertedByParser && m_needsShadowTreeRecreation && renderer() && needsStyleRecalc())
+    if (m_needsShadowTreeRecreation)
         buildPendingResource();
-    return true;
 }
 
 #ifdef DUMP_INSTANCE_TREE
@@ -889,10 +885,10 @@
 
 void SVGUseElement::invalidateShadowTree()
 {
-    if (!renderer() || m_needsShadowTreeRecreation)
+    if (m_needsShadowTreeRecreation)
         return;
     m_needsShadowTreeRecreation = true;
-    setNeedsStyleRecalc();
+    setNeedsStyleRecalc(ReconstructRenderTree);
     invalidateDependentShadowTrees();
 }
 

Modified: trunk/Source/WebCore/svg/SVGUseElement.h (161139 => 161140)


--- trunk/Source/WebCore/svg/SVGUseElement.h	2013-12-30 10:26:00 UTC (rev 161139)
+++ trunk/Source/WebCore/svg/SVGUseElement.h	2013-12-30 14:04:44 UTC (rev 161140)
@@ -67,7 +67,7 @@
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     virtual void svgAttributeChanged(const QualifiedName&);
 
-    virtual bool willRecalcStyle(Style::Change);
+    virtual void willAttachRenderers() OVERRIDE;
 
     virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE;
     virtual void toClipPath(Path&);

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp (161139 => 161140)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2013-12-30 10:26:00 UTC (rev 161139)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2013-12-30 14:04:44 UTC (rev 161140)
@@ -41,8 +41,6 @@
 #include "HTMLStyleElement.h"
 #include "ImageLoader.h"
 #include "ProcessingInstruction.h"
-#include "RenderElement.h"
-#include "RenderText.h"
 #include "ResourceError.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
@@ -168,9 +166,6 @@
     Vector<xmlChar> empty;
     m_bufferedText.swap(empty);
 
-    if (m_view && m_leafTextNode->parentNode() && m_leafTextNode->parentNode()->renderer() && !m_leafTextNode->renderer())
-        Style::attachTextRenderer(*m_leafTextNode);
-
     m_leafTextNode = 0;
 }
 

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (161139 => 161140)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2013-12-30 10:26:00 UTC (rev 161139)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2013-12-30 14:04:44 UTC (rev 161140)
@@ -47,7 +47,6 @@
 #include "HTMLTemplateElement.h"
 #include "Page.h"
 #include "ProcessingInstruction.h"
-#include "RenderElement.h"
 #include "ResourceError.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
@@ -845,7 +844,6 @@
     if (!m_currentNode) // Synchronous DOM events may have removed the current node.
         return;
 
-    const ContainerNode* currentNode = m_currentNode;
 #if ENABLE(TEMPLATE_ELEMENT)
     if (newElement->hasTagName(HTMLNames::templateTag))
         pushCurrentNode(toHTMLTemplateElement(newElement.get())->content());
@@ -855,9 +853,6 @@
     pushCurrentNode(newElement.get());
 #endif
 
-    if (m_view && currentNode->renderer() && !newElement->renderer())
-        Style::attachRenderTree(*newElement);
-
     if (newElement->hasTagName(HTMLNames::htmlTag))
         toHTMLHtmlElement(newElement.get())->insertedByParser();
 
@@ -1030,9 +1025,7 @@
     exitText();
 
     RefPtr<CDATASection> newNode = CDATASection::create(m_currentNode->document(), toString(s, len));
-    m_currentNode->parserAppendChild(newNode.get());
-    if (m_view)
-        Style::attachTextRenderer(*newNode);
+    m_currentNode->parserAppendChild(newNode.release());
 }
 
 void XMLDocumentParser::comment(const xmlChar* s)
@@ -1048,7 +1041,7 @@
     exitText();
 
     RefPtr<Comment> newNode = Comment::create(m_currentNode->document(), toString(s));
-    m_currentNode->parserAppendChild(newNode.get());
+    m_currentNode->parserAppendChild(newNode.release());
 }
 
 enum StandaloneInfo {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to