configure.ac | 2 - svgio/qa/cppunit/SvgImportTest.cxx | 19 +++++++++++++ svgio/qa/cppunit/data/tdf161985.svg | 14 +++++++++ svgio/source/svgreader/svgstyleattributes.cxx | 37 ++++++++++++++++++-------- 4 files changed, 60 insertions(+), 12 deletions(-)
New commits: commit 54f976a603b9ff5156a54392f9d16353aa311173 Author: Aron Budea <aron.bu...@collabora.com> AuthorDate: Sat Jul 13 00:22:44 2024 +0200 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Sat Jul 13 00:22:44 2024 +0200 Bump version to 7.6.7.2.M2 Change-Id: I2a68ff5dc4d7d61508bcb9611d1153e0043ba3be diff --git a/configure.ac b/configure.ac index a281be1b45d8..0e83fe31f76a 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([LibreOffice],[7.6.7.2.M1],[],[],[http://documentfoundation.org/]) +AC_INIT([LibreOffice],[7.6.7.2.M2],[],[],[http://documentfoundation.org/]) dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard commit f72c0ec7a115b3ec0ceaf45e58fae6459c294f37 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Jul 11 14:22:58 2024 +0200 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Fri Jul 12 17:39:53 2024 +0200 tdf#161985: getOpacity is also called from other places Partially revert 56039daae4a436d7ea1b093a02cf0e8ad3bda4a9 "tdf#149673: only check opacity from parent..." to make getOpacity behave as before and move the new behaviour of getOpacity inside add_postProcess Change-Id: If475cddbc4967308fa06adacda621cb3790c6f70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170351 Reviewed-by: Aron Budea <aron.bu...@collabora.com> Tested-by: Jenkins (cherry picked from commit d023ef070990e242df62d6c1951cc953fd60e7db) diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 262c5cadcc68..660d763f85b7 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -385,6 +385,25 @@ CPPUNIT_TEST_FIXTURE(Test, testFontsizeRelative) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", "serif"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf161985) +{ + Primitive2DSequence aSequenceTdf161985 = parseSvg(u"/svgio/qa/cppunit/data/tdf161985.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf161985.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf161985); + + CPPUNIT_ASSERT (pDocument); + + // Without the fix in place, this test would have failed with + // - Expected: 0 + // - Actual : 1 + assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", 0); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", 1); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", "text", u"This is a test file."); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf145896) { Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf145896.svg"); diff --git a/svgio/qa/cppunit/data/tdf161985.svg b/svgio/qa/cppunit/data/tdf161985.svg new file mode 100644 index 000000000000..781811b15dbf --- /dev/null +++ b/svgio/qa/cppunit/data/tdf161985.svg @@ -0,0 +1,14 @@ +<svg viewBox="0 0 630 550" xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"> + #help { font-size:12px; } + </style> + <g> + <g id="help" opacity="0"> + <path + d="M16 50 c-16 0 -16 -8 -16 -16 v-18 c0 -16 8 -16 16 -16 h300 c16 0 16 5 16 16 v18 c0 16 -8 16 -16 16 H60 L0 70 L36 50 H16"/> + </g> + <text> + <tspan x="101.0625" y="222.22849">This is a test file.</tspan> + </text> + </g> +</svg> diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 826f00b6687a..d099d34f1638 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1164,7 +1164,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)) { @@ -1292,7 +1309,7 @@ namespace svgio::svgreader maBaselineShift(BaselineShift::Baseline), maBaselineShiftNumber(0), maDominantBaseline(DominantBaseline::Auto), - maResolvingParent(32, 0), + maResolvingParent(35, 0), mbStrokeDasharraySet(false) { } @@ -2315,16 +2332,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