mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Ensure that derived types are right for optimized-away implementations.
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
This commit is contained in:
parent
0514059618
commit
7d438cd816
18 changed files with 295 additions and 146 deletions
|
@ -24,7 +24,7 @@ macro_rules! ns {
|
|||
}
|
||||
|
||||
/// A Gecko namespace is just a wrapped atom.
|
||||
#[derive(Clone, Debug, Default, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)]
|
||||
#[derive(Clone, Debug, Default, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
|
||||
#[repr(transparent)]
|
||||
pub struct Namespace(pub Atom);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue