Download it now!
Bug 100198 - Resolving of styles is incorrect in svg files with css * selector
Summary: Resolving of styles is incorrect in svg files with css * selector
Status: RESOLVED DUPLICATE of bug 99115
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: filter:svg
Depends on:
Blocks: SVG-Import
  Show dependency treegraph
Reported: 2016-06-02 21:58 UTC by sam tygier
Modified: 2019-09-13 10:39 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

tdf100198.svg (1.09 KB, image/svg+xml)
2016-06-02 22:18 UTC, sam tygier
tdf100198.svg in impress (6.62 KB, image/png)
2016-06-02 22:19 UTC, sam tygier
tdf100198.svg in firefox (4.64 KB, image/png)
2016-06-02 22:19 UTC, sam tygier
0001-tdf-100198-unit-test.patch (5.11 KB, patch)
2016-06-02 22:22 UTC, sam tygier

Note You need to log in before you can comment on or make changes to this bug.
Description sam tygier 2016-06-02 21:58:28 UTC
In bug 99994 it was found that there is a problem with resolving the style for an element where there is a CSS * selector rule. This originally manifested in a crash, as the call getFontFamily() would give different results on the first and second call. The patch on that bug fixes the crash, but does not resolve the underlying issue.

A full fix would resolve the crash even after reverting

(While that commit should be reverted for testing it is still useful, as it saves making multiple calls to a function that must traverse the svg style hierarchy).

With '*' CSS rules the style resolution can still be wrong, even with out causing a crash (see attached test). I suspect solving this amounts to the same thing.
Comment 1 sam tygier 2016-06-02 22:18:15 UTC
Created attachment 125463 [details]

An svg file with a "*" selector and some text elements with fill color set by multiple methods. The colors are not correct for some elements (compared to firefox and inkscape).
Comment 2 sam tygier 2016-06-02 22:19:19 UTC
Created attachment 125464 [details]
tdf100198.svg in impress
Comment 3 sam tygier 2016-06-02 22:19:54 UTC
Created attachment 125465 [details]
tdf100198.svg in firefox
Comment 4 sam tygier 2016-06-02 22:22:09 UTC
Created attachment 125466 [details]

A unit test using tdf100198.svg. This does not currently pass.

(git treats the svg file as binary, I am not how to prevent this)
Comment 5 Aron Budea 2016-06-03 05:22:19 UTC
Thanks for opening the followup report.
Confirmed with the new test file.
Comment 6 Xisco Faulí 2016-07-12 23:24:05 UTC
In order to investigate this issue, I reverted 68ccab350ca5b907f185c729e94a14df15fedc23, and I found that there 2 places where a new SvgStyleAttribute object is created for attachment 125233 [details]:

git grep -F "new SvgStyleAttributes(*this)" svgio/
svgio/source/svgreader/svgnode.cxx:                mpLocalCssStyle = new SvgStyleAttributes(*this);
svgio/source/svgreader/svgstylenode.cxx:                SvgStyleAttributes* pNewStyle = new SvgStyleAttributes(*this);

one for the element's style attribute like style="stroke:#000000;" and the other for the style node like:


Could it be the cause why

            const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();

                return pSvgStyleAttributes->getFontFamily();

ends up in an infinite loop where the parent points to its child?
Comment 7 QA Administrators 2017-10-30 08:33:29 UTC Comment hidden (obsolete)
Comment 8 sam tygier 2017-10-30 14:27:02 UTC
Still incorrectly rendered in:
Build ID: 22b09f6418e8c2d508a9eaf86b2399209b0990f4
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk2; 
Locale: en-GB (en_GB.utf8); Calc: group
Comment 9 Roman Kuznetsov 2018-06-20 14:01:16 UTC
still repro in LO 6.1 beta 2
Comment 10 QA Administrators 2019-06-21 02:53:01 UTC Comment hidden (obsolete)
Comment 11 sam tygier 2019-06-21 07:08:11 UTC
Still incorrectly rendered in:

Build ID: 2b840030fec2aae0fd2658d8d4f9548af4e3518d
CPU threads: 8; OS: Linux 5.1; UI render: default; VCL: gtk3; 
Locale: en-GB (en_GB.UTF-8); UI-Language: en-GB
Comment 12 Xisco Faulí 2019-09-13 09:25:54 UTC
*** Bug 103154 has been marked as a duplicate of this bug. ***
Comment 13 Xisco Faulí 2019-09-13 10:39:30 UTC
This is another regression from
Closing as RESOLVED DUPLICATED of bug 99115

*** This bug has been marked as a duplicate of bug 99115 ***