Re: Specifying mask type for <mask> elements

Hi Brian,

On Sep 26, 2012, at 6:11 PM, Brian Birtles <bbirtles@mozilla.com> wrote:

> (2012/09/27 1:03), Dirk Schulze wrote:
>> Hi,
>> 
>> I thought about adding the optional keywords 'alpha','luminance' to a <mask> reference again. It is not possible to differ between an image reference and a mask reference at parse time. As an example:
>> 
>> mask: url(test.svg#fragment) alpha;
>> 
>> The parser realizes that the reference is a valid URL. But the fragment can either point to a resource (mask, clipPath, linearGradient, radialGradient, pattern) or graphical element (rect, circle, path,…). The document might not reachable at all.>
> 
> I was under the impression that CSS Images didn't referring to, e.g. 
> "url(test.svg#rectElem)"? You should use element() for that. The text in 
> CSS4 Images simply talks about the url() syntax referring to an image 
> file, not a fragment.[1]
CSS4 Images just forgets one very important use case that is not covered by media fragments as well: SVG stacks [1]. Mozilla and Opera support them. I would like to see them in WebKit as well, but didn't have time to look at this. CSS Images is a bit behind real world :) (not really since it belongs to SVG). A SVG stack would be treated as CSS Image by the way.

> 
> Hence, the note (Issue 4 currently) in the masking spec.[2]
> 
> We had implementation feedback that said that if you have to look up the 
> fragment and determine what type of element it was before deciding if 
> you can use normal CSS image processing or not that would be difficult 
> and not performant. So we wanted a way to determine at parse time how to 
> treat the resource.
Not how to treat the resource! It is not possible to know which kind of resource you have, unless you downloaded and parsed it. This is not done in the parsing step, but afterwards. Therefore we need to make sure that the syntax is independent of the actual resource type. That is why I would like to have the same syntax on '<mask>' resources as for <mask-image> types.

> 
> The current proposal is that if you have url() and a '#' then you abort 
> CSS image processing and treat it as a <mask> or whatever. Otherwise you 
> can just treat it as a CSS image.
That wouldn't even be possible with CSS images, which accepts media fragments (e.g #xywh=…).

> 
>> But while the above syntax would be correct for a reference to a graphical element, it is incorrect if it references a mask resource.
>> 
>> I suggest adding these keywords again to be consistent with the behavior of parsers.
>> 
>> The problem is, that it still does not make sense for most <mask> elements to let the masked object decide about the 'mask-type'. A mask mostly just good for one think: luminance or alpha masking. We could ignore the keywords in the case of a <mask> reference.
> 
> It's not impossible to have a mask that is useful in both ways (e.g. a 
> circle with a radial gradient applied), but yes, definitely rare.
Agree.

> 
> I'm ok with adding the keywords back, but I don't think we should ignore 
> them.
Ok, so we add 'auto' to the mask-type property, but keep 'luminance' as default?

Greetings,
Dirk


[1] http://simurai.com/post/20251013889/svg-stacks

Received on Thursday, 27 September 2012 02:42:05 UTC