diff --git a/examples/SVGView/SVGView.upp b/examples/SVGView/SVGView.upp
index 003a1f557..3dac8c889 100644
--- a/examples/SVGView/SVGView.upp
+++ b/examples/SVGView/SVGView.upp
@@ -19,6 +19,7 @@ file
svg\rg1024_Presentation_with_girl.svg,
svg\symbol.svg,
svg\idtest.svg,
+ svg\wooden-easter-egg-holder.svg,
svg\yinyang.svg;
mainconfig
diff --git a/examples/SVGView/svg/wooden-easter-egg-holder.svg b/examples/SVGView/svg/wooden-easter-egg-holder.svg
new file mode 100644
index 000000000..ddf155d58
--- /dev/null
+++ b/examples/SVGView/svg/wooden-easter-egg-holder.svg
@@ -0,0 +1,9080 @@
+
+
diff --git a/uppsrc/Painter/SvgInternal.h b/uppsrc/Painter/SvgInternal.h
index a40fd6459..efbd4825b 100644
--- a/uppsrc/Painter/SvgInternal.h
+++ b/uppsrc/Painter/SvgInternal.h
@@ -124,6 +124,7 @@ struct SvgParser {
void Items(const XmlNode& n, int depth);
void Element(const XmlNode& n, int depth, bool dosymbols = false);
void ParseGradient(const XmlNode& n, bool radial);
+ void ParseStyle(const XmlNode& n);
void ResolveGradient(int i);
void MapIds(const XmlNode& n);
diff --git a/uppsrc/Painter/SvgParser.cpp b/uppsrc/Painter/SvgParser.cpp
index 9ef38df37..329433c21 100644
--- a/uppsrc/Painter/SvgParser.cpp
+++ b/uppsrc/Painter/SvgParser.cpp
@@ -238,6 +238,38 @@ void SvgParser::ParseGradient(const XmlNode& n, bool radial)
s.offset = Nvl(StrDbl(m.Attr("offset")), offset);
}
}
+void SvgParser::ParseStyle(const XmlNode& n)
+{
+ String text = n.GatherText();
+ try {
+ CParser p(text);
+ while(!p.IsEof()) {
+ if(p.Char('.') && p.IsId()) {
+ Vector ids;
+ String id = p.ReadIdh();
+ ids.Add(id);
+ while(p.Char(',') && p.Char('.') && p.IsId()) {
+ id = p.ReadIdh();
+ ids.Add(id);
+ }
+
+ if(p.Char('{')) {
+ const char *b = p.GetPtr();
+ while(!p.IsChar('}') && !p.IsEof())
+ p.SkipTerm();
+
+ String style(b, p.GetPtr());
+ for(const String& id : ids)
+ classes.GetAdd(id) << style;
+ }
+ p.Char('}');
+ }
+ else
+ p.SkipTerm();
+ }
+ }
+ catch(CParser::Error) {}
+}
void SvgParser::Poly(const XmlNode& n, bool line)
{
@@ -356,27 +388,9 @@ void SvgParser::Element(const XmlNode& n, int depth, bool dosymbols)
else
if(m.IsTag("radialGradient"))
ParseGradient(m, true);
- else if(m.IsTag("style")) {
- String text = m.GatherText();
- try {
- CParser p(text);
- while(!p.IsEof()) {
- if(p.Char('.') && p.IsId()) {
- String id = p.ReadIdh();
- if(p.Char('{')) {
- const char *b = p.GetPtr();
- while(!p.IsChar('}') && !p.IsEof())
- p.SkipTerm();
- classes.Add(id, String(b, p.GetPtr()));
- }
- p.Char('}');
- }
- else
- p.SkipTerm();
- }
- }
- catch(CParser::Error) {}
- }
+ else
+ if(m.IsTag("style"))
+ ParseStyle(m);
}
else
if(n.IsTag("linearGradient"))
@@ -503,27 +517,8 @@ void SvgParser::Element(const XmlNode& n, int depth, bool dosymbols)
}
}
else
- if(n.IsTag("style")) {
- String text = n.GatherText();
- try {
- CParser p(text);
- while(!p.IsEof()) {
- if(p.Char('.') && p.IsId()) {
- String id = p.ReadIdh();
- if(p.Char('{')) {
- const char *b = p.GetPtr();
- while(!p.IsChar('}') && !p.IsEof())
- p.SkipTerm();
- classes.Add(id, String(b, p.GetPtr()));
- }
- p.Char('}');
- }
- else
- p.SkipTerm();
- }
- }
- catch(CParser::Error) {}
- }
+ if(n.IsTag("style"))
+ ParseStyle(n);
}
void SvgParser::Items(const XmlNode& n, int depth)