Re: Utility of background-composite and background-blend-mode?

On Tue, Mar 5, 2013 at 7:45 PM, Rik Cabanier <cabanier@gmail.com> wrote:

> If you follow the spec [1], each background image is drawn during the step
> '2. background image of element'. The background that is available for the
> blend operation at that time is everything up to an ancestor that created a
> stacking context.


Hmm. I see that the spec says "Everything in CSS that creates a stacking
context <http://www.w3.org/TR/CSS21/zindex.html> must be considered a
group." I don't like that. An ancestor that created a stacking context just
because it's absolute-positioned with z-index not 'auto' shouldn't impact
blending and shouldn't create an isolated group; it'll create a performance
penalty for existing Web content.

You also say "In SVG, every element must create a group. This seems costly
but implementations can optimize this by not treating elements with default
arguments as groups." You also need to check that the element doesn't
contain any descendants that use non-default blending. This can be done but
it could be costly.

BTW I noticed that you require clip-to-self behavior for compositing. This
is tricky because it means you have to define for everything that can be
rendered by CSS exactly what the clip-to-self shape is, and it's not always
obvious. For this reason we adopted non-clip-to-self behavior for canvas.

BTW^32 knockout groups are subtle and under-defined because an "element"
doesn't correspond one-to-one with actual drawing operations. For example,
if I have an element with a background, border and outline, all of which
overlap, does the border knock out the background? Does the outline knock
out the border? Note that there could be other content between the border
and the outline in z-order.

Getting back to the point of this thread: it seems to me that
background-composite and background-blend-mode are not that useful if we
have mix-blend-mode and mix-composite. You can do the same sorts of
effects, just with more markup. With Web Components and intelligent use of
pseudo-elements, you might not even need more markup. I think I'm still in
favour of eliminating background-composite and background-blend-mode.

Rob
-- 
Wrfhf pnyyrq gurz gbtrgure naq fnvq, “Lbh xabj gung gur ehyref bs gur
Tragvyrf ybeq vg bire gurz, naq gurve uvtu bssvpvnyf rkrepvfr nhgubevgl
bire gurz. Abg fb jvgu lbh. Vafgrnq, jubrire jnagf gb orpbzr terng nzbat
lbh zhfg or lbhe freinag, naq jubrire jnagf gb or svefg zhfg or lbhe fynir
— whfg nf gur Fba bs Zna qvq abg pbzr gb or freirq, ohg gb freir, naq gb
tvir uvf yvsr nf n enafbz sbe znal.” [Znggurj 20:25-28]

Received on Wednesday, 6 March 2013 02:07:17 UTC