svgio/qa/cppunit/SvgImportTest.cxx            |   15 +++++++++++++++
 svgio/qa/cppunit/data/tdf123926.svg           |   14 ++++++++++++++
 svgio/source/svgreader/svgstyleattributes.cxx |   13 +++++++++++++
 3 files changed, 42 insertions(+)

New commits:
commit 5b4b6d08d1a839a595f42a56ecff5d4964fcf90c
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Sep 19 16:08:59 2019 +0200
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Mon Oct 21 11:33:34 2019 +0200

    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Ă­ <xiscofa...@libreoffice.org>
    (cherry picked from commit 586de7ac433dca98edf4a5a3d13b5e393b9880ed)
    Reviewed-on: https://gerrit.libreoffice.org/79258
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 23e6a7ccd445..f5cfe34d38a1 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -58,6 +58,7 @@ class Test : public test::BootstrapFixture, public 
XmlTestTools
     void testClipPathAndStyle();
     void testi125329();
     void testMaskingPath07b();
+    void test123926();
     void test47446();
     void test47446b();
     void testMaskText();
@@ -89,6 +90,7 @@ public:
     CPPUNIT_TEST(testClipPathAndStyle);
     CPPUNIT_TEST(testi125329);
     CPPUNIT_TEST(testMaskingPath07b);
+    CPPUNIT_TEST(test123926);
     CPPUNIT_TEST(test47446);
     CPPUNIT_TEST(test47446b);
     CPPUNIT_TEST(testMaskText);
@@ -554,6 +556,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 cd3d14159aa0..38da5e2b648c 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 (maNodeFillURL.isEmpty())
             {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to