summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-09-19 16:08:59 +0200
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2019-09-19 21:57:24 +0200
commit586de7ac433dca98edf4a5a3d13b5e393b9880ed (patch)
tree22444906ec7c91d09424afb5c21eeaa18bb52bad /svgio
parent496f93c8667a28a37112f1a9835308b756d771de (diff)
tdf#123926: SVGIO: Check parent's fill when...
... 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Ă­ <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx15
-rw-r--r--svgio/qa/cppunit/data/tdf123926.svg14
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx13
3 files changed, 42 insertions, 0 deletions
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<int>(aSequence123926.getLength()));
+
+ drawinglayer::tools::Primitive2dXmlDump dumper;
+ xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(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 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" version="1.1" class="highcharts-root" style="font-family:&quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, Arial, Helvetica, sans-serif;font-size:12px;" width="600" height="400" viewBox="0 0 600 400">
+ <defs>
+ <clipPath id="highcharts-qkip48v-39">
+ <rect x="0" y="0" width="505" height="283" fill="none"/>
+ </clipPath>
+ </defs>
+ <g class="highcharts-series-group" data-z-index="3">
+ <g data-z-index="0.1" class="highcharts-series highcharts-series-0 highcharts-bubble-series highcharts-color-0 " transform="translate(85,61) scale(1 1)" clip-path="url(#highcharts-qkip48v-39)">
+ <path fill="rgb(124,181,236)" fill-opacity="0.5" d="M 501 123.5 A 13.5 13.5 0 1 1 500.99999325000056 123.48650000225 Z" stroke="#7cb5ec" stroke-width="1" class="highcharts-point highcharts-color-0"/>
+ </g>
+ </g>
+</svg>
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)
{