Bug 47262

Summary: FILEOPEN: SVG: xlink:href in radialGradient/linearGradient doesn't work if referred element hasn't been parsed yet
Product: LibreOffice Reporter: sasha.libreoffice
Component: DrawAssignee: Xisco Faulí <xiscofauli>
Status: RESOLVED FIXED    
Severity: normal CC: alexpikptz, bfo.bugmail, h3734236, raal, stgohi-lobugs, vsfoote, xiscofauli
Priority: medium    
Version: 3.3.4 release   
Hardware: All   
OS: All   
Whiteboard: target:5.2.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 88277    
Attachments: test case of svg file importing
reduced document
another sample

Description sasha.libreoffice 2012-03-12 23:10:54 UTC
Created attachment 58351 [details]
test case of svg file importing

To reproduce this problem: 
0. Start LibreOffice
1. File->Open, select file vochito.svg
Expected: color gradients in picture are correct
Actually: color gradients are grey 

Reproduced in 3.3.4 and 3.5.0 on Fedora 64 bit
Comment 1 bfoman (inactive) 2012-08-09 12:06:41 UTC
Confirmed with:
LO 3.5.5.3 
Build ID: own W7 debug build
Windows 7 Professional SP1 64 bit

A lots of problems with color gradients (headlights, engine cover, wheels, backlights etc.).
Comment 2 Alexandr 2014-07-19 12:49:54 UTC
Reproducible with LibreOffice 4.2.5 and 4.3.0 on Debian x86_64.
Comment 3 V Stuart Foote 2015-01-10 19:37:23 UTC
On Windows 7 sp1, 64-bit en-US
Version: 4.4.0.2
Build ID: a3603970151a6ae2596acd62b70112f4d376b990
Locale: en_US

The SVG Insert -> Image filter renders this correctly.
 
The SVG fileOpen filter (Draw) does not.
Comment 4 Xisco Faulí 2015-11-10 14:39:52 UTC
Created attachment 120455 [details]
reduced document

In the reduced document the radialGradient contains a xlink:href= to #linearGradient4134" which is a linearGradient.
The problem is that the linearGradient is defined in the document after the radialGradient in the document so it fails to find it at http://opengrok.libreoffice.org/xref/core/filter/source/svg/svgreader.cxx#222 as the linearGradient hasn't been parsed yet
Comment 5 Xisco Faulí 2015-11-10 14:46:50 UTC
*** Bug 95652 has been marked as a duplicate of this bug. ***
Comment 6 Xisco Faulí 2015-11-10 14:53:57 UTC
Change summary accordingly
Comment 7 Xisco Faulí 2015-11-16 17:16:10 UTC
Created attachment 120581 [details]
another sample
Comment 8 Robinson Tryon (qubit) 2015-12-09 18:52:40 UTC Comment hidden (obsolete)
Comment 9 A (Andy) 2015-12-19 21:57:25 UTC
Reproducible with LO 5.0.3.2, Win 8.1
Comment 10 Commit Notification 2016-01-11 08:53:36 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#47262 SVG: Parse gradient styles twice if the referred...

It will be available in 5.2.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.