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
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
Manish Goregaokar
dcefcc3c22
Add ToComputedValue and ToCss impls
2017-11-02 14:29:58 -07:00
Emilio Cobos Álvarez
36ff89bd28
style: Remove HasViewportPercentage.
...
It's not needed since #18268
2017-08-29 23:51:21 +02:00
Anthony Ramine
41c3be54ea
Implement #[distance(fallback)] for #[derive(ComputeSquaredDistance)]
2017-08-28 12:26:42 +02: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
4a4bf89575
Implement #[animate(fallback)] for #[derive(Animate)]
...
This allows us to derive the Animate trait, providing a fallback function
for when the 2 values aren't similar.
2017-08-28 12:26:36 +02: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
8101887d31
Support #[animation(constant)] when deriving ToAnimatedZero
2017-08-28 10:39:32 +02:00
Anthony Ramine
eaf2f1ec33
Introduce #[animation(constant)] for the Animate trait
...
This allows us to handle fields that should be the same during animations.
2017-08-28 10:39:10 +02:00
Anthony Ramine
af560a8fab
Support #[animation(error)] in more cases
...
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.
2017-08-27 23:31:17 +02:00
Anthony Ramine
dc827c14e1
Fix the name of the #[animation] attribute, oops
2017-08-27 23:31:16 +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
13d47ba69a
Remove some garbage code from style_derive
2017-08-27 23:31:16 +02:00