Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 493994

Summary: [HiDPI] Icon for Problem view error marker/overlay contains black pixels
Product: [Eclipse Project] Platform Reporter: Sravan Kumar Lakkimsetti <sravankumarl>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bsd, daniel_megert, Lars.Vogel, lshanmug, markus.kell.r, noopur_gupta, psuzzi, tmccrary
Version: 4.6Flags: daniel_megert: pmc_approved+
daniel_megert: review+
psuzzi: review+
Lars.Vogel: review+
Target Milestone: 4.6 RC3   
Hardware: All   
OS: All   
See Also: https://issues.apache.org/jira/browse/BATIK-1112
https://git.eclipse.org/r/73644
https://git.eclipse.org/r/73646
https://git.eclipse.org/r/73647
https://git.eclipse.org/r/73652
https://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=3f476c9430ebbc3c1096311e65e0e1fc6118ace9
https://git.eclipse.org/c/platform/eclipse.platform.git/commit/?id=993ec08ed52a021ed86f50e30e5dd9e5a2450bda
https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=46c1a14425159a90fd57892b70958571a39ff24d
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=f8a5cdd230a9e981c32407b153910b33a58d3c82
Whiteboard:
Attachments:
Description Flags
comparison of I20160518-2000 and I10260517-2000
none
Ant buildfile that removes the bad properties none

Description Sravan Kumar Lakkimsetti CLA 2016-05-19 06:18:37 EDT
Created attachment 261845 [details]
comparison of I20160518-2000 and I10260517-2000

Here is the comparison with I20160518-2000 and I20160517-2000 this is 200%
leftside screen shot is I20160518-2000. Please have look at the highlighted differences. 

One difference that stands out is error marker instead of white it is black. the other highlighted
Comment 1 Lakshmi P Shanmugam CLA 2016-05-19 07:04:04 EDT
The problems view error overlay problem happens even on Mac with retina display. The error appears as red with black instead of white.
Comment 2 Noopur Gupta CLA 2016-05-19 09:15:27 EDT
I20160518-2000

- Using Plug-in Image Browser and comparing:

/icons/full/dview16/problems_view_error@2x.png and /icons/full/dview16/problems_view_error.png

/icons/full/dview16/problems_view_warning@2x.png and
/icons/full/dview16/problems_view_warning.png

the error/warning marker is on the left in @2x icons instead of right.

- No @2x icon available for /icons/full/eview16/problems_view_info.png as there is no corresponding SVG yet (bug 479244).
Comment 3 Patrik Suzzi CLA 2016-05-19 10:38:53 EDT
I cropped the image: http://i.imgur.com/Wr0FVIG.png

Looking to bottom-left we see high-definition error-markers with a black cross.
To the bottom right, we see low-resolution ones with white cross (correct).

Seems the high-definition icons have the wrong background color, or we did not specify the transparent color properly.

(In reply to Noopur Gupta from comment #2)
> I20160518-2000
> - No @2x icon available for /icons/full/eview16/problems_view_info.png as
> there is no corresponding SVG yet (bug 479244).

Does this mean that resolving bug 479244 will solve this bug?
Comment 4 Markus Keller CLA 2016-05-19 11:41:54 EDT
I took https://git.eclipse.org/r/#/c/71351/ to generate the @2x icons, and I missed this problem.

Tony already mentioned this in bug 485757 comment #28:
> There are some issues with batik and how inkscape interpret styles.
> Inkscape's newer releases add a #000000 style to seemly random elements,
> causing visual errors to show up when rendered with batik. The zoom icons
> shouldn't be affected though.

The problems_view_error.svg is one of the icons that exhibit this bug in Apache Batik. I couldn't pinpoint the exact problem yet, but it looks like Batik only fails if an SVG <path> element's "style" attribute has its CSS properties in a specific order.

Everyone in the stack made huge design mistakes
- SVG uses a crazy XML syntax that embeds CSS in XML attributes
- XML only allows single-line attributes, which makes them hard to compare
- Inkscape writes the CSS properties in random order, making them hard to compare
- Batik apparently depends on the order of CSS properties

I'll try to find a solution for RC3.
Comment 5 Tony McCrary CLA 2016-05-19 13:15:46 EDT
I was thinking about adding mojo that just checks for the broken configuration, that way in the future it'll be harder for these svg files to slip in. It could optionally be part of rendering, I imagine parsing and validating every icon will be fairly expensive.
Comment 6 Dani Megert CLA 2016-05-19 14:29:39 EDT
(In reply to Patrik Suzzi from comment #3)
> Does this mean that resolving bug 479244 will solve this bug?

No.
Comment 7 Markus Keller CLA 2016-05-20 09:00:53 EDT
Found it:

In problems_view_error.png, there's a <path> with a "style" attribute that contains CSS properties.

Batik can't deal with the "-inkscape-font-specification:Sans" property. If that property appears in front of the "fill:#ffffff" property, then the latter is skipped, and apparently the default value that gets used in that case is black.

I've checked other SVGs with that property, but not all of them seem to be affected.

These are the ones I found to be affected:

error_co.svg
info_tsk.svg (missing white gradient on the right side of the 'i')
problems_view_error.png
quickfix_error_obj.svg

The fix is to search for this regex and replace with \1:

-inkscape-font-specification:[^;"]*;([^"]*fill:)


Tony, what's your current state? Is https://git.eclipse.org/r/#/c/71351/ otherwise ready to go, or do you have more pending changes that have not been pushed yet? Shall I rebase that Gerrit, add the changes, push it, and re-generate the @2x icons?
Comment 8 Markus Keller CLA 2016-05-20 10:18:30 EDT
Apache Batik bug:
https://issues.apache.org/jira/browse/BATIK-1112

We should remove all problematic CSS properties. I didn't find any other properties that start with a "-", and properties at the end of the attribute are harmless (e.g. those generated by older versions of Inkscape)

Regex to find matches to remove:

-inkscape-font-specification:[^;"]*;
Comment 9 Tony McCrary CLA 2016-05-20 11:02:40 EDT
Yes, please rebase. There aren't any more changes at the moment. Thanks!
Comment 10 Markus Keller CLA 2016-05-20 11:05:24 EDT
Created attachment 261903 [details]
Ant buildfile that removes the bad properties

This could be set up as builder in the Eclipse project. There's probably a way in Maven/m2e to do something similar, but I'm not up to speed there.
Comment 11 Markus Keller CLA 2016-05-25 14:18:11 EDT
Added and ran Ant script that removes problematic
"-inkscape-font-specification:" properties that break Batik rendering:
http://git.eclipse.org/c/platform/eclipse.platform.images.git/commit/?id=f7c728a90d348b04a2a011d168916f4b1ee5a9c9

Gerrits for the broken @2x icons follow.
Comment 12 Eclipse Genie CLA 2016-05-25 14:20:36 EDT
New Gerrit change created: https://git.eclipse.org/r/73644
Comment 13 Eclipse Genie CLA 2016-05-25 14:29:45 EDT
New Gerrit change created: https://git.eclipse.org/r/73646
Comment 14 Eclipse Genie CLA 2016-05-25 14:30:18 EDT
New Gerrit change created: https://git.eclipse.org/r/73647
Comment 15 Eclipse Genie CLA 2016-05-25 14:47:41 EDT
New Gerrit change created: https://git.eclipse.org/r/73652
Comment 16 Markus Keller CLA 2016-05-25 14:50:04 EDT
I did not include /org.eclipse.ui/icons/full/obj16/info_tsk@2x.png in the patch, since the gradient on the new icon didn't look good at this size. This will be fixed via bug 479244.
Comment 17 Dani Megert CLA 2016-05-25 15:13:49 EDT
We can wait for more reviews, but +1 as PMC to have this in RC3.
Comment 22 Markus Keller CLA 2016-05-25 16:08:22 EDT
Thanks Dani. I've pushed the changes. Another review or a verification in tonight's build would still be welcome.
Comment 23 Patrik Suzzi CLA 2016-05-25 20:00:00 EDT
Reviewed, ok on all repositories.