summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToma┼ż Vajngerl <tomaz.vajngerl@collabora.com>2014-04-16 09:40:29 +0200
committerAndras Timar <andras.timar@collabora.com>2014-04-16 10:54:55 +0200
commit8d15b2c3dbad718782d3923ece0eb6816beafab0 (patch)
tree75bd6cafc0b879a13d71a2b5bead4c19a9c2b87f
parentb84fed9967cb3364c5f9eb1064ab04336cf4e822 (diff)
fdo#74743 avoid infinite loop when gathering "svg" element styles
Change-Id: Ifcfd0c64302b9174510e3d774607f5ca60173885 Signed-off-by: Andras Timar <andras.timar@collabora.com>
-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 ecddfbf3a5e9..0fae7366f1f0 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 8e107c650c70..cde53879a879 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)