diff options
author | Xisco Fauli <anistenis@gmail.com> | 2016-03-07 23:05:59 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-03-09 08:51:27 +0000 |
commit | ecc7f698b5f080530f006218fa3dd82da43d9abb (patch) | |
tree | 54307f8f7cc17c2d39dc63c530bb76def03a3e7f /svgio/source | |
parent | 49b78749b1323dc7978d15135bc42646cb0db719 (diff) |
SVGIO: Fix problem when style's parent contains a mask element
Change-Id: I26aab6c0f959f6cc78d040f59f1acf0c7e29931b
Reviewed-on: https://gerrit.libreoffice.org/23045
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svgio/source')
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 691a1f8d2a41..b226770d55b3 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1154,16 +1154,11 @@ namespace svgio if(!aSource.empty()) // test again, applied clipPath may have lead to empty geometry { - if(!getMaskXLink().isEmpty()) + const SvgMaskNode* mpMask = accessMaskXLink(); + if(mpMask) { - // try to access linked Mask - const SvgMaskNode* mpMask = dynamic_cast< const SvgMaskNode* >(mrOwner.getDocument().findSvgNodeById(getMaskXLink())); - - if(mpMask) - { - // #i124852# transform may be needed when userSpaceOnUse - mpMask->apply(aSource, pTransform); - } + // #i124852# transform may be needed when userSpaceOnUse + mpMask->apply(aSource, pTransform); } if(!aSource.empty()) // test again, applied mask may have lead to empty geometry @@ -1212,6 +1207,7 @@ namespace svgio maClipPathXLink(), mpClipPathXLink(nullptr), maMaskXLink(), + mpMaskXLink(nullptr), maMarkerStartXLink(), mpMarkerStartXLink(nullptr), maMarkerMidXLink(), @@ -2687,6 +2683,38 @@ namespace svgio return mpClipPathXLink; } + OUString SvgStyleAttributes::getMaskXLink() const + { + if(!maMaskXLink.isEmpty()) + { + return maMaskXLink; + } + + const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); + + if(pSvgStyleAttributes && !pSvgStyleAttributes->maMaskXLink.isEmpty()) + { + return pSvgStyleAttributes->getMaskXLink(); + } + + return OUString(); + } + + const SvgMaskNode* SvgStyleAttributes::accessMaskXLink() const + { + if(!mpMaskXLink) + { + const OUString aMask(getMaskXLink()); + + if(!aMask.isEmpty()) + { + const_cast< SvgStyleAttributes* >(this)->mpMaskXLink = dynamic_cast< const SvgMaskNode* >(mrOwner.getDocument().findSvgNodeById(getMaskXLink())); + } + } + + return mpMaskXLink; + } + OUString SvgStyleAttributes::getMarkerStartXLink() const { if(!maMarkerStartXLink.isEmpty()) |