summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx16
-rw-r--r--svgio/source/svgreader/svgsvgnode.cxx3
2 files changed, 9 insertions, 10 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 4e7388882bc1..9c080cdcd532 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -205,17 +205,15 @@ namespace svgio
const SvgStyleAttributes* SvgStyleAttributes::getParentStyle() const
{
- if(getCssStyleParent())
- {
- return getCssStyleParent();
- }
+ const SvgStyleAttributes* pParentStyle = getCssStyleParent();
- if(mrOwner.getParent())
- {
- return mrOwner.getParent()->getSvgStyleAttributes();
- }
+ // no parent style set, check parent for its style attributes
+ if(pParentStyle == NULL && mrOwner.getParent() != NULL)
+ pParentStyle = mrOwner.getParent()->getSvgStyleAttributes();
- return 0;
+ if (pParentStyle != this) // to prevent infinite loop
+ return pParentStyle;
+ return NULL;
}
void SvgStyleAttributes::add_text(
diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx
index fef34ef8eda7..78e3ac930d3b 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -60,7 +60,8 @@ namespace svgio
const SvgStyleAttributes* SvgSvgNode::getSvgStyleAttributes() const
{
- return checkForCssStyle(OUString("svg"), maSvgStyleAttributes);
+ checkForCssStyle(OUString("svg"), maSvgStyleAttributes);
+ return maSvgStyleAttributes.getCssStyleParent();
}
void SvgSvgNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)