bool buildSVGPathSegListFromByteStream(SVGPathByteStream* stream, SVGPathElement* element, SVGPathSegList& result, PathParsingMode parsingMode) { ASSERT(stream); if (stream->isEmpty()) return true; SVGPathSegListBuilder* builder = globalSVGPathSegListBuilder(element, parsingMode == NormalizedParsing ? PathSegNormalizedRole : PathSegUnalteredRole, result); auto source = std::make_unique<SVGPathByteStreamSource>(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(parsingMode); parser->cleanup(); return ok; }
bool SVGPathParserFactory::buildSVGPathSegListFromString(const String& d, SVGPathSegList* result, PathParsingMode parsingMode) { ASSERT(result); if (d.isEmpty()) return false; SVGPathSegListBuilder* builder = globalSVGPathSegListBuilder(result); OwnPtr<SVGPathStringSource> source = SVGPathStringSource::create(d); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(parsingMode); parser->cleanup(); return ok; }
bool SVGPathParserFactory::buildSVGPathSegListFromByteStream(SVGPathByteStream* stream, SVGPathElement* element, SVGPathSegList& result, PathParsingMode parsingMode) { ASSERT(stream); if (stream->isEmpty()) return false; SVGPathSegListBuilder* builder = globalSVGPathSegListBuilder(element, parsingMode == NormalizedParsing ? PathSegNormalizedRole : PathSegUnalteredRole, result); OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(parsingMode); parser->cleanup(); return ok; }
bool SVGPathParserFactory::buildSVGPathSegListFromByteStream(SVGPathByteStream* stream, SVGPathSegList* result, PathParsingMode parsingMode) { ASSERT(stream); ASSERT(result); if (stream->isEmpty()) return false; SVGPathSegListBuilder* builder = globalSVGPathSegListBuilder(result); OwnPtr<SVGPathByteStreamSource> source = SVGPathByteStreamSource::create(stream); SVGPathParser* parser = globalSVGPathParser(source.get(), builder); bool ok = parser->parsePathDataFromSource(parsingMode); parser->cleanup(); return ok; }