aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/svg/SkSVGParser.h2
-rw-r--r--include/svg/SkSVGTypes.h1
-rw-r--r--src/svg/SkSVGParser.cpp14
-rw-r--r--src/svg/SkSVGRect.cpp2
-rw-r--r--src/svg/SkSVGSVG.cpp4
-rw-r--r--src/svg/SkSVGSVG.h3
6 files changed, 18 insertions, 8 deletions
diff --git a/include/svg/SkSVGParser.h b/include/svg/SkSVGParser.h
index 86ae4c28d9..83b120dd64 100644
--- a/include/svg/SkSVGParser.h
+++ b/include/svg/SkSVGParser.h
@@ -32,7 +32,7 @@ class SkSVGElement;
class SkSVGParser : public SkXMLParser {
public:
- SkSVGParser();
+ SkSVGParser(SkXMLParserError* err = NULL);
virtual ~SkSVGParser();
void _addAttribute(const char* attrName, const char* attrValue) {
fXMLWriter.addAttribute(attrName, attrValue); }
diff --git a/include/svg/SkSVGTypes.h b/include/svg/SkSVGTypes.h
index 38d63cec1c..99d8ca1913 100644
--- a/include/svg/SkSVGTypes.h
+++ b/include/svg/SkSVGTypes.h
@@ -40,6 +40,7 @@ enum SkSVGTypes {
SkSVGType_Symbol,
SkSVGType_Text,
SkSVGType_Tspan,
+ SkSVGType_Unknown,
SkSVGType_Use
};
diff --git a/src/svg/SkSVGParser.cpp b/src/svg/SkSVGParser.cpp
index b55c5edbef..df861780b2 100644
--- a/src/svg/SkSVGParser.cpp
+++ b/src/svg/SkSVGParser.cpp
@@ -43,7 +43,9 @@
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");
@@ -157,7 +159,7 @@ bool SkSVGParser::onAddAttributeLen(const char name[], const char value[], size_
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) {
@@ -201,9 +203,11 @@ bool SkSVGParser::onStartElementLen(const char name[], size_t len) {
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;
diff --git a/src/svg/SkSVGRect.cpp b/src/svg/SkSVGRect.cpp
index 03fdfdcc3a..8765d1d7c1 100644
--- a/src/svg/SkSVGRect.cpp
+++ b/src/svg/SkSVGRect.cpp
@@ -33,7 +33,7 @@ SkSVGRect::SkSVGRect() {
}
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);
diff --git a/src/svg/SkSVGSVG.cpp b/src/svg/SkSVGSVG.cpp
index 1678fc168e..9423c3ac40 100644
--- a/src/svg/SkSVGSVG.cpp
+++ b/src/svg/SkSVGSVG.cpp
@@ -27,9 +27,11 @@ const SkSVGAttribute SkSVGSVG::gAttributes[] = {
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)
diff --git a/src/svg/SkSVGSVG.h b/src/svg/SkSVGSVG.h
index f331ccd94e..257c136445 100644
--- a/src/svg/SkSVGSVG.h
+++ b/src/svg/SkSVGSVG.h
@@ -30,9 +30,12 @@ private:
SkString f_width;
SkString f_version;
SkString f_viewBox;
+ SkString f_x;
SkString f_xml_space;
SkString f_xmlns;
SkString f_xml_xlink;
+ SkString f_y;
+
typedef SkSVGElement INHERITED;
};