Commit graph

58 commits

Author SHA1 Message Date
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
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
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
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01: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
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
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
Anthony Ramine
02b0f71d45 Simplify some code in #[derive(ToCss)] 2018-03-09 10:12:29 +01:00
Anthony Ramine
859002a81f Opt into field bounds when deriving ToCss, instead of opting out 2018-03-08 16:33:19 +01:00
Emilio Cobos Álvarez
bf08c659a0
style: Switch css(skip_if) to use a Path for consistency. 2018-03-08 10:28:10 +01:00
Emilio Cobos Álvarez
6da1b2fff5
style: Introduce css(skip_if) to conditionally skip serialization of a field. 2018-03-08 10:26:25 +01:00
Emilio Cobos Álvarez
ada45f4968
style: Remove useless String::to_string call. 2018-03-08 10:26:25 +01:00
Anthony Ramine
90b23963b7 Introduce #[css(if_empty = "…", iterable)] 2018-03-07 13:07:13 +01:00
Anthony Ramine
88685be649 Don't use SequenceWriter if there is a single field to serialise 2018-03-06 13:14:26 +01:00
Anthony Ramine
85950a801f Move #[css(iterable)] on fields rather than variants 2018-03-06 11:08:19 +01:00
Anthony Ramine
f5393cef8d Add some assertions for #[derive(ToCss)] on enums 2018-03-06 11:08:19 +01:00
Anthony Ramine
3b31ec36f1 Don't use Ident for #[css(function)]
CSS identifiers aren't Rust identifiers.
2018-03-06 11:08:19 +01:00
Anthony Ramine
529a30a682 Extract variant code to its own function in style_derive::to_css 2018-03-06 11:08:19 +01:00
Anthony Ramine
14dd4217fa Qualify path to ToCss in #[derive(ToCss)] 2018-03-06 11:08:19 +01:00
Anthony Ramine
ca45695db1 Introduce #[css(skip)] 2018-03-05 15:53:15 +01:00
Anthony Ramine
c4cfb127b8 Use darling::util::Override in #[derive(ToCss)] 2018-03-05 13:23:33 +01:00
Anthony Ramine
a71b5d5e16 Derive ToCss for Symbols 2018-03-03 01:01:59 +01:00
Bastien Orivel
9faa579c89 Bump syn/quote in style_derive 2018-02-12 17:08:55 +01:00
Emilio Cobos Álvarez
e41d724694
style: Derive ToCss for FontFamilyList.
The extra reference in to_css is needed because the family list iterator returns
by value in Gecko.
2018-02-07 17:44:15 +01:00
Anthony Ramine
1f8777bb0b Move TransformStyle out of Mako files 2018-02-01 12:40:36 +01:00
Anthony Ramine
579cef6a69 Rename #[parse(aliases)] to #[css(aliases)] 2018-02-01 10:36:14 +01:00
Anthony Ramine
42c8dc983f Derive ToCss for TransformOperation
Now that SequenceWriter<W> does not monomorphise excessively, we can actually
type check a derived ToCss without too much type recursion.
2018-01-23 11:02:34 +01:00
Anthony Ramine
cd8f96cc9e Change ToCss to take a CssWriter<W>
This more concrete wrapper type can write a prefix the very first time something
is written to it. This allows removing plenty of useless monomorphisations caused
by the former W/SequenceWriter<W> pair of types.
2018-01-23 10:41:42 +01:00
Emilio Cobos Álvarez
09a3db8657
style_derive: Allow css(iterable) to work on non-functions too, as long as there's only one binding. 2017-12-16 21:47:58 +01:00
Emilio Cobos Álvarez
7036cb0077
Allow deriving Parse for keywords. 2017-12-15 20:01:31 +01:00
Matt Brubeck
3005a26daf style: Use the ? operator for Option 2017-12-09 08:29:53 -08:00
Emilio Cobos Álvarez
eac0d104a3
style: Remove mozmm CSS unit.
Bug: 1416564
Reviewed-by: heycam
MozReview-Commit-ID: AU4CUq09tw4
2017-11-14 14:25:40 +01:00
Emilio Cobos Álvarez
92944cd5eb
style: Make css(dimension) apply to the variant. 2017-11-12 16:25:00 +01:00
Emilio Cobos Álvarez
4927786d90
style: Implement css(dimension) and derive ToCss for a bunch of stuff.
For css(dimension), it'd be nice to derive(Parse) too, I think...
2017-11-12 16:22:45 +01:00
Emilio Cobos Álvarez
06f8f0384b
style: add css(function, iterable), and derive ToCss for VariantAlternates. 2017-11-12 05:24:08 +01:00
Anthony Ramine
4faadb489f Implement #[css(derive_debug)]
This makes #[derive(ToCss)] derive Debug with a simple call to the to_css method.
2017-08-28 12:26:40 +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
17d97cf87b Use darling in style_derive
This allows use to handle #[css] in a way simpler fashion.
2017-08-24 01:28:58 +02:00
Anthony Ramine
f275895028 Introduce style_derive::cg 2017-08-23 16:52:04 +02:00
Corey Farwell
58fd2956b3 Fix typo in comment. 2017-07-26 21:29:08 +00:00