mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
style: Add derived ToShmem implementations.
Differential Revision: https://phabricator.services.mozilla.com/D17197
This commit is contained in:
parent
128c6ae94a
commit
40248ae5fd
93 changed files with 649 additions and 267 deletions
|
@ -14,7 +14,7 @@ use std::fmt::{self, Write};
|
|||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
|
||||
/// A binary `and` or `or` operator.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum Operator {
|
||||
And,
|
||||
|
@ -29,7 +29,7 @@ enum AllowOr {
|
|||
}
|
||||
|
||||
/// Represents a media condition.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)]
|
||||
pub enum MediaCondition {
|
||||
/// A simple media feature expression, implicitly parenthesized.
|
||||
Feature(MediaFeatureExpression),
|
||||
|
|
|
@ -27,7 +27,7 @@ use std::fmt::{self, Write};
|
|||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
|
||||
/// An aspect ratio, with a numerator and denominator.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
|
||||
pub struct AspectRatio(pub u32, pub u32);
|
||||
|
||||
impl ToCss for AspectRatio {
|
||||
|
@ -51,7 +51,7 @@ impl PartialOrd for AspectRatio {
|
|||
}
|
||||
|
||||
/// The kind of matching that should be performed on a media feature value.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
|
||||
pub enum Range {
|
||||
/// At least the specified value.
|
||||
Min,
|
||||
|
@ -60,7 +60,7 @@ pub enum Range {
|
|||
}
|
||||
|
||||
/// The operator that was specified in this media feature.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
|
||||
pub enum Operator {
|
||||
/// =
|
||||
Equal,
|
||||
|
@ -93,7 +93,7 @@ impl ToCss for Operator {
|
|||
///
|
||||
/// Ranged media features are not allowed with operations (that'd make no
|
||||
/// sense).
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
|
||||
pub enum RangeOrOperator {
|
||||
/// A `Range`.
|
||||
Range(Range),
|
||||
|
@ -151,7 +151,7 @@ impl RangeOrOperator {
|
|||
|
||||
/// A feature expression contains a reference to the media feature, the value
|
||||
/// the media query contained, and the range to evaluate.
|
||||
#[derive(Clone, Debug, MallocSizeOf)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, ToShmem)]
|
||||
pub struct MediaFeatureExpression {
|
||||
feature_index: usize,
|
||||
value: Option<MediaExpressionValue>,
|
||||
|
@ -467,7 +467,7 @@ impl MediaFeatureExpression {
|
|||
/// If the first, this would need to store the relevant values.
|
||||
///
|
||||
/// See: https://github.com/w3c/csswg-drafts/issues/1968
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)]
|
||||
pub enum MediaExpressionValue {
|
||||
/// A length.
|
||||
Length(Length),
|
||||
|
|
|
@ -15,7 +15,7 @@ use cssparser::{ParserInput, Token};
|
|||
|
||||
/// A type that encapsulates a media query list.
|
||||
#[css(comma, derive_debug)]
|
||||
#[derive(Clone, MallocSizeOf, ToCss)]
|
||||
#[derive(Clone, MallocSizeOf, ToCss, ToShmem)]
|
||||
pub struct MediaList {
|
||||
/// The list of media queries.
|
||||
#[css(iterable)]
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::fmt::{self, Write};
|
|||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
|
||||
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)]
|
||||
pub enum Qualifier {
|
||||
/// Hide a media query from legacy UAs:
|
||||
/// <https://drafts.csswg.org/mediaqueries/#mq-only>
|
||||
|
@ -27,7 +27,7 @@ pub enum Qualifier {
|
|||
}
|
||||
|
||||
/// <https://drafts.csswg.org/mediaqueries/#media-types>
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
|
||||
pub struct MediaType(pub CustomIdent);
|
||||
|
||||
impl MediaType {
|
||||
|
@ -58,7 +58,7 @@ impl MediaType {
|
|||
/// A [media query][mq].
|
||||
///
|
||||
/// [mq]: https://drafts.csswg.org/mediaqueries/
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)]
|
||||
pub struct MediaQuery {
|
||||
/// The qualifier for this query.
|
||||
pub qualifier: Option<Qualifier>,
|
||||
|
@ -151,7 +151,7 @@ impl MediaQuery {
|
|||
}
|
||||
|
||||
/// <http://dev.w3.org/csswg/mediaqueries-3/#media0>
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
|
||||
pub enum MediaQueryType {
|
||||
/// A media type that matches every device.
|
||||
All,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue