mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Make the style crate almost build on stable Rust.
`discriminant_value` will need to be replaced with something else later.
This commit is contained in:
parent
ea73c8efac
commit
00b6210519
41 changed files with 370 additions and 375 deletions
|
@ -10,12 +10,14 @@ use util::geometry::ViewportPx;
|
|||
use values::specified;
|
||||
|
||||
|
||||
#[derive(Debug, HeapSizeOf, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct MediaQueryList {
|
||||
pub media_queries: Vec<MediaQuery>
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf)]
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum Range<T> {
|
||||
Min(T),
|
||||
Max(T),
|
||||
|
@ -58,20 +60,23 @@ impl<T: Ord> Range<T> {
|
|||
}
|
||||
|
||||
/// http://dev.w3.org/csswg/mediaqueries-3/#media1
|
||||
#[derive(PartialEq, Copy, Clone, Debug, HeapSizeOf)]
|
||||
#[derive(PartialEq, Copy, Clone, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum Expression {
|
||||
/// http://dev.w3.org/csswg/mediaqueries-3/#width
|
||||
Width(Range<specified::Length>),
|
||||
}
|
||||
|
||||
/// http://dev.w3.org/csswg/mediaqueries-3/#media0
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf)]
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum Qualifier {
|
||||
Only,
|
||||
Not,
|
||||
}
|
||||
|
||||
#[derive(Debug, HeapSizeOf, PartialEq)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct MediaQuery {
|
||||
pub qualifier: Option<Qualifier>,
|
||||
pub media_type: MediaQueryType,
|
||||
|
@ -90,20 +95,23 @@ impl MediaQuery {
|
|||
}
|
||||
|
||||
/// http://dev.w3.org/csswg/mediaqueries-3/#media0
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf)]
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum MediaQueryType {
|
||||
All, // Always true
|
||||
MediaType(MediaType),
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf)]
|
||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub enum MediaType {
|
||||
Screen,
|
||||
Print,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, HeapSizeOf)]
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct Device {
|
||||
pub media_type: MediaType,
|
||||
pub viewport_size: TypedSize2D<ViewportPx, f32>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue