Re: [css-masking] 'mask' with resource and image references (was: [css4-images] support for SVG Paint Servers without element())

On Nov 7, 2012, at 10:43 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

> On Wed, Nov 7, 2012 at 6:56 AM, Dirk Schulze <dschulze@adobe.com> wrote:
>> On Nov 7, 2012, at 4:24 AM, Robert O'Callahan <robert@ocallahan.org> wrote:
>>> On Wed, Nov 7, 2012 at 3:14 PM, Dirk Schulze <dschulze@adobe.com> wrote:
>>>> On Nov 6, 2012, at 5:06 PM, Robert O'Callahan <robert@ocallahan.org> wrote:
>>>>> Just remove the <mask-source> alternative. "mask:url(foo.svg#abc)" gets parsed to a mask-image value of url(foo.svg#abc). When rendering, since the mask-image value is a url() with a fragment identifier, it should be treated as a reference to an SVG <mask>.
>>>> 
>>>> This is difficult because of multiple reasons:
>>>> 
>>>> <mask-source> does not only allow URLs, but also the 'child' keyword and the child selector.
>>> 
>>> So add those separately as alternatives for mask-image.
>> 
>> That doesn't sound right for me. 'mask-image' should get CSS images IMO. Both, the keyword and the selector are just other ways to reference <mask> elements.
> 
> No, that's actually required.  I hadn't reviewed this carefully
> before, but roc is right.
> 
> The 'mask' property, as currently written, does not work.  'mask' is a
> shorthand, which means that it must *fully* expand into
> sub-properties.  Any behavior expressible via the shorthand *must* be
> expressible by an appropriate combination of the longhands as well,
> because the shorthand *disappears entirely* in the cascade.  It's
> more-or-less just a macro for the longhands.

You are right, this needs to change.

> 
> So, 'mask-image' needs to have its grammar revised to take this into
> account, so that it can take mask references as well.

This would be the consequence, but wouldn't help IMO.

mask-image: url(image#frag);

It would be unclear until the processing, if this is an SVG resource or an image. However, the syntax would be valid in both cases. The problem for WebKit is, that we already assume that this will be an CSS Image and already start creating an CSSImage resource. This is incompatible with an SVG resource (because of various reasons roc already mentioned). That's why this is not an option for WebKit right now.


> Alternately, we
> need an additional property which takes a mask ref, and overrides
> mask-image if specified (like list-style-type and list-style-image -
> the latter wins if it's not none).

This additional property would make sense from the logical point of view and seem to solve the issue described above, but doesn't help at all on the short hand:

mask: url(image#frag);

Is that 'mask-image'? 'mask-reference'? You can't say until you load the resource. So you can't distinguish between the both during the pure parsing process. This seems to be worst IMO.

Another name for the shorthand for the 'mask-*' properties on the other hand would work for all browsers.

Greetings,
Dirk

Received on Wednesday, 7 November 2012 20:46:14 UTC