From 586de7ac433dca98edf4a5a3d13b5e393b9880ed Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 19 Sep 2019 16:08:59 +0200 Subject: tdf#123926: SVGIO: Check parent's fill when... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... the element is a clippath and fill=none fill="none" is created as SvgPaint(aColor, true, false, false) in svgtools.cxx meaning bSet = true, bCurrent = False and bOn = False, so it never checks its parent if it's a clippath Change-Id: Ia8c556674809b2b86280219e4084550e366bbff8 Reviewed-on: https://gerrit.libreoffice.org/79201 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ­ --- svgio/qa/cppunit/SvgImportTest.cxx | 15 +++++++++++++++ svgio/qa/cppunit/data/tdf123926.svg | 14 ++++++++++++++ svgio/source/svgreader/svgstyleattributes.cxx | 13 +++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 svgio/qa/cppunit/data/tdf123926.svg (limited to 'svgio') diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 5f714e98b4e7..aee83b05d440 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -59,6 +59,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testClipPathAndStyle(); void testi125329(); void testMaskingPath07b(); + void test123926(); void test47446(); void test47446b(); void testMaskText(); @@ -92,6 +93,7 @@ public: CPPUNIT_TEST(testClipPathAndStyle); CPPUNIT_TEST(testi125329); CPPUNIT_TEST(testMaskingPath07b); + CPPUNIT_TEST(test123926); CPPUNIT_TEST(test47446); CPPUNIT_TEST(test47446b); CPPUNIT_TEST(testMaskText); @@ -562,6 +564,19 @@ void Test::testMaskingPath07b() } +void Test::test123926() +{ + Primitive2DSequence aSequence123926 = parseSvg("/svgio/qa/cppunit/data/tdf123926.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence123926.getLength())); + + drawinglayer::tools::Primitive2dXmlDump dumper; + xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence123926)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform/transform/unifiedtransparence/polypolygoncolor", "color", "#7cb5ec"); +} + void Test::test47446() { //Check that marker's fill attribute is black is not set diff --git a/svgio/qa/cppunit/data/tdf123926.svg b/svgio/qa/cppunit/data/tdf123926.svg new file mode 100644 index 000000000000..1a5c2758aab4 --- /dev/null +++ b/svgio/qa/cppunit/data/tdf123926.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 5cda5995e82f..bd882e0e24c7 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -2006,6 +2006,19 @@ namespace svgio { return &maFill.getBColor(); } + else if(mbIsClipPathContent) + { + const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); + + if (pSvgStyleAttributes && maResolvingParent[0] < nStyleDepthLimit) + { + ++maResolvingParent[0]; + const basegfx::BColor* pFill = pSvgStyleAttributes->getFill(); + --maResolvingParent[0]; + + return pFill; + } + } } else if (!mpSvgGradientNodeFill && !mpSvgPatternNodeFill) { -- cgit