Bug 94765 - FILEOPEN: SVG: URL fails is the reference is not in the mapper (gradients/patterns) ( see comment 17 )
Summary: FILEOPEN: SVG: URL fails is the reference is not in the mapper (gradients/pat...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.0.2.2 release
Hardware: Other All
: medium normal
Assignee: Xisco Faulí
URL:
Whiteboard: target:6.4.0 target:6.3.3
Keywords: filter:svg
Depends on:
Blocks: SVG-Import
  Show dependency treegraph
 
Reported: 2015-10-04 20:51 UTC by Iandol
Modified: 2019-11-20 16:33 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshot of 5.1alpha (355.11 KB, image/png)
2015-10-04 20:51 UTC, Iandol
Details
screenshot of expected rendering (84.34 KB, image/png)
2015-10-04 21:30 UTC, Iandol
Details
svg test file (840 bytes, image/svg+xml)
2015-10-04 21:32 UTC, Iandol
Details
URL is not supported inside style type="text/css"> (920 bytes, image/svg+xml)
2019-09-18 13:52 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Iandol 2015-10-04 20:51:52 UTC
Created attachment 119282 [details]
screenshot of 5.1alpha

I have a very simple test SVG with two boxes, one filled with yellow and the other filled with a very simple two-colour linear gradient, the linear gradient is drawn as filled black in Writer. I see bug #47439 but it seems to be about more complex linear gradients which render in the wrong direction and miss >2 colour points.
Comment 1 Iandol 2015-10-04 21:30:35 UTC
Created attachment 119283 [details]
screenshot of expected rendering

Expected rendering
Comment 2 Iandol 2015-10-04 21:32:34 UTC
Created attachment 119284 [details]
svg test file

SVG test file, the xml is:

[code]
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 width="841.9px" height="595.3px" viewBox="0 0 841.9 595.3" style="enable-background:new 0 0 841.9 595.3;" xml:space="preserve"
	>
<style type="text/css">
	.st0{fill:#FFF200;stroke:#FFF200;stroke-miterlimit:10;}
	.st1{fill:url(#SVGID_1_);stroke:#000000;stroke-miterlimit:10;}
</style>
<rect x="70.3" y="48.3" class="st0" width="332.5" height="278.6"/>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="432.1587" y1="340.3492" x2="770.254" y2="340.3492">
	<stop  offset="0" style="stop-color:#DBDBDB"/>
	<stop  offset="1" style="stop-color:#737373"/>
</linearGradient>
<rect x="432.2" y="214.2" class="st1" width="338.1" height="252.4"/>
</svg>
[/code]
Comment 3 Buovjaga 2015-10-08 08:22:44 UTC
Confirmed on insert to Writer.
Could not find a duplicate either.

Another recent report: bug 94588

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: f830600ece806ec365a4839e79afabe183c5e36d
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-10-06_22:49:09
Locale: en-US (fi_FI)
Comment 4 Xisco Faulí 2015-11-16 15:22:16 UTC Comment hidden (obsolete)
Comment 5 Xisco Faulí 2015-11-16 15:52:10 UTC
*** Bug 64276 has been marked as a duplicate of this bug. ***
Comment 6 Xisco Faulí 2015-11-16 15:54:47 UTC
*** Bug 78232 has been marked as a duplicate of this bug. ***
Comment 7 V Stuart Foote 2015-11-16 16:12:54 UTC
*** Bug 79854 has been marked as a duplicate of this bug. ***
Comment 8 Xisco Faulí 2015-12-09 17:00:31 UTC
*** Bug 53096 has been marked as a duplicate of this bug. ***
Comment 9 QA Administrators 2017-01-03 19:40:25 UTC Comment hidden (obsolete)
Comment 10 Iandol 2017-01-05 02:18:32 UTC
This bug persists in macOS LO5.3 (tested using my test.svg attached to this bug report).

Version: 5.3.0.1
Build ID: 3b800451b1d0c48045de03b5b3c7bbbac87f20d9
CPU Threads: 4; OS Version: Mac OS X 10.12.2; UI Render: GL; Layout Engine: new; 
Locale: en-GB (en_GB.UTF-8); Calc: group
Comment 11 QA Administrators 2018-01-06 03:31:31 UTC Comment hidden (obsolete)
Comment 12 Roman Kuznetsov 2018-12-16 20:37:35 UTC
still repro in

Version: 6.3.0.0.alpha0+ (x64)
Build ID: 3c964980da07892a02d5ac721d80558c459532d0
CPU threads: 4; OS: Windows 10.0; UI render: GL; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-12-12_03:38:09
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded
Comment 13 Xisco Faulí 2019-09-13 10:16:57 UTC
The summary < FILEOPEN: SVG: <style type="text/css"> isn't supported > is no longer true.
SVGIO supports <style type="text/css"> see https://opengrok.libreoffice.org/xref/core/svgio/source/svgreader/svgnode.cxx?r=b8db9688#207
However, 'st1' class contains an URL element fill:url(#SVGID_1_) pointing to id="SVGID_1_" and the library doesn't support that.
Comment 14 Xisco Faulí 2019-09-16 19:00:40 UTC
*** Bug 99562 has been marked as a duplicate of this bug. ***
Comment 15 Xisco Faulí 2019-09-18 10:52:38 UTC
*** Bug 127376 has been marked as a duplicate of this bug. ***
Comment 16 Xisco Faulí 2019-09-18 13:52:01 UTC
Created attachment 154261 [details]
URL is not supported inside style type="text/css">

as this SVG shows, fill="url(#SVGID_1_)" works if declared in the element but not if done inside the class
Comment 17 Xisco Faulí 2019-09-18 17:25:43 UTC
I found the reason why it's failing.
The svg files are read from top to bottom, so if we have something like

<style type="text/css">
    .st1{fill:url(#SVGID_1_);stroke:#000000;stroke-miterlimit:10;}
</style>

on top of the document, pNode in https://opengrok.libreoffice.org/xref/core/svgio/source/svgreader/svgstyleattributes.cxx?r=ec3a14ba#1339 is null because the element #SVGID_1 is not in the mapper yet.
Moving the style block to the bottom would fix the issue...
Comment 18 Xisco Faulí 2019-09-19 08:12:39 UTC
taking
Comment 19 Commit Notification 2019-09-19 11:53:18 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ab1479956568b0d9a6022133cf651f846293aa46

tdf#94765: SVGIO: Look for gradient/pattern ids once the file...

It will be available in 6.4.0.

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.
Comment 20 Frederic Parrenin 2019-09-20 12:10:25 UTC
I confirm that bug 103154 has been fixed in master.
Comment 21 Commit Notification 2019-09-25 08:35:05 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/commit/92267cdb1a45e1f40199136849feb692f7e06d0e

tdf#94765: SVGIO: Look for gradient/pattern ids once the file...

It will be available in 6.3.3.

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.
Comment 22 W7q9CiR4jA 2019-10-20 12:56:40 UTC
(In reply to Commit Notification from comment #21)
> Xisco Fauli committed a patch related to this issue.
> It has been pushed to "libreoffice-6-3":
> 
> https://git.libreoffice.org/core/commit/
> 92267cdb1a45e1f40199136849feb692f7e06d0e
> 
> tdf#94765: SVGIO: Look for gradient/pattern ids once the file...
> 
> It will be available in 6.3.3.
> 
> 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.

Just to inform on the positive results after using a patched version. On prior versions of Libreoffice, all Unifi/Ubiquiti SVGs in the following SVG pack were rendered mostly black:
https://help.ubnt.com/hc/en-us/articles/204911374-Ubiquiti-Icons-and-Images-for-Diagrams

Version: Nightly 2019/10/18 6.3.4.0.0+

There are still some issues with SVGs, but this particular one seems fixed. It is a shame that it appears impossible to make these SVGs useful in previous versions of Libreoffice. I have even created an extension, and still they are rendered mostly black.