We want to implement ResourceLoader module to ship CSS for sets of SVG+PNG icons to the user. This has been in the works for a while now at https://gerrit.wikimedia.org/r/#/c/165922/ , I'm filing this task to have a place to dump assets and tests and such, and point people to.
Description
Details
| Subject | Author | Repo | Branch | Lines +/- | |
|---|---|---|---|---|---|
| ResourceLoaderImageModule for icons | Trevor Parscal | mediawiki/core | master | +758 -10 | |
| Demo for ResourceLoaderImageModule | Bartosz Dziewoński | mediawiki/core | master | +182 -0 |
Event Timeline
Trevor's rasterization test: https://github.com/trevorparscal/colorize (check out the rsvg branch too: https://github.com/trevorparscal/colorize/tree/rsvg).
Effect: the default behavior sucks. Using ImageMagick and rsvg, respectively, we get icons mangled in different funny ways:
| ImageMagick | rsvg |
However, it can be easily worked around. ImageMagick just needs some command-line options, rsvg needs massaged input data.
| ImageMagick, tweaked | rsvg, tweaked |
Problem: SvgHandler doesn't allow us to do either of these things. Needs some refactoring.
Change 165922 had a related patch set uploaded (by Bartosz Dziewoński):
ResourceLoaderImageModule for icons
When testing please keep in mind image magick quality varries considerably depending on if it was compiled against rsvg or not.
Also, if the goal here is to have these images rasterized dynamically, I'm not sure if that's a good idea:
*Not all people have either image magick or rsvg installed
*I believe I've seen people who have image magick installed, with it compiled to use rsvg, but don't have the shared librsvg library installed, resulting in an error whenever image magick is fed an svg
*Hard to control for quality when different users will have different software, and different versions/compile time options of the software installed
Huh, so ImageMagick can act like a wrapper for rsvg? Curious, I didn't know that.
The rasterized images are only used by browsers that can't handle SVG, and there aren't that many of them anymore. Without dynamic rasterizatiom we'd have to take care of somewhere between one and ten additional copies for each image.
Hmm. If its just obscure browsers that need the png fallback, then its probably fine to assume that mediawiki can render them dynamically.
Well, IE7 isn't "obscure" but it's not widely used. :-) Do we have a list of the browsers that would need PNGs and a rough number for their usage?
ImageMagick's use of RSVG is cool - but the reason we were trying to get ImageMagick to output acceptable quality (using super sampling and sharpening) was to support the minimum requirements of MediaWiki for "rendering thumbnails", as stated on mediawiki.org. RSVG support is indeed a great thing to have both for performance and quality reasons.
Do we have a list of the browsers that would need PNGs and a rough number for their usage?
The ones that are not supported by http://pauginer.com/post/36614680636/invisible-gradient-technique – that post mentions IE<=9, Firefox<=3.5 and some old Android browsers. The full list of browsers that need PNG is the browsers that don't support http://caniuse.com/#feat=multibackgrounds or http://caniuse.com/#feat=css-gradients .
So, this would be mostly IE8 and below users – maybe 3% of worldwide usage, and less by the time MediaWiki 1.25 ships. Theoretically we could modify the MW release tarballs to ship with the PNGs available if it's a problem, but I'm not convinced it's needed. Let's address that come the RCs if someone finds it problematic in the real world.
Change 178560 had a related patch set uploaded (by Bartosz Dziewoński):
Demo for ResourceLoaderImageModule
Change 178560 abandoned by Bartosz Dziewoński:
Demo for ResourceLoaderImageModule
Reason:
Proof of concept, not intended to be merged.
So Idf6ff4 is merged; can this be marked as Resolved? If so, are the "blocking" tasks not really blocking, or is there a subsequent implicit part of this task ("… and use it") which isn't yet fixed?
The "blocking" tasks are blocking releasing this as part of a new MediaWiki version. They make the module unusable by third-parties without replicating WMF configuration.
(Perhaps not T76477: Create a variant of SvgHandler suitable for ResourceLoaderImage, but the other two do.)



