diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-03-26 14:13:21 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-03-26 18:38:59 +0100 |
commit | feb4e0890b883940ec6964375293727ac6229f1c (patch) | |
tree | 53074a948d013c3e3a198d47c653dd176d5b6d65 /svgio/source | |
parent | 73957dd866b6d5b7144a37ce1477b0c781d5fef6 (diff) |
tdf#160373: Iterate over all parents to check whether it's a clipPath content
Change-Id: I383ec264e4c88ebcee2ae6a839b762bba8abfc12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165347
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/source')
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index d5e3ad33209e..0ae986f010cd 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1287,18 +1287,9 @@ namespace svgio::svgreader maBaselineShift(BaselineShift::Baseline), maBaselineShiftNumber(0), maDominantBaseline(DominantBaseline::Auto), - maResolvingParent(31, 0), - mbIsClipPathContent(SVGToken::ClipPathNode == mrOwner.getType()), + maResolvingParent(32, 0), mbStrokeDasharraySet(false) { - const SvgStyleAttributes* pParentStyle = getParentStyle(); - if(!mbIsClipPathContent) - { - if(pParentStyle) - { - mbIsClipPathContent = pParentStyle->mbIsClipPathContent; - } - } } SvgStyleAttributes::~SvgStyleAttributes() @@ -2005,10 +1996,27 @@ namespace svgio::svgreader } } + bool SvgStyleAttributes::isClipPathContent() const + { + if (SVGToken::ClipPathNode == mrOwner.getType()) + return true; + + const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); + if (pSvgStyleAttributes && maResolvingParent[31] < nStyleDepthLimit) + { + ++maResolvingParent[31]; + bool ret = pSvgStyleAttributes->isClipPathContent(); + --maResolvingParent[31]; + return ret; + } + + return false; + } + // #i125258# ask if fill is a direct hard attribute (no hierarchy) bool SvgStyleAttributes::isFillSet() const { - if(mbIsClipPathContent) + if(isClipPathContent()) { return false; } @@ -2042,7 +2050,7 @@ namespace svgio::svgreader { return &maFill.getBColor(); } - else if(mbIsClipPathContent) + else if(isClipPathContent()) { const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); @@ -2066,7 +2074,7 @@ namespace svgio::svgreader const basegfx::BColor* pFill = pSvgStyleAttributes->getFill(); --maResolvingParent[0]; - if(mbIsClipPathContent) + if(isClipPathContent()) { if (pFill) { @@ -2269,7 +2277,7 @@ namespace svgio::svgreader return ret; } - if(mbIsClipPathContent) + if(isClipPathContent()) { return SvgNumber(0.0); } |