Changeset 161140 in webkit


Ignore:
Timestamp:
Dec 30, 2013, 6:04:44 AM (11 years ago)
Author:
Antti Koivisto
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.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r161137 r161140  
     12013-12-30  Antti Koivisto  <antti@apple.com>
     2
     3        XML document builder should create render tree asynchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=126285
     5
     6        Reviewed by Andreas Kling.
     7
     8        * platform/mac/fast/table/dynamic-caption-add-before-child-expected.png:
     9        * platform/mac/fast/table/dynamic-caption-add-before-child-expected.txt:
     10       
     11            This is progression. Captions are now correctly in document order.
     12
     13        * svg/custom/object-no-size-attributes-expected.txt:
     14       
     15            Unnecessary text renderer disappears.
     16
     17        * svg/custom/resource-invalidation-crash-expected.txt:
     18       
     19            Progression, the dump has the correct fill.
     20
    1212013-12-29  Joone Hur  <joone.hur@intel.com>
    222
  • trunk/LayoutTests/platform/mac/fast/table/dynamic-caption-add-before-child-expected.txt

    r161129 r161140  
    55    RenderBody {body} at (8,8) size 784x216
    66      RenderTable {table} at (0,0) size 81x216
    7         RenderBlock {caption} at (0,144) size 81x72
     7        RenderBlock {caption} at (0,0) size 81x72
    88          RenderText {#text} at (19,0) size 81x72
    99            text run at (19,0) width 43: "PASS:"
     
    1111            text run at (21,36) width 39: "added"
    1212            text run at (17,54) width 47: "caption"
    13         RenderBlock {caption} at (0,0) size 81x36
     13        RenderBlock {caption} at (0,72) size 81x36
    1414          RenderText {#text} at (2,0) size 77x36
    1515            text run at (2,0) width 77: "PASS: Text"
    1616            text run at (3,18) width 75: "in caption 1"
    17 layer at (8,44) size 81x36
    18   RenderBlock {caption} at (0,36) size 81x36
    19     RenderText {#text} at (2,0) size 77x36
    20       text run at (2,0) width 77: "PASS: Text"
    21       text run at (3,18) width 75: "in caption 2"
    22 layer at (8,80) size 81x36
    23   RenderBlock {caption} at (0,72) size 81x36
    24     RenderText {#text} at (2,0) size 77x36
    25       text run at (2,0) width 77: "PASS: Text"
    26       text run at (3,18) width 75: "in caption 3"
    2717layer at (8,116) size 81x36
    2818  RenderBlock {caption} at (0,108) size 81x36
    2919    RenderText {#text} at (2,0) size 77x36
    3020      text run at (2,0) width 77: "PASS: Text"
     21      text run at (3,18) width 75: "in caption 2"
     22layer at (8,152) size 81x36
     23  RenderBlock {caption} at (0,144) size 81x36
     24    RenderText {#text} at (2,0) size 77x36
     25      text run at (2,0) width 77: "PASS: Text"
     26      text run at (3,18) width 75: "in caption 3"
     27layer at (8,188) size 81x36
     28  RenderBlock {caption} at (0,180) size 81x36
     29    RenderText {#text} at (2,0) size 77x36
     30      text run at (2,0) width 77: "PASS: Text"
    3131      text run at (3,18) width 75: "in caption 4"
  • trunk/LayoutTests/svg/custom/object-no-size-attributes-expected.txt

    r149088 r161140  
    1111            RenderSVGRect {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
    1212      RenderText {#text} at (0,0) size 0x0
    13       RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/svg/custom/resource-invalidation-crash-expected.txt

    r103407 r161140  
    99      RenderSVGResourcePattern {pattern} [id="a"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
    1010      RenderSVGResourcePattern {pattern} [id="b"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
    11         RenderSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#000000]}] [x=0.00] [y=0.00] [width=0.00] [height=0.00]
     11        RenderSVGRect {rect} at (0,0) size 0x0 [fill={[type=PATTERN] [id="a"]}] [x=0.00] [y=0.00] [width=0.00] [height=0.00]
    1212      RenderSVGResourcePattern {pattern} [id="a"] [patternUnits=objectBoundingBox] [patternContentUnits=userSpaceOnUse]
    1313      RenderSVGRect {rect} at (0,0) size 0x0 [fill={[type=PATTERN] [id="a"]}] [x=0.00] [y=0.00] [width=0.00] [height=0.00]
  • trunk/Source/WebCore/ChangeLog

    r161137 r161140  
     12013-12-30  Antti Koivisto  <antti@apple.com>
     2
     3        XML document builder should create render tree asynchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=126285
     5
     6        Reviewed by Andreas Kling.
     7       
     8        Stop creating renderers explicitly.
     9        Fix SVG <use> element to not rely on parse time render tree construction.
     10
     11        * svg/SVGUseElement.cpp:
     12        (WebCore::SVGUseElement::svgAttributeChanged):
     13       
     14            Remove renderer check, we may not have created the render tree yet.
     15
     16        (WebCore::SVGUseElement::willAttachRenderers):
     17       
     18            Switch to willAttachRenderers from willRecalcStyle. The latter is only called as long as style
     19            recalc doesn't start creating new renderers.
     20
     21        (WebCore::SVGUseElement::invalidateShadowTree):
     22       
     23            Remove renderer check, we may not have created the render tree yet.
     24            Invalidate with ReconstructRenderTree so willAttachRenderers will always get called.
     25
     26        * svg/SVGUseElement.h:
     27        * xml/parser/XMLDocumentParser.cpp:
     28        (WebCore::XMLDocumentParser::exitText):
     29        * xml/parser/XMLDocumentParserLibxml2.cpp:
     30        (WebCore::XMLDocumentParser::startElementNs):
     31        (WebCore::XMLDocumentParser::cdataBlock):
     32       
     33            Remove explicit call to attachRenderTree. The render tree will be created lazily.
     34
    1352013-12-29  Joone Hur  <joone.hur@intel.com>
    236
  • trunk/Source/WebCore/svg/SVGUseElement.cpp

    r160651 r161140  
    258258    }
    259259
    260     if (!renderer)
    261         return;
    262 
    263260    if (SVGLangSpace::isKnownAttribute(attrName)
    264261        || SVGExternalResourcesRequired::isKnownAttribute(attrName)) {
     
    270267}
    271268
    272 bool SVGUseElement::willRecalcStyle(Style::Change)
    273 {
    274     if (!m_wasInsertedByParser && m_needsShadowTreeRecreation && renderer() && needsStyleRecalc())
     269void SVGUseElement::willAttachRenderers()
     270{
     271    if (m_needsShadowTreeRecreation)
    275272        buildPendingResource();
    276     return true;
    277273}
    278274
     
    890886void SVGUseElement::invalidateShadowTree()
    891887{
    892     if (!renderer() || m_needsShadowTreeRecreation)
     888    if (m_needsShadowTreeRecreation)
    893889        return;
    894890    m_needsShadowTreeRecreation = true;
    895     setNeedsStyleRecalc();
     891    setNeedsStyleRecalc(ReconstructRenderTree);
    896892    invalidateDependentShadowTrees();
    897893}
  • trunk/Source/WebCore/svg/SVGUseElement.h

    r158097 r161140  
    6868    virtual void svgAttributeChanged(const QualifiedName&);
    6969
    70     virtual bool willRecalcStyle(Style::Change);
     70    virtual void willAttachRenderers() OVERRIDE;
    7171
    7272    virtual RenderElement* createRenderer(PassRef<RenderStyle>) OVERRIDE;
  • trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp

    r161128 r161140  
    4242#include "ImageLoader.h"
    4343#include "ProcessingInstruction.h"
    44 #include "RenderElement.h"
    45 #include "RenderText.h"
    4644#include "ResourceError.h"
    4745#include "ResourceRequest.h"
     
    169167    m_bufferedText.swap(empty);
    170168
    171     if (m_view && m_leafTextNode->parentNode() && m_leafTextNode->parentNode()->renderer() && !m_leafTextNode->renderer())
    172         Style::attachTextRenderer(*m_leafTextNode);
    173 
    174169    m_leafTextNode = 0;
    175170}
  • trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp

    r161127 r161140  
    4848#include "Page.h"
    4949#include "ProcessingInstruction.h"
    50 #include "RenderElement.h"
    5150#include "ResourceError.h"
    5251#include "ResourceRequest.h"
     
    846845        return;
    847846
    848     const ContainerNode* currentNode = m_currentNode;
    849847#if ENABLE(TEMPLATE_ELEMENT)
    850848    if (newElement->hasTagName(HTMLNames::templateTag))
     
    856854#endif
    857855
    858     if (m_view && currentNode->renderer() && !newElement->renderer())
    859         Style::attachRenderTree(*newElement);
    860 
    861856    if (newElement->hasTagName(HTMLNames::htmlTag))
    862857        toHTMLHtmlElement(newElement.get())->insertedByParser();
     
    10311026
    10321027    RefPtr<CDATASection> newNode = CDATASection::create(m_currentNode->document(), toString(s, len));
    1033     m_currentNode->parserAppendChild(newNode.get());
    1034     if (m_view)
    1035         Style::attachTextRenderer(*newNode);
     1028    m_currentNode->parserAppendChild(newNode.release());
    10361029}
    10371030
     
    10491042
    10501043    RefPtr<Comment> newNode = Comment::create(m_currentNode->document(), toString(s));
    1051     m_currentNode->parserAppendChild(newNode.get());
     1044    m_currentNode->parserAppendChild(newNode.release());
    10521045}
    10531046
Note: See TracChangeset for help on using the changeset viewer.