Bug 117920 - SVG is shifted after inserting in document
Summary: SVG is shifted after inserting in document
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Xisco Faulí
URL:
Whiteboard: target:24.2.0 target:7.6.1
Keywords: filter:svg
Depends on:
Blocks: SVG-Import
  Show dependency treegraph
 
Reported: 2018-05-30 21:46 UTC by Aron Budea
Modified: 2023-08-21 01:43 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample SVG (3.52 KB, image/svg+xml)
2018-05-30 21:46 UTC, Aron Budea
Details
Screenshot (30.84 KB, image/png)
2018-05-30 21:47 UTC, Aron Budea
Details
svg sample file (2.38 KB, image/svg+xml)
2018-05-31 16:06 UTC, nurcantur
Details
test.svg attached screenshot (21.44 KB, image/jpeg)
2018-05-31 16:10 UTC, nurcantur
Details
simplify document (2.09 KB, image/svg+xml)
2023-08-17 07:19 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2018-05-30 21:46:35 UTC
Created attachment 142424 [details]
Sample SVG

The attached SVG has four black squares in its corners. When inserted, it appears shifted.

The SVG was created in Adobe Illustrator (whic behaved the same way), and later simplified in Inkscape, plus some Illustrator-specific garbage was removed from the file.

Shows badly in LO 6.1 beta1, 4.0.0.3, and even worse in 3.3.0 / Windows 7 & Ubuntu 17.10.
Comment 1 Aron Budea 2018-05-30 21:47:05 UTC
Created attachment 142425 [details]
Screenshot
Comment 2 nurcantur 2018-05-31 12:36:48 UTC
Thank you for reporting the bug. 
Unfortunately, when I open sample.svg in a browser I get the error message

"This page contains the following errors:
error on line 5 at column 37: xmlns:i: '&ns_ai;' is not a valid URI
Below is a rendering of the page up to the first error."

I think, because of this error LO cannot properly render the svg file. I tried the different svg file and LO rendered it properly.  Please first try to fix the error in .svg file then try again to see, if the problem is still exists or not.

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested information is provided.
Comment 3 Aron Budea 2018-05-31 15:18:52 UTC
Thank you for the feedback. Indeed there's this message in Chrome, but not in Firefox, and if it's just the URI interpretation that is the issue, I doubt it has significance. Plus the image displays fine in Chrome as well.
Comment 4 nurcantur 2018-05-31 16:06:10 UTC
Created attachment 142452 [details]
svg sample file
Comment 5 nurcantur 2018-05-31 16:10:26 UTC
Created attachment 142453 [details]
test.svg attached screenshot
Comment 6 nurcantur 2018-05-31 16:19:40 UTC
(In reply to Aron Budea from comment #3)
> Thank you for the feedback. Indeed there's this message in Chrome, but not
> in Firefox, and if it's just the URI interpretation that is the issue, I
> doubt it has significance. Plus the image displays fine in Chrome as well.

I also get the same error in Safari.I create a new svg file in Inkscape. When I attached the test.svg to a new writer file I get the expected result seen in test.svg attached screenshot 

If you fixed the error in the SVG, you get the expected result.
Comment 7 Aron Budea 2018-06-09 23:57:54 UTC
The original file was created in Illustrator, I doubt a file created in Inkscape can be use to reproduce the same issue. I'm afraid I don't have Illustrator myself, my best effort was creating a sample from the original file in Inkscape, which can be used to exhibit the bug in LibreOffice.
Comment 8 Jean-Baptiste Faure 2018-06-10 15:32:44 UTC
Confirming with LO 6.1.0.0.beta1+ under Ubuntu 16.04 x86-64
For me the problem is clearly on the LO side:
1/ external viewer shows the image correctly
2/ when inserting in a text or drawing document the file picker shows a correct preview.
3/ when using the function Edit with an external tool, the view is correct.

Setting as NEW.

Best regards. JBF
Comment 9 Jean-Baptiste Faure 2018-06-10 15:38:15 UTC
It seems that LO does not interpret 
transform="translate(-18.512236,-6.775101)"

If you replace that by transform="translate(0.,0.)"
with your preferred text editor then image viewer shows the same thing than LO.

Best regards. JBF
Comment 10 QA Administrators 2019-06-11 03:01:03 UTC Comment hidden (obsolete)
Comment 11 QA Administrators 2021-06-11 03:49:06 UTC Comment hidden (obsolete)
Comment 12 Jean-Baptiste Faure 2021-06-12 20:54:53 UTC
Nothing changed, bug still reproducible with LO 7.1.5.0.0+ and master 7.2.0.0 alpha1, both build at home under Ubuntu 20.04 x86-64.

Best regards. JBF
Comment 13 Stéphane Guillou (stragu) 2022-11-23 11:19:14 UTC
Same issue in recent master build with attachment 142424 [details]:

Version: 7.5.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 1435c5b12646269e2b5b58ec7d51626dce6505db
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 14 Xisco Faulí 2023-08-17 07:19:17 UTC
Created attachment 189002 [details]
simplify document
Comment 15 Xisco Faulí 2023-08-17 07:23:32 UTC
This is related to the <switch> element
Comment 17 Commit Notification 2023-08-18 19:39:09 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/06075cd2ffc490feb7560f92ffc894b1e6751f90

tdf#117920: Revert "related tdf#156579: just break for switch element"

It will be available in 7.6.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.