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 upRefactor how we handle trait bounds in style_derive #18239
Conversation
07f470b
to
2aa8f3a
|
Overall looks good, got a few comments though. |
| pub enum MozLength { | ||
| LengthOrPercentageOrAuto(LengthOrPercentageOrAuto), | ||
| #[animation(error)] |
This comment has been minimized.
This comment has been minimized.
| Shape(BasicShape, Option<ReferenceBox>), | ||
| Shape( | ||
| BasicShape, | ||
| #[animation(equal)] |
This comment has been minimized.
This comment has been minimized.
emilio
Aug 26, 2017
Member
What about naming the attribute only_if_equal? Or error_if_unequal? Seems like it'd be clearer. And the last would be more consistent with animation(error).
| pub struct CalcLengthOrPercentage { | ||
| #[animation(equal)] |
This comment has been minimized.
This comment has been minimized.
emilio
Aug 26, 2017
Member
The semantics of this on ToAnimatedZero are quite different to Animate... I'm not sure how I feel about this.
| Keyword(TrackKeyword), | ||
| Keyword( | ||
| #[compute(clone)] | ||
| TrackKeyword, |
This comment has been minimized.
This comment has been minimized.
emilio
Aug 26, 2017
Member
I think it'd be easier to just impl ComputedValueAsSpecified for TrackKeyword in this case, any reason that cannot be done?
| pub enum T { | ||
| None, | ||
| #[animation(error)] |
This comment has been minimized.
This comment has been minimized.
For the traits we derive which methods don't depend on associated types (i.e. all of them but ToAnimatedValue and ToComputedValue), we now add trait bounds for the actual field types directly, instead of bounding the type parameters.
The trait ToAnimatedZero now supports it, and it now applies to things with generics, avoiding the trait bounds for field types of the variant on which it applies.
0820314
to
ccae9ca
|
https://treeherder.mozilla.org/#/jobs?repo=try&revision=46ef23b95d92a02108ca9cd47067a0d171bf00a6 Geckolib build error fixed. |
|
Thanks for the documentation! Maybe an example of the generated code would be nice, but that can also be a followup if somebody is confused about it. r=me |
|
@bors-servo r=emilio |
|
|
Refactor how we handle trait bounds in style_derive <!-- 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/18239) <!-- Reviewable:end -->
|
|
Don't allow interpolating SVGPaintKind::None. This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1396483 PR #18103 disallowed interpolation between fill:none and fill:none, but that change was regressed by the refactoring in PR #18239. This patch restores the intended behavior, disabling animation of SVGPaintKind::None. <!-- 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 <!-- Either: --> There are already these tests in dom/smil/tests of gecko, this PR will enable these tests. For detail, see https://bugzilla.mozilla.org/show_bug.cgi?id=1396483 . <!-- 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/18364) <!-- Reviewable:end -->
PR servo#18103 disallowed interpolation between fill:none and fill:none, but that change was regressed by the refactoring in PR servo#18239. This patch restores the intended behavior, disabling animation of SVGPaintKind::None.
nox commentedAug 25, 2017
•
edited by SimonSapin
This change is