Commit graph

86 commits

Author SHA1 Message Date
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
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
6ce5e9a869 Never store a squared root in SquaredDistance 2018-03-04 02:10:44 +01:00
bors-servo
95f81d0c39
Auto merge of #20183 - servo:computed-as-clone, r=emilio
Unconditionally derive ToComputedValue as Clone for non-generic types

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.

<!-- 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/20183)
<!-- Reviewable:end -->
2018-03-03 14:15:17 -05: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
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
537fda543e
style_derive: Support parse-time aliases.
This will allow #19659 to use derive on display using:

    #[parse(aliases = "-webkit-flex")]
    Flex,
    #[parse(aliases = "-webkit-inline-flex")]
    InlineFlex,

And such.
2017-12-31 09:53:17 +01:00
bors-servo
a9c17970c1 Auto merge of #19576 - canaltinova:text-align, r=Manishearth,emilio
style: Move text-align outside of the mako file.

I will need this refactoring before my next job. I didn't actually fix the FIXME's along the way. My other PR probably will cover these.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- 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/19576)
<!-- Reviewable:end -->
2017-12-18 12:12:52 -06:00
Nazım Can Altınova
3ad2687c0b style_derive: Make parse derive work with C like enums. 2017-12-16 15:47:50 -06: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
5b8f65190a
style: Handle servo-prefixed stuff correctly. 2017-12-15 21:43:29 +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