Re: CSS Masking

Hi Rob,

On Aug 14, 2012, at 11:06 PM, Robert O'Callahan <robert@ocallahan.org> wrote:

> Is duplicating all the functionality of CSS backgrounds really necessary? Are there use-cases for all of it? Do you have any data on which features of -webkit-mask-* are actually used?

The approach of this specification is to specify the current behavior of browsers. Firefox supports SVG Mask and SVG ClipPath on arbitrary HTML content, WebKit has 'mask-image' (with the shorthand 'mask') and 'mask-box-image'. At least the WebKit properties are prefixed.

To your concerns: If you search for '-webkit-mask-box-image' (a property where I thought that it is to specific), you'll find 400,000 search entries at Google. These results are mainly on blogs, forums and articles. If you look at some of the latests entries, then you'll see questions about the usage of -webkit-mask on retina displays. So it looks like these properties are heavily used - even today. At least on the mobile marked. Since we have a lot of concentration on mobile, this seems to be a reasonable number.

To the functionality of background: If you look at the property definitions, you'll see that you can do a lot of things that are not _easily_ possible with SVG Masks. You can do patterns, stretch patterns of masks, stretch masks to match the size of the object and a lot more. Web-authors are already familiar with 'background' it makes a lot of sense to reuse the specification here instead of reinventing the wheel.

The last thing is the expectation of web authors. We have '-webkit-mask' properties for quite some time. They are used for mobile applications and websites for WebKit based browsers. You could use SVG mask as fallback, but not a lot of web-authors really do. If we redefine the 'mask' properties we would not match the expectation of web-authors.
It is also easier for implementors since the same parsing code from background and border-image can be reused for masking. Even the actual implementation is really easy since you can again reuse a lot of code. This makes it more likely that all browsers can implement this feature.

Greetings,
Dirk


> 
> Rob
> -- 
> “You have heard that it was said, ‘Love your neighbor and hate your enemy.’ But I tell you, love your enemies and pray for those who persecute you, that you may be children of your Father in heaven. ... If you love those who love you, what reward will you get? Are not even the tax collectors doing that? And if you greet only your own people, what are you doing more than others?" [Matthew 5:43-47]
> 

Received on Wednesday, 15 August 2012 16:10:57 UTC