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

"perspective" property must reject negative values #15449

Closed
upsuper opened this issue Feb 8, 2017 · 22 comments
Closed

"perspective" property must reject negative values #15449

upsuper opened this issue Feb 8, 2017 · 22 comments

Comments

@upsuper
Copy link
Member

@upsuper upsuper commented Feb 8, 2017

Spec: https://drafts.csswg.org/css-transforms-2/#perspective-property

(The spec says positive, but it should be non-negative... which is an issue of the spec.)

Relevant code: https://github.com/servo/servo/blob/master/components/style/properties/longhand/box.mako.rs#L1642-L1648

(Should be an easy one, but not clear what is the best way to fix. cc @Manishearth)

@BorisChiou
Copy link
Contributor

@BorisChiou BorisChiou commented Feb 8, 2017

The perspective matrix uses the parameter, d, to compute the matrix [1]: "-1/d", so zero should be unacceptable. However, IIRC, in Gecko, we treat prespective(0) as prespective(inf), so we still works on zero.

[1] https://drafts.csswg.org/css-transforms-2/#PerspectiveDefined

@upsuper
Copy link
Member Author

@upsuper upsuper commented Feb 8, 2017

We treat perspective(0) as perspective(inf), but we treat perspective: 0 as perspective: epsilon. Anyway, that happens in later place, so style system doesn't need to handle that. It just needs to reject negative value.

@BorisChiou
Copy link
Contributor

@BorisChiou BorisChiou commented Feb 8, 2017

I see. Thanks for clarification.

@Manishearth Manishearth added the E-easy label Feb 8, 2017
@highfive
Copy link

@highfive highfive commented Feb 8, 2017

Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the #servo channel in IRC.

If you intend to work on this issue, then add @highfive: assign me to your comment, and I'll assign this to you. 😄

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Feb 8, 2017

We just need to add parse_non_negative as the predefined type parse function there.

@ioctaptceb
Copy link

@ioctaptceb ioctaptceb commented Feb 8, 2017

@highfive: assign me!

@highfive
Copy link

@highfive highfive commented Feb 8, 2017

Hey @ioctaptceb! Thanks for your interest in working on this issue. It's now assigned to you!

@dcci
Copy link

@dcci dcci commented Feb 18, 2017

Sorry if I'm missing something obvious, but what's the policy for PR timeouts? If nobody is actually working on this I'd like to try implementing it.

@jdm
Copy link
Member

@jdm jdm commented Feb 18, 2017

It is good form to ask the person directly before starting to work on somethng. @ioctaptceb have you made any progress?

@dcci
Copy link

@dcci dcci commented Feb 25, 2017

ping?

@upsuper
Copy link
Member Author

@upsuper upsuper commented Feb 25, 2017

It seems @ioctaptceb doesn't respond after a whole week... This issue is now yours, @dcci :)

@upsuper upsuper added C-assigned and removed C-assigned labels Feb 25, 2017
@ioctaptceb
Copy link

@ioctaptceb ioctaptceb commented Feb 25, 2017

@dcci please go ahead!

@dcci
Copy link

@dcci dcci commented Feb 26, 2017

I was unsure how to test this one, so I asked on IRC.
Copying for the archives:

14:32 <@SimonSapin> davide: then add a testharness.js test in tests/wpt/mozilla/tests/css
14:32 <@SimonSapin> see tests/wpt/README.md for instructions
14:34 <@SimonSapin> use a style="…" attribute in HTML with an invalid value, and assert in JS that element.style.perspective is the empty string
14:36 <@SimonSapin> also try assigning a different value to
                    element.style.perspective, like assigning " 1Px" and see it
                    become "1px" when accessed again (which goes through the
                    parser and serializer)
@KiChjang
Copy link
Member

@KiChjang KiChjang commented Mar 14, 2017

@dcci What's the status of this?

@n0max
Copy link
Contributor

@n0max n0max commented Mar 22, 2017

@highfive: assign me

@highfive
Copy link

@highfive highfive commented Mar 22, 2017

Hey @n0max! Thanks for your interest in working on this issue. It's now assigned to you!

@highfive highfive added the C-assigned label Mar 22, 2017
@highfive
Copy link

@highfive highfive commented Mar 26, 2017

cc @emilio

@bholley bholley added the A-stylo label Mar 26, 2017
@wafflespeanut
Copy link
Member

@wafflespeanut wafflespeanut commented Mar 27, 2017

@n0max Did you start working on this? Need help?

@n0max
Copy link
Contributor

@n0max n0max commented Mar 27, 2017

I have already changed the parsing to non negative and created some test cases.
But the mozresource.pyc file was added to the MANIFEST.json and running ./mach update-manifest don't change anything. I'm currently try to fix this.
My changes are at commit.

@wafflespeanut
Copy link
Member

@wafflespeanut wafflespeanut commented Mar 27, 2017

Ah, just revert the manifest to the previous commit, update-manifest again and amend your changes to your current commit?

@jdm
Copy link
Member

@jdm jdm commented Mar 27, 2017

You will need to remove the the mozresource.pyc file before running update-manifest again.

@n0max
Copy link
Contributor

@n0max n0max commented Mar 27, 2017

Thank you, that worked.

bors-servo added a commit that referenced this issue Mar 29, 2017
Parse perspective property as non negative and add tests

<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15449  (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16157)
<!-- Reviewable:end -->
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.

You can’t perform that action at this time.