Bug 107392

Summary: SVG images break z-index
Product: LibreOffice Reporter: Miklos Vajna <vmiklos>
Component: WriterAssignee: Miklos Vajna <vmiklos>
Status: RESOLVED FIXED    
Severity: normal CC: rb.henschel
Priority: medium    
Version: 5.4.0.0.alpha0+   
Hardware: All   
OS: All   
Whiteboard: target:5.4.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 88278, 103152    
Attachments: Reproducer document.

Description Miklos Vajna 2017-04-24 14:44:19 UTC
Created attachment 132791 [details]
Reproducer document.

See the attached document, open it in Writer.

Expected: z-index (or z-order) from bottom -> up is bitmap (twitter logo), text frame, finally the svg image (libreoffice logo).

Actual: text frame, svg, bitmap.
Comment 1 David 2017-04-24 15:45:44 UTC
Related to bug 96315?
Comment 2 Regina Henschel 2017-04-24 19:32:24 UTC
I see the wrong order, but I cannot produce a similar disorder with a new document. How have you created that file?
If you delete either the svg or the ersatz png in the file source, the order is correct. If you resave the document the order is corrected to the actual stacking. If I manually change the z-order in file, the shown stacking corresponds to the z-index.
Comment 3 Miklos Vajna 2017-04-26 15:32:25 UTC
David, based on the title it sounds related, yes. It's a good idea to check if the fix for this bug will fix that other bug as well (and in that case that should be closed as a duplicate).

Regina, this is a simplified version of a customer document, but I think it's possible to create something like this from scratch as well. You just have to make sure that in Writer you have e.g. 3 paragraphs and anchor 3 images to each of them, so you can control in which order the shapes appear in the document, then make sure that the z-indexes are 1-2-0 in the document order (so on the UI first "send to back" the second shape, then the first, finally the third). And to trigger the sorting problem the middle shape should be an SVG one, together with a PNG replacement.
Comment 4 Commit Notification 2017-04-26 16:37:42 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1b471124df251011b0053900cb82ceb0f3d8be86

tdf#107392 ODF import: fix z-order sorting of SVG images

It will be available in 5.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 5 vihsa 2017-05-31 04:59:36 UTC
verified.
version: 5.5.0.0.alpha0+ / build id : ec79f34 / android 5.1