Commit graph

21 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
8c004c0858 style: Reformat recent changes. 2019-04-12 12:20:14 +02:00
Emilio Cobos Álvarez
fc0dad2074 style: Handle the non-generic path earlier in the derive code.
No need to build the match body if there are no generics. This should hopefully
save some work too.

Depends on D26289

Differential Revision: https://phabricator.services.mozilla.com/D26290
2019-04-12 12:20:05 +02:00
Emilio Cobos Álvarez
c3ab3f0963 style: Share more code between ToAnimatedValue and ToComputedValue derive.
I'm going to add a ToResolvedValue, and I don't want to add more copy-pasta.

This shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D26289
2019-04-12 12:20:04 +02:00
Cameron McCormack
d8a758272e style: Factor out some of style_derive.
Differential Revision: https://phabricator.services.mozilla.com/D17188
2019-04-12 12:19:45 +02:00
Emilio Cobos Álvarez
9b24a451f6 style: When deriving something with an output type, map preconditions as well.
Otherwise, deriving ToComputedValue and ToAnimatedValue in structs or enums with
other where clauses just doesn't work.

Differential Revision: https://phabricator.services.mozilla.com/D21859
2019-03-13 15:08:20 +01:00
Bastien Orivel
e94de4e1bd Update syn and related dependencies 2018-11-30 17:48:41 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Simon Sapin
a15d33a10e cargo fix --edition 2018-11-10 17:47:28 +01:00
Simon Sapin
ede79a6a5d Use 2018-style paths in code generated by style_derive 2018-11-10 17:47:28 +01:00
chansuke
25bc998f17 Format component of style_derive 2018-09-07 22:18:51 +09:00
Anthony Ramine
4d0bf2ddf9 Opt into field bounds for #[derive(ToComputedValue)] 2018-03-09 18:54:59 +01:00
Anthony Ramine
2efd06c12d Remove #[compute(clone)] 2018-03-09 15:45:34 +01:00
Anthony Ramine
859002a81f Opt into field bounds when deriving ToCss, instead of opting out 2018-03-08 16:33:19 +01:00
Anthony Ramine
b517bcd42b Unconditionally derive ToComputedValue as Clone for non-generics
We assume that types such as `<Self as ToComputedValue>::ToComputedValue == Self`
just construct a new value that is just a clone of the original one without any
additional code.
2018-03-03 18:41:50 +01:00
Bastien Orivel
9faa579c89 Bump syn/quote in style_derive 2018-02-12 17:08:55 +01:00
Manish Goregaokar
dcefcc3c22
Add ToComputedValue and ToCss impls 2017-11-02 14:29:58 -07:00
Anthony Ramine
735e093de7 Implement #[compute(clone)] for #[derive(ToComputedValue)] 2017-08-28 10:39:53 +02:00
Anthony Ramine
efc852f6e3 Improve handling of trait bounds when deriving fmap-like traits 2017-08-28 10:39:50 +02:00
Anthony Ramine
04ad28b564 Refactor how we handle trait bounds in style_derive
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.
2017-08-27 23:31:16 +02:00
Anthony Ramine
f275895028 Introduce style_derive::cg 2017-08-23 16:52:04 +02:00
Anthony Ramine
07c0456cfd Derive ToComputedValue
For now, only impls for types like in style::values::generics can be derived.

This also needed a few ToComputedValueAsSpecified impls that I would like to
replace by some #[to_computed_value(clone)] attribute, but I think it is ok
to keep it like this for now.
2017-05-21 15:31:17 +02:00