mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
Derive HeapSizeOf on more Stylesheet-related types
In preparation of storing `Stylesheet`s on nodes.
This commit is contained in:
parent
f1b6c7cc99
commit
068e6a8e9f
5 changed files with 25 additions and 21 deletions
|
@ -17,12 +17,13 @@ use std::iter::Iterator;
|
|||
use std::slice;
|
||||
use string_cache::{Atom, Namespace};
|
||||
use url::Url;
|
||||
use util::mem::HeapSizeOf;
|
||||
use viewport::ViewportRule;
|
||||
|
||||
/// Each style rule has an origin, which determines where it enters the cascade.
|
||||
///
|
||||
/// http://dev.w3.org/csswg/css-cascade/#cascading-origins
|
||||
#[derive(Clone, PartialEq, Eq, Copy, Debug)]
|
||||
#[derive(Clone, PartialEq, Eq, Copy, Debug, HeapSizeOf)]
|
||||
pub enum Origin {
|
||||
/// http://dev.w3.org/csswg/css-cascade/#cascade-origin-ua
|
||||
UserAgent,
|
||||
|
@ -35,7 +36,7 @@ pub enum Origin {
|
|||
}
|
||||
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, HeapSizeOf, PartialEq)]
|
||||
pub struct Stylesheet {
|
||||
/// List of rules in the order they were found (important for
|
||||
/// cascading order)
|
||||
|
@ -44,7 +45,7 @@ pub struct Stylesheet {
|
|||
}
|
||||
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, HeapSizeOf, PartialEq)]
|
||||
pub enum CSSRule {
|
||||
Charset(String),
|
||||
Namespace(Option<String>, Namespace),
|
||||
|
@ -54,7 +55,7 @@ pub enum CSSRule {
|
|||
Viewport(ViewportRule),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, HeapSizeOf, PartialEq)]
|
||||
pub struct MediaRule {
|
||||
pub media_queries: MediaQueryList,
|
||||
pub rules: Vec<CSSRule>,
|
||||
|
@ -67,7 +68,7 @@ impl MediaRule {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, HeapSizeOf, PartialEq)]
|
||||
pub struct StyleRule {
|
||||
pub selectors: Vec<Selector>,
|
||||
pub declarations: PropertyDeclarationBlock,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue