summaryrefslogtreecommitdiff
path: root/svgio/source
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2013-06-27 20:41:29 +0200
committerThorsten Behrens <tbehrens@suse.com>2013-06-27 20:44:07 +0200
commitd9b09a3ff38b2cf11ee0b9f9f03d47375f2b11e8 (patch)
tree882746586e9284c25adde71d6e66f3021d0c3355 /svgio/source
parent66e72c38f77bedc28b990b2a724829b50c70bf8d (diff)
Fix fdo#65847 - avoid infinite recursion in style resolution.
That was previously asking back the node for the font size, which was again asking the SvgNumber, which was ... In this case, if the node has relative sizes, this is always relative to the parent. Change-Id: Iaa81d0238d9eb73f5af24df347d12d7cb8ba8c0a
Diffstat (limited to 'svgio/source')
-rw-r--r--svgio/source/svgreader/svgnode.cxx32
-rw-r--r--svgio/source/svgreader/svgtools.cxx4
2 files changed, 22 insertions, 14 deletions
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index 3bc092d5ec3e..e1698e81c472 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -491,13 +491,9 @@ namespace svgio
}
}
- double SvgNode::getCurrentFontSize() const
+ double SvgNode::getCurrentFontSizeInherited() const
{
- if(getSvgStyleAttributes())
- {
- return getSvgStyleAttributes()->getFontSize().solve(*this, xcoordinate);
- }
- else if(getParent())
+ if(getParent())
{
return getParent()->getCurrentFontSize();
}
@@ -507,14 +503,17 @@ namespace svgio
}
}
- double SvgNode::getCurrentXHeight() const
+ double SvgNode::getCurrentFontSize() const
{
if(getSvgStyleAttributes())
- {
- // for XHeight, use FontSize currently
- return getSvgStyleAttributes()->getFontSize().solve(*this, ycoordinate);
- }
- else if(getParent())
+ return getSvgStyleAttributes()->getFontSize().solve(*this, xcoordinate);
+
+ return getCurrentFontSizeInherited();
+ }
+
+ double SvgNode::getCurrentXHeightInherited() const
+ {
+ if(getParent())
{
return getParent()->getCurrentXHeight();
}
@@ -524,6 +523,15 @@ namespace svgio
}
}
+ double SvgNode::getCurrentXHeight() const
+ {
+ if(getSvgStyleAttributes())
+ // for XHeight, use FontSize currently
+ return getSvgStyleAttributes()->getFontSize().solve(*this, ycoordinate);
+
+ return getCurrentXHeightInherited();
+ }
+
void SvgNode::setId(const OUString* pfId)
{
if(mpId)
diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx
index 2b89f0df6f1b..7607a439a3ed 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -159,11 +159,11 @@ namespace svgio
{
case Unit_em:
{
- return mfNumber * rInfoProvider.getCurrentFontSize();
+ return mfNumber * rInfoProvider.getCurrentFontSizeInherited();
}
case Unit_ex:
{
- return mfNumber * rInfoProvider.getCurrentXHeight() * 0.5;
+ return mfNumber * rInfoProvider.getCurrentXHeightInherited() * 0.5;
}
case Unit_px:
{