New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG and CSS display:contents #305
Comments
This is a good question, but I think the easiest solution is to follow both specs as written. Hypothetically, if
All of this is very complicated, and of questionable utility. The only use case that I could see is being able to turn off SVG rendering mode on an I am therefore inclined to follow the SVG spec as written (and the Gecko implementation), and say that For
An SVG canvas is a "replaced element" for the purpose of the CSS box tree, so |
On Mon, Feb 13, 2017 at 12:02 PM, Amelia Bellamy-Royds ***@***.***> wrote:
This is a good question, but I think the easiest solution is to follow both specs as written.
I disagree. ^_^ While SVG isn't specced as working with the CSS box
model (instead hooking into 'display' directly to do something
similar), it's not hard to imagine how it would be implemented, and
putting SVG on the box model is still one of my long-term goals. I
believe we should act in a way that's consistent with that long-term
goal. I do have slightly different opinions on how to do so, tho:
* on a root <svg>: nothing displays. The SVG elements generate some
special kind of box, that I think only knows how to render if there's
an svg-canvas ancestor box. Take that away, and they can't display.
They don't magically become block or inline boxes.
* on a grouping element (nested <svg> or <g>): the
transform/filter/etc that element would apply is ignored, same as you
suggest.
* on a shape element: I'm inclined to say that nothing renders,
because I think it's reasonable to state that, at the language level,
shapes suppress the generation of boxes below them. In other words,
identical to display:none, because shape elements *only* generate
their own box anyway; children are always suppressed.
* on a text element: nothing renders - like the relationship of svg
boxes to an svg-canvas ancestor, I think svg inline text needs an
svg-text ancestor to render. Remove that, and it's suppressed.
* on anything else: nothing happens, because they don't generate boxes anyway.
The end result is that display:contents and display:none end up almost
identical, except display:contents "unwraps" a wrapper element.
~TJ
|
Okay, so @tabatkins and I added an appendix to the Display module to break down all of this for discussion: https://drafts.csswg.org/css-display/#unbox Comments/suggestions welcome. CSSWG thread still at w3c/csswg-drafts#540 |
The CSS WG just discussed this; see the IRC log. The resolution was:
|
So to confirm, that means that |
Yes, as it's a replaced element in the outer page's context (and there's no good answer for what to do with the contents of the SVG if we did just strip the wrapper). |
This has been resolved in CSS WG and I don't think there is anything required from SVG WG. This is certainly not blocking updated 2.0 CR publication. Closing the issue |
While implementing display:contents in Blink, we encountered the question of whether display:contents means an SVG node should be rendered or not. The current draft says all other values than display:none should be rendered [1], but we assume this statement pre-dates the introduction of display:contents. Gecko, which already shipped display:contents, do render SVG nodes for display:contents.
[1] https://svgwg.org/svg2-draft/render.html#VisibilityControl
The text was updated successfully, but these errors were encountered: