svgio/qa/cppunit/SvgImportTest.cxx | 3 +++ svgio/qa/cppunit/data/RectWithStylesByGroup.svg | 18 ++++++++++++++++++ svgio/source/svgreader/svggnode.cxx | 8 +++++++- 3 files changed, 28 insertions(+), 1 deletion(-)
New commits: commit 2dbd2cb9a55c90f4f3db3a781526cc2246d0bdd7 Author: Joren De Cuyper <jore...@libreoffice.org> Date: Tue Jul 15 13:52:10 2014 +0200 Avoid infinite loop when gathering "g" element styles Same way of how fdo#74743 is fixed 3b7472b284131c09d91b69f26d5d26d54648f939 Change-Id: If6cc8eb6ff89b0081f27ff75a9b60a3e81cff1bd Reviewed-on: https://gerrit.libreoffice.org/10326 Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> Tested-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 23fcf90..a5e5e17 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -82,6 +82,9 @@ void Test::testStyles() Primitive2DSequence maSequenceRectWithParentStyle = parseSvg("/svgio/qa/cppunit/data/RectWithParentStyles.svg"); CPPUNIT_ASSERT_EQUAL(1, (int) maSequenceRectWithParentStyle.getLength()); + Primitive2DSequence maSequenceRectWithStylesByGroup = parseSvg("/svgio/qa/cppunit/data/RectWithStylesByGroup.svg"); + CPPUNIT_ASSERT_EQUAL(1, (int) maSequenceRectWithStylesByGroup.getLength()); + // TODO: Test if the 3 sequences are equal.. //const Primitive2DReference xReference(maSequenceRect[0]); } diff --git a/svgio/qa/cppunit/data/RectWithStylesByGroup.svg b/svgio/qa/cppunit/data/RectWithStylesByGroup.svg new file mode 100644 index 0000000..6fefdf2 --- /dev/null +++ b/svgio/qa/cppunit/data/RectWithStylesByGroup.svg @@ -0,0 +1,18 @@ +<?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="http://www.w3.org/2000/svg" version="1.1" + width="10cm" height="5cm" viewBox="0 0 1000 500"> + <defs> + <style type="text/css"><![CDATA[ + g { + fill: red; + stroke: blue; + stroke-width: 3 + } + ]]></style> + </defs> +<g> + <rect x="200" y="100" width="600" height="300"/> +</g> +</svg> diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx index 82d3d5d..45fa6a3 100644 --- a/svgio/source/svgreader/svggnode.cxx +++ b/svgio/source/svgreader/svggnode.cxx @@ -43,7 +43,13 @@ namespace svgio const SvgStyleAttributes* SvgGNode::getSvgStyleAttributes() const { - return checkForCssStyle(OUString("g"), maSvgStyleAttributes); + const SvgStyleAttributes* aCheckCssStyle = checkForCssStyle(OUString("g"), maSvgStyleAttributes); + const SvgStyleAttributes* aGetCssStyleParent = maSvgStyleAttributes.getCssStyleParent(); + + if (aGetCssStyleParent == NULL) + return aCheckCssStyle; + + return aGetCssStyleParent; } void SvgGNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits