Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mask is too liberal in what it accepts #15772

Closed
Manishearth opened this issue Feb 28, 2017 · 7 comments
Closed

mask is too liberal in what it accepts #15772

Manishearth opened this issue Feb 28, 2017 · 7 comments

Comments

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Feb 28, 2017

alpha padding-box url(404.png) border-box should not be accepted for mask, but it is.

cc @canaltinova

@canova
Copy link
Member

@canova canova commented Mar 1, 2017

It's not clear to me why mask-origin and mask-clip must come consecutively. Grammar of mask says they can come in any order but both firefox and chrome don't accept it

<mask-layer> = <mask-reference> || <position> [ / <bg-size> ]? ||<repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>

First <geometry-box> is mask-origin and second one is mask-clip property. According to this, sequence is not important. I can make this work like firefox and chrome but I couldn't find an explanation about this in spec. Am I missing something?

@Manishearth
Copy link
Member Author

@Manishearth Manishearth commented Mar 1, 2017

@dbaron should this be a spec bug or a firefox/chrome bug?

@bzbarsky
Copy link
Contributor

@bzbarsky bzbarsky commented Mar 2, 2017

The parsing code in Gecko has this comment:

    // The spec allows a second box value (for background-clip),
    // immediately following the first one (for background-origin).

(see CSSParserImpl::ParseImageLayersItem, which is used by mask layers too).

Did the spec quietly change at some point? I'm having a hard time believing that both @dbaron and I misread this in 2013 when he fixed https://bugzilla.mozilla.org/show_bug.cgi?id=570896

Note that https://bugzilla.mozilla.org/show_bug.cgi?id=1188074 exists too. Though that claims that Chrome's behavior doesn't match ours for background...

@dbaron
Copy link
Contributor

@dbaron dbaron commented Mar 2, 2017

The spec changed in January 2014. I vaguely recall a discussion, although it's not linked from that changeset.

Note that I also filed w3c/fxtf-drafts#118

@dbaron
Copy link
Contributor

@dbaron dbaron commented Mar 2, 2017

(But if Firefox and Chrome both match the old spec, at this point we should probably consider changing the spec back. Do they?)

@canova
Copy link
Member

@canova canova commented Mar 4, 2017

I've tried only this certain example in Chrome earlier. After trying different cases, it looks like Chrome doesn't accept sub-properties apart from mask-reference.(this was previous spec behavior, I guess) I couldn't see any issue about the mask shorthand in Chrome issue tracker either.
(But in background shorthand, Chrome accepts non-consecutive background-origin and background-clip, Firefox doesn't.)

@upsuper
Copy link
Member

@upsuper upsuper commented May 25, 2017

FWIW, Chrome supports the new spec. A simple testcase:

<!DOCTYPE html>
<style>
div { -webkit-mask: url(404.png) border-box repeat padding-box; }
</style>
<script>
document.write(document.styleSheets[0].cssRules[0].cssText);
</script>

I'm going to change Gecko's behavior to match the spec in bug 1188074 also for behavior of background shorthand. So closing this issue.

@upsuper upsuper closed this May 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.