Bug 46963 - Add helper methods to cast between renderers & SVGTextContent/PositioningElement
Summary: Add helper methods to cast between renderers & SVGTextContent/PositioningElement
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nikolas Zimmermann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-01 00:02 PDT by Nikolas Zimmermann
Modified: 2010-10-01 00:37 PDT (History)
2 users (show)

See Also:


Attachments
Patch (3.94 KB, patch)
2010-10-01 00:04 PDT, Nikolas Zimmermann
krit: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolas Zimmermann 2010-10-01 00:02:18 PDT
The new text layout engine needs a simple way to cast a inlineTextBox->renderer() to either SVGTextContentElement or SVGTextPositioningElement.
Add static helper methods doing that.
Comment 1 Nikolas Zimmermann 2010-10-01 00:04:11 PDT
Created attachment 69428 [details]
Patch
Comment 2 Dirk Schulze 2010-10-01 00:15:22 PDT
Comment on attachment 69428 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=69428&action=review

The patch itself looks good to me. r=me with the fixes.

> WebCore/svg/SVGTextContentElement.cpp:219
> +SVGTextContentElement* SVGTextContentElement::fromRenderer(RenderObject* renderer)

Another name for 'fromRenderer' is maybe more self-explanatory. Niko suggested elementFromRenderer.

> WebCore/svg/SVGTextContentElement.cpp:238
> +    if (!node->hasTagName(SVGNames::textTag)
> +     && !node->hasTagName(SVGNames::tspanTag)
> +#if ENABLE(SVG_FONTS)
> +     && !node->hasTagName(SVGNames::altGlyphTag)
> +#endif
> +     && !node->hasTagName(SVGNames::trefTag)
> +     && !node->hasTagName(SVGNames::textPathTag))
> +        return 0;

The indention is wrong.

> WebCore/svg/SVGTextPositioningElement.cpp:164
> +    if (!node->hasTagName(SVGNames::textTag)
> +     && !node->hasTagName(SVGNames::tspanTag)
> +#if ENABLE(SVG_FONTS)
> +     && !node->hasTagName(SVGNames::altGlyphTag)
> +#endif
> +     && !node->hasTagName(SVGNames::trefTag))
> +        return 0;

wrong indention.
Comment 3 Nikolas Zimmermann 2010-10-01 00:37:21 PDT
Landed in r68867.