Changeset 118002 in webkit


Ignore:
Timestamp:
May 22, 2012 10:51:24 AM (12 years ago)
Author:
rwlbuis@webkit.org
Message:

ASSERTs in RenderInline::layout()
https://bugs.webkit.org/show_bug.cgi?id=63365

Patch by Rob Buis <rbuis@rim.com> on 2012-05-22
Reviewed by Nikolas Zimmermann.

Source/WebCore:

Do not allow creation of renderers for text content children in elements by default.
Subclasses like SVGTextElement override this behavior.
This also fixes the <a><textPath</a> case because the <a> parent decides to allow <textPath> or not:
http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environment

Test: svg/custom/disallowed-text-content-rendering.svg

  • svg/SVGElement.cpp:

(WebCore::SVGElement::childShouldCreateRenderer):

  • svg/SVGElement.h:

(SVGElement):

LayoutTests:

Test text content element children inside elements.

  • svg/custom/disallowed-text-content-rendering-expected.txt: Added.
  • svg/custom/disallowed-text-content-rendering.svg: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r118001 r118002  
     12012-05-22  Rob Buis  <rbuis@rim.com>
     2
     3        ASSERTs in RenderInline::layout()
     4        https://bugs.webkit.org/show_bug.cgi?id=63365
     5
     6        Reviewed by Nikolas Zimmermann.
     7
     8        Test text content element children inside elements.
     9
     10        * svg/custom/disallowed-text-content-rendering-expected.txt: Added.
     11        * svg/custom/disallowed-text-content-rendering.svg: Added.
     12
    1132012-05-22  Takashi Sakamoto  <tasak@google.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r118001 r118002  
     12012-05-22  Rob Buis  <rbuis@rim.com>
     2
     3        ASSERTs in RenderInline::layout()
     4        https://bugs.webkit.org/show_bug.cgi?id=63365
     5
     6        Reviewed by Nikolas Zimmermann.
     7
     8        Do not allow creation of renderers for text content children in elements by default.
     9        Subclasses like SVGTextElement override this behavior.
     10        This also fixes the <a><textPath</a> case because the <a> parent decides to allow <textPath> or not:
     11        http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environment
     12
     13        Test: svg/custom/disallowed-text-content-rendering.svg
     14
     15        * svg/SVGElement.cpp:
     16        (WebCore::SVGElement::childShouldCreateRenderer):
     17        * svg/SVGElement.h:
     18        (SVGElement):
     19
    1202012-05-22  Takashi Sakamoto  <tasak@google.com>
    221
  • trunk/Source/WebCore/svg/SVGElement.cpp

    r117242 r118002  
    496496bool SVGElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
    497497{
    498     if (childContext.node()->isSVGElement())
     498    DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, invalidTextContent, ());
     499
     500    if (invalidTextContent.isEmpty()) {
     501        invalidTextContent.add(SVGNames::textPathTag);
     502#if ENABLE(SVG_FONTS)
     503        invalidTextContent.add(SVGNames::altGlyphTag);
     504#endif
     505        invalidTextContent.add(SVGNames::trefTag);
     506        invalidTextContent.add(SVGNames::tspanTag);
     507    }
     508    if (childContext.node()->isSVGElement()) {
     509        if (invalidTextContent.contains(static_cast<SVGElement*>(childContext.node())->tagQName()))
     510            return false;
     511
    499512        return static_cast<SVGElement*>(childContext.node())->isValid();
     513    }
    500514    return false;
    501515}
  • trunk/Source/WebCore/svg/SVGElement.h

    r117242 r118002  
    124124    virtual void finishParsingChildren();
    125125    virtual void attributeChanged(const Attribute&) OVERRIDE;
    126     virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
     126    virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
    127127   
    128128    virtual void removedFrom(Node*) OVERRIDE;
Note: See TracChangeset for help on using the changeset viewer.