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

View file

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

View file

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