Commit graph

117 commits

Author SHA1 Message Date
Bastien Orivel
c7ff341768 Update darling to 0.9 2019-05-23 12:14:56 +02:00
Simon Sapin
51d6b6350e Upgrade to rustc 1.36.0-nightly (e305df184 2019-04-24)
This includes a `size_of` regression for a few DOM types,
due to https://github.com/rust-lang/rust/pull/58623 which replaces the
implementation of `HashMap` in the standard library to Hashbrown.

Although `size_of<HashMap>` grows, it’s not obvious how total memory usage
is going to be impacted: Hashbrown only has one `u8` instead of one `usize`
of overhead per hash table bucket for storing (part of) a hash,
and so might allocate less memory itself.

Hashbrown also typically has better run time performance:
https://github.com/rust-lang/hashbrown#performance

Still, I’ve filed https://github.com/rust-lang/hashbrown/issues/69
about potentially reducing the `size_of<HashMap>` regression.
2019-04-25 13:52:09 +02:00
Emilio Cobos Álvarez
8c004c0858 style: Reformat recent changes. 2019-04-12 12:20:14 +02:00
Emilio Cobos Álvarez
a47dcb5707 style: Derive ToResolvedValue.
Differential Revision: https://phabricator.services.mozilla.com/D26783
2019-04-12 12:20:09 +02:00
Emilio Cobos Álvarez
6ac777ebf2 style: Add derive code for a new ToResolvedValue trait, and a few trivial implementations.
Differential Revision: https://phabricator.services.mozilla.com/D26782
2019-04-12 12:20:08 +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
c3f46d78a0 style: Add two commas to appease tidy. 2019-03-13 15:08:41 +01:00
Emilio Cobos Álvarez
5aeab7adb1 style: Reformat recent changes. 2019-03-13 15:08:38 +01: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
Emilio Cobos Álvarez
35b8b95263 style: Implement a version of #[css(skip_if)] that takes more context.
I called it contextual_skip_if, though better names welcome.

Differential Revision: https://phabricator.services.mozilla.com/D21858
2019-03-13 15:08:19 +01:00
Emilio Cobos Álvarez
be616c31e8 style: Rustfmt recent changes. 2019-02-23 21:05:32 -08:00
Emilio Cobos Álvarez
73d5b82f9f style: Improve #[derive(Parse)].
I want to do this so that I can get rid of Either<>. The reasons for getting rid
of either are multiple:

 * It doesn't generate as nice C++ code using cbindgen.
 * It isn't that nice to use either from Rust.
 * cbindgen has bugs with zero-sized types.

I started using this for ColorOrAuto and a few others, for now.

Differential Revision: https://phabricator.services.mozilla.com/D19844
2019-02-23 21:04:44 -08:00
Emilio Cobos Álvarez
2e6d34cad9 style: Rustfmt recent changes. 2019-01-13 21:59:35 +01:00
Boris Chiou
a8943d2ec5 style: Part 1: Support field_bound on Animate.
So we can derive Animate on more generic types.

Differential Revision: https://phabricator.services.mozilla.com/D16339
2019-01-13 21:58:36 +01:00
Simon Sapin
be2218a134 Fix some warnings 2018-12-28 15:31:08 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Bastien Orivel
dd301c084d Fix all clippy warnings in style_derive 2018-12-12 21:32:52 +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
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Emilio Cobos Álvarez
25db9e3be7
style: Teach ComputeSquaredDistance derive about #[animation(constant)].
Differential Revision: https://phabricator.services.mozilla.com/D5337
2018-09-15 17:56:41 +02:00
chansuke
25bc998f17 Format component of style_derive 2018-09-07 22:18:51 +09:00
Emilio Cobos Álvarez
82db42390d
style: Better debugging for media-query related code and ua-cache.
Bug: 1470145
Reviewed-by: xidorn
MozReview-Commit-ID: 3XHAxK2BOTS
2018-06-23 20:37:16 +02:00
Emilio Cobos Álvarez
e94395b523
style_derive: Fix tidy lint. 2018-06-12 12:15:17 -07:00
Emilio Cobos Álvarez
2c0a19e517
style: Move some parsing-only attributes to use #[parse(..)] instead of #[css(..)].
I need to admit I'm ambivalent about this one :).

Bug: 1466609
Reviewed-by: xidorn
MozReview-Commit-ID: F1jlfnQKXwo
2018-06-12 12:15:10 -07:00
Emilio Cobos Álvarez
1da798e65b
style: Introduce css(parse_condition).
This will allow us to add a pref for this, and to parse it only on chrome easily.

Bug: 1288572
Reviewed-by: xidorn
MozReview-Commit-ID: L1rsyc2A2hu
2018-06-12 12:15:06 -07:00
Emilio Cobos Álvarez
40a616920c
style: Remove values::Verbatim.
No point of having two things that do the same.

Bug: 1457635
Reviewed-by: xidorn
MozReview-Commit-ID: Do1L4bvOeVQ
2018-05-05 16:20:38 +02:00
Emilio Cobos Álvarez
c508d8576d
style: Move represents_keyword to the css attributes.
Bug: 1457635
Reviewed-by: xidorn
MozReview-Commit-ID: 21yuU4h34AQ
2018-05-05 16:20:22 +02:00
Emilio Cobos Álvarez
292f899631
style: Fix tidy issues and Servo build. 2018-04-29 05:09:43 +02:00
Xidorn Quan
0f7f9eebc0
style: Add some attributes for SpecifiedValueInfo to help deriving more from types.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: IyohSTbUO31
2018-04-29 03:28:48 +02:00
Xidorn Quan
43bb6364f6
style: Have Parse derive respect #[css(skip)] on variant as well and derive Parse for KeywordSize.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: evSvk1RQGe
2018-04-29 03:28:44 +02:00
Xidorn Quan
26c3aeda97
style: Add collect_values function to SpecifiedValueInfo trait for collecting possible values.
This is the basic structure of the stuff. Following patches will fill
the gap between Gecko and Servo on value generating, and finally hook
it into InspectorUtils.

Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: KNLAfFBiY6e
2018-04-29 03:28:40 +02:00
Xidorn Quan
3b9c40dd14
style: Skip system font variant for ToCss in font subproperties.
System font keywords are not a valid value for those properties.

The newly-added #[css(skip)] would be reused by deriving algorithm of
SpecifiedValueInfo to skip them as well.

Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: EmnhkaA9RR5
2018-04-29 03:28:39 +02:00
Xidorn Quan
7fe7b2ffb1
style: Add a ValueInfo trait for exposing types needed by devtools.
Most of types just derive it using proc_macro directly. Some of value
types need manual impl.

In my current plan, this new trait will be used in bug 1434130 to expose
values as well.

Bug: 1455576
Reviewed-by: emilio
MozReview-Commit-ID: LI7fy45VkRw
2018-04-29 03:28:34 +02:00
Bastien Orivel
8bd2e91cdc Update Webrender
Fixes #20609
2018-04-25 10:25:21 +02:00
Anthony Ramine
dcae5860a8 Share a single #[animation(no_bound(…))] for the animation traits 2018-03-12 09:48:25 +01:00
Anthony Ramine
ba12a344c6 Opt out of bounds on type params for #[derive(ToAnimatedZero)] 2018-03-12 09:48:25 +01:00
Anthony Ramine
6f7425059c Opt out of bounds on type params for #[derive(ComputeSquaredDistance)] 2018-03-12 09:48:24 +01:00
Anthony Ramine
5cc2d7c4b3 Opt out of trait bounds on type params for #[derive(Animate)]
This allows us to not generate trait bounds for field types anymore,
by excluding bounds for type parameters used only in fields annotated
with `#[animation(error)]`.

The syntax is `#[animation(no_bound(Foo, Bar))]` where `Foo` is a type
parameter for the type on which we derive things. Ideally this should
be an attribute on the type parameter but this isn't stable yet.
2018-03-12 09:47:18 +01:00
Anthony Ramine
68be1aae8c Kill fmap_output_type 2018-03-09 18:55:26 +01: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
92068ca540 Simplify the derived bounds for ToAnimatedValue 2018-03-09 15:11:45 +01:00
Anthony Ramine
c2e4a609a0 Don't generate fancy Clone + PartialEq bounds for #[animation(constant)] 2018-03-09 11:57:20 +01:00
Anthony Ramine
539c60389e Move some code to its own function in #[derive(Animate)] 2018-03-09 10:12:57 +01:00