summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-09-23 13:25:06 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-09-23 14:20:12 +0200
commit5e6b02055a887bc49c5252c1ae359ae96947e80c (patch)
tree84e0bfd3b7eec803c1d0d8b8d6708e86608ff274
parent82b9ff35649cd67ca16296676d2ad1e4eff15493 (diff)
tdf#151118: don't trim leading/trailing spaces in 'preserve' case
Thanks again to Mike Kaganski for spotting Change-Id: Ifd8dcf15d7714ebc4f19083fefe0d78d27d46b4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140483 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx2
-rw-r--r--svgio/qa/cppunit/data/textXmlSpace.svg4
-rw-r--r--svgio/source/svgreader/svgtools.cxx8
3 files changed, 6 insertions, 8 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index d2cc7bd90828..9d9fb93dc8c1 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -437,7 +437,7 @@ void Test::testTextXmlSpace()
assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "text", "a b");
assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "text", "a b");
assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "text", "ab");
- assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[5]", "text", "a b");
+ assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[5]", "text", " a b ");
assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[6]", "text", "a b");
assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[7]", "text", "a b");
assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[8]", "text", "a b");
diff --git a/svgio/qa/cppunit/data/textXmlSpace.svg b/svgio/qa/cppunit/data/textXmlSpace.svg
index f200d74dd3f3..fe1bc8ceeb79 100644
--- a/svgio/qa/cppunit/data/textXmlSpace.svg
+++ b/svgio/qa/cppunit/data/textXmlSpace.svg
@@ -1,12 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
viewBox="0 0 250 250">
- <text y="10" xml:space="default">a b</text>
+ <text y="10" xml:space="default"> a b </text>
<text y="30" xml:space="default">a b</text>
<text y="50" xml:space="default">a
b</text>
<text y="70" xml:space="default">a
b</text>
- <text y="90" xml:space="preserve">a b</text>
+ <text y="90" xml:space="preserve"> a b </text>
<text y="110" xml:space="preserve">a b</text>
<text y="130" xml:space="preserve">a
b</text>
diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx
index eeca00ac3330..02a37dc0e8b4 100644
--- a/svgio/source/svgreader/svgtools.cxx
+++ b/svgio/source/svgreader/svgtools.cxx
@@ -1525,13 +1525,11 @@ namespace svgio::svgreader
// convert tab to space
aRetval = convert(aRetval, aTab, aSpace, false);
- // strip of all leading and trailing spaces
- aRetval = aRetval.trim();
-
if(bIsDefault)
{
- // consolidate contiguous space
- aRetval = consolidateContiguousSpace(aRetval);
+ // strip of all leading and trailing spaces
+ // and consolidate contiguous space
+ aRetval = consolidateContiguousSpace(aRetval.trim());
}
return aRetval;