Re: [svgwg] Opacity properties should affect nothing but opacity

> While I was working on http://codepen.io/TobiReif/pen/ZpERON , at 
some point I came across the issue - I set opacity (from CSS IIRC) and
 one or more items were suddenly overlapped by others. That is very 
bad SVG-user experience design. (Not sure why the issue appeared in an
 SVG using SVG1, perhaps the browser had jumped ahead to SVG2 in this 
aspect.)

As Nikos said, as long as you're relying solely on the default z-index
 (which SVG1 does, by definition), nothing ever changes order when you
 apply opacity/filter/etc.  That said, Chrome/Webkit does have a 
compositing bug (which we've had for a long time, because it's very 
hard/expensive to fix properly, tho we're finally getting to the point
 where we should be able to do it) where "composited" things (things 
which get put onto a separate GPU layer, due to things like 
opacity/filters/etc) can jump into the wrong visual layer. That's 
probably what you're hitting; it's got nothing to do with the spec at 
all.

That said, even in SVG2, what you're asking for is *actually 
impossible* (at least, not without a lot of fakery behind the scenes).
  The 'opacity' property, along with all the other visual effects like
 'filter' and such, are "group" properties - they apply to their 
entire subtree as a group, as if the subtree was painted into a canvas
 and then the visual effect was applied.  This is fundamentally 
incompatible with other items getting sandwiched inbetween elements of
 the group.  In some cases you can fake it - split the group in half 
and do the work on each half separately - but in the general (and 
relatively common) case, you can't; you'd get a noticeably different 
display from the splitting than you'd have without it.  CSS's 
situation isn't a mess, it's the logical consequence of mixing "group"
 properties with layer reordering.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at 
https://github.com/w3c/svgwg/issues/264#issuecomment-246432360 using 
your GitHub account

Received on Monday, 12 September 2016 17:51:21 UTC