diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 9dc25ac2fb03..280cffc5c8a5 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -654,6 +654,14 @@ CPPUNIT_TEST_FIXTURE(Test, testContextFill) assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, u"#ff0000"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testFillContextStroke) +{ + xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/fillContextStroke.svg"); + + assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line"_ostr, "color"_ostr, u"#ff0000"_ustr); + assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, u"#ff0000"_ustr); +} + CPPUNIT_TEST_FIXTURE(Test, testContextStroke) { xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/contextStroke.svg"); diff --git a/svgio/qa/cppunit/data/fillContextStroke.svg b/svgio/qa/cppunit/data/fillContextStroke.svg new file mode 100644 index 000000000000..a5288889c63e --- /dev/null +++ b/svgio/qa/cppunit/data/fillContextStroke.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 7e099534e464..485142240871 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1332,6 +1332,10 @@ namespace svgio::svgreader { mbContextFill = true; } + else if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"context-stroke")) + { + mbContextStroke = true; + } else if(readSvgPaint(aContent, aSvgPaint, aURL, aOpacity)) { setFill(aSvgPaint); @@ -1381,6 +1385,10 @@ namespace svgio::svgreader { mbContextStroke = true; } + else if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"context-fill")) + { + mbContextFill = true; + } else if(readSvgPaint(aContent, aSvgPaint, aURL, aOpacity)) { maStroke = aSvgPaint; @@ -2130,6 +2138,10 @@ namespace svgio::svgreader { return getContextFill(); } + else if (mbContextStroke) + { + return getContextStroke(); + } else if (maNodeFillURL.isEmpty()) { const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle(); @@ -2175,6 +2187,10 @@ namespace svgio::svgreader return &maStroke.getBColor(); } } + else if (mbContextFill) + { + return getContextFill(); + } else if (mbContextStroke) { return getContextStroke();