class SkSVGParser : public SkXMLParser {
public:
- SkSVGParser();
+ SkSVGParser(SkXMLParserError* err = NULL);
virtual ~SkSVGParser();
void _addAttribute(const char* attrName, const char* attrValue) {
fXMLWriter.addAttribute(attrName, attrValue); }
static int gGeneratedMatrixID = 0;
-SkSVGParser::SkSVGParser() : fHead(&fEmptyPaint), fIDs(256),
+SkSVGParser::SkSVGParser(SkXMLParserError* errHandler) :
+ SkXMLParser(errHandler),
+ fHead(&fEmptyPaint), fIDs(256),
fXMLWriter(&fStream), fCurrElement(NULL), fInSVG(false), fSuppressPaint(false) {
fLastTransform.reset();
fEmptyPaint.f_fill.set("black");
if (fCurrElement == NULL) // this signals we should ignore attributes for this element
return true;
if (fCurrElement->fIsDef == false && fCurrElement->fIsNotDef == false)
- return true; // also an ignored element
+ return false; // also an ignored element
size_t nameLen = strlen(name);
int attrIndex = findAttribute(fCurrElement, name, nameLen, false);
if (attrIndex == -1) {
if (nextColon && nextColon - name < len)
return false;
SkSVGTypes type = GetType(name, len);
- SkASSERT(type >= 0);
- if (type < 0)
- return true;
+// SkASSERT(type >= 0);
+ if (type < 0) {
+ type = SkSVGType_G;
+// return true;
+ }
SkSVGElement* parent = fParents.count() > 0 ? fParents.top() : NULL;
SkSVGElement* element = CreateElement(type, parent);
bool result = false;
}
void SkSVGRect::translate(SkSVGParser& parser, bool defState) {
- parser._startElement("rectangle");
+ parser._startElement("rect");
INHERITED::translate(parser, defState);
SVG_ADD_ATTRIBUTE_ALIAS(left, x);
SVG_ADD_ATTRIBUTE_ALIAS(top, y);
SVG_ATTRIBUTE(width),
SVG_ATTRIBUTE(version),
SVG_ATTRIBUTE(viewBox),
+ SVG_ATTRIBUTE(x),
SVG_LITERAL_ATTRIBUTE(xml:space, f_xml_space),
SVG_ATTRIBUTE(xmlns),
- SVG_LITERAL_ATTRIBUTE(xmlns:xlink, f_xml_xlink)
+ SVG_LITERAL_ATTRIBUTE(xmlns:xlink, f_xml_xlink),
+ SVG_ATTRIBUTE(y),
};
DEFINE_SVG_INFO(SVG)