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

Refactor how we handle trait bounds in style_derive #18239

Merged
merged 18 commits into from Aug 28, 2017
Merged

Conversation

@nox
Copy link
Member

nox commented Aug 25, 2017

This change is Reviewable

@nox nox force-pushed the derive-all-the-things branch 2 times, most recently from 07f470b to 2aa8f3a Aug 26, 2017
Copy link
Member

emilio left a comment

Overall looks good, got a few comments though.

pub enum MozLength {
LengthOrPercentageOrAuto(LengthOrPercentageOrAuto),
#[animation(error)]

This comment has been minimized.

@emilio

emilio Aug 26, 2017

Member

Keep the FIXME, maybe?

Shape(BasicShape, Option<ReferenceBox>),
Shape(
BasicShape,
#[animation(equal)]

This comment has been minimized.

@emilio

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.

@emilio

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.

@emilio

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.

@emilio

emilio Aug 26, 2017

Member

Hmm... shouldn't this be in the None variant?

nox added 5 commits Aug 24, 2017
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.
@nox nox force-pushed the derive-all-the-things branch from 2aa8f3a to 63b1f71 Aug 28, 2017
@nox nox force-pushed the derive-all-the-things branch 2 times, most recently from 0820314 to ccae9ca Aug 28, 2017
@nox nox force-pushed the derive-all-the-things branch from ccae9ca to ba4136b Aug 28, 2017
@nox
Copy link
Member Author

nox commented Aug 28, 2017

@emilio
emilio approved these changes Aug 28, 2017
Copy link
Member

emilio left a comment

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

@nox
Copy link
Member Author

nox commented Aug 28, 2017

@bors-servo r=emilio

@bors-servo
Copy link
Contributor

bors-servo commented Aug 28, 2017

📌 Commit ba4136b has been approved by emilio

@bors-servo
Copy link
Contributor

bors-servo commented Aug 28, 2017

Testing commit ba4136b with merge a266e96...

bors-servo added a commit that referenced this pull request Aug 28, 2017
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 28, 2017

@bors-servo bors-servo merged commit ba4136b into master Aug 28, 2017
4 checks passed
4 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
dependency-ci Dependencies checked
Details
homu Test successful
Details
@emilio emilio deleted the derive-all-the-things branch Aug 28, 2017
bors-servo added a commit that referenced this pull request Sep 4, 2017
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 -->
pylbrecht added a commit to pylbrecht/servo that referenced this pull request Sep 4, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

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