summaryrefslogtreecommitdiff
path: root/svgio/source/svgreader/svgstyleattributes.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svgio/source/svgreader/svgstyleattributes.cxx')
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx37
1 files changed, 26 insertions, 11 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 485142240871..5fe78f8b58d0 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1181,7 +1181,24 @@ namespace svgio::svgreader
drawinglayer::primitive2d::Primitive2DContainer&& rSource,
const std::optional<basegfx::B2DHomMatrix>& pTransform) const
{
- const double fOpacity(getOpacity().solve(mrOwner));
+ // default is 1
+ double fOpacity(1.0);
+
+ if(maOpacity.isSet())
+ {
+ fOpacity = maOpacity.solve(mrOwner);
+ }
+ else
+ {
+ // if opacity is not set, check the css style
+ if (const SvgStyleAttributes* pSvgStyleAttributes = getCssStyleParent())
+ {
+ if (pSvgStyleAttributes->maOpacity.isSet())
+ {
+ fOpacity = pSvgStyleAttributes->maOpacity.solve(mrOwner);
+ }
+ }
+ }
if(basegfx::fTools::equalZero(fOpacity))
{
@@ -1303,7 +1320,7 @@ namespace svgio::svgreader
maBaselineShift(BaselineShift::Baseline),
maBaselineShiftNumber(0),
maDominantBaseline(DominantBaseline::Auto),
- maResolvingParent(34, 0),
+ maResolvingParent(35, 0),
mbStrokeDasharraySet(false),
mbContextFill(false),
mbContextStroke(false),
@@ -2411,16 +2428,14 @@ namespace svgio::svgreader
return maOpacity;
}
- // This is called from add_postProcess so only check the parent style
- // if it has a local css style, because it's the first in the stack
- if(mrOwner.hasLocalCssStyle())
- {
- const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
+ const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
- if (pSvgStyleAttributes && pSvgStyleAttributes->maOpacity.isSet())
- {
- return pSvgStyleAttributes->maOpacity;
- }
+ if (pSvgStyleAttributes && maResolvingParent[34] < nStyleDepthLimit)
+ {
+ ++maResolvingParent[34];
+ auto ret = pSvgStyleAttributes->getOpacity();
+ --maResolvingParent[34];
+ return ret;
}
// default is 1