mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 10:15:41 +00:00
Bug 1505618 - Import formatting changes from servo/servo#22126.
This commit is contained in:
parent
53c419d84d
commit
176fa6315c
@ -5,9 +5,9 @@
|
||||
extern crate hashglobe;
|
||||
extern crate smallvec;
|
||||
|
||||
use hashglobe::FailedAllocationError;
|
||||
#[cfg(feature = "known_system_malloc")]
|
||||
use hashglobe::alloc;
|
||||
use hashglobe::FailedAllocationError;
|
||||
use smallvec::Array;
|
||||
use smallvec::SmallVec;
|
||||
use std::vec::Vec;
|
||||
|
@ -20,8 +20,8 @@ use std::fmt;
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
pub use std::collections::hash_map::{Entry, RandomState, Iter as MapIter, IterMut as MapIterMut};
|
||||
pub use std::collections::hash_set::{Iter as SetIter, IntoIter as SetIntoIter};
|
||||
pub use std::collections::hash_map::{Entry, Iter as MapIter, IterMut as MapIterMut, RandomState};
|
||||
pub use std::collections::hash_set::{IntoIter as SetIntoIter, Iter as SetIter};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct HashMap<K, V, S = RandomState>(StdMap<K, V, S>);
|
||||
|
@ -15,13 +15,13 @@ use std::borrow::Borrow;
|
||||
use std::cmp::max;
|
||||
use std::fmt::{self, Debug};
|
||||
#[allow(deprecated)]
|
||||
use std::hash::{Hash, BuildHasher};
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::iter::FromIterator;
|
||||
use std::mem::{self, replace};
|
||||
use std::ops::{Deref, Index};
|
||||
|
||||
use super::table::{self, Bucket, EmptyBucket, FullBucket, FullBucketMut, RawTable, SafeHash};
|
||||
use super::table::BucketState::{Empty, Full};
|
||||
use super::table::{self, Bucket, EmptyBucket, FullBucket, FullBucketMut, RawTable, SafeHash};
|
||||
|
||||
use FailedAllocationError;
|
||||
|
||||
@ -2214,11 +2214,11 @@ fn assert_covariance() {
|
||||
#[cfg(test)]
|
||||
mod test_map {
|
||||
extern crate rand;
|
||||
use super::HashMap;
|
||||
use self::rand::{thread_rng, Rng};
|
||||
use super::Entry::{Occupied, Vacant};
|
||||
use super::HashMap;
|
||||
use super::RandomState;
|
||||
use cell::RefCell;
|
||||
use self::rand::{thread_rng, Rng};
|
||||
|
||||
#[test]
|
||||
fn test_zero_capacities() {
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, BuildHasher};
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::iter::{Chain, FromIterator};
|
||||
use std::ops::{BitOr, BitAnd, BitXor, Sub};
|
||||
use std::ops::{BitAnd, BitOr, BitXor, Sub};
|
||||
|
||||
use super::Recover;
|
||||
use super::hash_map::{self, HashMap, Keys, RandomState};
|
||||
use super::Recover;
|
||||
|
||||
// Future Optimization (FIXME!)
|
||||
// =============================
|
||||
@ -1258,8 +1258,8 @@ fn assert_covariance() {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_set {
|
||||
use super::HashSet;
|
||||
use super::hash_map::RandomState;
|
||||
use super::HashSet;
|
||||
|
||||
#[test]
|
||||
fn test_zero_capacities() {
|
||||
|
@ -9,13 +9,13 @@
|
||||
// except according to those terms.
|
||||
|
||||
use alloc::{alloc, dealloc};
|
||||
use shim::{Shared, Unique};
|
||||
use std::cmp;
|
||||
use std::hash::{BuildHasher, Hash, Hasher};
|
||||
use std::marker;
|
||||
use std::mem::{self, align_of, size_of};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::ptr;
|
||||
use shim::{Unique, Shared};
|
||||
|
||||
use self::BucketState::*;
|
||||
use FailedAllocationError;
|
||||
|
@ -82,8 +82,8 @@ extern crate xml5ever;
|
||||
use serde_bytes::ByteBuf;
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::mem::size_of;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::ops::Range;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::os::raw::c_void;
|
||||
use void::Void;
|
||||
|
||||
@ -557,6 +557,36 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V> MallocShallowSizeOf for std::collections::BTreeMap<K, V>
|
||||
where
|
||||
K: Eq + Hash,
|
||||
{
|
||||
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
if ops.has_malloc_enclosing_size_of() {
|
||||
self.values()
|
||||
.next()
|
||||
.map_or(0, |v| unsafe { ops.malloc_enclosing_size_of(v) })
|
||||
} else {
|
||||
self.len() * (size_of::<V>() + size_of::<K>() + size_of::<usize>())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V> MallocSizeOf for std::collections::BTreeMap<K, V>
|
||||
where
|
||||
K: Eq + Hash + MallocSizeOf,
|
||||
V: MallocSizeOf,
|
||||
{
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
let mut n = self.shallow_size_of(ops);
|
||||
for (k, v) in self.iter() {
|
||||
n += k.size_of(ops);
|
||||
n += v.size_of(ops);
|
||||
}
|
||||
n
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V, S> MallocShallowSizeOf for hashglobe::hash_map::HashMap<K, V, S>
|
||||
where
|
||||
K: Eq + Hash,
|
||||
|
@ -88,7 +88,8 @@ fn malloc_size_of_derive(s: synstructure::Structure) -> quote::Tokens {
|
||||
fn test_struct() {
|
||||
let source = syn::parse_str(
|
||||
"struct Foo<T> { bar: Bar, baz: T, #[ignore_malloc_size_of = \"\"] z: Arc<T> }",
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
let source = synstructure::Structure::new(&source);
|
||||
|
||||
let expanded = malloc_size_of_derive(source).to_string();
|
||||
|
@ -23,7 +23,7 @@ use sink::Push;
|
||||
use smallvec::{self, SmallVec};
|
||||
use std::cmp;
|
||||
use std::iter;
|
||||
use std::ops::{AddAssign, Add};
|
||||
use std::ops::{Add, AddAssign};
|
||||
use std::ptr;
|
||||
use std::slice;
|
||||
|
||||
|
@ -588,7 +588,8 @@ where
|
||||
element.is_html_element_in_html_document(),
|
||||
&local_name.name,
|
||||
&local_name.lower_name,
|
||||
).borrow();
|
||||
)
|
||||
.borrow();
|
||||
element.local_name() == name
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,10 @@ use attr::{ParsedCaseSensitivity, SELECTOR_WHITESPACE};
|
||||
use bloom::BLOOM_HASH_MASK;
|
||||
use builder::{SelectorBuilder, SpecificityAndFlags};
|
||||
use context::QuirksMode;
|
||||
use cssparser::{parse_nth, serialize_identifier};
|
||||
use cssparser::{BasicParseError, BasicParseErrorKind, ParseError, ParseErrorKind};
|
||||
use cssparser::{CowRcStr, Delimiter, SourceLocation};
|
||||
use cssparser::{CssStringWriter, Parser as CssParser, ToCss, Token};
|
||||
use cssparser::{parse_nth, serialize_identifier};
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use servo_arc::ThinArc;
|
||||
use sink::Push;
|
||||
@ -270,7 +270,9 @@ where
|
||||
|
||||
// Ensure they're actually all compound selectors without pseudo-elements.
|
||||
if selector.has_pseudo_element() {
|
||||
return Err(location.new_custom_error(SelectorParseErrorKind::PseudoElementInComplexSelector));
|
||||
return Err(
|
||||
location.new_custom_error(SelectorParseErrorKind::PseudoElementInComplexSelector)
|
||||
);
|
||||
}
|
||||
|
||||
if selector.iter_raw_match_order().any(|s| s.is_combinator()) {
|
||||
@ -457,7 +459,7 @@ where
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
}
|
||||
AttributeOther(ref attr_selector) if !attr_selector.never_matches => {
|
||||
let empty_string;
|
||||
let namespace = match attr_selector.namespace() {
|
||||
@ -1720,7 +1722,8 @@ where
|
||||
if namespace.is_none() && include!(concat!(
|
||||
env!("OUT_DIR"),
|
||||
"/ascii_case_insensitive_html_attributes.rs"
|
||||
)).contains(&*local_name_lower_cow)
|
||||
))
|
||||
.contains(&*local_name_lower_cow)
|
||||
{
|
||||
case_sensitivity =
|
||||
ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument
|
||||
@ -1872,33 +1875,30 @@ where
|
||||
SimpleSelectorParseResult::PseudoElement(p) => {
|
||||
slotted_selector = None;
|
||||
pseudo_element = Some(p);
|
||||
}
|
||||
},
|
||||
SimpleSelectorParseResult::SlottedPseudo(selector) => {
|
||||
slotted_selector = Some(selector);
|
||||
let maybe_pseudo = parse_one_simple_selector(
|
||||
parser,
|
||||
input,
|
||||
/* inside_negation = */ false,
|
||||
)?;
|
||||
let maybe_pseudo =
|
||||
parse_one_simple_selector(parser, input, /* inside_negation = */ false)?;
|
||||
|
||||
pseudo_element = match maybe_pseudo {
|
||||
None => None,
|
||||
Some(SimpleSelectorParseResult::PseudoElement(pseudo)) => {
|
||||
if !pseudo.valid_after_slotted() {
|
||||
return Err(input.new_custom_error(
|
||||
SelectorParseErrorKind::InvalidPseudoElementAfterSlotted
|
||||
SelectorParseErrorKind::InvalidPseudoElementAfterSlotted,
|
||||
));
|
||||
}
|
||||
Some(pseudo)
|
||||
}
|
||||
},
|
||||
Some(SimpleSelectorParseResult::SimpleSelector(..)) |
|
||||
Some(SimpleSelectorParseResult::SlottedPseudo(..)) => {
|
||||
return Err(input.new_custom_error(
|
||||
SelectorParseErrorKind::NonPseudoElementAfterSlotted
|
||||
SelectorParseErrorKind::NonPseudoElementAfterSlotted,
|
||||
));
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
debug_assert!(slotted_selector.is_some() || pseudo_element.is_some());
|
||||
@ -1925,14 +1925,12 @@ where
|
||||
let name = match input.next_including_whitespace()? {
|
||||
&Token::Ident(ref name) => name.clone(),
|
||||
t => {
|
||||
return Err(location.new_custom_error(
|
||||
SelectorParseErrorKind::NoIdentForPseudo(t.clone()),
|
||||
))
|
||||
return Err(location
|
||||
.new_custom_error(SelectorParseErrorKind::NoIdentForPseudo(t.clone())))
|
||||
},
|
||||
};
|
||||
|
||||
let pseudo_class =
|
||||
P::parse_non_ts_pseudo_class(parser, location, name.clone())?;
|
||||
let pseudo_class = P::parse_non_ts_pseudo_class(parser, location, name.clone())?;
|
||||
if !p.supports_pseudo_class(&pseudo_class) {
|
||||
return Err(input.new_custom_error(
|
||||
SelectorParseErrorKind::UnsupportedPseudoClassOrElement(name),
|
||||
@ -2139,7 +2137,8 @@ where
|
||||
"last-of-type" => Ok(Component::LastOfType),
|
||||
"only-of-type" => Ok(Component::OnlyOfType),
|
||||
_ => Err(())
|
||||
}).or_else(|()| {
|
||||
})
|
||||
.or_else(|()| {
|
||||
P::parse_non_ts_pseudo_class(parser, location, name).map(Component::NonTSPseudoClass)
|
||||
})
|
||||
}
|
||||
@ -2147,12 +2146,12 @@ where
|
||||
// NB: pub module in order to access the DummyParser
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use builder::HAS_PSEUDO_BIT;
|
||||
use cssparser::{serialize_identifier, Parser as CssParser, ParserInput, ToCss};
|
||||
use parser;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use super::*;
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum PseudoClass {
|
||||
@ -2422,9 +2421,9 @@ pub mod tests {
|
||||
vec![Component::LocalName(LocalName {
|
||||
name: DummyAtom::from("EeÉ"),
|
||||
lower_name: DummyAtom::from("eeÉ"),
|
||||
}), ],
|
||||
})],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("|e"),
|
||||
@ -2437,7 +2436,7 @@ pub mod tests {
|
||||
}),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// When the default namespace is not set, *| should be elided.
|
||||
// https://github.com/servo/servo/pull/17537
|
||||
@ -2447,9 +2446,9 @@ pub mod tests {
|
||||
vec![Component::LocalName(LocalName {
|
||||
name: DummyAtom::from("e"),
|
||||
lower_name: DummyAtom::from("e"),
|
||||
}), ],
|
||||
})],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// When the default namespace is set, *| should _not_ be elided (as foo
|
||||
// is no longer equivalent to *|foo--the former is only for foo in the
|
||||
@ -2469,14 +2468,14 @@ pub mod tests {
|
||||
}),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("*"),
|
||||
Ok(SelectorList::from_vec(vec![Selector::from_vec(
|
||||
vec![Component::ExplicitUniversalType],
|
||||
specificity(0, 0, 0)
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("|*"),
|
||||
@ -2486,14 +2485,14 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_expected("*|*", Some("*")),
|
||||
Ok(SelectorList::from_vec(vec![Selector::from_vec(
|
||||
vec![Component::ExplicitUniversalType],
|
||||
specificity(0, 0, 0)
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(
|
||||
@ -2506,7 +2505,7 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse(".foo:lang(en-US)"),
|
||||
@ -2516,14 +2515,14 @@ pub mod tests {
|
||||
Component::NonTSPseudoClass(PseudoClass::Lang("en-US".to_owned())),
|
||||
],
|
||||
specificity(0, 2, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("#bar"),
|
||||
Ok(SelectorList::from_vec(vec![Selector::from_vec(
|
||||
vec![Component::ID(DummyAtom::from("bar"))],
|
||||
specificity(1, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("e.foo#bar"),
|
||||
@ -2537,7 +2536,7 @@ pub mod tests {
|
||||
Component::ID(DummyAtom::from("bar")),
|
||||
],
|
||||
specificity(1, 1, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("e.foo #bar"),
|
||||
@ -2552,7 +2551,7 @@ pub mod tests {
|
||||
Component::ID(DummyAtom::from("bar")),
|
||||
],
|
||||
specificity(1, 1, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// Default namespace does not apply to attribute selectors
|
||||
// https://github.com/mozilla/servo/pull/1652
|
||||
@ -2563,9 +2562,9 @@ pub mod tests {
|
||||
vec![Component::AttributeInNoNamespaceExists {
|
||||
local_name: DummyAtom::from("Foo"),
|
||||
local_name_lower: DummyAtom::from("foo"),
|
||||
}, ],
|
||||
}],
|
||||
specificity(0, 1, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert!(parse_ns("svg|circle", &parser).is_err());
|
||||
parser
|
||||
@ -2582,7 +2581,7 @@ pub mod tests {
|
||||
}),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns("svg|*", &parser),
|
||||
@ -2592,7 +2591,7 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// Default namespace does not apply to attribute selectors
|
||||
// https://github.com/mozilla/servo/pull/1652
|
||||
@ -2610,7 +2609,7 @@ pub mod tests {
|
||||
},
|
||||
],
|
||||
specificity(0, 1, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// Default namespace does apply to type selectors
|
||||
assert_eq!(
|
||||
@ -2624,7 +2623,7 @@ pub mod tests {
|
||||
}),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns("*", &parser),
|
||||
@ -2634,7 +2633,7 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns("*|*", &parser),
|
||||
@ -2644,7 +2643,7 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// Default namespace applies to universal and type selectors inside :not and :matches,
|
||||
// but not otherwise.
|
||||
@ -2660,7 +2659,7 @@ pub mod tests {
|
||||
),
|
||||
],
|
||||
specificity(0, 1, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(*)", &parser),
|
||||
@ -2671,12 +2670,13 @@ pub mod tests {
|
||||
vec![
|
||||
Component::DefaultNamespace(MATHML.into()),
|
||||
Component::ExplicitUniversalType,
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
),
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(e)", &parser),
|
||||
@ -2690,12 +2690,13 @@ pub mod tests {
|
||||
name: DummyAtom::from("e"),
|
||||
lower_name: DummyAtom::from("e"),
|
||||
}),
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("[attr|=\"foo\"]"),
|
||||
@ -2706,9 +2707,9 @@ pub mod tests {
|
||||
value: DummyAtom::from("foo"),
|
||||
never_matches: false,
|
||||
case_sensitivity: ParsedCaseSensitivity::CaseSensitive,
|
||||
}, ],
|
||||
}],
|
||||
specificity(0, 1, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// https://github.com/mozilla/servo/issues/1723
|
||||
assert_eq!(
|
||||
@ -2716,7 +2717,7 @@ pub mod tests {
|
||||
Ok(SelectorList::from_vec(vec![Selector::from_vec(
|
||||
vec![Component::PseudoElement(PseudoElement::Before)],
|
||||
specificity(0, 0, 1) | HAS_PSEUDO_BIT,
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("::before:hover"),
|
||||
@ -2726,7 +2727,7 @@ pub mod tests {
|
||||
Component::NonTSPseudoClass(PseudoClass::Hover),
|
||||
],
|
||||
specificity(0, 1, 1) | HAS_PSEUDO_BIT,
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("::before:hover:hover"),
|
||||
@ -2737,7 +2738,7 @@ pub mod tests {
|
||||
Component::NonTSPseudoClass(PseudoClass::Hover),
|
||||
],
|
||||
specificity(0, 2, 1) | HAS_PSEUDO_BIT,
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert!(parse("::before:hover:active").is_err());
|
||||
assert!(parse("::before:hover .foo").is_err());
|
||||
@ -2760,7 +2761,7 @@ pub mod tests {
|
||||
Component::PseudoElement(PseudoElement::After),
|
||||
],
|
||||
specificity(0, 0, 2) | HAS_PSEUDO_BIT,
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("#d1 > .ok"),
|
||||
@ -2771,7 +2772,7 @@ pub mod tests {
|
||||
Component::Class(DummyAtom::from("ok")),
|
||||
],
|
||||
(1 << 20) + (1 << 10) + (0 << 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
parser.default_ns = None;
|
||||
assert!(parse(":not(#provel.old)").is_err());
|
||||
@ -2784,9 +2785,9 @@ pub mod tests {
|
||||
vec![Component::ID(DummyAtom::from("provel"))]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(1, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(svg|circle)", &parser),
|
||||
@ -2798,11 +2799,12 @@ pub mod tests {
|
||||
name: DummyAtom::from("circle"),
|
||||
lower_name: DummyAtom::from("circle"),
|
||||
}),
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// https://github.com/servo/servo/issues/16017
|
||||
assert_eq!(
|
||||
@ -2812,9 +2814,9 @@ pub mod tests {
|
||||
vec![Component::ExplicitUniversalType]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(|*)", &parser),
|
||||
@ -2823,11 +2825,12 @@ pub mod tests {
|
||||
vec![
|
||||
Component::ExplicitNoNamespace,
|
||||
Component::ExplicitUniversalType,
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// *| should be elided if there is no default namespace.
|
||||
// https://github.com/servo/servo/pull/17537
|
||||
@ -2838,9 +2841,9 @@ pub mod tests {
|
||||
vec![Component::ExplicitUniversalType]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(svg|*)", &parser),
|
||||
@ -2849,11 +2852,12 @@ pub mod tests {
|
||||
vec![
|
||||
Component::Namespace(DummyAtom("svg".into()), SVG.into()),
|
||||
Component::ExplicitUniversalType,
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
|
||||
assert!(parse("::slotted()").is_err());
|
||||
@ -2891,7 +2895,8 @@ pub mod tests {
|
||||
let selector = &parse_ns(
|
||||
"*|*::before",
|
||||
&DummyParser::default_with_namespace(DummyAtom::from("https://mozilla.org")),
|
||||
).unwrap()
|
||||
)
|
||||
.unwrap()
|
||||
.0[0];
|
||||
assert!(selector.is_universal());
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ impl OpaqueElement {
|
||||
/// Creates a new OpaqueElement from an arbitrarily-typed pointer.
|
||||
pub fn new<T>(ptr: &T) -> Self {
|
||||
unsafe {
|
||||
OpaqueElement(NonNull::new_unchecked(ptr as *const T as *const () as *mut ()))
|
||||
OpaqueElement(NonNull::new_unchecked(
|
||||
ptr as *const T as *const () as *mut (),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ use nodrop::NoDrop;
|
||||
#[cfg(feature = "servo")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use stable_deref_trait::{CloneStableDeref, StableDeref};
|
||||
use std::{isize, usize};
|
||||
use std::borrow;
|
||||
use std::cmp::Ordering;
|
||||
use std::convert::From;
|
||||
@ -48,6 +47,7 @@ use std::ptr;
|
||||
use std::slice;
|
||||
use std::sync::atomic;
|
||||
use std::sync::atomic::Ordering::{Acquire, Relaxed, Release};
|
||||
use std::{isize, usize};
|
||||
|
||||
// Private macro to get the offset of a struct field in bytes from the address of the struct.
|
||||
macro_rules! offset_of {
|
||||
@ -1170,11 +1170,11 @@ impl<A: fmt::Debug, B: fmt::Debug> fmt::Debug for ArcUnion<A, B> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Arc, HeaderWithLength, ThinArc};
|
||||
use std::clone::Clone;
|
||||
use std::ops::Drop;
|
||||
use std::sync::atomic;
|
||||
use std::sync::atomic::Ordering::{Acquire, SeqCst};
|
||||
use super::{Arc, HeaderWithLength, ThinArc};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
struct Canary(*mut atomic::AtomicUsize);
|
||||
|
@ -8,15 +8,14 @@
|
||||
// compile it out so that people remember it exists, thus the cfg'd Sender
|
||||
// import.
|
||||
|
||||
use Atom;
|
||||
use bezier::Bezier;
|
||||
use context::SharedStyleContext;
|
||||
use dom::{OpaqueNode, TElement};
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use properties::{self, CascadeMode, ComputedValues, LonghandId};
|
||||
use properties::animated_properties::AnimatedProperty;
|
||||
use properties::longhands::animation_direction::computed_value::single_value::T as AnimationDirection;
|
||||
use properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
|
||||
use properties::{self, CascadeMode, ComputedValues, LonghandId};
|
||||
use rule_tree::CascadeLevel;
|
||||
use servo_arc::Arc;
|
||||
#[cfg(feature = "servo")]
|
||||
@ -26,12 +25,12 @@ use std::fmt;
|
||||
use std::sync::mpsc::Sender;
|
||||
use stylesheets::keyframes_rule::{KeyframesAnimation, KeyframesStep, KeyframesStepValue};
|
||||
use timer::Timer;
|
||||
use values::computed::box_::TransitionProperty;
|
||||
use values::computed::Time;
|
||||
use values::computed::TimingFunction;
|
||||
use values::computed::box_::TransitionProperty;
|
||||
use values::generics::box_::AnimationIterationCount;
|
||||
use values::generics::easing::{StepPosition, TimingFunction as GenericTimingFunction};
|
||||
|
||||
use Atom;
|
||||
|
||||
/// This structure represents a keyframes animation current iteration state.
|
||||
///
|
||||
@ -316,7 +315,8 @@ impl PropertyAnimation {
|
||||
old_style,
|
||||
new_style,
|
||||
)
|
||||
}).collect(),
|
||||
})
|
||||
.collect(),
|
||||
TransitionProperty::Longhand(longhand_id) => {
|
||||
let animation = PropertyAnimation::from_longhand(
|
||||
longhand_id,
|
||||
@ -367,8 +367,9 @@ impl PropertyAnimation {
|
||||
let mut current_step = (time * (steps as f64)).floor() as i32;
|
||||
|
||||
if pos == StepPosition::Start ||
|
||||
pos == StepPosition::JumpStart ||
|
||||
pos == StepPosition::JumpBoth {
|
||||
pos == StepPosition::JumpStart ||
|
||||
pos == StepPosition::JumpBoth
|
||||
{
|
||||
current_step = current_step + 1;
|
||||
}
|
||||
|
||||
@ -472,7 +473,8 @@ pub fn start_transitions_if_applicable(
|
||||
duration: box_style.transition_duration_mod(i).seconds() as f64,
|
||||
property_animation,
|
||||
},
|
||||
)).unwrap();
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
had_animations = true;
|
||||
}
|
||||
@ -759,7 +761,8 @@ where
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}).unwrap_or(animation.steps.len() - 1);
|
||||
})
|
||||
.unwrap_or(animation.steps.len() - 1);
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
//!
|
||||
//! [attr]: https://dom.spec.whatwg.org/#interface-attr
|
||||
|
||||
use {Atom, LocalName, Namespace, Prefix};
|
||||
use app_units::Au;
|
||||
use cssparser::{self, Color, RGBA};
|
||||
use euclid::num::Zero;
|
||||
@ -17,10 +16,11 @@ use servo_arc::Arc;
|
||||
use servo_url::ServoUrl;
|
||||
use shared_lock::Locked;
|
||||
use std::str::FromStr;
|
||||
use str::str_join;
|
||||
use str::{read_exponent, read_fraction, HTML_SPACE_CHARACTERS};
|
||||
use str::{read_numbers, split_commas, split_html_space_chars};
|
||||
use str::str_join;
|
||||
use values::specified::Length;
|
||||
use {Atom, LocalName, Namespace, Prefix};
|
||||
|
||||
// Duplicated from script::dom::values.
|
||||
const UNSIGNED_LONG_MAX: u32 = 2147483647;
|
||||
|
@ -67,7 +67,8 @@ fn find_python() -> String {
|
||||
"python2.7"
|
||||
} else {
|
||||
"python"
|
||||
}.to_owned()
|
||||
}
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
|
@ -14,6 +14,8 @@ mod common {
|
||||
|
||||
#[cfg(feature = "bindgen")]
|
||||
mod bindings {
|
||||
use super::super::PYTHON;
|
||||
use super::common::*;
|
||||
use bindgen::{Builder, CodegenConfig};
|
||||
use regex::Regex;
|
||||
use std::cmp;
|
||||
@ -26,8 +28,6 @@ mod bindings {
|
||||
use std::slice;
|
||||
use std::sync::Mutex;
|
||||
use std::time::SystemTime;
|
||||
use super::common::*;
|
||||
use super::super::PYTHON;
|
||||
use toml;
|
||||
use toml::value::Table;
|
||||
|
||||
@ -284,7 +284,8 @@ mod bindings {
|
||||
let macro_name = captures.get(1).unwrap().as_str().to_string();
|
||||
let type_name = captures.get(2).unwrap().as_str().to_string();
|
||||
(macro_name, type_name)
|
||||
}).collect()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_borrowed_types() -> Vec<(bool, String)> {
|
||||
@ -419,7 +420,8 @@ mod bindings {
|
||||
servo,
|
||||
if generic { "<T>" } else { "" }
|
||||
))
|
||||
}).get_builder();
|
||||
})
|
||||
.get_builder();
|
||||
write_binding_file(builder, STRUCTS_FILE, &fixups);
|
||||
}
|
||||
|
||||
@ -467,7 +469,8 @@ mod bindings {
|
||||
filter: env::var("STYLO_BUILD_FILTER")
|
||||
.ok()
|
||||
.unwrap_or_else(|| "bindgen".to_owned()),
|
||||
})).expect("Failed to set logger.");
|
||||
}))
|
||||
.expect("Failed to set logger.");
|
||||
|
||||
true
|
||||
} else {
|
||||
@ -486,7 +489,8 @@ mod bindings {
|
||||
.handle_common(&mut fixups)
|
||||
.handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
|
||||
.handle_str_items("structs-types", |mut builder, ty| {
|
||||
builder = builder.blacklist_type(ty)
|
||||
builder = builder
|
||||
.blacklist_type(ty)
|
||||
.raw_line(format!("use gecko_bindings::structs::{};", ty));
|
||||
structs_types.insert(ty);
|
||||
// TODO this is hacky, figure out a better way to do it without
|
||||
@ -504,10 +508,14 @@ mod bindings {
|
||||
.handle_table_items("array-types", |builder, item| {
|
||||
let cpp_type = item["cpp-type"].as_str().unwrap();
|
||||
let rust_type = item["rust-type"].as_str().unwrap();
|
||||
builder
|
||||
.raw_line(format!(concat!("pub type nsTArrayBorrowed_{}<'a> = ",
|
||||
"&'a mut ::gecko_bindings::structs::nsTArray<{}>;"),
|
||||
cpp_type, rust_type))
|
||||
builder.raw_line(format!(
|
||||
concat!(
|
||||
"pub type nsTArrayBorrowed_{}<'a> = ",
|
||||
"&'a mut ::gecko_bindings::structs::nsTArray<{}>;"
|
||||
),
|
||||
cpp_type,
|
||||
rust_type
|
||||
))
|
||||
})
|
||||
.handle_str_items("servo-immutable-borrow-types", |b, ty| b.borrowed_type(ty))
|
||||
// Right now the only immutable borrow types are ones which we import
|
||||
@ -529,7 +537,8 @@ mod bindings {
|
||||
.raw_line(format!(
|
||||
"pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;",
|
||||
ty
|
||||
)).borrowed_type(ty)
|
||||
))
|
||||
.borrowed_type(ty)
|
||||
.zero_size_type(ty, &structs_types);
|
||||
}
|
||||
for ty in get_boxed_types().iter() {
|
||||
@ -538,14 +547,16 @@ mod bindings {
|
||||
.raw_line(format!(
|
||||
"pub type {0}Owned = ::gecko_bindings::sugar::ownership::Owned<{0}>;",
|
||||
ty
|
||||
)).blacklist_type(format!("{}OwnedOrNull", ty))
|
||||
))
|
||||
.blacklist_type(format!("{}OwnedOrNull", ty))
|
||||
.raw_line(format!(
|
||||
concat!(
|
||||
"pub type {0}OwnedOrNull = ",
|
||||
"::gecko_bindings::sugar::ownership::OwnedOrNull<{0}>;"
|
||||
),
|
||||
ty
|
||||
)).mutable_borrowed_type(ty)
|
||||
))
|
||||
.mutable_borrowed_type(ty)
|
||||
.zero_size_type(ty, &structs_types);
|
||||
}
|
||||
write_binding_file(builder, BINDINGS_FILE, &fixups);
|
||||
@ -595,9 +606,9 @@ mod bindings {
|
||||
|
||||
#[cfg(not(feature = "bindgen"))]
|
||||
mod bindings {
|
||||
use std::{env, fs, io};
|
||||
use std::path::{Path, PathBuf};
|
||||
use super::common::*;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{env, fs, io};
|
||||
|
||||
/// Copy contents of one directory into another.
|
||||
/// It currently only does a shallow copy.
|
||||
@ -622,7 +633,8 @@ mod bindings {
|
||||
println!("cargo:rerun-if-changed={}", dir.display());
|
||||
copy_dir(&dir, &*OUTDIR_PATH, |path| {
|
||||
println!("cargo:rerun-if-changed={}", path.display());
|
||||
}).expect("Fail to copy generated files to out dir");
|
||||
})
|
||||
.expect("Fail to copy generated files to out dir");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,9 @@ use animation::Animation;
|
||||
use app_units::Au;
|
||||
use bloom::StyleBloom;
|
||||
use data::{EagerPseudoStyles, ElementData};
|
||||
use dom::{SendElement, TElement};
|
||||
#[cfg(feature = "servo")]
|
||||
use dom::OpaqueNode;
|
||||
use dom::{SendElement, TElement};
|
||||
use euclid::Size2D;
|
||||
use euclid::TypedScale;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
@ -27,8 +27,8 @@ use properties::PropertyId;
|
||||
use rule_cache::RuleCache;
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::{SnapshotMap, EAGER_PSEUDO_COUNT};
|
||||
use selectors::NthIndexCache;
|
||||
use selectors::matching::ElementSelectorFlags;
|
||||
use selectors::NthIndexCache;
|
||||
use servo_arc::Arc;
|
||||
#[cfg(feature = "servo")]
|
||||
use servo_atoms::Atom;
|
||||
|
@ -6,7 +6,6 @@
|
||||
//!
|
||||
//! [counter-style]: https://drafts.csswg.org/css-counter-styles/
|
||||
|
||||
use Atom;
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser};
|
||||
use cssparser::{CowRcStr, Parser, SourceLocation, Token};
|
||||
use error_reporting::ContextualParseError;
|
||||
@ -20,8 +19,9 @@ use std::ops::Range;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
|
||||
use style_traits::{StyleParseErrorKind, ToCss};
|
||||
use values::CustomIdent;
|
||||
use values::specified::Integer;
|
||||
use values::CustomIdent;
|
||||
use Atom;
|
||||
|
||||
/// Parse a counter style name reference.
|
||||
///
|
||||
@ -502,7 +502,8 @@ impl Parse for Ranges {
|
||||
}
|
||||
}
|
||||
Ok(opt_start..opt_end)
|
||||
}).map(Ranges)
|
||||
})
|
||||
.map(Ranges)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
//!
|
||||
//! [custom]: https://drafts.csswg.org/css-variables/
|
||||
|
||||
use Atom;
|
||||
use cssparser::{Delimiter, Parser, ParserInput, SourcePosition, Token, TokenSerializationType};
|
||||
use hash::map::Entry;
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
@ -20,6 +19,7 @@ use std::cmp;
|
||||
use std::fmt::{self, Write};
|
||||
use std::hash::Hash;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use Atom;
|
||||
|
||||
/// The environment from which to get `env` function values.
|
||||
///
|
||||
@ -631,11 +631,8 @@ impl<'a> CustomPropertiesBuilder<'a> {
|
||||
// environment variable here, perform substitution here instead
|
||||
// of forcing a full traversal in `substitute_all` afterwards.
|
||||
let value = if !has_references && unparsed_value.references_environment {
|
||||
let result = substitute_references_in_value(
|
||||
unparsed_value,
|
||||
&map,
|
||||
&self.environment,
|
||||
);
|
||||
let result =
|
||||
substitute_references_in_value(unparsed_value, &map, &self.environment);
|
||||
match result {
|
||||
Ok(new_value) => Arc::new(new_value),
|
||||
Err(..) => {
|
||||
@ -886,11 +883,7 @@ fn substitute_all(custom_properties_map: &mut CustomPropertiesMap, environment:
|
||||
// Now we have shown that this variable is not in a loop, and
|
||||
// all of its dependencies should have been resolved. We can
|
||||
// start substitution now.
|
||||
let result = substitute_references_in_value(
|
||||
&value,
|
||||
&context.map,
|
||||
&context.environment,
|
||||
);
|
||||
let result = substitute_references_in_value(&value, &context.map, &context.environment);
|
||||
|
||||
match result {
|
||||
Ok(computed_value) => {
|
||||
|
@ -7,7 +7,6 @@
|
||||
#![allow(unsafe_code)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
#[cfg(feature = "gecko")]
|
||||
@ -20,9 +19,9 @@ use font_metrics::FontMetricsProvider;
|
||||
use media_queries::Device;
|
||||
use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock};
|
||||
use selector_parser::{AttrValue, Lang, PseudoElement, SelectorImpl};
|
||||
use selectors::Element as SelectorsElement;
|
||||
use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode};
|
||||
use selectors::sink::Push;
|
||||
use selectors::Element as SelectorsElement;
|
||||
use servo_arc::{Arc, ArcBorrow};
|
||||
use shared_lock::Locked;
|
||||
use std::fmt;
|
||||
@ -31,6 +30,7 @@ use std::hash::Hash;
|
||||
use std::ops::Deref;
|
||||
use stylist::CascadeData;
|
||||
use traversal_flags::TraversalFlags;
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// An opaque handle to a node, which, unlike UnsafeNode, cannot be transformed
|
||||
/// back into a non-opaque representation. The only safe operation that can be
|
||||
|
@ -5,17 +5,17 @@
|
||||
//! Generic implementations of some DOM APIs so they can be shared between Servo
|
||||
//! and Gecko.
|
||||
|
||||
use Atom;
|
||||
use context::QuirksMode;
|
||||
use dom::{TDocument, TElement, TNode, TShadowRoot};
|
||||
use invalidation::element::invalidator::{DescendantInvalidationLists, Invalidation};
|
||||
use invalidation::element::invalidator::{InvalidationProcessor, InvalidationVector};
|
||||
use selectors::{Element, NthIndexCache, SelectorList};
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use selectors::matching::{self, MatchingContext, MatchingMode};
|
||||
use selectors::parser::{Combinator, Component, LocalName, SelectorImpl};
|
||||
use selectors::{Element, NthIndexCache, SelectorList};
|
||||
use smallvec::SmallVec;
|
||||
use std::borrow::Borrow;
|
||||
use Atom;
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#dom-element-matches>
|
||||
pub fn element_matches<E>(
|
||||
@ -338,7 +338,10 @@ fn local_name_matches<E>(element: E, local_name: &LocalName<E::Impl>) -> bool
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
let LocalName { ref name, ref lower_name } = *local_name;
|
||||
let LocalName {
|
||||
ref name,
|
||||
ref lower_name,
|
||||
} = *local_name;
|
||||
if element.is_html_element_in_html_document() {
|
||||
element.local_name() == lower_name.borrow()
|
||||
} else {
|
||||
@ -543,23 +546,15 @@ where
|
||||
let case_sensitivity = quirks_mode.classes_and_ids_case_sensitivity();
|
||||
collect_all_elements::<E, Q, _>(root, results, |element| {
|
||||
element.has_class(class, case_sensitivity) &&
|
||||
matching::matches_selector_list(
|
||||
selector_list,
|
||||
&element,
|
||||
matching_context,
|
||||
)
|
||||
matching::matches_selector_list(selector_list, &element, matching_context)
|
||||
});
|
||||
}
|
||||
},
|
||||
SimpleFilter::LocalName(ref local_name) => {
|
||||
collect_all_elements::<E, Q, _>(root, results, |element| {
|
||||
local_name_matches(element, local_name) &&
|
||||
matching::matches_selector_list(
|
||||
selector_list,
|
||||
&element,
|
||||
matching_context,
|
||||
)
|
||||
matching::matches_selector_list(selector_list, &element, matching_context)
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -6,10 +6,10 @@
|
||||
//!
|
||||
//! [ff]: https://drafts.csswg.org/css-fonts/#at-font-face-rule
|
||||
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::{CowRcStr, SourceLocation};
|
||||
#[cfg(feature = "gecko")]
|
||||
use cssparser::UnicodeRange;
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::{CowRcStr, SourceLocation};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::{Parse, ParserContext};
|
||||
#[cfg(feature = "gecko")]
|
||||
@ -18,17 +18,17 @@ use selectors::parser::SelectorParseErrorKind;
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::values::SequenceWriter;
|
||||
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
|
||||
use style_traits::{StyleParseErrorKind, ToCss};
|
||||
use style_traits::values::SequenceWriter;
|
||||
use values::computed::font::FamilyName;
|
||||
use values::generics::font::FontStyle as GenericFontStyle;
|
||||
use values::specified::Angle;
|
||||
use values::specified::font::SpecifiedFontStyle;
|
||||
use values::specified::font::{AbsoluteFontWeight, FontStretch};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings};
|
||||
use values::specified::font::SpecifiedFontStyle;
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
use values::specified::Angle;
|
||||
|
||||
/// A source for a font-face rule.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
@ -55,7 +55,10 @@ impl OneOrMoreSeparated for Source {
|
||||
pub enum FontFaceSourceListComponent {
|
||||
Url(*const ::gecko_bindings::structs::mozilla::css::URLValue),
|
||||
Local(*mut ::gecko_bindings::structs::nsAtom),
|
||||
FormatHint { length: usize, utf8_bytes: *const u8 },
|
||||
FormatHint {
|
||||
length: usize,
|
||||
utf8_bytes: *const u8,
|
||||
},
|
||||
}
|
||||
|
||||
/// A `UrlSource` represents a font-face source that has been specified with a
|
||||
@ -133,7 +136,7 @@ macro_rules! impl_range {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// The font-weight descriptor:
|
||||
@ -192,10 +195,7 @@ impl FontStretchRange {
|
||||
}
|
||||
}
|
||||
|
||||
let (min, max) = sort_range(
|
||||
compute_stretch(&self.0),
|
||||
compute_stretch(&self.1),
|
||||
);
|
||||
let (min, max) = sort_range(compute_stretch(&self.0), compute_stretch(&self.1));
|
||||
ComputedFontStretchRange(min, max)
|
||||
}
|
||||
}
|
||||
@ -277,7 +277,7 @@ impl FontStyle {
|
||||
SpecifiedFontStyle::compute_angle_degrees(second),
|
||||
);
|
||||
ComputedFontStyleDescriptor::Oblique(min, max)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -340,7 +340,8 @@ impl<'a> FontFace<'a> {
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}).cloned()
|
||||
})
|
||||
.cloned()
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
@ -6,12 +6,12 @@
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use Atom;
|
||||
use app_units::Au;
|
||||
use context::SharedStyleContext;
|
||||
use logical_geometry::WritingMode;
|
||||
use media_queries::Device;
|
||||
use properties::style_structs::Font;
|
||||
use Atom;
|
||||
|
||||
/// Represents the font metrics that style needs from a font to compute the
|
||||
/// value of certain CSS units like `ex`.
|
||||
|
@ -32,16 +32,16 @@ use gecko_bindings::structs::RawServoStyleRule;
|
||||
use gecko_bindings::structs::RawServoStyleSheetContents;
|
||||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong};
|
||||
use media_queries::MediaList;
|
||||
use properties::{ComputedValues, PropertyDeclarationBlock};
|
||||
use properties::animated_properties::AnimationValue;
|
||||
use properties::{ComputedValues, PropertyDeclarationBlock};
|
||||
use rule_tree::StrongRuleNode;
|
||||
use servo_arc::{Arc, ArcBorrow};
|
||||
use shared_lock::Locked;
|
||||
use std::{mem, ptr};
|
||||
use stylesheets::keyframes_rule::Keyframe;
|
||||
use stylesheets::{CounterStyleRule, CssRules, FontFaceRule, FontFeatureValuesRule};
|
||||
use stylesheets::{DocumentRule, ImportRule, KeyframesRule, MediaRule, NamespaceRule, PageRule};
|
||||
use stylesheets::{StyleRule, StylesheetContents, SupportsRule};
|
||||
use stylesheets::keyframes_rule::Keyframe;
|
||||
use values::computed::QuotePair;
|
||||
|
||||
macro_rules! impl_arc_ffi {
|
||||
|
@ -12,15 +12,17 @@ use app_units::Au;
|
||||
use gecko::values::GeckoStyleCoordConvertible;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs::{self, nsStyleCoord_CalcValue};
|
||||
use gecko_bindings::structs::{nsresult, SheetType, nsStyleImage};
|
||||
use gecko_bindings::structs::{nsStyleImage, nsresult, SheetType};
|
||||
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
||||
use std::f32::consts::PI;
|
||||
use stylesheets::{Origin, RulesMutateError};
|
||||
use values::computed::{Angle, CalcLengthOrPercentage, Gradient, Image};
|
||||
use values::computed::{Integer, LengthOrPercentage, LengthOrPercentageOrAuto, NonNegativeLengthOrPercentageOrAuto};
|
||||
use values::computed::{Percentage, TextAlign};
|
||||
use values::computed::image::LineDirection;
|
||||
use values::computed::url::ComputedImageUrl;
|
||||
use values::computed::{Angle, CalcLengthOrPercentage, Gradient, Image};
|
||||
use values::computed::{
|
||||
Integer, LengthOrPercentage, LengthOrPercentageOrAuto, NonNegativeLengthOrPercentageOrAuto,
|
||||
};
|
||||
use values::computed::{Percentage, TextAlign};
|
||||
use values::generics::box_::VerticalAlign;
|
||||
use values::generics::grid::{TrackListValue, TrackSize};
|
||||
use values::generics::image::{CompatMode, GradientItem, Image as GenericImage};
|
||||
@ -113,13 +115,15 @@ impl From<nsStyleCoord_CalcValue> for NonNegativeLengthOrPercentageOrAuto {
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use values::generics::NonNegative;
|
||||
NonNegative(if other.mLength < 0 || other.mPercent < 0. {
|
||||
LengthOrPercentageOrAuto::Calc(
|
||||
CalcLengthOrPercentage::with_clamping_mode(
|
||||
Au(other.mLength).into(),
|
||||
if other.mHasPercent { Some(Percentage(other.mPercent)) } else { None },
|
||||
AllowedNumericType::NonNegative,
|
||||
)
|
||||
)
|
||||
LengthOrPercentageOrAuto::Calc(CalcLengthOrPercentage::with_clamping_mode(
|
||||
Au(other.mLength).into(),
|
||||
if other.mHasPercent {
|
||||
Some(Percentage(other.mPercent))
|
||||
} else {
|
||||
None
|
||||
},
|
||||
AllowedNumericType::NonNegative,
|
||||
))
|
||||
} else {
|
||||
other.into()
|
||||
})
|
||||
@ -231,11 +235,11 @@ impl nsStyleImage {
|
||||
|
||||
// FIXME(emilio): This is really complex, we should use cbindgen for this.
|
||||
fn set_gradient(&mut self, gradient: Gradient) {
|
||||
use self::structs::nsStyleCoord;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER as CLOSEST_CORNER;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE as CLOSEST_SIDE;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as FARTHEST_CORNER;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE as FARTHEST_SIDE;
|
||||
use self::structs::nsStyleCoord;
|
||||
use values::generics::image::{Circle, Ellipse, EndingShape, GradientKind, ShapeExtent};
|
||||
use values::specified::position::{X, Y};
|
||||
|
||||
@ -493,9 +497,9 @@ impl nsStyleImage {
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE as CLOSEST_SIDE;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as FARTHEST_CORNER;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE as FARTHEST_SIDE;
|
||||
use values::computed::Length;
|
||||
use values::computed::image::LineDirection;
|
||||
use values::computed::position::Position;
|
||||
use values::computed::Length;
|
||||
use values::generics::image::{Circle, ColorStop, CompatMode, Ellipse};
|
||||
use values::generics::image::{EndingShape, GradientKind, ShapeExtent};
|
||||
|
||||
@ -625,7 +629,8 @@ impl nsStyleImage {
|
||||
position: LengthOrPercentage::from_gecko_style_coord(&stop.mLocation),
|
||||
})
|
||||
}
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
|
||||
let compat_mode = if gecko_gradient.mMozLegacySyntax {
|
||||
CompatMode::Moz
|
||||
@ -649,9 +654,9 @@ pub mod basic_shape {
|
||||
|
||||
use gecko::values::GeckoStyleCoordConvertible;
|
||||
use gecko_bindings::structs;
|
||||
use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners};
|
||||
use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType};
|
||||
use gecko_bindings::structs::{StyleGeometryBox, StyleShapeSource, StyleShapeSourceType};
|
||||
use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners};
|
||||
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
|
||||
use gecko_bindings::sugar::refptr::RefPtr;
|
||||
use std::borrow::Borrow;
|
||||
@ -718,7 +723,8 @@ pub mod basic_shape {
|
||||
match other.mType {
|
||||
StyleShapeSourceType::URL => unsafe {
|
||||
let shape_image = &*other.__bindgen_anon_1.mShapeImage.as_ref().mPtr;
|
||||
let other_url = RefPtr::new(*shape_image.__bindgen_anon_1.mURLValue.as_ref() as *mut _);
|
||||
let other_url =
|
||||
RefPtr::new(*shape_image.__bindgen_anon_1.mURLValue.as_ref() as *mut _);
|
||||
let url = ComputedUrl::from_url_value(other_url);
|
||||
ShapeSource::ImageOrUrl(url)
|
||||
},
|
||||
|
@ -8,8 +8,10 @@ use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use context::QuirksMode;
|
||||
use dom::TElement;
|
||||
use gecko_bindings::bindings::{self, RawServoStyleSet};
|
||||
use gecko_bindings::structs::{RawGeckoPresContextBorrowed, ServoStyleSetSizes, StyleSheet as DomStyleSheet};
|
||||
use gecko_bindings::structs::{StyleSheetInfo, nsIDocument};
|
||||
use gecko_bindings::structs::{nsIDocument, StyleSheetInfo};
|
||||
use gecko_bindings::structs::{
|
||||
RawGeckoPresContextBorrowed, ServoStyleSetSizes, StyleSheet as DomStyleSheet,
|
||||
};
|
||||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||
use malloc_size_of::MallocSizeOfOps;
|
||||
|
@ -5,8 +5,8 @@
|
||||
//! Global style data
|
||||
|
||||
use context::StyleSystemOptions;
|
||||
use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread};
|
||||
use gecko_bindings::bindings::Gecko_SetJemallocThreadLocalArena;
|
||||
use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread};
|
||||
use num_cpus;
|
||||
use parallel::STYLE_THREAD_STACK_SIZE_KB;
|
||||
use rayon;
|
||||
|
@ -4,17 +4,17 @@
|
||||
|
||||
//! Gecko's media feature list and evaluator.
|
||||
|
||||
use Atom;
|
||||
use app_units::Au;
|
||||
use euclid::Size2D;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs;
|
||||
use media_queries::Device;
|
||||
use media_queries::media_feature::{AllowsRanges, ParsingRequirements};
|
||||
use media_queries::media_feature::{MediaFeatureDescription, Evaluator};
|
||||
use media_queries::media_feature::{Evaluator, MediaFeatureDescription};
|
||||
use media_queries::media_feature_expression::{AspectRatio, RangeOrOperator};
|
||||
use media_queries::Device;
|
||||
use values::computed::CSSPixelLength;
|
||||
use values::computed::Resolution;
|
||||
use Atom;
|
||||
|
||||
fn viewport_size(device: &Device) -> Size2D<Au> {
|
||||
let pc = device.pres_context();
|
||||
@ -305,15 +305,15 @@ bitflags! {
|
||||
}
|
||||
|
||||
fn primary_pointer_capabilities(device: &Device) -> PointerCapabilities {
|
||||
PointerCapabilities::from_bits_truncate(
|
||||
unsafe { bindings::Gecko_MediaFeatures_PrimaryPointerCapabilities(device.document()) }
|
||||
)
|
||||
PointerCapabilities::from_bits_truncate(unsafe {
|
||||
bindings::Gecko_MediaFeatures_PrimaryPointerCapabilities(device.document())
|
||||
})
|
||||
}
|
||||
|
||||
fn all_pointer_capabilities(device: &Device) -> PointerCapabilities {
|
||||
PointerCapabilities::from_bits_truncate(
|
||||
unsafe { bindings::Gecko_MediaFeatures_AllPointerCapabilities(device.document()) }
|
||||
)
|
||||
PointerCapabilities::from_bits_truncate(unsafe {
|
||||
bindings::Gecko_MediaFeatures_AllPointerCapabilities(device.document())
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
//! Gecko's media-query device and expression representation.
|
||||
|
||||
use app_units::AU_PER_PX;
|
||||
use app_units::Au;
|
||||
use app_units::AU_PER_PX;
|
||||
use cssparser::RGBA;
|
||||
use custom_properties::CssEnvironment;
|
||||
use euclid::Size2D;
|
||||
@ -20,10 +20,10 @@ use servo_arc::Arc;
|
||||
use std::fmt;
|
||||
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering};
|
||||
use string_cache::Atom;
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use values::{CustomIdent, KeyframesName};
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use values::computed::font::FontSize;
|
||||
use values::{CustomIdent, KeyframesName};
|
||||
|
||||
/// The `Device` in Gecko wraps a pres context, has a default values computed,
|
||||
/// and contains all the viewport rule state.
|
||||
|
@ -3,29 +3,29 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* This file contains a helper macro includes all supported non-tree-structural
|
||||
* pseudo-classes.
|
||||
*
|
||||
* This file contains a helper macro includes all supported non-tree-structural
|
||||
* pseudo-classes.
|
||||
*
|
||||
|
||||
* FIXME: Find a way to autogenerate this file.
|
||||
*
|
||||
* Expected usage is as follows:
|
||||
* ```
|
||||
* macro_rules! pseudo_class_macro{
|
||||
* ([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
|
||||
* // do stuff
|
||||
* }
|
||||
* }
|
||||
* apply_non_ts_list!(pseudo_class_macro)
|
||||
* ```
|
||||
*
|
||||
* $gecko_type can be either "_" or an ident in Gecko's CSSPseudoClassType.
|
||||
* $state can be either "_" or an expression of type ElementState. If present,
|
||||
* the semantics are that the pseudo-class matches if any of the bits in
|
||||
* $state are set on the element.
|
||||
* $flags can be either "_" or an expression of type NonTSPseudoClassFlag,
|
||||
* see selector_parser.rs for more details.
|
||||
*/
|
||||
* FIXME: Find a way to autogenerate this file.
|
||||
*
|
||||
* Expected usage is as follows:
|
||||
* ```
|
||||
* macro_rules! pseudo_class_macro{
|
||||
* ([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
|
||||
* // do stuff
|
||||
* }
|
||||
* }
|
||||
* apply_non_ts_list!(pseudo_class_macro)
|
||||
* ```
|
||||
*
|
||||
* $gecko_type can be either "_" or an ident in Gecko's CSSPseudoClassType.
|
||||
* $state can be either "_" or an expression of type ElementState. If present,
|
||||
* the semantics are that the pseudo-class matches if any of the bits in
|
||||
* $state are set on the element.
|
||||
* $flags can be either "_" or an expression of type NonTSPseudoClassFlag,
|
||||
* see selector_parser.rs for more details.
|
||||
*/
|
||||
|
||||
macro_rules! apply_non_ts_list {
|
||||
($apply_macro:ident) => {
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
use cssparser::ToCss;
|
||||
use gecko_bindings::structs::{self, CSSPseudoElementType};
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
|
||||
use std::fmt;
|
||||
use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
|
||||
|
@ -12,10 +12,10 @@ use gecko_bindings::structs::RawServoSelectorList;
|
||||
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||
use invalidation::element::document_state::InvalidationMatchingData;
|
||||
use selector_parser::{Direction, SelectorParser};
|
||||
use selectors::SelectorList;
|
||||
use selectors::parser::{SelectorParseErrorKind, Visit};
|
||||
use selectors::parser::{self as selector_parser, Selector};
|
||||
use selectors::parser::{SelectorParseErrorKind, Visit};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use selectors::SelectorList;
|
||||
use std::fmt;
|
||||
use str::starts_with_ignore_ascii_case;
|
||||
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||
|
@ -5,7 +5,6 @@
|
||||
//! A gecko snapshot, that stores the element attributes and state before they
|
||||
//! change in order to properly calculate restyle hints.
|
||||
|
||||
use WeakAtom;
|
||||
use dom::TElement;
|
||||
use element_state::ElementState;
|
||||
use gecko::snapshot_helpers;
|
||||
@ -18,6 +17,7 @@ use invalidation::element::element_wrapper::ElementSnapshot;
|
||||
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
|
||||
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
|
||||
use string_cache::{Atom, Namespace};
|
||||
use WeakAtom;
|
||||
|
||||
/// A snapshot of a Gecko element.
|
||||
pub type GeckoElementSnapshot = ServoElementSnapshot;
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
//! Element an snapshot common logic.
|
||||
|
||||
use CaseSensitivityExt;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs::{self, nsAtom};
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use string_cache::{Atom, WeakAtom};
|
||||
use CaseSensitivityExt;
|
||||
|
||||
/// A function that, given an element of type `T`, allows you to get a single
|
||||
/// class or a class list.
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
use cssparser::Parser;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs::root::mozilla::CORSMode;
|
||||
use gecko_bindings::structs::root::mozilla::css::URLValue;
|
||||
use gecko_bindings::structs::root::mozilla::CORSMode;
|
||||
use gecko_bindings::structs::root::nsStyleImageRequest;
|
||||
use gecko_bindings::sugar::ownership::{HasArcFFI, FFIArcHelpers};
|
||||
use gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI};
|
||||
use gecko_bindings::sugar::refptr::RefPtr;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use nsstring::nsCString;
|
||||
@ -123,10 +123,7 @@ impl SpecifiedUrl {
|
||||
|
||||
fn from_css_url_with_cors(url: CssUrl, cors: CORSMode) -> Self {
|
||||
let url_value = unsafe {
|
||||
let ptr = bindings::Gecko_URLValue_Create(
|
||||
url.0.clone().into_strong(),
|
||||
cors,
|
||||
);
|
||||
let ptr = bindings::Gecko_URLValue_Create(url.0.clone().into_strong(), cors);
|
||||
// We do not expect Gecko_URLValue_Create returns null.
|
||||
debug_assert!(!ptr.is_null());
|
||||
RefPtr::from_addrefed(ptr)
|
||||
@ -261,11 +258,7 @@ impl ToCss for ComputedUrl {
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
serialize_computed_url(
|
||||
&self.0.url_value,
|
||||
dest,
|
||||
bindings::Gecko_GetComputedURLSpec,
|
||||
)
|
||||
serialize_computed_url(&self.0.url_value, dest, bindings::Gecko_GetComputedURLSpec)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,30 +6,34 @@
|
||||
|
||||
//! Different kind of helpers to interact with Gecko values.
|
||||
|
||||
use Atom;
|
||||
use app_units::Au;
|
||||
use counter_style::{Symbol, Symbols};
|
||||
use cssparser::RGBA;
|
||||
use gecko_bindings::structs::{self, CounterStylePtr, nsStyleCoord};
|
||||
use gecko_bindings::structs::{self, nsStyleCoord, CounterStylePtr};
|
||||
use gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius};
|
||||
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
||||
use media_queries::Device;
|
||||
use nsstring::{nsACString, nsCStr};
|
||||
use std::cmp::max;
|
||||
use values::{Auto, Either, None_, Normal};
|
||||
use values::computed::{Angle, ExtremumLength, Length, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage};
|
||||
use values::computed::{MaxLength as ComputedMaxLength, MozLength as ComputedMozLength, Percentage};
|
||||
use values::computed::{NonNegativeLength, NonNegativeLengthOrPercentage, NonNegativeNumber};
|
||||
use values::computed::FlexBasis as ComputedFlexBasis;
|
||||
use values::computed::basic_shape::ShapeRadius as ComputedShapeRadius;
|
||||
use values::generics::{CounterStyleOrNone, NonNegative};
|
||||
use values::computed::FlexBasis as ComputedFlexBasis;
|
||||
use values::computed::{
|
||||
Angle, ExtremumLength, Length, LengthOrPercentage, LengthOrPercentageOrAuto,
|
||||
};
|
||||
use values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage};
|
||||
use values::computed::{
|
||||
MaxLength as ComputedMaxLength, MozLength as ComputedMozLength, Percentage,
|
||||
};
|
||||
use values::computed::{NonNegativeLength, NonNegativeLengthOrPercentage, NonNegativeNumber};
|
||||
use values::generics::basic_shape::ShapeRadius;
|
||||
use values::generics::box_::Perspective;
|
||||
use values::generics::flex::FlexBasis;
|
||||
use values::generics::gecko::ScrollSnapPoint;
|
||||
use values::generics::grid::{TrackBreadth, TrackKeyword};
|
||||
use values::generics::length::{MaxLength, MozLength};
|
||||
use values::generics::{CounterStyleOrNone, NonNegative};
|
||||
use values::{Auto, Either, None_, Normal};
|
||||
use Atom;
|
||||
|
||||
/// A trait that defines an interface to convert from and to `nsStyleCoord`s.
|
||||
pub trait GeckoStyleCoordConvertible: Sized {
|
||||
@ -537,7 +541,8 @@ impl CounterStyleOrNone {
|
||||
.map(|symbol| match *symbol {
|
||||
Symbol::String(ref s) => nsCStr::from(s),
|
||||
Symbol::Ident(_) => unreachable!("Should not have identifier in symbols()"),
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
let symbols: Vec<_> = symbols
|
||||
.iter()
|
||||
.map(|symbol| symbol as &nsACString as *const _)
|
||||
@ -557,8 +562,8 @@ impl CounterStyleOrNone {
|
||||
/// Convert Gecko CounterStylePtr to CounterStyleOrNone or String.
|
||||
pub fn from_gecko_value(gecko_value: &CounterStylePtr) -> Either<Self, String> {
|
||||
use gecko_bindings::bindings;
|
||||
use values::CustomIdent;
|
||||
use values::generics::SymbolsType;
|
||||
use values::CustomIdent;
|
||||
|
||||
let name = unsafe { bindings::Gecko_CounterStyle_GetName(gecko_value) };
|
||||
if !name.is_null() {
|
||||
|
@ -14,7 +14,6 @@
|
||||
//! style system it's kind of pointless in the Stylo case, and only Servo forces
|
||||
//! the separation between the style system implementation and everything else.
|
||||
|
||||
use CaseSensitivityExt;
|
||||
use app_units::Au;
|
||||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
@ -29,9 +28,6 @@ use gecko::global_style_data::GLOBAL_STYLE_DATA;
|
||||
use gecko::selector_parser::{NonTSPseudoClass, PseudoElement, SelectorImpl};
|
||||
use gecko::snapshot_helpers;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme};
|
||||
use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetPreviousSibling, Gecko_GetNextStyleChild};
|
||||
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
||||
use gecko_bindings::bindings::Gecko_ElementHasAnimations;
|
||||
use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations;
|
||||
use gecko_bindings::bindings::Gecko_ElementHasCSSTransitions;
|
||||
@ -47,35 +43,40 @@ use gecko_bindings::bindings::Gecko_IsSignificantChild;
|
||||
use gecko_bindings::bindings::Gecko_MatchLang;
|
||||
use gecko_bindings::bindings::Gecko_UnsetDirtyStyleAttr;
|
||||
use gecko_bindings::bindings::Gecko_UpdateAnimations;
|
||||
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme};
|
||||
use gecko_bindings::bindings::{
|
||||
Gecko_GetLastChild, Gecko_GetNextStyleChild, Gecko_GetPreviousSibling,
|
||||
};
|
||||
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
||||
use gecko_bindings::structs;
|
||||
use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode, RawGeckoXBLBinding};
|
||||
use gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag};
|
||||
use gecko_bindings::structs::nsChangeHint;
|
||||
use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme;
|
||||
use gecko_bindings::structs::nsRestyleHint;
|
||||
use gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
|
||||
use gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT;
|
||||
use gecko_bindings::structs::ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO;
|
||||
use gecko_bindings::structs::ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO;
|
||||
use gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT;
|
||||
use gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
|
||||
use gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES;
|
||||
use gecko_bindings::structs::NODE_NEEDS_FRAME;
|
||||
use gecko_bindings::structs::nsChangeHint;
|
||||
use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme;
|
||||
use gecko_bindings::structs::nsRestyleHint;
|
||||
use gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag};
|
||||
use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode, RawGeckoXBLBinding};
|
||||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
|
||||
use hash::FxHashMap;
|
||||
use logical_geometry::WritingMode;
|
||||
use media_queries::Device;
|
||||
use properties::{ComputedValues, LonghandId};
|
||||
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use properties::animated_properties::{AnimationValue, AnimationValueMap};
|
||||
use properties::style_structs::Font;
|
||||
use properties::{ComputedValues, LonghandId};
|
||||
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use rule_tree::CascadeLevel as ServoCascadeLevel;
|
||||
use selector_parser::{AttrValue, HorizontalDirection, Lang};
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
|
||||
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
use selectors::matching::VisitedHandlingMode;
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
use selectors::sink::Push;
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use servo_arc::{Arc, ArcBorrow, RawOffsetArc};
|
||||
use shared_lock::Locked;
|
||||
use std::cell::RefCell;
|
||||
@ -85,6 +86,7 @@ use std::mem;
|
||||
use std::ptr;
|
||||
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||
use stylist::CascadeData;
|
||||
use CaseSensitivityExt;
|
||||
|
||||
#[inline]
|
||||
fn elements_with_id<'a, 'le>(
|
||||
@ -937,7 +939,8 @@ impl<'le> GeckoElement<'le> {
|
||||
.animate(
|
||||
to.as_ref().unwrap(),
|
||||
Procedure::Interpolate { progress: 0.5 },
|
||||
).is_ok()
|
||||
)
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1278,7 +1281,8 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||
Some(
|
||||
Locked::<PropertyDeclarationBlock>::as_arc(
|
||||
&*(&raw as *const &structs::RawServoDeclarationBlock),
|
||||
).borrow_arc(),
|
||||
)
|
||||
.borrow_arc(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,9 @@
|
||||
use gecko_bindings::bindings::Gecko_AddRefCSSShadowArrayArbitraryThread;
|
||||
use gecko_bindings::bindings::Gecko_NewCSSShadowArray;
|
||||
use gecko_bindings::bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread;
|
||||
use gecko_bindings::structs::{RefPtr, nsCSSShadowArray, nsCSSShadowItem};
|
||||
use std::{ptr, slice};
|
||||
use gecko_bindings::structs::{nsCSSShadowArray, nsCSSShadowItem, RefPtr};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::{ptr, slice};
|
||||
|
||||
impl RefPtr<nsCSSShadowArray> {
|
||||
/// Replaces the current `nsCSSShadowArray` with a new one of len `len`.
|
||||
|
@ -234,9 +234,13 @@ impl nsCSSValue {
|
||||
}
|
||||
debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_List);
|
||||
let list: &mut structs::nsCSSValueList = &mut unsafe {
|
||||
self.mValue.mList.as_ref() // &*nsCSSValueList_heap
|
||||
.as_mut().expect("List pointer should be non-null")
|
||||
}._base;
|
||||
self.mValue
|
||||
.mList
|
||||
.as_ref() // &*nsCSSValueList_heap
|
||||
.as_mut()
|
||||
.expect("List pointer should be non-null")
|
||||
}
|
||||
._base;
|
||||
for (item, new_value) in list.into_iter().zip(values) {
|
||||
*item = new_value;
|
||||
}
|
||||
@ -255,9 +259,13 @@ impl nsCSSValue {
|
||||
}
|
||||
debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_PairList);
|
||||
let mut item_ptr = &mut unsafe {
|
||||
self.mValue.mPairList.as_ref() // &*nsCSSValuePairList_heap
|
||||
.as_mut().expect("List pointer should be non-null")
|
||||
}._base as *mut structs::nsCSSValuePairList;
|
||||
self.mValue
|
||||
.mPairList
|
||||
.as_ref() // &*nsCSSValuePairList_heap
|
||||
.as_mut()
|
||||
.expect("List pointer should be non-null")
|
||||
}
|
||||
._base as *mut structs::nsCSSValuePairList;
|
||||
while let Some(item) = unsafe { item_ptr.as_mut() } {
|
||||
let value = values.next().expect("Values shouldn't have been exhausted");
|
||||
item.mXValue = value.0;
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
use gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength;
|
||||
use gecko_bindings::bindings::Gecko_EnsureStyleTransitionArrayLength;
|
||||
use gecko_bindings::structs::{StyleAnimation, StyleTransition};
|
||||
use gecko_bindings::structs::nsStyleAutoArray;
|
||||
use gecko_bindings::structs::{StyleAnimation, StyleTransition};
|
||||
use std::iter::{once, Chain, IntoIterator, Once};
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::slice::{Iter, IterMut};
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs::{nsStyleCoord, nsStyleCoord_Calc, nsStyleCoord_CalcValue};
|
||||
use gecko_bindings::structs::{nscoord, nsStyleCorners, nsStyleSides, nsStyleUnion, nsStyleUnit};
|
||||
use gecko_bindings::structs::{nsStyleCorners, nsStyleSides, nsStyleUnion, nsStyleUnit, nscoord};
|
||||
use std::mem;
|
||||
|
||||
impl nsStyleCoord {
|
||||
@ -277,8 +277,8 @@ pub unsafe trait CoordDataMut: CoordData {
|
||||
#[inline(always)]
|
||||
/// Sets the inner value.
|
||||
fn set_value(&mut self, value: CoordDataValue) {
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
use self::CoordDataValue::*;
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
self.reset();
|
||||
unsafe {
|
||||
let (unit, union) = self.values_mut();
|
||||
@ -364,8 +364,8 @@ pub unsafe trait CoordData {
|
||||
#[inline(always)]
|
||||
/// Get the appropriate value for this object.
|
||||
fn as_value(&self) -> CoordDataValue {
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
use self::CoordDataValue::*;
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
unsafe {
|
||||
match self.unit() {
|
||||
eStyleUnit_Null => Null,
|
||||
|
@ -117,7 +117,9 @@ impl<T> nsTArray<T> {
|
||||
I: ExactSizeIterator + Iterator<Item = T>,
|
||||
{
|
||||
debug_assert!(iter.len() <= 0xFFFFFFFF);
|
||||
unsafe { self.set_len_pod(iter.len() as u32); }
|
||||
unsafe {
|
||||
self.set_len_pod(iter.len() as u32);
|
||||
}
|
||||
self.iter_mut().zip(iter).for_each(|(r, v)| *r = v);
|
||||
}
|
||||
}
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
//! A rust helper to ease the use of Gecko's refcounted types.
|
||||
|
||||
use Atom;
|
||||
use gecko_bindings::{structs, bindings};
|
||||
use gecko_bindings::sugar::ownership::HasArcFFI;
|
||||
use gecko_bindings::{bindings, structs};
|
||||
use servo_arc::Arc;
|
||||
use std::{fmt, mem, ptr};
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::{fmt, mem, ptr};
|
||||
use Atom;
|
||||
|
||||
/// Trait for all objects that have Addref() and Release
|
||||
/// methods and can be placed inside RefPtr<T>
|
||||
@ -217,7 +217,9 @@ impl<T> structs::RefPtr<T> {
|
||||
where
|
||||
U: HasArcFFI<FFIType = T>,
|
||||
{
|
||||
unsafe { U::release_opt(self.mRawPtr.as_ref()); }
|
||||
unsafe {
|
||||
U::release_opt(self.mRawPtr.as_ref());
|
||||
}
|
||||
self.set_arc_leaky(other);
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
use gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
|
||||
use gecko_bindings::structs::StyleComplexColor;
|
||||
use gecko_bindings::structs::StyleComplexColor_Tag as Tag;
|
||||
use values::{Auto, Either};
|
||||
use values::computed::{Color as ComputedColor, RGBAColor as ComputedRGBA};
|
||||
use values::computed::ui::ColorOrAuto;
|
||||
use values::computed::{Color as ComputedColor, RGBAColor as ComputedRGBA};
|
||||
use values::generics::color::{Color as GenericColor, ComplexColorRatios};
|
||||
use values::{Auto, Either};
|
||||
|
||||
impl StyleComplexColor {
|
||||
/// Create a `StyleComplexColor` value that represents `currentColor`.
|
||||
|
@ -17,13 +17,13 @@ use gecko_bindings::bindings::Gecko_ReleaseAtom;
|
||||
use gecko_bindings::structs::{nsAtom, nsAtom_AtomKind, nsDynamicAtom, nsStaticAtom};
|
||||
use nsstring::{nsAString, nsStr};
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use std::{mem, slice, str};
|
||||
use std::borrow::{Borrow, Cow};
|
||||
use std::char::{self, DecodeUtf16};
|
||||
use std::fmt::{self, Write};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::iter::Cloned;
|
||||
use std::ops::Deref;
|
||||
use std::{mem, slice, str};
|
||||
use style_traits::SpecifiedValueInfo;
|
||||
|
||||
#[macro_use]
|
||||
|
@ -5,16 +5,16 @@
|
||||
//! A wrapper over an element and a snapshot, that allows us to selector-match
|
||||
//! against a past state of the element.
|
||||
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom};
|
||||
use dom::TElement;
|
||||
use element_state::ElementState;
|
||||
use selector_parser::{AttrValue, NonTSPseudoClass, PseudoElement, SelectorImpl};
|
||||
use selector_parser::{Snapshot, SnapshotMap};
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use std::cell::Cell;
|
||||
use std::fmt;
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// In order to compute restyle hints, we perform a selector match against a
|
||||
/// list of partial selectors whose rightmost simple selector may be sensitive
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
//! Code for invalidations due to state or attribute changes.
|
||||
|
||||
use {Atom, LocalName, Namespace};
|
||||
use context::QuirksMode;
|
||||
use element_state::{DocumentState, ElementState};
|
||||
use fallible::FallibleVec;
|
||||
@ -16,6 +15,7 @@ use selectors::parser::{Combinator, Component};
|
||||
use selectors::parser::{Selector, SelectorIter, Visit};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use smallvec::SmallVec;
|
||||
use {Atom, LocalName, Namespace};
|
||||
|
||||
/// Mapping between (partial) CompoundSelectors (and the combinator to their
|
||||
/// right) and the states and attributes they depend on.
|
||||
|
@ -8,8 +8,8 @@
|
||||
use context::StackLimitChecker;
|
||||
use dom::{TElement, TNode, TShadowRoot};
|
||||
use selector_parser::SelectorImpl;
|
||||
use selectors::matching::{CompoundSelectorMatchingResult, MatchingContext};
|
||||
use selectors::matching::matches_compound_selector_from;
|
||||
use selectors::matching::{CompoundSelectorMatchingResult, MatchingContext};
|
||||
use selectors::parser::{Combinator, Component, Selector};
|
||||
use smallvec::SmallVec;
|
||||
use std::fmt;
|
||||
|
@ -5,7 +5,6 @@
|
||||
//! An invalidation processor for style changes due to state and attribute
|
||||
//! changes.
|
||||
|
||||
use {Atom, WeakAtom};
|
||||
use context::SharedStyleContext;
|
||||
use data::ElementData;
|
||||
use dom::TElement;
|
||||
@ -17,12 +16,13 @@ use invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use selector_map::SelectorMap;
|
||||
use selector_parser::Snapshot;
|
||||
use selectors::NthIndexCache;
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode};
|
||||
use selectors::matching::matches_selector;
|
||||
use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode};
|
||||
use selectors::NthIndexCache;
|
||||
use smallvec::SmallVec;
|
||||
use stylesheets::origin::{Origin, OriginSet};
|
||||
use {Atom, WeakAtom};
|
||||
|
||||
/// The collector implementation.
|
||||
struct Collector<'a, 'b: 'a, 'selectors: 'a, E>
|
||||
|
@ -7,9 +7,6 @@
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
use Atom;
|
||||
use CaseSensitivityExt;
|
||||
use LocalName as SelectorLocalName;
|
||||
use dom::{TDocument, TElement, TNode};
|
||||
use fxhash::FxHashSet;
|
||||
use invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
|
||||
@ -20,6 +17,9 @@ use selectors::attr::CaseSensitivity;
|
||||
use selectors::parser::{Component, LocalName, Selector};
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use stylesheets::{CssRule, StylesheetInDocument};
|
||||
use Atom;
|
||||
use CaseSensitivityExt;
|
||||
use LocalName as SelectorLocalName;
|
||||
|
||||
/// A style sheet invalidation represents a kind of element or subtree that may
|
||||
/// need to be restyled. Whether it represents a whole subtree or just a single
|
||||
|
@ -84,7 +84,8 @@ pub extern crate servo_arc;
|
||||
#[cfg(feature = "servo")]
|
||||
#[macro_use]
|
||||
extern crate servo_atoms;
|
||||
#[cfg(feature = "servo")] extern crate servo_channel;
|
||||
#[cfg(feature = "servo")]
|
||||
extern crate servo_channel;
|
||||
#[cfg(feature = "servo")]
|
||||
extern crate servo_config;
|
||||
#[cfg(feature = "servo")]
|
||||
@ -168,20 +169,20 @@ pub use gecko_string_cache as string_cache;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Atom;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Namespace;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Atom as Prefix;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Atom as LocalName;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Namespace;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo_atoms::Atom;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use html5ever::Prefix;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use html5ever::LocalName;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use html5ever::Namespace;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use html5ever::Prefix;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo_atoms::Atom;
|
||||
|
||||
/// The CSS properties supported by the style system.
|
||||
/// Generated from the properties.mako.rs template by build.rs
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
//! Geometry in flow-relative space.
|
||||
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use euclid::num::Zero;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use properties::style_structs;
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt::{self, Debug, Error, Formatter};
|
||||
|
@ -12,8 +12,8 @@ use context::{SharedStyleContext, StyleContext};
|
||||
use data::ElementData;
|
||||
use dom::TElement;
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use properties::ComputedValues;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::ComputedValues;
|
||||
use rule_tree::{CascadeLevel, StrongRuleNode};
|
||||
use selector_parser::{PseudoElement, RestyleDamage};
|
||||
use selectors::matching::ElementSelectorFlags;
|
||||
@ -224,7 +224,8 @@ trait PrivateMatchMethods: TElement {
|
||||
context,
|
||||
RuleInclusion::All,
|
||||
PseudoElementResolution::IfApplicable,
|
||||
).cascade_style_and_visited_with_default_parents(inputs);
|
||||
)
|
||||
.cascade_style_and_visited_with_default_parents(inputs);
|
||||
|
||||
Some(style.0)
|
||||
}
|
||||
@ -618,14 +619,12 @@ trait PrivateMatchMethods: TElement {
|
||||
|
||||
match *running_animation {
|
||||
Animation::Transition(..) => unreachable!(),
|
||||
Animation::Keyframes(_, _, _, ref mut state) => {
|
||||
match update {
|
||||
AnimationUpdate::Regular => {},
|
||||
AnimationUpdate::AnimationCanceled => {
|
||||
state.expired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Animation::Keyframes(_, _, _, ref mut state) => match update {
|
||||
AnimationUpdate::Regular => {},
|
||||
AnimationUpdate::AnimationCanceled => {
|
||||
state.expired = true;
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,12 @@
|
||||
//!
|
||||
//! https://drafts.csswg.org/mediaqueries-4/#typedef-media-condition
|
||||
|
||||
use super::{Device, MediaFeatureExpression};
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Parser, Token};
|
||||
use parser::ParserContext;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use super::{Device, MediaFeatureExpression};
|
||||
|
||||
/// A binary `and` or `or` operator.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
//! Media features.
|
||||
|
||||
use Atom;
|
||||
use super::media_feature_expression::{AspectRatio, RangeOrOperator};
|
||||
use super::Device;
|
||||
use cssparser::Parser;
|
||||
use parser::ParserContext;
|
||||
use std::fmt;
|
||||
use style_traits::ParseError;
|
||||
use super::Device;
|
||||
use super::media_feature_expression::{AspectRatio, RangeOrOperator};
|
||||
use values::computed::{CSSPixelLength, Resolution};
|
||||
use Atom;
|
||||
|
||||
/// A generic discriminant for an enum value.
|
||||
pub type KeywordDiscriminant = u8;
|
||||
|
@ -5,24 +5,24 @@
|
||||
//! Parsing for media feature expressions, like `(foo: bar)` or
|
||||
//! `(width >= 400px)`.
|
||||
|
||||
use Atom;
|
||||
use super::media_feature::{Evaluator, MediaFeatureDescription};
|
||||
use super::media_feature::{KeywordDiscriminant, ParsingRequirements};
|
||||
use super::Device;
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Parser, Token};
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::structs;
|
||||
use num_traits::Zero;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::cmp::{PartialOrd, Ordering};
|
||||
use std::cmp::{Ordering, PartialOrd};
|
||||
use std::fmt::{self, Write};
|
||||
use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::Origin;
|
||||
use super::Device;
|
||||
use super::media_feature::{Evaluator, MediaFeatureDescription};
|
||||
use super::media_feature::{ParsingRequirements, KeywordDiscriminant};
|
||||
use values::{serialize_atom_identifier, CSSFloat};
|
||||
use values::computed::{self, ToComputedValue};
|
||||
use values::specified::{Integer, Length, Number, Resolution};
|
||||
use values::{serialize_atom_identifier, CSSFloat};
|
||||
use Atom;
|
||||
|
||||
/// An aspect ratio, with a numerator and denominator.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
|
@ -6,12 +6,12 @@
|
||||
//!
|
||||
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query-list
|
||||
|
||||
use super::{Device, MediaQuery, Qualifier};
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Delimiter, Parser};
|
||||
use cssparser::{ParserInput, Token};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::ParserContext;
|
||||
use super::{Device, MediaQuery, Qualifier};
|
||||
|
||||
/// A type that encapsulates a media query list.
|
||||
#[css(comma, derive_debug)]
|
||||
|
@ -6,14 +6,14 @@
|
||||
//!
|
||||
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query
|
||||
|
||||
use Atom;
|
||||
use super::media_condition::MediaCondition;
|
||||
use cssparser::Parser;
|
||||
use parser::ParserContext;
|
||||
use std::fmt::{self, Write};
|
||||
use str::string_as_ascii_lowercase;
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use super::media_condition::MediaCondition;
|
||||
use values::CustomIdent;
|
||||
use Atom;
|
||||
|
||||
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
@ -130,7 +130,8 @@ impl MediaQuery {
|
||||
let ident = input.expect_ident().map_err(|_| ())?;
|
||||
let media_type = MediaQueryType::parse(&ident)?;
|
||||
Ok((qualifier, Some(media_type)))
|
||||
}).unwrap_or_default();
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let condition = if explicit_media_type.is_none() {
|
||||
Some(MediaCondition::parse(context, input)?)
|
||||
|
@ -14,11 +14,11 @@ pub mod media_feature;
|
||||
pub mod media_feature_expression;
|
||||
|
||||
pub use self::media_condition::MediaCondition;
|
||||
pub use self::media_feature_expression::MediaFeatureExpression;
|
||||
pub use self::media_list::MediaList;
|
||||
pub use self::media_query::{MediaQuery, MediaQueryType, MediaType, Qualifier};
|
||||
pub use self::media_feature_expression::MediaFeatureExpression;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo::media_queries::Device;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko::media_queries::Device;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo::media_queries::Device;
|
||||
|
@ -526,7 +526,8 @@ impl RuleTree {
|
||||
path,
|
||||
guards,
|
||||
&mut dummy,
|
||||
).expect("Should return a valid rule node")
|
||||
)
|
||||
.expect("Should return a valid rule node")
|
||||
}
|
||||
}
|
||||
|
||||
@ -730,9 +731,9 @@ unsafe impl Send for RuleTree {}
|
||||
#[cfg(feature = "gecko")]
|
||||
#[cfg(debug_assertions)]
|
||||
mod gecko_leak_checking {
|
||||
use super::RuleNode;
|
||||
use std::mem::size_of;
|
||||
use std::os::raw::{c_char, c_void};
|
||||
use super::RuleNode;
|
||||
|
||||
extern "C" {
|
||||
pub fn NS_LogCtor(aPtr: *const c_void, aTypeName: *const c_char, aSize: u32);
|
||||
|
@ -5,13 +5,12 @@
|
||||
//! A data structure to efficiently index structs containing selectors by local
|
||||
//! name, ids and hash.
|
||||
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
use applicable_declarations::ApplicableDeclarationList;
|
||||
use context::QuirksMode;
|
||||
use dom::TElement;
|
||||
use fallible::FallibleVec;
|
||||
use hash::{HashMap, HashSet};
|
||||
use hash::map as hash_map;
|
||||
use hash::{HashMap, HashSet};
|
||||
use hashglobe::FailedAllocationError;
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use rule_tree::{CascadeLevel, ShadowCascadeOrder};
|
||||
@ -21,6 +20,7 @@ use selectors::parser::{Combinator, Component, SelectorIter};
|
||||
use smallvec::SmallVec;
|
||||
use std::hash::{BuildHasherDefault, Hash, Hasher};
|
||||
use stylist::Rule;
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// A hasher implementation that doesn't hash anything, because it expects its
|
||||
/// input to be a suitable u32 hash.
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use Atom;
|
||||
use cssparser::{Parser as CssParser, ParserInput};
|
||||
use element_state::ElementState;
|
||||
use selectors::parser::SelectorList;
|
||||
@ -14,6 +13,7 @@ use std::fmt::{self, Debug, Write};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use stylesheets::{Namespaces, Origin, UrlExtraData};
|
||||
use values::serialize_atom_identifier;
|
||||
use Atom;
|
||||
|
||||
/// A convenient alias for the type that represents an attribute value used for
|
||||
/// selector parser implementation.
|
||||
|
@ -8,17 +8,17 @@ use app_units::Au;
|
||||
use cssparser::RGBA;
|
||||
use custom_properties::CssEnvironment;
|
||||
use euclid::{Size2D, TypedScale, TypedSize2D};
|
||||
use media_queries::MediaType;
|
||||
use media_queries::media_feature::{AllowsRanges, ParsingRequirements};
|
||||
use media_queries::media_feature::{MediaFeatureDescription, Evaluator};
|
||||
use media_queries::media_feature::{Evaluator, MediaFeatureDescription};
|
||||
use media_queries::media_feature_expression::RangeOrOperator;
|
||||
use media_queries::MediaType;
|
||||
use properties::ComputedValues;
|
||||
use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use values::KeyframesName;
|
||||
use values::computed::CSSPixelLength;
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use values::computed::font::FontSize;
|
||||
use values::computed::CSSPixelLength;
|
||||
use values::KeyframesName;
|
||||
|
||||
/// A device is a structure that represents the current media a given document
|
||||
/// is displayed in.
|
||||
|
@ -195,7 +195,7 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam
|
||||
let mut damage = ServoRestyleDamage::empty();
|
||||
|
||||
// This should check every CSS property, as enumerated in the fields of
|
||||
// http://doc.servo.org/style/properties/struct.ComputedValues.html
|
||||
// https://doc.servo.org/style/properties/struct.ComputedValues.html
|
||||
|
||||
// This uses short-circuiting boolean OR for its side effects and ignores the result.
|
||||
let _ = restyle_damage_rebuild_and_reflow!(
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
//! Servo's selector parser.
|
||||
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, Prefix};
|
||||
use attr::{AttrIdentifier, AttrValue};
|
||||
use cssparser::{serialize_identifier, CowRcStr, Parser as CssParser, SourceLocation, ToCss};
|
||||
use dom::{OpaqueNode, TElement, TNode};
|
||||
@ -14,8 +13,8 @@ use element_state::{DocumentState, ElementState};
|
||||
use fxhash::FxHashMap;
|
||||
use invalidation::element::document_state::InvalidationMatchingData;
|
||||
use invalidation::element::element_wrapper::ElementSnapshot;
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use selector_parser::{AttrValue as SelectorAttrValue, PseudoElementCascadeType, SelectorParser};
|
||||
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::parser::{SelectorParseErrorKind, Visit};
|
||||
@ -24,6 +23,7 @@ use std::fmt;
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, Prefix};
|
||||
|
||||
/// A pseudo-element, both public and private.
|
||||
///
|
||||
@ -348,8 +348,8 @@ impl NonTSPseudoClass {
|
||||
/// Gets a given state flag for this pseudo-class. This is used to do
|
||||
/// selector matching, and it's set from the DOM.
|
||||
pub fn state_flag(&self) -> ElementState {
|
||||
use element_state::ElementState;
|
||||
use self::NonTSPseudoClass::*;
|
||||
use element_state::ElementState;
|
||||
match *self {
|
||||
Active => ElementState::IN_ACTIVE_STATE,
|
||||
Focus => ElementState::IN_FOCUS_STATE,
|
||||
|
@ -64,7 +64,6 @@
|
||||
//! selectors are effectively stripped off, so that matching them all against
|
||||
//! elements makes sense.
|
||||
|
||||
use Atom;
|
||||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
use bloom::StyleBloom;
|
||||
@ -74,8 +73,8 @@ use matching::MatchMethods;
|
||||
use owning_ref::OwningHandle;
|
||||
use properties::ComputedValues;
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selectors::NthIndexCache;
|
||||
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
|
||||
use selectors::NthIndexCache;
|
||||
use servo_arc::Arc;
|
||||
use smallbitvec::SmallBitVec;
|
||||
use smallvec::SmallVec;
|
||||
@ -86,6 +85,7 @@ use std::ptr::NonNull;
|
||||
use style_resolver::{PrimaryStyle, ResolvedElementStyles};
|
||||
use stylist::Stylist;
|
||||
use uluru::{Entry, LRUCache};
|
||||
use Atom;
|
||||
|
||||
mod checks;
|
||||
|
||||
@ -120,9 +120,8 @@ unsafe impl Sync for OpaqueComputedValues {}
|
||||
|
||||
impl OpaqueComputedValues {
|
||||
fn from(cv: &ComputedValues) -> Self {
|
||||
let p = unsafe {
|
||||
NonNull::new_unchecked(cv as *const ComputedValues as *const () as *mut ())
|
||||
};
|
||||
let p =
|
||||
unsafe { NonNull::new_unchecked(cv as *const ComputedValues as *const () as *mut ()) };
|
||||
OpaqueComputedValues(p)
|
||||
}
|
||||
|
||||
@ -204,7 +203,8 @@ impl ValidationData {
|
||||
let values =
|
||||
OpaqueComputedValues::from(parent.borrow_data().unwrap().styles.primary());
|
||||
values
|
||||
}).clone()
|
||||
})
|
||||
.clone()
|
||||
}
|
||||
|
||||
/// Computes the revalidation results if needed, and returns it.
|
||||
|
@ -7,12 +7,12 @@
|
||||
|
||||
use app_units::Au;
|
||||
use dom::TElement;
|
||||
use properties::{self, ComputedValues, StyleBuilder};
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::longhands::float::computed_value::T as Float;
|
||||
use properties::longhands::overflow_x::computed_value::T as Overflow;
|
||||
use properties::longhands::position::computed_value::T as Position;
|
||||
use properties::{self, ComputedValues, StyleBuilder};
|
||||
|
||||
/// A struct that implements all the adjustment methods.
|
||||
///
|
||||
@ -713,12 +713,15 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||
if self.style.pseudo.is_some() {
|
||||
return;
|
||||
}
|
||||
let is_html_select_element =
|
||||
element.map_or(false, |e| e.is_html_element() && e.local_name() == &*local_name!("select"));
|
||||
let is_html_select_element = element.map_or(false, |e| {
|
||||
e.is_html_element() && e.local_name() == &*local_name!("select")
|
||||
});
|
||||
if !is_html_select_element {
|
||||
return;
|
||||
}
|
||||
self.style.mutate_inherited_text().set_line_height(LineHeight::normal());
|
||||
self.style
|
||||
.mutate_inherited_text()
|
||||
.set_line_height(LineHeight::normal());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,13 @@ use data::{EagerPseudoStyles, ElementStyles};
|
||||
use dom::TElement;
|
||||
use log::Level::Trace;
|
||||
use matching::MatchMethods;
|
||||
use properties::{AnimationRules, ComputedValues};
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::{AnimationRules, ComputedValues};
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::{PseudoElement, SelectorImpl};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode};
|
||||
use selectors::matching::{
|
||||
ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode,
|
||||
};
|
||||
use servo_arc::Arc;
|
||||
use stylist::RuleInclusion;
|
||||
|
||||
|
@ -120,7 +120,8 @@ macro_rules! parse_quoted_or_unquoted_string {
|
||||
.parse_entirely(|input| {
|
||||
let string = input.expect_string()?;
|
||||
Ok($url_matching_function(string.as_ref().to_owned()))
|
||||
}).or_else(|_: ParseError| {
|
||||
})
|
||||
.or_else(|_: ParseError| {
|
||||
while let Ok(_) = input.next() {}
|
||||
Ok($url_matching_function(input.slice_from(start).to_string()))
|
||||
})
|
||||
|
@ -6,7 +6,6 @@
|
||||
//!
|
||||
//! [font-feature-values]: https://drafts.csswg.org/css-fonts-3/#at-font-feature-values-rule
|
||||
|
||||
use Atom;
|
||||
use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr};
|
||||
use cssparser::{DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, Token};
|
||||
@ -23,6 +22,7 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::CssRuleType;
|
||||
use values::computed::font::FamilyName;
|
||||
use values::serialize_atom_identifier;
|
||||
use Atom;
|
||||
|
||||
/// A @font-feature-values block declaration.
|
||||
/// It is `<ident>: <integer>+`.
|
||||
|
@ -4,23 +4,23 @@
|
||||
|
||||
//! Keyframes: https://drafts.csswg.org/css-animations/#keyframes
|
||||
|
||||
use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser};
|
||||
use cssparser::{parse_one_rule, DeclarationListParser, DeclarationParser, SourceLocation, Token};
|
||||
use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::ParserContext;
|
||||
use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
|
||||
use properties::LonghandIdSet;
|
||||
use properties::{Importance, PropertyDeclaration};
|
||||
use properties::{LonghandId, PropertyDeclarationBlock, PropertyId};
|
||||
use properties::{PropertyDeclarationId, SourcePropertyDeclaration};
|
||||
use properties::LonghandIdSet;
|
||||
use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard};
|
||||
use shared_lock::{Locked, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::{CssRuleType, StylesheetContents};
|
||||
use stylesheets::rule_parser::VendorPrefix;
|
||||
use stylesheets::{CssRuleType, StylesheetContents};
|
||||
use values::{serialize_percentage, KeyframesName};
|
||||
|
||||
/// A [`@keyframes`][keyframes] rule.
|
||||
@ -89,7 +89,8 @@ impl DeepCloneWithLock for KeyframesRule {
|
||||
Arc::new(
|
||||
lock.wrap(x.read_with(guard).deep_clone_with_lock(lock, guard, params)),
|
||||
)
|
||||
}).collect(),
|
||||
})
|
||||
.collect(),
|
||||
vendor_prefix: self.vendor_prefix.clone(),
|
||||
source_location: self.source_location.clone(),
|
||||
}
|
||||
@ -327,7 +328,8 @@ impl KeyframesStep {
|
||||
let (declaration, _) = guard
|
||||
.get(PropertyDeclarationId::Longhand(
|
||||
LonghandId::AnimationTimingFunction,
|
||||
)).unwrap();
|
||||
))
|
||||
.unwrap();
|
||||
match *declaration {
|
||||
PropertyDeclaration::AnimationTimingFunction(ref value) => {
|
||||
// Use the first value.
|
||||
@ -499,7 +501,8 @@ pub fn parse_keyframe_list(
|
||||
shared_lock: shared_lock,
|
||||
declarations: &mut declarations,
|
||||
},
|
||||
).filter_map(Result::ok)
|
||||
)
|
||||
.filter_map(Result::ok)
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -45,13 +45,13 @@ pub use self::media_rule::MediaRule;
|
||||
pub use self::namespace_rule::NamespaceRule;
|
||||
pub use self::origin::{Origin, OriginSet, OriginSetIterator, PerOrigin, PerOriginIter};
|
||||
pub use self::page_rule::PageRule;
|
||||
pub use self::rule_parser::{State, TopLevelRuleParser, InsertRuleContext};
|
||||
pub use self::rule_list::{CssRules, CssRulesHelpers};
|
||||
pub use self::rule_parser::{InsertRuleContext, State, TopLevelRuleParser};
|
||||
pub use self::rules_iterator::{AllRules, EffectiveRules};
|
||||
pub use self::rules_iterator::{NestedRuleIterationCondition, RulesIterator};
|
||||
pub use self::style_rule::StyleRule;
|
||||
pub use self::stylesheet::{DocumentStyleSheet, Namespaces, Stylesheet};
|
||||
pub use self::stylesheet::{StylesheetContents, StylesheetInDocument, UserAgentStylesheets};
|
||||
pub use self::style_rule::StyleRule;
|
||||
pub use self::supports_rule::SupportsRule;
|
||||
pub use self::viewport_rule::ViewportRule;
|
||||
|
||||
@ -88,7 +88,7 @@ impl UrlExtraData {
|
||||
#[cfg(feature = "gecko")]
|
||||
impl fmt::Debug for UrlExtraData {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
use gecko_bindings::{structs, bindings};
|
||||
use gecko_bindings::{bindings, structs};
|
||||
|
||||
struct DebugURI(*mut structs::nsIURI);
|
||||
impl fmt::Debug for DebugURI {
|
||||
@ -109,7 +109,8 @@ impl fmt::Debug for UrlExtraData {
|
||||
.field(
|
||||
"referrer",
|
||||
&DebugURI(self.0.mReferrer.raw::<structs::nsIURI>()),
|
||||
).finish()
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
//! The `@namespace` at-rule.
|
||||
|
||||
use {Namespace, Prefix};
|
||||
use cssparser::SourceLocation;
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use {Namespace, Prefix};
|
||||
|
||||
/// A `@namespace` rule.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
|
@ -11,10 +11,10 @@ use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use stylesheets::{CssRule, RulesMutateError};
|
||||
use stylesheets::loader::StylesheetLoader;
|
||||
use stylesheets::rule_parser::{InsertRuleContext, State};
|
||||
use stylesheets::stylesheet::StylesheetContents;
|
||||
use stylesheets::{CssRule, RulesMutateError};
|
||||
|
||||
/// A list of CSS rules.
|
||||
#[derive(Debug)]
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
//! Parsing of the stylesheet contents.
|
||||
|
||||
use {Namespace, Prefix};
|
||||
use counter_style::{parse_counter_style_body, parse_counter_style_name_definition};
|
||||
use cssparser::{AtRuleParser, AtRuleType, Parser, QualifiedRuleParser, RuleListParser};
|
||||
use cssparser::{BasicParseError, BasicParseErrorKind, CowRcStr, SourceLocation};
|
||||
@ -19,17 +18,18 @@ use servo_arc::Arc;
|
||||
use shared_lock::{Locked, SharedRwLock};
|
||||
use str::starts_with_ignore_ascii_case;
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
use stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader};
|
||||
use stylesheets::{DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule};
|
||||
use stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule};
|
||||
use stylesheets::document_rule::DocumentCondition;
|
||||
use stylesheets::font_feature_values_rule::parse_family_name_list;
|
||||
use stylesheets::keyframes_rule::parse_keyframe_list;
|
||||
use stylesheets::stylesheet::Namespaces;
|
||||
use stylesheets::supports_rule::SupportsCondition;
|
||||
use stylesheets::viewport_rule;
|
||||
use values::{CssUrl, CustomIdent, KeyframesName};
|
||||
use stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader};
|
||||
use stylesheets::{DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule};
|
||||
use stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule};
|
||||
use values::computed::font::FamilyName;
|
||||
use values::{CssUrl, CustomIdent, KeyframesName};
|
||||
use {Namespace, Prefix};
|
||||
|
||||
/// The information we need particularly to do CSSOM insertRule stuff.
|
||||
pub struct InsertRuleContext<'a> {
|
||||
|
@ -9,8 +9,8 @@ use media_queries::Device;
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use smallvec::SmallVec;
|
||||
use std::slice;
|
||||
use stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule};
|
||||
use stylesheets::StylesheetInDocument;
|
||||
use stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule};
|
||||
|
||||
/// An iterator over a list of rules.
|
||||
pub struct RulesIterator<'a, 'b, C>
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
use cssparser::SourceLocation;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::MallocUnconditionalShallowSizeOf;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use properties::PropertyDeclarationBlock;
|
||||
use selector_parser::SelectorImpl;
|
||||
use selectors::SelectorList;
|
||||
|
@ -2,7 +2,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use {Namespace, Prefix};
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Parser, ParserInput, RuleListParser};
|
||||
use error_reporting::{ContextualParseError, ParseErrorReporter};
|
||||
@ -15,16 +14,19 @@ use media_queries::{Device, MediaList};
|
||||
use parking_lot::RwLock;
|
||||
use parser::ParserContext;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard};
|
||||
use shared_lock::{
|
||||
DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard,
|
||||
};
|
||||
use std::mem;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use style_traits::ParsingMode;
|
||||
use stylesheets::{CssRule, CssRules, Origin, UrlExtraData};
|
||||
use stylesheets::loader::StylesheetLoader;
|
||||
use stylesheets::rule_parser::{State, TopLevelRuleParser};
|
||||
use stylesheets::rules_iterator::{EffectiveRules, EffectiveRulesIterator};
|
||||
use stylesheets::rules_iterator::{NestedRuleIterationCondition, RulesIterator};
|
||||
use stylesheets::{CssRule, CssRules, Origin, UrlExtraData};
|
||||
use use_counters::UseCounters;
|
||||
use {Namespace, Prefix};
|
||||
|
||||
/// This structure holds the user-agent and user stylesheets.
|
||||
pub struct UserAgentStylesheets {
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
//! [@supports rules](https://drafts.csswg.org/css-conditional-3/#at-supports)
|
||||
|
||||
use cssparser::parse_important;
|
||||
use cssparser::{Delimiter, Parser, SourceLocation, Token};
|
||||
use cssparser::{ParseError as CssParseError, ParserInput};
|
||||
use cssparser::parse_important;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use parser::ParserContext;
|
||||
@ -172,9 +172,7 @@ impl SupportsCondition {
|
||||
}
|
||||
|
||||
/// <https://drafts.csswg.org/css-conditional-3/#supports_condition_in_parens>
|
||||
fn parse_in_parens<'i, 't>(
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
fn parse_in_parens<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
// Whitespace is normally taken care of in `Parser::next`,
|
||||
// but we want to not include it in `pos` for the SupportsCondition::FutureSyntax cases.
|
||||
while input.try(Parser::expect_whitespace).is_ok() {}
|
||||
@ -183,9 +181,8 @@ impl SupportsCondition {
|
||||
// FIXME: remove clone() when lifetimes are non-lexical
|
||||
match input.next()?.clone() {
|
||||
Token::ParenthesisBlock => {
|
||||
let nested = input.try(|input| {
|
||||
input.parse_nested_block(parse_condition_or_declaration)
|
||||
});
|
||||
let nested =
|
||||
input.try(|input| input.parse_nested_block(parse_condition_or_declaration));
|
||||
if nested.is_ok() {
|
||||
return nested;
|
||||
}
|
||||
@ -209,11 +206,7 @@ impl SupportsCondition {
|
||||
}
|
||||
|
||||
/// Evaluate a supports condition
|
||||
pub fn eval(
|
||||
&self,
|
||||
cx: &ParserContext,
|
||||
namespaces: &Namespaces,
|
||||
) -> bool {
|
||||
pub fn eval(&self, cx: &ParserContext, namespaces: &Namespaces) -> bool {
|
||||
match *self {
|
||||
SupportsCondition::Not(ref cond) => !cond.eval(cx, namespaces),
|
||||
SupportsCondition::Parenthesized(ref cond) => cond.eval(cx, namespaces),
|
||||
@ -300,7 +293,7 @@ impl ToCss for SupportsCondition {
|
||||
dest.write_str("selector(")?;
|
||||
selector.to_css(dest)?;
|
||||
dest.write_str(")")
|
||||
}
|
||||
},
|
||||
SupportsCondition::MozBoolPref(ref name) => {
|
||||
dest.write_str("-moz-bool-pref(")?;
|
||||
let name =
|
||||
@ -328,51 +321,51 @@ impl ToCss for RawSelector {
|
||||
|
||||
impl RawSelector {
|
||||
/// Tries to evaluate a `selector()` function.
|
||||
pub fn eval(
|
||||
&self,
|
||||
context: &ParserContext,
|
||||
namespaces: &Namespaces,
|
||||
) -> bool {
|
||||
pub fn eval(&self, context: &ParserContext, namespaces: &Namespaces) -> bool {
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
if unsafe { !::gecko_bindings::structs::StaticPrefs_sVarCache_layout_css_supports_selector_enabled } {
|
||||
if unsafe {
|
||||
!::gecko_bindings::structs::StaticPrefs_sVarCache_layout_css_supports_selector_enabled
|
||||
} {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let mut input = ParserInput::new(&self.0);
|
||||
let mut input = Parser::new(&mut input);
|
||||
input.parse_entirely(|input| -> Result<(), CssParseError<()>> {
|
||||
let parser = SelectorParser {
|
||||
namespaces,
|
||||
stylesheet_origin: context.stylesheet_origin,
|
||||
url_data: Some(context.url_data),
|
||||
};
|
||||
input
|
||||
.parse_entirely(|input| -> Result<(), CssParseError<()>> {
|
||||
let parser = SelectorParser {
|
||||
namespaces,
|
||||
stylesheet_origin: context.stylesheet_origin,
|
||||
url_data: Some(context.url_data),
|
||||
};
|
||||
|
||||
#[allow(unused_variables)]
|
||||
let selector = Selector::<SelectorImpl>::parse(&parser, input)
|
||||
.map_err(|_| input.new_custom_error(()))?;
|
||||
#[allow(unused_variables)]
|
||||
let selector = Selector::<SelectorImpl>::parse(&parser, input)
|
||||
.map_err(|_| input.new_custom_error(()))?;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
use selector_parser::PseudoElement;
|
||||
use selectors::parser::Component;
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
use selector_parser::PseudoElement;
|
||||
use selectors::parser::Component;
|
||||
|
||||
let has_any_unknown_webkit_pseudo =
|
||||
selector.has_pseudo_element() &&
|
||||
selector.iter_raw_match_order().any(|component| {
|
||||
matches!(
|
||||
*component,
|
||||
Component::PseudoElement(PseudoElement::UnknownWebkit(..))
|
||||
)
|
||||
});
|
||||
if has_any_unknown_webkit_pseudo {
|
||||
return Err(input.new_custom_error(()));
|
||||
let has_any_unknown_webkit_pseudo = selector.has_pseudo_element() && selector
|
||||
.iter_raw_match_order()
|
||||
.any(|component| {
|
||||
matches!(
|
||||
*component,
|
||||
Component::PseudoElement(PseudoElement::UnknownWebkit(..))
|
||||
)
|
||||
});
|
||||
if has_any_unknown_webkit_pseudo {
|
||||
return Err(input.new_custom_error(()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}).is_ok()
|
||||
Ok(())
|
||||
})
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,20 +405,22 @@ impl Declaration {
|
||||
|
||||
let mut input = ParserInput::new(&self.0);
|
||||
let mut input = Parser::new(&mut input);
|
||||
input.parse_entirely(|input| -> Result<(), CssParseError<()>> {
|
||||
let prop = input.expect_ident_cloned().unwrap();
|
||||
input.expect_colon().unwrap();
|
||||
input
|
||||
.parse_entirely(|input| -> Result<(), CssParseError<()>> {
|
||||
let prop = input.expect_ident_cloned().unwrap();
|
||||
input.expect_colon().unwrap();
|
||||
|
||||
let id =
|
||||
PropertyId::parse(&prop, context).map_err(|_| input.new_custom_error(()))?;
|
||||
let id =
|
||||
PropertyId::parse(&prop, context).map_err(|_| input.new_custom_error(()))?;
|
||||
|
||||
let mut declarations = SourcePropertyDeclaration::new();
|
||||
input.parse_until_before(Delimiter::Bang, |input| {
|
||||
PropertyDeclaration::parse_into(&mut declarations, id, &context, input)
|
||||
.map_err(|_| input.new_custom_error(()))
|
||||
})?;
|
||||
let _ = input.try(parse_important);
|
||||
Ok(())
|
||||
}).is_ok()
|
||||
let mut declarations = SourcePropertyDeclaration::new();
|
||||
input.parse_until_before(Delimiter::Bang, |input| {
|
||||
PropertyDeclaration::parse_into(&mut declarations, id, &context, input)
|
||||
.map_err(|_| input.new_custom_error(()))
|
||||
})?;
|
||||
let _ = input.try(parse_important);
|
||||
Ok(())
|
||||
})
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
use app_units::Au;
|
||||
use context::QuirksMode;
|
||||
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::CowRcStr;
|
||||
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use error_reporting::ContextualParseError;
|
||||
use euclid::TypedSize2D;
|
||||
use font_metrics::get_metrics_provider_for_product;
|
||||
@ -26,8 +26,8 @@ use std::fmt::{self, Write};
|
||||
use std::iter::Enumerate;
|
||||
use std::str::Chars;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, PinchZoomFactor, StyleParseErrorKind, ToCss};
|
||||
use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom};
|
||||
use style_traits::{CssWriter, ParseError, PinchZoomFactor, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::{Origin, StylesheetInDocument};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
//! Selector matching.
|
||||
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
use applicable_declarations::{ApplicableDeclarationBlock, ApplicableDeclarationList};
|
||||
use context::{CascadeInputs, QuirksMode};
|
||||
use dom::{TElement, TShadowRoot};
|
||||
@ -16,9 +15,9 @@ use hashglobe::FailedAllocationError;
|
||||
use invalidation::element::invalidation_map::InvalidationMap;
|
||||
use invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::MallocUnconditionalShallowSizeOf;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
|
||||
use media_queries::Device;
|
||||
use properties::{self, CascadeMode, ComputedValues};
|
||||
use properties::{AnimationRules, PropertyDeclarationBlock};
|
||||
@ -26,14 +25,14 @@ use rule_cache::{RuleCache, RuleCacheConditions};
|
||||
use rule_tree::{CascadeLevel, RuleTree, ShadowCascadeOrder, StrongRuleNode, StyleSource};
|
||||
use selector_map::{PrecomputedHashMap, PrecomputedHashSet, SelectorMap, SelectorMapEntry};
|
||||
use selector_parser::{PerPseudoElementMap, PseudoElement, SelectorImpl, SnapshotMap};
|
||||
use selectors::NthIndexCache;
|
||||
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::bloom::BloomFilter;
|
||||
use selectors::matching::{matches_selector, ElementSelectorFlags, MatchingContext, MatchingMode};
|
||||
use selectors::matching::VisitedHandlingMode;
|
||||
use selectors::matching::{matches_selector, ElementSelectorFlags, MatchingContext, MatchingMode};
|
||||
use selectors::parser::{AncestorHashes, Combinator, Component, Selector};
|
||||
use selectors::parser::{SelectorIter, Visit};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use selectors::NthIndexCache;
|
||||
use servo_arc::{Arc, ArcBorrow};
|
||||
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
|
||||
use smallbitvec::SmallBitVec;
|
||||
@ -43,14 +42,15 @@ use std::sync::Mutex;
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use stylesheet_set::{DataValidity, DocumentStylesheetSet, SheetRebuildKind};
|
||||
use stylesheet_set::{DocumentStylesheetFlusher, SheetCollectionFlusher};
|
||||
use stylesheets::keyframes_rule::KeyframesAnimation;
|
||||
use stylesheets::viewport_rule::{self, MaybeNew, ViewportRule};
|
||||
use stylesheets::StyleRule;
|
||||
use stylesheets::StylesheetInDocument;
|
||||
#[cfg(feature = "gecko")]
|
||||
use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule};
|
||||
use stylesheets::{CssRule, Origin, OriginSet, PerOrigin, PerOriginIter};
|
||||
use stylesheets::StyleRule;
|
||||
use stylesheets::StylesheetInDocument;
|
||||
use stylesheets::keyframes_rule::KeyframesAnimation;
|
||||
use stylesheets::viewport_rule::{self, MaybeNew, ViewportRule};
|
||||
use thread_state::{self, ThreadState};
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// The type of the stylesheets that the stylist contains.
|
||||
#[cfg(feature = "servo")]
|
||||
@ -517,7 +517,8 @@ impl Stylist {
|
||||
self.stylesheets.iter(),
|
||||
guards,
|
||||
&self.device,
|
||||
).finish(),
|
||||
)
|
||||
.finish(),
|
||||
};
|
||||
|
||||
self.viewport_constraints =
|
||||
@ -1017,7 +1018,8 @@ impl Stylist {
|
||||
stylesheets.clone(),
|
||||
guards,
|
||||
&device,
|
||||
).finish(),
|
||||
)
|
||||
.finish(),
|
||||
}
|
||||
};
|
||||
|
||||
@ -1535,7 +1537,6 @@ impl Stylist {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
results
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,8 @@ where
|
||||
context,
|
||||
rule_inclusion,
|
||||
PseudoElementResolution::IfApplicable,
|
||||
).resolve_primary_style(
|
||||
)
|
||||
.resolve_primary_style(
|
||||
style.as_ref().map(|s| &**s),
|
||||
layout_parent_style.as_ref().map(|s| &**s),
|
||||
);
|
||||
@ -382,10 +383,12 @@ where
|
||||
context,
|
||||
rule_inclusion,
|
||||
PseudoElementResolution::Force,
|
||||
).resolve_style(
|
||||
)
|
||||
.resolve_style(
|
||||
style.as_ref().map(|s| &**s),
|
||||
layout_parent_style.as_ref().map(|s| &**s),
|
||||
).into()
|
||||
)
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Calculates the style for a single node.
|
||||
@ -717,8 +720,8 @@ where
|
||||
E: TElement,
|
||||
{
|
||||
use style_traits::ToCss;
|
||||
use values::Either;
|
||||
use values::generics::image::Image;
|
||||
use values::Either;
|
||||
|
||||
// We speculatively evaluate any paint worklets during styling.
|
||||
// This allows us to run paint worklets in parallel with style and layout.
|
||||
|
@ -4,16 +4,16 @@
|
||||
|
||||
//! Animated types for CSS values related to effects.
|
||||
|
||||
#[cfg(not(feature = "gecko"))]
|
||||
use values::Impossible;
|
||||
use values::animated::color::Color;
|
||||
use values::computed::{Angle, Number};
|
||||
use values::computed::length::Length;
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::computed::url::ComputedUrl;
|
||||
use values::computed::{Angle, Number};
|
||||
use values::generics::effects::BoxShadow as GenericBoxShadow;
|
||||
use values::generics::effects::Filter as GenericFilter;
|
||||
use values::generics::effects::SimpleShadow as GenericSimpleShadow;
|
||||
#[cfg(not(feature = "gecko"))]
|
||||
use values::Impossible;
|
||||
|
||||
/// An animated value for a single `box-shadow`.
|
||||
pub type BoxShadow = GenericBoxShadow<Color, Length, Length, Length>;
|
||||
|
@ -5,8 +5,8 @@
|
||||
//! Animation implementation for various font-related types.
|
||||
|
||||
use super::{Animate, Procedure, ToAnimatedZero};
|
||||
use values::computed::font::{FontVariationSettings, FontWeight};
|
||||
use values::computed::Number;
|
||||
use values::computed::font::{FontWeight, FontVariationSettings};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::generics::font::{FontSettings as GenericFontSettings, FontTag, VariationValue};
|
||||
|
||||
@ -143,7 +143,9 @@ impl<'a> FontSettingTagIter<'a> {
|
||||
impl<'a> Iterator for FontSettingTagIter<'a> {
|
||||
type Item = Result<(&'a ComputedVariationValue, &'a ComputedVariationValue), ()>;
|
||||
|
||||
fn next(&mut self) -> Option<Result<(&'a ComputedVariationValue, &'a ComputedVariationValue), ()>> {
|
||||
fn next(
|
||||
&mut self,
|
||||
) -> Option<Result<(&'a ComputedVariationValue, &'a ComputedVariationValue), ()>> {
|
||||
match (
|
||||
FontSettingTagIter::next_tag(&mut self.a_state),
|
||||
FontSettingTagIter::next_tag(&mut self.b_state),
|
||||
|
@ -5,10 +5,12 @@
|
||||
//! Animation implementation for various length-related types.
|
||||
|
||||
use super::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
||||
use values::computed::length::{
|
||||
CalcLengthOrPercentage, Length, LengthOrPercentageOrAuto, LengthOrPercentageOrNone,
|
||||
};
|
||||
use values::computed::MaxLength as ComputedMaxLength;
|
||||
use values::computed::MozLength as ComputedMozLength;
|
||||
use values::computed::Percentage;
|
||||
use values::computed::length::{Length, CalcLengthOrPercentage, LengthOrPercentageOrNone, LengthOrPercentageOrAuto};
|
||||
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc>
|
||||
impl Animate for CalcLengthOrPercentage {
|
||||
@ -23,9 +25,15 @@ impl Animate for CalcLengthOrPercentage {
|
||||
Ok(Some(this.animate(&other, procedure)?))
|
||||
};
|
||||
|
||||
let length = self.unclamped_length().animate(&other.unclamped_length(), procedure)?;
|
||||
let length = self
|
||||
.unclamped_length()
|
||||
.animate(&other.unclamped_length(), procedure)?;
|
||||
let percentage = animate_percentage_half(self.percentage, other.percentage)?;
|
||||
Ok(CalcLengthOrPercentage::with_clamping_mode(length, percentage, self.clamping_mode))
|
||||
Ok(CalcLengthOrPercentage::with_clamping_mode(
|
||||
length,
|
||||
percentage,
|
||||
self.clamping_mode,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,10 +13,10 @@ use euclid::{Point2D, Size2D};
|
||||
use properties::PropertyId;
|
||||
use smallvec::SmallVec;
|
||||
use std::cmp;
|
||||
use values::computed::Angle as ComputedAngle;
|
||||
use values::computed::BorderCornerRadius as ComputedBorderCornerRadius;
|
||||
use values::computed::length::CalcLengthOrPercentage;
|
||||
use values::computed::url::ComputedUrl;
|
||||
use values::computed::Angle as ComputedAngle;
|
||||
use values::computed::BorderCornerRadius as ComputedBorderCornerRadius;
|
||||
|
||||
pub mod color;
|
||||
pub mod effects;
|
||||
@ -38,16 +38,16 @@ enum PropertyCategory {
|
||||
impl PropertyCategory {
|
||||
fn of(id: &PropertyId) -> Self {
|
||||
match *id {
|
||||
PropertyId::Shorthand(..) |
|
||||
PropertyId::ShorthandAlias(..) => PropertyCategory::Shorthand,
|
||||
PropertyId::Longhand(id) |
|
||||
PropertyId::LonghandAlias(id, ..) => {
|
||||
PropertyId::Shorthand(..) | PropertyId::ShorthandAlias(..) => {
|
||||
PropertyCategory::Shorthand
|
||||
},
|
||||
PropertyId::Longhand(id) | PropertyId::LonghandAlias(id, ..) => {
|
||||
if id.is_logical() {
|
||||
PropertyCategory::LogicalLonghand
|
||||
} else {
|
||||
PropertyCategory::PhysicalLonghand
|
||||
}
|
||||
}
|
||||
},
|
||||
PropertyId::Custom(..) => PropertyCategory::Custom,
|
||||
}
|
||||
}
|
||||
@ -81,9 +81,9 @@ pub fn compare_property_priority(a: &PropertyId, b: &PropertyId) -> cmp::Orderin
|
||||
// name.
|
||||
let subprop_count_a = a.longhands().count();
|
||||
let subprop_count_b = b.longhands().count();
|
||||
subprop_count_a.cmp(&subprop_count_b).then_with(|| {
|
||||
a.idl_name_sort_order().cmp(&b.idl_name_sort_order())
|
||||
})
|
||||
subprop_count_a
|
||||
.cmp(&subprop_count_b)
|
||||
.then_with(|| a.idl_name_sort_order().cmp(&b.idl_name_sort_order()))
|
||||
}
|
||||
|
||||
/// Animate from one value to another.
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
//! Animation implementations for various SVG-related types.
|
||||
|
||||
use properties::animated_properties::ListAnimation;
|
||||
use super::{Animate, Procedure, ToAnimatedZero};
|
||||
use properties::animated_properties::ListAnimation;
|
||||
use values::animated::color::Color as AnimatedColor;
|
||||
use values::computed::{Number, NumberOrPercentage, LengthOrPercentage};
|
||||
use values::computed::url::ComputedUrl;
|
||||
use values::computed::{LengthOrPercentage, Number, NumberOrPercentage};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::generics::svg::{SVGLength, SvgLengthOrPercentageOrNumber, SVGPaint};
|
||||
use values::generics::svg::{SVGStrokeDashArray, SVGOpacity};
|
||||
use values::generics::svg::{SVGLength, SVGPaint, SvgLengthOrPercentageOrNumber};
|
||||
use values::generics::svg::{SVGOpacity, SVGStrokeDashArray};
|
||||
|
||||
/// Animated SVGPaint.
|
||||
pub type IntermediateSVGPaint = SVGPaint<AnimatedColor, ComputedUrl>;
|
||||
@ -32,13 +32,11 @@ fn to_number_or_percentage(
|
||||
value: &SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number>,
|
||||
) -> Result<NumberOrPercentage, ()> {
|
||||
Ok(match *value {
|
||||
SvgLengthOrPercentageOrNumber::LengthOrPercentage(ref l) => {
|
||||
match *l {
|
||||
LengthOrPercentage::Length(ref l) => NumberOrPercentage::Number(l.px()),
|
||||
LengthOrPercentage::Percentage(ref p) => NumberOrPercentage::Percentage(*p),
|
||||
LengthOrPercentage::Calc(..) => return Err(()),
|
||||
}
|
||||
}
|
||||
SvgLengthOrPercentageOrNumber::LengthOrPercentage(ref l) => match *l {
|
||||
LengthOrPercentage::Length(ref l) => NumberOrPercentage::Number(l.px()),
|
||||
LengthOrPercentage::Percentage(ref p) => NumberOrPercentage::Percentage(*p),
|
||||
LengthOrPercentage::Calc(..) => return Err(()),
|
||||
},
|
||||
SvgLengthOrPercentageOrNumber::Number(ref n) => NumberOrPercentage::Number(*n),
|
||||
})
|
||||
}
|
||||
@ -50,22 +48,15 @@ impl Animate for SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number> {
|
||||
let other = to_number_or_percentage(other)?;
|
||||
|
||||
match (this, other) {
|
||||
(
|
||||
NumberOrPercentage::Number(ref this),
|
||||
NumberOrPercentage::Number(ref other),
|
||||
) => {
|
||||
Ok(SvgLengthOrPercentageOrNumber::Number(
|
||||
this.animate(other, procedure)?
|
||||
))
|
||||
},
|
||||
(NumberOrPercentage::Number(ref this), NumberOrPercentage::Number(ref other)) => Ok(
|
||||
SvgLengthOrPercentageOrNumber::Number(this.animate(other, procedure)?),
|
||||
),
|
||||
(
|
||||
NumberOrPercentage::Percentage(ref this),
|
||||
NumberOrPercentage::Percentage(ref other),
|
||||
) => {
|
||||
Ok(SvgLengthOrPercentageOrNumber::LengthOrPercentage(
|
||||
LengthOrPercentage::Percentage(this.animate(other, procedure)?)
|
||||
))
|
||||
},
|
||||
) => Ok(SvgLengthOrPercentageOrNumber::LengthOrPercentage(
|
||||
LengthOrPercentage::Percentage(this.animate(other, procedure)?),
|
||||
)),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
@ -73,8 +64,7 @@ impl Animate for SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number> {
|
||||
|
||||
impl ComputeSquaredDistance for SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number> {
|
||||
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||
to_number_or_percentage(self)?
|
||||
.compute_squared_distance(&to_number_or_percentage(other)?)
|
||||
to_number_or_percentage(self)?.compute_squared_distance(&to_number_or_percentage(other)?)
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,9 +95,9 @@ where
|
||||
return Err(());
|
||||
}
|
||||
match (self, other) {
|
||||
(&SVGStrokeDashArray::Values(ref this), &SVGStrokeDashArray::Values(ref other)) => {
|
||||
Ok(SVGStrokeDashArray::Values(this.animate_repeatable_list(other, procedure)?))
|
||||
},
|
||||
(&SVGStrokeDashArray::Values(ref this), &SVGStrokeDashArray::Values(ref other)) => Ok(
|
||||
SVGStrokeDashArray::Values(this.animate_repeatable_list(other, procedure)?),
|
||||
),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
@ -135,11 +125,12 @@ where
|
||||
#[inline]
|
||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||
match *self {
|
||||
SVGStrokeDashArray::Values(ref values) => {
|
||||
Ok(SVGStrokeDashArray::Values(
|
||||
values.iter().map(ToAnimatedZero::to_animated_zero).collect::<Result<Vec<_>, _>>()?,
|
||||
))
|
||||
}
|
||||
SVGStrokeDashArray::Values(ref values) => Ok(SVGStrokeDashArray::Values(
|
||||
values
|
||||
.iter()
|
||||
.map(ToAnimatedZero::to_animated_zero)
|
||||
.collect::<Result<Vec<_>, _>>()?,
|
||||
)),
|
||||
SVGStrokeDashArray::ContextValue => Ok(SVGStrokeDashArray::ContextValue),
|
||||
}
|
||||
}
|
||||
|
@ -5,13 +5,13 @@
|
||||
//! Computed angles.
|
||||
|
||||
use num_traits::Zero;
|
||||
use std::{f32, f64};
|
||||
use std::f64::consts::PI;
|
||||
use std::fmt::{self, Write};
|
||||
use std::ops::Add;
|
||||
use std::{f32, f64};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::CSSFloat;
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::CSSFloat;
|
||||
|
||||
/// A computed angle in degrees.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
@ -92,6 +92,7 @@ impl ComputeSquaredDistance for Angle {
|
||||
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
|
||||
// Use the formula for calculating the distance between angles defined in SVG:
|
||||
// https://www.w3.org/TR/SVG/animate.html#complexDistances
|
||||
self.radians64().compute_squared_distance(&other.radians64())
|
||||
self.radians64()
|
||||
.compute_squared_distance(&other.radians64())
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::computed::length::NonNegativeLengthOrPercentageOrAuto;
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::generics::background::BackgroundSize as GenericBackgroundSize;
|
||||
use values::specified::background::BackgroundRepeat as SpecifiedBackgroundRepeat;
|
||||
use values::specified::background::BackgroundRepeatKeyword;
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::computed::{Image, LengthOrPercentage};
|
||||
use values::computed::url::ComputedUrl;
|
||||
use values::computed::{Image, LengthOrPercentage};
|
||||
use values::generics::basic_shape as generic;
|
||||
|
||||
/// A computed alias for FillRule.
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
use app_units::Au;
|
||||
use values::animated::ToAnimatedZero;
|
||||
use values::computed::{Number, NumberOrPercentage};
|
||||
use values::computed::length::{LengthOrPercentage, NonNegativeLength};
|
||||
use values::computed::{Number, NumberOrPercentage};
|
||||
use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
|
||||
use values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth;
|
||||
use values::generics::border::BorderImageSlice as GenericBorderImageSlice;
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
//! Computed types for box properties.
|
||||
|
||||
use values::computed::{Context, Number, ToComputedValue};
|
||||
use values::computed::length::{LengthOrPercentage, NonNegativeLength};
|
||||
use values::computed::{Context, Number, ToComputedValue};
|
||||
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
||||
use values::generics::box_::Perspective as GenericPerspective;
|
||||
use values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||
@ -13,7 +13,9 @@ use values::specified::box_ as specified;
|
||||
|
||||
pub use values::specified::box_::{AnimationName, Appearance, Contain, Display, OverflowClipBox};
|
||||
pub use values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
|
||||
pub use values::specified::box_::{OverscrollBehavior, ScrollSnapType, TouchAction, TransitionProperty, WillChange};
|
||||
pub use values::specified::box_::{
|
||||
OverscrollBehavior, ScrollSnapType, TouchAction, TransitionProperty, WillChange,
|
||||
};
|
||||
|
||||
/// A computed value for the `vertical-align` property.
|
||||
pub type VerticalAlign = GenericVerticalAlign<LengthOrPercentage>;
|
||||
|
@ -7,8 +7,8 @@
|
||||
use cssparser::{Color as CSSParserColor, RGBA};
|
||||
use std::fmt;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::animated::ToAnimatedValue;
|
||||
use values::animated::color::RGBA as AnimatedRGBA;
|
||||
use values::animated::ToAnimatedValue;
|
||||
use values::generics::color::Color as GenericColor;
|
||||
|
||||
/// Computed value type for the specified RGBAColor.
|
||||
|
@ -4,16 +4,16 @@
|
||||
|
||||
//! Computed types for CSS values related to effects.
|
||||
|
||||
#[cfg(not(feature = "gecko"))]
|
||||
use values::Impossible;
|
||||
use values::computed::{Angle, NonNegativeNumber};
|
||||
use values::computed::color::Color;
|
||||
use values::computed::length::{Length, NonNegativeLength};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::computed::url::ComputedUrl;
|
||||
use values::computed::{Angle, NonNegativeNumber};
|
||||
use values::generics::effects::BoxShadow as GenericBoxShadow;
|
||||
use values::generics::effects::Filter as GenericFilter;
|
||||
use values::generics::effects::SimpleShadow as GenericSimpleShadow;
|
||||
#[cfg(not(feature = "gecko"))]
|
||||
use values::Impossible;
|
||||
|
||||
/// A computed value for a single shadow of the `box-shadow` property.
|
||||
pub type BoxShadow = GenericBoxShadow<Color, Length, NonNegativeLength, Length>;
|
||||
|
@ -4,28 +4,28 @@
|
||||
|
||||
//! Computed values for font properties
|
||||
|
||||
use Atom;
|
||||
use app_units::Au;
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use cssparser::{serialize_identifier, CssStringWriter, Parser};
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::{bindings, structs};
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::sugar::refptr::RefPtr;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::{bindings, structs};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use std::fmt::{self, Write};
|
||||
use std::hash::{Hash, Hasher};
|
||||
#[cfg(feature = "servo")]
|
||||
use std::slice;
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use values::CSSFloat;
|
||||
use values::animated::{ToAnimatedValue, ToAnimatedZero};
|
||||
use values::computed::{Angle, Context, Integer, NonNegativeLength, NonNegativePercentage};
|
||||
use values::computed::{Number, Percentage, ToComputedValue};
|
||||
use values::generics::font::{self as generics, FeatureTagValue, FontSettings, VariationValue};
|
||||
use values::specified::font::{self as specified, MIN_FONT_WEIGHT, MAX_FONT_WEIGHT};
|
||||
use values::specified::font::{self as specified, MAX_FONT_WEIGHT, MIN_FONT_WEIGHT};
|
||||
use values::specified::length::{FontBaseSize, NoCalcLength};
|
||||
use values::CSSFloat;
|
||||
use Atom;
|
||||
|
||||
pub use values::computed::Length as MozScriptMinSize;
|
||||
pub use values::specified::font::{FontSynthesis, MozScriptSizeMultiplier, XLang, XTextZoom};
|
||||
|
@ -10,16 +10,16 @@
|
||||
use std::f32::consts::PI;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::{Either, None_};
|
||||
use values::computed::{Angle, Color, Context};
|
||||
use values::computed::{Length, LengthOrPercentage, NumberOrPercentage, ToComputedValue};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::computed::Percentage;
|
||||
use values::computed::position::Position;
|
||||
use values::computed::url::ComputedImageUrl;
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::computed::Percentage;
|
||||
use values::computed::{Angle, Color, Context};
|
||||
use values::computed::{Length, LengthOrPercentage, NumberOrPercentage, ToComputedValue};
|
||||
use values::generics::image::{self as generic, CompatMode};
|
||||
use values::specified::image::LineDirection as SpecifiedLineDirection;
|
||||
use values::specified::position::{X, Y};
|
||||
use values::{Either, None_};
|
||||
|
||||
/// A computed image layer.
|
||||
pub type ImageLayer = Either<None_, Image>;
|
||||
|
@ -4,20 +4,20 @@
|
||||
|
||||
//! `<length>` computed values, and related ones.
|
||||
|
||||
use super::{Context, Number, Percentage, ToComputedValue};
|
||||
use app_units::Au;
|
||||
use ordered_float::NotNan;
|
||||
use std::fmt::{self, Write};
|
||||
use std::ops::{Add, Neg};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use super::{Context, Number, Percentage, ToComputedValue};
|
||||
use values::{specified, Auto, CSSFloat, Either, Normal, IsAuto};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::generics::NonNegative;
|
||||
use values::generics::length::{MaxLength as GenericMaxLength, MozLength as GenericMozLength};
|
||||
use values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength};
|
||||
use values::generics::NonNegative;
|
||||
use values::specified::length::ViewportPercentageLength;
|
||||
use values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength};
|
||||
use values::{specified, Auto, CSSFloat, Either, IsAuto, Normal};
|
||||
|
||||
pub use super::image::Image;
|
||||
pub use values::specified::url::UrlOrNone;
|
||||
@ -207,12 +207,12 @@ impl ToCss for CalcLengthOrPercentage {
|
||||
if length.px() == 0. && self.clamping_mode.clamp(p.0) == p.0 {
|
||||
return p.to_css(dest);
|
||||
}
|
||||
}
|
||||
},
|
||||
None => {
|
||||
if self.clamping_mode.clamp(length.px()) == length.px() {
|
||||
return length.to_css(dest);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
dest.write_str("calc(")?;
|
||||
@ -957,8 +957,18 @@ pub type NonNegativeLengthOrPercentageOrNormal = Either<NonNegativeLengthOrPerce
|
||||
/// block-size, and inline-size.
|
||||
#[allow(missing_docs)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
)]
|
||||
pub enum ExtremumLength {
|
||||
MozMaxContent,
|
||||
MozMinContent,
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
//! `list` computed values.
|
||||
|
||||
pub use values::specified::list::{QuotePair, Quotes};
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use values::specified::list::ListStyleType;
|
||||
pub use values::specified::list::{QuotePair, Quotes};
|
||||
|
||||
use servo_arc::Arc;
|
||||
|
||||
@ -21,7 +21,8 @@ lazy_static! {
|
||||
opening: "\u{2018}".to_owned().into_boxed_str(),
|
||||
closing: "\u{2019}".to_owned().into_boxed_str(),
|
||||
},
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,13 @@
|
||||
|
||||
//! Computed values.
|
||||
|
||||
use Atom;
|
||||
#[cfg(feature = "servo")]
|
||||
use Prefix;
|
||||
use super::animated::ToAnimatedValue;
|
||||
use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent;
|
||||
use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as GenericTrackBreadth};
|
||||
use super::generics::grid::{TrackList as GenericTrackList, TrackSize as GenericTrackSize};
|
||||
use super::generics::{GreaterThanOrEqualToOne, NonNegative};
|
||||
use super::specified;
|
||||
use super::{CSSFloat, CSSInteger};
|
||||
use context::QuirksMode;
|
||||
use euclid::Size2D;
|
||||
use font_metrics::{get_metrics_provider_for_product, FontMetricsProvider};
|
||||
@ -19,17 +23,12 @@ use std::cell::RefCell;
|
||||
use std::cmp;
|
||||
use std::f32;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use style_traits::cursor::CursorKind;
|
||||
use super::{CSSFloat, CSSInteger};
|
||||
use super::animated::ToAnimatedValue;
|
||||
use super::generics::{GreaterThanOrEqualToOne, NonNegative};
|
||||
use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as GenericTrackBreadth};
|
||||
use super::generics::grid::{TrackList as GenericTrackList, TrackSize as GenericTrackSize};
|
||||
use super::generics::grid::GridTemplateComponent as GenericGridTemplateComponent;
|
||||
use super::specified;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use Atom;
|
||||
#[cfg(feature = "servo")]
|
||||
use Prefix;
|
||||
|
||||
pub use app_units::Au;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use self::align::{AlignContent, AlignItems, JustifyContent, JustifyItems, SelfAlignment};
|
||||
#[cfg(feature = "gecko")]
|
||||
@ -37,13 +36,13 @@ pub use self::align::{AlignSelf, JustifySelf};
|
||||
pub use self::angle::Angle;
|
||||
pub use self::background::{BackgroundRepeat, BackgroundSize};
|
||||
pub use self::basic_shape::FillRule;
|
||||
pub use self::border::{BorderImageRepeat, BorderImageSideWidth, BorderImageSlice, BorderImageWidth};
|
||||
pub use self::border::{BorderCornerRadius, BorderRadius, BorderSpacing};
|
||||
pub use self::font::{FontSize, FontSizeAdjust, FontStretch, FontSynthesis, FontVariantAlternates, FontWeight};
|
||||
pub use self::font::{FontFamily, FontLanguageOverride, FontStyle, FontVariantEastAsian, FontVariationSettings};
|
||||
pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric};
|
||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
||||
pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display, TransitionProperty};
|
||||
pub use self::border::{
|
||||
BorderImageRepeat, BorderImageSideWidth, BorderImageSlice, BorderImageWidth,
|
||||
};
|
||||
pub use self::box_::{
|
||||
AnimationIterationCount, AnimationName, Contain, Display, TransitionProperty,
|
||||
};
|
||||
pub use self::box_::{Appearance, Clear, Float};
|
||||
pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize};
|
||||
pub use self::box_::{ScrollSnapType, TouchAction, VerticalAlign, WillChange};
|
||||
@ -53,36 +52,47 @@ pub use self::counters::{Content, ContentItem, CounterIncrement, CounterReset};
|
||||
pub use self::easing::TimingFunction;
|
||||
pub use self::effects::{BoxShadow, Filter, SimpleShadow};
|
||||
pub use self::flex::FlexBasis;
|
||||
pub use self::image::{Gradient, GradientItem, Image, ImageLayer, LineDirection, MozImageRect};
|
||||
pub use self::font::{
|
||||
FontFamily, FontLanguageOverride, FontStyle, FontVariantEastAsian, FontVariationSettings,
|
||||
};
|
||||
pub use self::font::{FontFeatureSettings, FontVariantLigatures, FontVariantNumeric};
|
||||
pub use self::font::{
|
||||
FontSize, FontSizeAdjust, FontStretch, FontSynthesis, FontVariantAlternates, FontWeight,
|
||||
};
|
||||
pub use self::font::{MozScriptLevel, MozScriptMinSize, MozScriptSizeMultiplier, XLang, XTextZoom};
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use self::gecko::ScrollSnapPoint;
|
||||
pub use self::rect::LengthOrNumberRect;
|
||||
pub use self::resolution::Resolution;
|
||||
pub use super::{Auto, Either, None_};
|
||||
pub use super::specified::{BorderStyle, TextDecorationLine};
|
||||
pub use self::image::{Gradient, GradientItem, Image, ImageLayer, LineDirection, MozImageRect};
|
||||
pub use self::length::{CSSPixelLength, ExtremumLength, NonNegativeLength};
|
||||
pub use self::length::{CalcLengthOrPercentage, Length, LengthOrNumber, LengthOrPercentage};
|
||||
pub use self::length::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone, MaxLength, MozLength};
|
||||
pub use self::length::{CSSPixelLength, ExtremumLength, NonNegativeLength};
|
||||
pub use self::length::{NonNegativeLengthOrPercentage, NonNegativeLengthOrPercentageOrAuto};
|
||||
pub use self::list::{QuotePair, Quotes};
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use self::list::ListStyleType;
|
||||
pub use self::list::{QuotePair, Quotes};
|
||||
pub use self::motion::OffsetPath;
|
||||
pub use self::outline::OutlineStyle;
|
||||
pub use self::percentage::{Percentage, NonNegativePercentage};
|
||||
pub use self::percentage::{NonNegativePercentage, Percentage};
|
||||
pub use self::position::{GridAutoFlow, GridTemplateAreas, Position, ZIndex};
|
||||
pub use self::rect::LengthOrNumberRect;
|
||||
pub use self::resolution::Resolution;
|
||||
pub use self::svg::MozContextProperties;
|
||||
pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
|
||||
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
|
||||
pub use self::svg::MozContextProperties;
|
||||
pub use self::table::XSpan;
|
||||
pub use self::text::{InitialLetter, LetterSpacing, LineHeight, MozTabSize};
|
||||
pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle, TextOverflow, WordSpacing};
|
||||
pub use self::text::{
|
||||
TextAlign, TextEmphasisPosition, TextEmphasisStyle, TextOverflow, WordSpacing,
|
||||
};
|
||||
pub use self::time::Time;
|
||||
pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
|
||||
pub use self::transform::{TransformOrigin, TransformStyle, Translate};
|
||||
pub use self::ui::{ColorOrAuto, Cursor, MozForceBrokenImageIcon};
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use self::ui::CursorImage;
|
||||
pub use self::ui::{ColorOrAuto, Cursor, MozForceBrokenImageIcon};
|
||||
pub use super::specified::{BorderStyle, TextDecorationLine};
|
||||
pub use super::{Auto, Either, None_};
|
||||
pub use app_units::Au;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
pub mod align;
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
use std::fmt;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::{serialize_percentage, CSSFloat};
|
||||
use values::animated::ToAnimatedValue;
|
||||
use values::generics::NonNegative;
|
||||
use values::{serialize_percentage, CSSFloat};
|
||||
|
||||
/// A computed percentage.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user