Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement serialization of transform functions #15194
Comments
|
Please make a comment here if you intend to work on this issue. Thank you! |
|
Am working on now! |
|
Great! Please ask questions here if there is anything unclear. |
|
It looks like we are implementing serialization of the specified transforms, not the computed ones. If that is correct, it looks like we are discarding needed information to regenerate the original specified transforms in parse. Should I then modify the specified data structures to retain the necessary information and drop it into the compute section? |
|
Nah. It is okay to drop info during computing. Should parse+compute back to the same computed value. |
|
Advice requested: when should I use enum SpecifiedOperation {
Matrix(SpecifiedMatrix),
Skew(specified::Angle, specified::Angle),
Translate(TranslateKind,
specified::LengthOrPercentage,
specified::LengthOrPercentage,
specified::Length),
Scale(CSSFloat, CSSFloat, CSSFloat),
Rotate(CSSFloat, CSSFloat, CSSFloat, specified::Angle),
Perspective(specified::Length),
}For example, currently there is: |
|
Whenever the type is not copyable. The length ones and perhaps the angle ones aren't. It's okay to use an unnecessary ref. |
|
How would I properly test this using the css-tests? Currently I am trying |
|
I don't think there's a way to step around the verbose summary -- it only outputs a list of things which have changed. You can get a shorter (but still verbose) summary via I'm unsure if those tests actually contain any serialization tests. Create a new one in wpt if you can't find one (via |
|
The verbose summary is caused by #15193. |
|
I’m starting to get stuff to work! There is an issue: the current implementation expresses |
|
Per spec, and other major browsers' behavior, I think for specified value, the original unit should be preserved. (That said, This means you'll probably also need to change some of the parsing code to preserve the units. In addition to that, it seems that Servo is currently normalizing For computed value... I guess it doesn't really matter, because we don't need to serialize transform functions in their original form for value returned by |
|
Previous work and reviews are in #15508 |
|
cc @emilio |
|
@upsuper I would like to work on this. What is the best way to start? |
|
I can't figure out how the impl would look like. :( Can you please write a complete impl block? |
|
Though, that may fall afoul of the covered rule, hm. |
|
Why not just |
|
They want it to be usable in other cases too, without forcing a borrow. But yes, that's a decent solution. |
|
Who's "They", if I can ask? And what's the use case? |
|
I think having |
|
Right, but what's the use case for |
|
Just ergonomics. But yeah, not much of a use case, |
|
And apologies, didn't know that usage of "they" as a gender-neutral, singular pronoun (I'd have expected a mention, "the assignee" or something like that). Didn't want to be mean :) |
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
|
Thanks for your help. I looked up how |
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
Implement serialization for transform functions. Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes #15194 <!-- 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 #15194 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/16242) <!-- Reviewable:end -->
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
Implement serialization for transform functions. Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes #15194 <!-- 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 #15194 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/16242) <!-- Reviewable:end -->
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
Implement serialization for transform functions. Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes #15194 <!-- 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 #15194 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/16242) <!-- Reviewable:end -->
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
Implement serialization for transform functions. Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes #15194 <!-- 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 #15194 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/16242) <!-- Reviewable:end -->
Preserve more information from transform function parsing. Preserve angle unit while parsing. Simplify SpecifiedMatrix. Use the write! macro for formatting with a helper called Css. Implement ToCss for &T if T implements ToCss. Add some tests and update others. closes servo#15194
stylo: Implement -moz-transform property -moz-transform property is an alias shorthand property. It has transform as sub-property but their parsing is different in some cases(matrix/matrix3d). -moz-transform also accepts LengthOrPercentage in the nondiagonal homogeneous components of matrix and matrix3d. It looks like length and percentage values are getting computed to number directly. For example 120px converts into 120 and calc(120px + 20%) converts into 140. So I did like this. But we need to check this behavior again to be sure, I guess. Also I spent half day investigating why matrices are not serializing after this change and found out their ToCss functions is not completely implemented yet😄 I was going to implement them but there is an easy issue about it(#15194) so I left it that way. Probably all tests won't pass without it. --- <!-- 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 #16003 and [Bug 1351356](https://bugzilla.mozilla.org/show_bug.cgi?id=1351356) <!-- 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/16231) <!-- Reviewable:end -->
Currently, only serialization of
translate()function is implmeneted. We should have the rest implemented as well.Spec: https://drafts.csswg.org/css-transforms/#serialization-of-transform-functions
The relevant code is https://github.com/servo/servo/blob/master/components/style/properties/longhand/box.mako.rs#L1183-L1237
(I think this is an easy one, but not sure. cc @Manishearth)