[Libreoffice-commits] core.git: Branch 'libreoffice-4-2-4' - svgio/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.com
Fri Apr 18 04:55:38 PDT 2014
svgio/source/svgreader/svgstyleattributes.cxx | 16 +++++++---------
svgio/source/svgreader/svgsvgnode.cxx | 3 ++-
2 files changed, 9 insertions(+), 10 deletions(-)
New commits:
commit 0462b477b7e1006282b28ec96ce6f4bcaa1a3dd0
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Wed Apr 16 09:40:29 2014 +0200
fdo#74743 avoid infinite loop when gathering "svg" element styles
Change-Id: Ifcfd0c64302b9174510e3d774607f5ca60173885
Signed-off-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 8d15b2c3dbad718782d3923ece0eb6816beafab0)
Reviewed-on: https://gerrit.libreoffice.org/9062
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index ecddfbf..0fae736 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 8e107c6..cde5387 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)
More information about the Libreoffice-commits
mailing list