diff options
author | Chr. Rossmanith <ChrRossmanith@gmx.de> | 2014-11-16 21:43:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-20 09:22:03 +0000 |
commit | 5f98e35f81c887ff55edbdbe0d264215d9faa562 (patch) | |
tree | db9abde8e1bd49c8a8c1699e8ff57d04ce8c4a5d /svgio | |
parent | c0fbb6be4f0c9822c1a5eb97d66e4f08d9f59c66 (diff) |
SVG: improve handling of visibility property
visible children of an invisible parent are now visible
Change-Id: I2eafbd15d22f54ec39f12bfd32175925ab8a6184
Reviewed-on: https://gerrit.libreoffice.org/12504
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/source/svgreader/svgnode.cxx | 22 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 7 |
2 files changed, 15 insertions, 14 deletions
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index d0848680c6b9..e4038e049362 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -496,12 +496,6 @@ namespace svgio return; } - const SvgStyleAttributes* pStyles = getSvgStyleAttributes(); - if(pStyles && (Visibility_hidden == pStyles->getVisibility() || Visibility_collapse == pStyles->getVisibility())) - { - return; - } - if(!bReferenced) { if(SVGTokenDefs == getType() || @@ -540,11 +534,14 @@ namespace svgio if(pCandidate && Display_none != pCandidate->getDisplay()) { + const SvgNodeVector& rGrandChildren = pCandidate->getChildren(); const SvgStyleAttributes* pChildStyles = pCandidate->getSvgStyleAttributes(); - if(pChildStyles && Visibility_hidden != pChildStyles->getVisibility()) + // decompose: + // - visible terminal nodes + // - all non-terminal nodes (might contain visible nodes down the hierarchy) + if( !rGrandChildren.empty() || ( pChildStyles && (Visibility_visible == pChildStyles->getVisibility())) ) { drawinglayer::primitive2d::Primitive2DSequence aNewTarget; - pCandidate->decomposeSvgNode(aNewTarget, bReferenced); if(aNewTarget.hasElements()) @@ -552,15 +549,16 @@ namespace svgio drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewTarget); } } - } - else if(!pCandidate) - { + } + else if(!pCandidate) + { OSL_ENSURE(false, "Null-Pointer in child node list (!)"); - } + } } if(rTarget.hasElements()) { + const SvgStyleAttributes* pStyles = getSvgStyleAttributes(); if(pStyles) { // check if we have Title or Desc diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 73fe7f8f2178..182448f827e5 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1230,15 +1230,18 @@ namespace svgio mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType()), mbStrokeDasharraySet(false) { + const SvgStyleAttributes* pParentStyle = getParentStyle(); if(!mbIsClipPathContent) { - const SvgStyleAttributes* pParentStyle = getParentStyle(); - if(pParentStyle) { mbIsClipPathContent = pParentStyle->mbIsClipPathContent; } } + if(pParentStyle) + { + maVisibility = pParentStyle->maVisibility; + } } SvgStyleAttributes::~SvgStyleAttributes() |