aboutsummaryrefslogtreecommitdiffstats
path: root/components/style_derive/to_computed_value.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move Stylo to its own repo (#31350)Delan Azabani2024-02-271-205/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove packages that were moved to external repo * Add workspace dependencies pointing to 2023-06-14 branch * Fix servo-tidy.toml errors * Update commit to include #31346 * Update commit to include servo/stylo#2 * Move css-properties.json lookup to target/doc/stylo * Remove dependency on vendored mako in favour of pypi dependency This also removes etc/ci/generate_workflow.py, which has been unused since at least 9e71bd6a7010d6e5723831696ae0ebe26b47682f. * Add temporary code to debug Windows test failures * Fix failures on Windows due to custom target dir * Update commit to include servo/stylo#3 * Fix license in tests/unit/style/build.rs * Document how to build with local Stylo in Cargo.toml
* Revert changes to servo_arc, style_derive, and style_traits (#31387)Martin Robinson2024-02-221-3/+0
| | | | | | | This reverts the Rust edition updates to these three traits as well as incorporates https://phabricator.services.mozilla.com/D117887. The purpose of this change is to reduce the diff with upstream stylo. Finally, formatting is disabled for these crates as well.
* Upgrade remaining components to edition 2018sagudev2023-02-181-0/+3
|
* style: Teach style_derive's map_type_params about mapping self correctly.Emilio Cobos Álvarez2021-02-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider the following: struct Complex<T> { something: T, #[compute(field_bound)] something_else: Generic<Self, T>, } That will generate: impl<T> ToComputedValue for Complex<T> where T: ToComputedValue, Generic<Self, T>: ToComputedValue<ComputedValue = Generic<Self, <T as ToComputedValue>::ComputedValue>>, { // ... } That last clause is obviously incorrect. map_type_params correctly maps the T, but it should know also about Self. Ideally we could just do the same as for T and do: <Self as ToComputedValue>::ComputedValue But that doesn't quite work, because we are in that implementation of the trait, and the compiler rightfully complains about we don't yet knowing the computed type. So we need to pass it explicitly, which is simple enough, if a bit annoying. Differential Revision: https://phabricator.services.mozilla.com/D83816
* Fix warnings introduced in newer Rust NightlySimon Sapin2021-02-251-1/+1
| | | | | | | | | | | | This does not (yet) upgrade ./rust-toolchain The warnings: * dead_code "field is never read" * redundant_semicolons "unnecessary trailing semicolon" * non_fmt_panic "panic message is not a string literal, this is no longer accepted in Rust 2021" * unstable_name_collisions "a method with this name may be added to the standard library in the future" * legacy_derive_helpers "derive helper attribute is used before it is introduced" https://github.com/rust-lang/rust/issues/79202
* style: Reformat recent changes.Emilio Cobos Álvarez2020-04-161-3/+14
|
* style: Ensure that derived types are right for optimized-away implementations.Emilio Cobos Álvarez2020-04-161-60/+99
| | | | | | | | | | | | | | | | | | | | | | We have this optimization where, for non-generic structs, we generate just a clone / move as the ToComputedValue / ToResolvedValue implementation. This moves the optimization a bit further down, and refines it so that we still generate all the relevant where clauses that make it sound, that is, that all the ToComputedValue implementations of the fields return the same type. Otherwise this wouldn't be sound and the type would need to become generic. We add an escape hatch (no_field_bound) for fields that need to be cloned but which don't implement the trait. This is right now only for the RefPtr<> in the shared font-family list, and a piece of code in PaintWorklet which looks kinda fishy, and probably should be fixed (but we don't ship it in Firefox and there's a pre-existing FIXME for servo, so I punted on it for now). The other thing this patch does is adding a bunch of ToComputedValue / ToResolvedValue implementations that are trivial and were missing. Differential Revision: https://phabricator.services.mozilla.com/D67913
* style: Reformat recent changes.Emilio Cobos Álvarez2019-04-121-27/+18
|
* style: Handle the non-generic path earlier in the derive code.Emilio Cobos Álvarez2019-04-121-13/+15
| | | | | | | | | 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
* style: Share more code between ToAnimatedValue and ToComputedValue derive.Emilio Cobos Álvarez2019-04-121-48/+91
| | | | | | | | 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
* style: Factor out some of style_derive.Cameron McCormack2019-04-121-1/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D17188
* style: When deriving something with an output type, map preconditions as well.Emilio Cobos Álvarez2019-03-131-0/+6
| | | | | | | 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
* Update syn and related dependenciesBastien Orivel2018-11-301-4/+4
|
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* `cargo fix --edition`Simon Sapin2018-11-101-1/+1
|
* Use 2018-style paths in code generated by style_deriveSimon Sapin2018-11-101-12/+12
|
* Format component of style_derivechansuke2018-09-071-4/+6
|
* Opt into field bounds for #[derive(ToComputedValue)]Anthony Ramine2018-03-091-27/+51
|
* Remove #[compute(clone)]Anthony Ramine2018-03-091-20/+5
|
* Opt into field bounds when deriving ToCss, instead of opting outAnthony Ramine2018-03-081-5/+8
|
* Unconditionally derive ToComputedValue as Clone for non-genericsAnthony Ramine2018-03-031-0/+23
| | | | | | 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.
* Bump syn/quote in style_deriveBastien Orivel2018-02-121-10/+10
|
* Add ToComputedValue and ToCss implsManish Goregaokar2017-11-021-1/+4
|
* Implement #[compute(clone)] for #[derive(ToComputedValue)]Anthony Ramine2017-08-281-5/+28
|
* Improve handling of trait bounds when deriving fmap-like traitsAnthony Ramine2017-08-281-10/+10
|
* Refactor how we handle trait bounds in style_deriveAnthony Ramine2017-08-271-9/+11
| | | | | | 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.
* Introduce style_derive::cgAnthony Ramine2017-08-231-107/+11
|
* Derive ToComputedValueAnthony Ramine2017-05-211-0/+142
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.