summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-07-10 14:10:01 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-07-10 16:53:58 +0200
commit3d5b5914ef56395a8ba3d4c0a2eff8a5c52046b4 (patch)
treefd4b8f4ea6b6aaa17b04102ffa2bcd75a32990e2 /svgio
parent7019eef453954785ad039bebd8c8a00183992584 (diff)
tdf#156201: just check one level up in the style stack
Otherwise, the parent might also have a local css style Change-Id: Ib6d1340045f22861aee3e526d22d014eeb2f5d38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154248 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx13
-rw-r--r--svgio/qa/cppunit/data/tdf156201.svg36
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx29
3 files changed, 59 insertions, 19 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 24f146592249..fc9557a5c312 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -505,6 +505,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156018)
assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", "#0000ff");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf156201)
+{
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156201.svg");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygoncolor", "color", "#2f3ba1");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf156167)
{
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156167.svg");
diff --git a/svgio/qa/cppunit/data/tdf156201.svg b/svgio/qa/cppunit/data/tdf156201.svg
new file mode 100644
index 000000000000..3000e17f459e
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf156201.svg
@@ -0,0 +1,36 @@
+<svg style="width: 100%; height: 100%;" height="492pt" version="1.1" viewBox="0 0 500 492" width="500pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <g id="PathCollection_1">
+ <defs>
+ <path d="
+M52.0418 -266.565
+L54.1695 -266.795
+L54.1955 -266.832
+L54.2469 -266.844
+L56.3492 -268.627
+L57.4099 -268.849
+L59.524 -270.389
+L60.4641 -271.625
+L62.5433 -273.716
+L62.8642 -275.66
+L63.198 -277.417
+L62.6856 -278.465
+L60.8035 -281.602
+L60.4975 -281.91
+L59.9992 -282.386
+L57.6251 -284.681
+L56.2525 -285.174
+L54.6591 -286.742
+L54.5155 -286.797
+L52.0418 -279.184
+L52.0418 -270.892" id="C0_0_32ce96eee2"></path>
+ </defs>
+ <g clip-path="url(#p65124e5d4c)">
+ <use style="fill:#2f3ba1;" x="0.0" xlink:href="#C0_0_32ce96eee2" y="492.3555"></use>
+ </g>
+ </g>
+ <defs>
+ <clipPath id="p65124e5d4c">
+ <rect height="446.4" width="446.4" x="38.27125" y="23.14175"></rect>
+ </clipPath>
+ </defs>
+</svg>
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 12766fde7986..91c27aeff637 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1291,7 +1291,7 @@ namespace svgio::svgreader
maClipRule(FillRule::notset),
maBaselineShift(BaselineShift::Baseline),
maBaselineShiftNumber(0),
- maResolvingParent(33, 0),
+ maResolvingParent(30, 0),
mbIsClipPathContent(SVGToken::ClipPathNode == mrOwner.getType()),
mbStrokeDasharraySet(false)
{
@@ -2376,11 +2376,11 @@ namespace svgio::svgreader
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
- if (pSvgStyleAttributes && maResolvingParent[31] < nStyleDepthLimit)
+ if (pSvgStyleAttributes && maResolvingParent[25] < nStyleDepthLimit)
{
- ++maResolvingParent[31];
+ ++maResolvingParent[25];
auto ret = pSvgStyleAttributes->getClipRule();
- --maResolvingParent[31];
+ --maResolvingParent[25];
return ret;
}
@@ -2865,12 +2865,9 @@ namespace svgio::svgreader
{
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
- if (pSvgStyleAttributes && maResolvingParent[30] < nStyleDepthLimit)
+ if (pSvgStyleAttributes)
{
- ++maResolvingParent[30];
- auto ret = pSvgStyleAttributes->getClipPathXLink();
- --maResolvingParent[30];
- return ret;
+ return pSvgStyleAttributes->maClipPathXLink;
}
}
@@ -2901,12 +2898,9 @@ namespace svgio::svgreader
{
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
- if (pSvgStyleAttributes && maResolvingParent[32] < nStyleDepthLimit)
+ if (pSvgStyleAttributes)
{
- ++maResolvingParent[32];
- auto ret = pSvgStyleAttributes->getFilterXLink();
- --maResolvingParent[32];
- return ret;
+ return pSvgStyleAttributes->maFilterXLink;
}
}
@@ -2937,12 +2931,9 @@ namespace svgio::svgreader
{
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
- if (pSvgStyleAttributes && maResolvingParent[25] < nStyleDepthLimit)
+ if (pSvgStyleAttributes)
{
- ++maResolvingParent[25];
- auto ret = pSvgStyleAttributes->getMaskXLink();
- --maResolvingParent[25];
- return ret;
+ return pSvgStyleAttributes->maMaskXLink;
}
}