Bug 43682 - Add missing String builder for SVGPathParser
Summary: Add missing String builder for SVGPathParser
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: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-07 14:59 PDT by Dirk Schulze
Modified: 2010-08-08 09:11 PDT (History)
1 user (show)

See Also:


Attachments
Patch (33.52 KB, patch)
2010-08-07 15:16 PDT, Dirk Schulze
zimmermann: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Schulze 2010-08-07 14:59:25 PDT
Add missing String builder (inheriting from SVGCustomer) for SVGPathParser.
Comment 1 Dirk Schulze 2010-08-07 15:16:15 PDT
Created attachment 63832 [details]
Patch
Comment 2 Nikolas Zimmermann 2010-08-08 04:46:35 PDT
Comment on attachment 63832 [details]
Patch

WebCore/svg/SVGPathParserFactory.cpp:80
 +      s_parser->setCurrentSource(source);
For consistency, add a newline before this statement and remove the one before return s_parser :-)

WebCore/svg/SVGPathParserFactory.cpp:181
 +      ASSERT(stream);
Ok you misunderstood the suggestion I gave.

The passed in OwnPtr should not be initialized, this is the task of this function.
The function should be used like this:

OwnPtr<SVGPathByteStream> stream; // stream pointer is null here!
if (!factory->buildSVGPathByteStreamFromString(d, stream, NormalizedParsing))
    return false;
// stream pointer is now set.

That means, the ASSERT(stream) should go away. The function should be used like this:

bool SVGPathParserFactory::buildSVGPathByteStreamFromString(const String& d, OwnPtr<SVGPathByteStream>& result, PathParsingMode parsingMode)
{
    if (d.isEmpty())
        return false;

    OwnPtr<SVGPathByteStream> stream = SVGPathByteStream::create();
    SVGPathByteStreamBuilder* builder = globalSVGPathByteStreamBuilder(stream.get());

    OwnPtr<SVGPathStringSource> source = SVGPathStringSource::create(d);
    SVGPathParser* parser = globalSVGPathParser(source.get(), builder);
    bool ok = parser->parsePathDataFromSource(parsingMode);
    parser->cleanup();
    result = stream.release(); // this is the important step
    return ok;
}

r=me, with those fixes.
Comment 3 Dirk Schulze 2010-08-08 09:11:15 PDT
Committed r64949: <http://trac.webkit.org/changeset/64949>