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
Anthony Ramine
ff67fc751d
Introduce #[animation]
...
For now, only #[animation(error)] is supported on variants and it makes
both #[derive(Animate)] and #[derive(ComputeSquaredDistance)] ignore
this particular variant.
2017-08-24 11:04:19 +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
12b9a42774
Fix quote dependency version
2017-08-23 18:35:42 +02:00
Anthony Ramine
f275895028
Introduce style_derive::cg
2017-08-23 16:52:04 +02:00
Anthony Ramine
7ee124b1ed
Derive the most trivial Animate impls
2017-08-22 19:12:47 +02:00
Anthony Ramine
faaf31411a
Derive the most trivial ToAnimatedZero impls
2017-08-22 19:12:42 +02:00
Anthony Ramine
277351da35
Derive ComputeSquaredDistance
2017-08-13 13:34:04 +02:00
Corey Farwell
58fd2956b3
Fix typo in comment.
2017-07-26 21:29:08 +00:00
Anthony Ramine
a3af32155f
Introduce #[css(comma)]
2017-07-11 17:14:14 +02:00
Anthony Ramine
9ab0b9b4ac
Introduce ToAnimatedValue 🎥
2017-06-29 14:03:15 +02:00
Anthony Ramine
39e29f557e
Simplify machinery to serialise optional parts of CSS values
...
We simply implement ToCss for Option<T>, printing nothing if the value is None,
and we then use SequenceWriter to skip writing of separators around empty parts.
2017-06-21 11:17:22 +02:00
Anthony Ramine
3a2e79274a
Derive ToCss for keyword structs
2017-06-17 13:46:33 +02:00
Anthony Ramine
b7c83eeb64
Limit trait bounds for derive(ToCss) to types with free variables
2017-06-17 00:36:53 +02:00
Anthony Ramine
d65a7e6f95
Avoid an unwrap in #[derive(ToCss)]
2017-06-16 13:55:26 +02:00
Anthony Ramine
43a5257a0c
Introduce #[css(function)] for #[derive(ToCss)]
...
Any variant with this attribute gets serialised as a CSS function,
using the variant name as the function name.
2017-06-13 10:19:23 +02:00
Anthony Ramine
45e8b0e8c7
Support unit variants when deriving ToCss
2017-06-07 16:47:59 +02:00
Anthony Ramine
c4f1d647a0
Derive the most trivial ToCss implementations 🌋
...
For now, all variants get serialised as the space-separated serialisations
of their fields. Unit variants are not supported.
2017-06-04 16:17:56 +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
Anthony Ramine
90bae7f802
Derive HasViewportPercentage 🍷
2017-05-20 14:48:04 +02:00