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

On Nov 6, 2012, at 11:35 AM, Robert O'Callahan <robert@ocallahan.org> wrote:

> On Tue, Nov 6, 2012 at 2:56 PM, Dirk Schulze <dschulze@adobe.com> wrote:
>> Example:
>> 
>> mask: url(image.svg#id);
>> 
>> The URL needs to be checked if valid. In this case it needs o be checked if it is an SVG image. If it is, use SVG masking (with <mask>).
> 
> Since the URL has a fragment, this will always be treated as an SVG mask with an external resource document containing a <mask> element. There is no need to determine whether the image is an SVG image.
> 
>> Second example:
>> 
>> mask: url(image.svg#id), url(image2.svg#id);
>> 
>> Both references should be treated as SVG resources (references to SVG mask). But in this case the construct is parsed as an shorthand for 'mask-image'. All that makes parsing more difficult.
> 
> Why? The value of mask-image is "url(image.svg#id), url(image2.svg#id)". Both are interpreted as references to SVG <mask> elements. There's no problem.

The current syntax for 'mask' is : <mask-source> | <mask-layer>#

So it depends on the values passed to the property, if the 'mask-image' logic is used (same as for 'background'), or if we use SVG masking.

Given the fact that the syntax of <mask-source> and <mask-layer> can be the same, it is not possible to determine which path to take before finishing at least one parsing sequence (sequences determined by comma). I am not aware of other CSS properties that require finishing parsing before it can be determined what will happen after the parsing (and the parser would still need more information, see next paragraph). I can't speak for the CSS parser of Gecko, but for WebKit this would be a problem at the moment. It would be a lot easier to know which path we need to take before starting the parsing process.

And even the fragment itself is not a good identifier, url(image.png#frag) will be an image as well. And the file ending itself can not be trusted. The file doesn't need to have a file ending at all. Therefore, the fragment alone can not be used to clarify if it is a resource or an image. That is what I meant in the mail before. The CSS Parser would need extra information about the file then just the URL.

That's why I would prefer another shorthand for the 'mask-image' properties.

Greetings,
Dirk

> 
> Rob
> -- 
> Jesus called them together and said, “You know that the rulers of the Gentiles lord it over them, and their high officials exercise authority over them. Not so with you. Instead, whoever wants to become great among you must be your servant, and whoever wants to be first must be your slave — just as the Son of Man did not come to be served, but to serve, and to give his life as a ransom for many.” [Matthew 20:25-28]
> 

Received on Tuesday, 6 November 2012 20:35:53 UTC