Bug 129356

Summary: VIEWING: SVG image are incorrectly rendered (CSS combinators)
Product: LibreOffice Reporter: Do <domenico.l76>
Component: filters and storageAssignee: Xisco Faulí <xiscofauli>
Status: RESOLVED FIXED    
Severity: normal CC: buzea.bogdan, domenico.l76, stephane.guillou, xiscofauli
Priority: medium Keywords: filter:svg
Version: 5.3 all versions   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=156834
https://bugs.documentfoundation.org/show_bug.cgi?id=160373
Whiteboard: target:24.2.0 target:7.6.1
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 88278    
Attachments: Image with problem
Image without problem
the diferences here
minimized sample

Description Do 2019-12-12 22:38:22 UTC
Description:
Followup from bug: https://bugs.documentfoundation.org/show_bug.cgi?id=129218

Svg not correctly rendered, I verified is linked to css processing.

I'm going to add 2 version of the same image:
Luscher.svg --> rendered with problem
Luscher_LibreOffice --> correctly rendered

The problem doesn't affect windows versions

Steps to Reproduce:
1. add the 2 image
2. open the 2 image on browser
3. compare the rendering

Actual Results:
Luscher.svg --> rendered with problem
Luscher_LibreOffice --> correctly rendered

Expected Results:
both images should have the same rendering


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
Comment 1 Do 2019-12-12 22:39:56 UTC
Created attachment 156532 [details]
Image with problem

I encounter problem also in nautilus
Comment 2 Do 2019-12-12 22:40:32 UTC
Created attachment 156533 [details]
Image without problem
Comment 3 Do 2019-12-12 22:41:22 UTC
Followup from bug 129218
Comment 4 BogdanB 2019-12-13 16:10:07 UTC
I tested this images and on Version: 6.5.0.0.alpha0+ the problem is still here.
It's to early to check this?

Build ID: 693bdcc3a8c4e849c306b0187a5bf8ffe4ddb824
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2019-12-12_16:14:25
Locale: ro-RO (ro_RO.UTF-8); UI-Language: en-US
Calc: threaded
Comment 5 BogdanB 2019-12-13 16:10:56 UTC
Created attachment 156561 [details]
the diferences here
Comment 6 Do 2019-12-15 15:29:48 UTC
(In reply to BogdanB from comment #4)
> I tested this images and on Version: 6.5.0.0.alpha0+ the problem is still
> here.
> It's to early to check this?
> 
> Build ID: 693bdcc3a8c4e849c306b0187a5bf8ffe4ddb824
> CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
> TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time:
> 2019-12-12_16:14:25
> Locale: ro-RO (ro_RO.UTF-8); UI-Language: en-US
> Calc: threaded

The problem appears also in stable version.
Previous bug was opened on 6.3.3.2, Xisco Faulí asked to me to try on alpha version and reopen bug in case the problem persist.
Comment 7 Xisco Faulí 2019-12-19 09:18:53 UTC
Also reproducible in

Version: 5.2.0.0.alpha1+
Build ID: 5b168b3fa568e48e795234dc5fa454bf24c9805e
CPU Threads: 4; OS Version: Linux 4.15; UI Render: default; 
Locale: ca-ES (ca_ES.UTF-8
Comment 8 Xisco Faulí 2019-12-19 09:25:47 UTC
The problem is LibreOffice fails to read styles such as

<defs><style type="text/css"><![CDATA[
g#cross line{
    stroke: #888;
    stroke-width: 6;                                       
}
]]></style></defs>  

<g id="cross">                                         
        <line  x1="010" y1="132" x2="255" y2="132"   />    
</g>
Comment 9 Xisco Faulí 2019-12-19 09:26:12 UTC
Created attachment 156667 [details]
minimized sample
Comment 10 QA Administrators 2021-12-19 03:48:43 UTC Comment hidden (obsolete)
Comment 11 Hossein 2021-12-19 21:09:19 UTC
Still reproducible with attachment 156667 [details] in the latest LibreOffice 7.4 master: 

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 6ca94dbd576be7aaa643393e2a9e2ee1c723c357
CPU threads: 8; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

The result is that only 1 line is visible, but in Firefox and Chrome 2 lines are visible.

There are several CSS combinators, and it seems none of them are currently supported in LibreOffice.

CSS Combinators:
* Descendant selector (space)
* Child selector (>)
* Adjacent sibling selector (+)
* General sibling selector (~)
https://www.w3schools.com/css/css_combinators.asp
Comment 12 Xisco Faulí 2023-08-21 19:22:37 UTC
the text positioning of attachment 156532 [details] has been fixed with 8fa209ce2e800dc8a51e941cd42a65fa8b2eb14b.
The only remaining issue is to fix the css combinators such as "g#cross polygon". it works if it's changed to "#cross polygon"
Comment 13 Xisco Faulí 2023-08-21 19:23:50 UTC
(In reply to Hossein from comment #11)
> There are several CSS combinators, and it seems none of them are currently
> supported in LibreOffice.
> 
> CSS Combinators:
> * Descendant selector (space)

This is already supported

> * Child selector (>)

This one too
Comment 14 Commit Notification 2023-08-22 18:07:10 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#129356: handle css combinator when the element name is combined...

It will be available in 24.2.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 15 Commit Notification 2023-08-22 19:00:36 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/603e1a7563a8ab8900fc2d7b99fbc0522e815056

tdf#129356: handle css combinator when the element name is combined...

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.