style: Unify some #[derive]s between Servo and Gecko.

Bug: 1468846
Reviewed-by: xidorn
MozReview-Commit-ID: FqoNCuLcdm7
This commit is contained in:
Emilio Cobos Álvarez 2018-06-14 13:00:18 -07:00
parent 4d255392f7
commit 9ca081c532
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 10 additions and 14 deletions

View file

@ -229,7 +229,7 @@ impl Device {
} }
/// The kind of matching that should be performed on a media feature value. /// The kind of matching that should be performed on a media feature value.
#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
pub enum Range { pub enum Range {
/// At least the specified value. /// At least the specified value.
Min, Min,
@ -241,7 +241,7 @@ pub enum Range {
/// A expression for gecko contains a reference to the media feature, the value /// A expression for gecko contains a reference to the media feature, the value
/// the media query contained, and the range to evaluate. /// the media query contained, and the range to evaluate.
#[derive(Clone, Debug)] #[derive(Clone, Debug, MallocSizeOf)]
pub struct Expression { pub struct Expression {
feature: &'static nsMediaFeature, feature: &'static nsMediaFeature,
value: Option<MediaExpressionValue>, value: Option<MediaExpressionValue>,
@ -294,7 +294,7 @@ impl PartialEq for Expression {
/// If the first, this would need to store the relevant values. /// If the first, this would need to store the relevant values.
/// ///
/// See: https://github.com/w3c/csswg-drafts/issues/1968 /// See: https://github.com/w3c/csswg-drafts/issues/1968
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum MediaExpressionValue { pub enum MediaExpressionValue {
/// A length. /// A length.
Length(Length), Length(Length),

View file

@ -24,9 +24,8 @@ pub use servo::media_queries::{Device, Expression};
pub use gecko::media_queries::{Device, Expression}; pub use gecko::media_queries::{Device, Expression};
/// A type that encapsulates a media query list. /// A type that encapsulates a media query list.
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[css(comma)] #[css(comma)]
#[derive(Clone, Debug, ToCss)] #[derive(Clone, Debug, MallocSizeOf, ToCss)]
pub struct MediaList { pub struct MediaList {
/// The list of media queries. /// The list of media queries.
#[css(iterable)] #[css(iterable)]
@ -43,8 +42,7 @@ impl MediaList {
} }
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix> /// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
#[cfg_attr(feature = "servo", derive(MallocSizeOf))] #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
pub enum Qualifier { pub enum Qualifier {
/// Hide a media query from legacy UAs: /// Hide a media query from legacy UAs:
/// <https://drafts.csswg.org/mediaqueries/#mq-only> /// <https://drafts.csswg.org/mediaqueries/#mq-only>
@ -57,8 +55,7 @@ pub enum Qualifier {
/// A [media query][mq]. /// A [media query][mq].
/// ///
/// [mq]: https://drafts.csswg.org/mediaqueries/ /// [mq]: https://drafts.csswg.org/mediaqueries/
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, MallocSizeOf, PartialEq)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct MediaQuery { pub struct MediaQuery {
/// The qualifier for this query. /// The qualifier for this query.
pub qualifier: Option<Qualifier>, pub qualifier: Option<Qualifier>,
@ -123,8 +120,7 @@ impl ToCss for MediaQuery {
} }
/// <http://dev.w3.org/csswg/mediaqueries-3/#media0> /// <http://dev.w3.org/csswg/mediaqueries-3/#media0>
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum MediaQueryType { pub enum MediaQueryType {
/// A media type that matches every device. /// A media type that matches every device.
All, All,
@ -152,8 +148,7 @@ impl MediaQueryType {
} }
/// <https://drafts.csswg.org/mediaqueries/#media-types> /// <https://drafts.csswg.org/mediaqueries/#media-types>
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct MediaType(pub CustomIdent); pub struct MediaType(pub CustomIdent);
impl MediaType { impl MediaType {
@ -180,6 +175,7 @@ impl MediaType {
} }
} }
} }
impl MediaQuery { impl MediaQuery {
/// Parse a media query given css input. /// Parse a media query given css input.
/// ///

View file

@ -12,7 +12,7 @@ use style_traits::{ParseError, StyleParseErrorKind};
use values::CSSFloat; use values::CSSFloat;
/// A specified resolution. /// A specified resolution.
#[derive(Clone, Debug, PartialEq, ToCss)] #[derive(Clone, Debug, PartialEq, MallocSizeOf, ToCss)]
pub enum Resolution { pub enum Resolution {
/// Dots per inch. /// Dots per inch.
#[css(dimension)] #[css(dimension)]