Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport a subset of SVG #12973
Support a subset of SVG #12973
Comments
|
cc @jrmuizel |
|
I am working from the assumption that https://www.w3.org/TR/SVG11/ is the specification to care about at this point. |
|
@nical has been doing some awesome work in Rust around an SVG implementation, at least as of our discussions in London: |
|
@nical's renderer is part of the work. I'm filing issues for the DOM and layout infrastructure surrounding that which will allow us to run representative benchmarks. |
|
@SimonSapin has a parser already working that he was using for some experiments. |
|
I have a a parser for the micro-syntax of I have written https://github.com/SimonSapin/victor/blob/master/src/svg/README.md about the state of SVG specifications as of a couple months ago. Last time I discussed this with Jack we talked about using moz2d to render SVG to a pixel buffer, and give that to WebRender to treat as an image. I’m not sure how this would help with confidence in WebRender. @pcwalton, @glennw, my understanding is that WebRender’s strategy is to not support arbitrary 2D graphics but specialize in CSS things like axis-aligned rectangles with rounded corners. Has that changed? (That is, would you want WebRender to support enough primitives to render SVG without something like moz2d?) Or more generally, what do you think is a good strategy to implement SVG in a browser that uses WebRender? |
|
|
For this to be a valuable experiment for the gecko-webrender integration it's important for the implementation to be as webrendery as possible. A basic sketch of what this would like is as follows:
|
|
That seems like a reasonable way forward. @jrmuizel I think when we last discussed this you suggested that we could use something "off the shelf" for the geometry rasterization part? |
|
@jrmuizel I like that plan. |
|
For now, it's probably best just to use Skia or Cairo for the geometry rasterization part. Both of these have fairly fast software rasterizers and support stroking and dashing In the future we could experiment with something more sophisticated like Direct2D's rasterize to geometry approach or something else. However, that work is relatively well contained and as long as the majority of webcontent isn't going through this path I don't expect it to be a bottleneck that we need to care about in the near term. |
|
Since I am mentioned here, the SVG work I have been doing is in the lyon repository. For now it mostly does one thing: provide tools to build and tessellate flattened path fill operations. It only generates triangles, and the renderer using it is responsible for uploading/displaying the geometry. I am very happy with the how the tessellator is working out, although since I am doing this entirely in my spare time, it is progressing very slowly (If anyone is interested in helping out it would be great). There's also a (work in progress) toy stroke tessellator that is simple but does not handle transparent overlapping geometry (overlapping pixels will be drawn twice instead of once). The repo is split into small crates, some of which may be useful even when not using the tessellators:
Edit: I should mention that the tessellator only implements the even-odd fill rule at the moment, and that vertex-aa is not yet implemented (a bring your own anti-aliasing party for now). I'll eventually add whatever svg feature is missing when I have time. |
|
It's my understanding we should be working from https://svgwg.org/svg2-draft/ |
|
SVG 2 is now at CR, so is in principle now done. It makes a fair bit of stuff in SVG 1.1 optional, which also seems useful for this use-case. :) |
|
Just a note that the SVG2 working group didn't have its charter renewed, and its future may be in doubt. (Those minutes also link to a spreadsheet where browsers declared intent on SVG2's proposed features.) As far as removing features, though, probably good enough. The WHATWG HTML5 spec has notes on conforming SVG features, but those were me researching what current browsers supported/didn't support. I'd be the first to say they should be challenged by any further knowledge. |
|
A lot of WPT tests want to see the SVG script element working. |
We need to start experimenting with SVG support in order to have more confidence in using WebRender for Gecko. This issue will serve as a tracking metabug for that work. Our goal is to implement the smallest subset possible, such that particular testcases look correct. We should hide this behind feature flags to avoid exposing a half-baked SVG implementation to web content.