cargo fix --edition

This commit is contained in:
Simon Sapin 2018-11-01 14:09:54 +01:00
parent e1fcffb336
commit a15d33a10e
197 changed files with 1414 additions and 1380 deletions

View file

@ -26,7 +26,7 @@ pub use std::collections::hash_set::{IntoIter as SetIntoIter, Iter as SetIter};
#[derive(Clone)] #[derive(Clone)]
pub struct HashMap<K, V, S = RandomState>(StdMap<K, V, S>); pub struct HashMap<K, V, S = RandomState>(StdMap<K, V, S>);
use FailedAllocationError; use crate::FailedAllocationError;
impl<K, V, S> Deref for HashMap<K, V, S> { impl<K, V, S> Deref for HashMap<K, V, S> {
type Target = StdMap<K, V, S>; type Target = StdMap<K, V, S>;

View file

@ -23,7 +23,7 @@ use std::ops::{Deref, Index};
use super::table::BucketState::{Empty, Full}; use super::table::BucketState::{Empty, Full};
use super::table::{self, Bucket, EmptyBucket, FullBucket, FullBucketMut, RawTable, SafeHash}; use super::table::{self, Bucket, EmptyBucket, FullBucket, FullBucketMut, RawTable, SafeHash};
use FailedAllocationError; use crate::FailedAllocationError;
const MIN_NONZERO_RAW_CAPACITY: usize = 32; // must be a power of two const MIN_NONZERO_RAW_CAPACITY: usize = 32; // must be a power of two

View file

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use alloc::{alloc, dealloc}; use crate::alloc::{alloc, dealloc};
use shim::{Shared, Unique}; use crate::shim::{Shared, Unique};
use std::cmp; use std::cmp;
use std::hash::{BuildHasher, Hash, Hasher}; use std::hash::{BuildHasher, Hash, Hasher};
use std::marker; use std::marker;
@ -18,7 +18,7 @@ use std::ops::{Deref, DerefMut};
use std::ptr; use std::ptr;
use self::BucketState::*; use self::BucketState::*;
use FailedAllocationError; use crate::FailedAllocationError;
/// Integer type used for stored hash values. /// Integer type used for stored hash values.
/// ///
@ -795,7 +795,7 @@ impl<K, V> RawTable<K, V> {
let buffer = alloc(size, alignment); let buffer = alloc(size, alignment);
if buffer.is_null() { if buffer.is_null() {
use AllocationInfo; use crate::AllocationInfo;
return Err(FailedAllocationError { return Err(FailedAllocationError {
reason: "out of memory when allocating RawTable", reason: "out of memory when allocating RawTable",
allocation_info: Some(AllocationInfo { size, alignment }), allocation_info: Some(AllocationInfo { size, alignment }),

View file

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use crate::parser::SelectorImpl;
use cssparser::ToCss; use cssparser::ToCss;
use parser::SelectorImpl;
use std::fmt; use std::fmt;
#[derive(Clone, Eq, PartialEq)] #[derive(Clone, Eq, PartialEq)]

View file

@ -17,9 +17,9 @@
//! is non-trivial. This module encapsulates those details and presents an //! is non-trivial. This module encapsulates those details and presents an
//! easy-to-use API for the parser. //! easy-to-use API for the parser.
use parser::{Combinator, Component, SelectorImpl}; use crate::parser::{Combinator, Component, SelectorImpl};
use crate::sink::Push;
use servo_arc::{Arc, HeaderWithLength, ThinArc}; use servo_arc::{Arc, HeaderWithLength, ThinArc};
use sink::Push;
use smallvec::{self, SmallVec}; use smallvec::{self, SmallVec};
use std::cmp; use std::cmp;
use std::iter; use std::iter;

View file

@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use attr::CaseSensitivity; use crate::attr::CaseSensitivity;
use bloom::BloomFilter; use crate::bloom::BloomFilter;
use nth_index_cache::NthIndexCache; use crate::nth_index_cache::NthIndexCache;
use parser::SelectorImpl; use crate::parser::SelectorImpl;
use tree::{Element, OpaqueElement}; use crate::tree::{Element, OpaqueElement};
/// What kind of selector matching mode we should use. /// What kind of selector matching mode we should use.
/// ///

View file

@ -31,6 +31,6 @@ pub mod sink;
mod tree; mod tree;
pub mod visitor; pub mod visitor;
pub use nth_index_cache::NthIndexCache; pub use crate::nth_index_cache::NthIndexCache;
pub use parser::{Parser, SelectorImpl, SelectorList}; pub use crate::parser::{Parser, SelectorImpl, SelectorList};
pub use tree::{Element, OpaqueElement}; pub use crate::tree::{Element, OpaqueElement};

View file

@ -2,16 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use attr::{AttrSelectorOperation, NamespaceConstraint, ParsedAttrSelectorOperation}; use crate::attr::{AttrSelectorOperation, NamespaceConstraint, ParsedAttrSelectorOperation};
use bloom::{BloomFilter, BLOOM_HASH_MASK}; use crate::bloom::{BloomFilter, BLOOM_HASH_MASK};
use nth_index_cache::NthIndexCacheInner; use crate::nth_index_cache::NthIndexCacheInner;
use parser::{AncestorHashes, Combinator, Component, LocalName}; use crate::parser::{AncestorHashes, Combinator, Component, LocalName};
use parser::{NonTSPseudoClass, Selector, SelectorImpl, SelectorIter, SelectorList}; use crate::parser::{NonTSPseudoClass, Selector, SelectorImpl, SelectorIter, SelectorList};
use crate::tree::Element;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::iter; use std::iter;
use tree::Element;
pub use context::*; pub use crate::context::*;
// The bloom filter for descendant CSS selectors will have a <1% false // The bloom filter for descendant CSS selectors will have a <1% false
// positive rate until it has this many selectors in it, then it will // positive rate until it has this many selectors in it, then it will
@ -678,7 +678,7 @@ where
element.namespace() == url.borrow() element.namespace() == url.borrow()
}, },
Component::ExplicitNoNamespace => { Component::ExplicitNoNamespace => {
let ns = ::parser::namespace_empty_string::<E::Impl>(); let ns = crate::parser::namespace_empty_string::<E::Impl>();
element.namespace() == ns.borrow() element.namespace() == ns.borrow()
}, },
Component::ID(ref id) => { Component::ID(ref id) => {
@ -693,7 +693,7 @@ where
} => { } => {
let is_html = element.is_html_element_in_html_document(); let is_html = element.is_html_element_in_html_document();
element.attr_matches( element.attr_matches(
&NamespaceConstraint::Specific(&::parser::namespace_empty_string::<E::Impl>()), &NamespaceConstraint::Specific(&crate::parser::namespace_empty_string::<E::Impl>()),
select_name(is_html, local_name, local_name_lower), select_name(is_html, local_name, local_name_lower),
&AttrSelectorOperation::Exists, &AttrSelectorOperation::Exists,
) )
@ -710,7 +710,7 @@ where
} }
let is_html = element.is_html_element_in_html_document(); let is_html = element.is_html_element_in_html_document();
element.attr_matches( element.attr_matches(
&NamespaceConstraint::Specific(&::parser::namespace_empty_string::<E::Impl>()), &NamespaceConstraint::Specific(&crate::parser::namespace_empty_string::<E::Impl>()),
local_name, local_name,
&AttrSelectorOperation::WithValue { &AttrSelectorOperation::WithValue {
operator: operator, operator: operator,
@ -728,7 +728,7 @@ where
let namespace = match attr_sel.namespace() { let namespace = match attr_sel.namespace() {
Some(ns) => ns, Some(ns) => ns,
None => { None => {
empty_string = ::parser::namespace_empty_string::<E::Impl>(); empty_string = crate::parser::namespace_empty_string::<E::Impl>();
NamespaceConstraint::Specific(&empty_string) NamespaceConstraint::Specific(&empty_string)
}, },
}; };

View file

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use crate::tree::OpaqueElement;
use fxhash::FxHashMap; use fxhash::FxHashMap;
use tree::OpaqueElement;
/// A cache to speed up matching of nth-index-like selectors. /// A cache to speed up matching of nth-index-like selectors.
/// ///

View file

@ -2,26 +2,26 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use attr::{AttrSelectorOperator, AttrSelectorWithOptionalNamespace}; use crate::attr::{AttrSelectorOperator, AttrSelectorWithOptionalNamespace};
use attr::{NamespaceConstraint, ParsedAttrSelectorOperation}; use crate::attr::{NamespaceConstraint, ParsedAttrSelectorOperation};
use attr::{ParsedCaseSensitivity, SELECTOR_WHITESPACE}; use crate::attr::{ParsedCaseSensitivity, SELECTOR_WHITESPACE};
use bloom::BLOOM_HASH_MASK; use crate::bloom::BLOOM_HASH_MASK;
use builder::{SelectorBuilder, SpecificityAndFlags}; use crate::builder::{SelectorBuilder, SpecificityAndFlags};
use context::QuirksMode; use crate::context::QuirksMode;
use crate::sink::Push;
pub use crate::visitor::{SelectorVisitor, Visit};
use cssparser::{parse_nth, serialize_identifier}; use cssparser::{parse_nth, serialize_identifier};
use cssparser::{BasicParseError, BasicParseErrorKind, ParseError, ParseErrorKind}; use cssparser::{BasicParseError, BasicParseErrorKind, ParseError, ParseErrorKind};
use cssparser::{CowRcStr, Delimiter, SourceLocation}; use cssparser::{CowRcStr, Delimiter, SourceLocation};
use cssparser::{CssStringWriter, Parser as CssParser, ToCss, Token}; use cssparser::{CssStringWriter, Parser as CssParser, ToCss, Token};
use precomputed_hash::PrecomputedHash; use precomputed_hash::PrecomputedHash;
use servo_arc::ThinArc; use servo_arc::ThinArc;
use sink::Push;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::borrow::{Borrow, Cow}; use std::borrow::{Borrow, Cow};
use std::fmt::{self, Debug, Display, Write}; use std::fmt::{self, Debug, Display, Write};
use std::iter::Rev; use std::iter::Rev;
use std::slice; use std::slice;
use thin_slice::ThinBoxedSlice; use thin_slice::ThinBoxedSlice;
pub use visitor::{SelectorVisitor, Visit};
/// A trait that represents a pseudo-element. /// A trait that represents a pseudo-element.
pub trait PseudoElement: Sized + ToCss { pub trait PseudoElement: Sized + ToCss {
@ -465,7 +465,7 @@ where
let namespace = match attr_selector.namespace() { let namespace = match attr_selector.namespace() {
Some(ns) => ns, Some(ns) => ns,
None => { None => {
empty_string = ::parser::namespace_empty_string::<Impl>(); empty_string = crate::parser::namespace_empty_string::<Impl>();
NamespaceConstraint::Specific(&empty_string) NamespaceConstraint::Specific(&empty_string)
}, },
}; };
@ -2147,9 +2147,9 @@ where
#[cfg(test)] #[cfg(test)]
pub mod tests { pub mod tests {
use super::*; use super::*;
use builder::HAS_PSEUDO_BIT; use crate::builder::HAS_PSEUDO_BIT;
use crate::parser;
use cssparser::{serialize_identifier, Parser as CssParser, ParserInput, ToCss}; use cssparser::{serialize_identifier, Parser as CssParser, ParserInput, ToCss};
use parser;
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt; use std::fmt;

View file

@ -5,9 +5,9 @@
//! Traits that nodes must implement. Breaks the otherwise-cyclic dependency //! Traits that nodes must implement. Breaks the otherwise-cyclic dependency
//! between layout and style. //! between layout and style.
use attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; use crate::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
use matching::{ElementSelectorFlags, MatchingContext}; use crate::matching::{ElementSelectorFlags, MatchingContext};
use parser::SelectorImpl; use crate::parser::SelectorImpl;
use std::fmt::Debug; use std::fmt::Debug;
use std::ptr::NonNull; use std::ptr::NonNull;

View file

@ -6,8 +6,8 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use attr::NamespaceConstraint; use crate::attr::NamespaceConstraint;
use parser::{Combinator, Component, SelectorImpl}; use crate::parser::{Combinator, Component, SelectorImpl};
/// A trait to visit selector properties. /// A trait to visit selector properties.
/// ///

View file

@ -1060,7 +1060,7 @@ unsafe impl<A: Sync + Send, B: Send + Sync> Sync for ArcUnion<A, B> {}
impl<A: PartialEq, B: PartialEq> PartialEq for ArcUnion<A, B> { impl<A: PartialEq, B: PartialEq> PartialEq for ArcUnion<A, B> {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
use ArcUnionBorrow::*; use crate::ArcUnionBorrow::*;
match (self.borrow(), other.borrow()) { match (self.borrow(), other.borrow()) {
(First(x), First(y)) => x == y, (First(x), First(y)) => x == y,
(Second(x), Second(y)) => x == y, (Second(x), Second(y)) => x == y,

View file

@ -8,29 +8,29 @@
// compile it out so that people remember it exists, thus the cfg'd Sender // compile it out so that people remember it exists, thus the cfg'd Sender
// import. // import.
use bezier::Bezier; use crate::bezier::Bezier;
use context::SharedStyleContext; use crate::context::SharedStyleContext;
use dom::{OpaqueNode, TElement}; use crate::dom::{OpaqueNode, TElement};
use font_metrics::FontMetricsProvider; use crate::font_metrics::FontMetricsProvider;
use properties::animated_properties::AnimatedProperty; use crate::properties::animated_properties::AnimatedProperty;
use properties::longhands::animation_direction::computed_value::single_value::T as AnimationDirection; use crate::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 crate::properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
use properties::{self, CascadeMode, ComputedValues, LonghandId}; use crate::properties::{self, CascadeMode, ComputedValues, LonghandId};
use rule_tree::CascadeLevel; use crate::rule_tree::CascadeLevel;
use crate::stylesheets::keyframes_rule::{KeyframesAnimation, KeyframesStep, KeyframesStepValue};
use crate::timer::Timer;
use crate::values::computed::box_::TransitionProperty;
use crate::values::computed::Time;
use crate::values::computed::TimingFunction;
use crate::values::generics::box_::AnimationIterationCount;
use crate::values::generics::easing::{StepPosition, TimingFunction as GenericTimingFunction};
use crate::Atom;
use servo_arc::Arc; use servo_arc::Arc;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use servo_channel::Sender; use servo_channel::Sender;
use std::fmt; use std::fmt;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use std::sync::mpsc::Sender; 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::generics::box_::AnimationIterationCount;
use values::generics::easing::{StepPosition, TimingFunction as GenericTimingFunction};
use Atom;
/// This structure represents a keyframes animation current iteration state. /// This structure represents a keyframes animation current iteration state.
/// ///

View file

@ -4,10 +4,10 @@
//! Applicable declarations management. //! Applicable declarations management.
use properties::PropertyDeclarationBlock; use crate::properties::PropertyDeclarationBlock;
use rule_tree::{CascadeLevel, ShadowCascadeOrder, StyleSource}; use crate::rule_tree::{CascadeLevel, ShadowCascadeOrder, StyleSource};
use crate::shared_lock::Locked;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::Locked;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::fmt::{self, Debug}; use std::fmt::{self, Debug};

View file

@ -7,20 +7,20 @@
//! [attr]: https://dom.spec.whatwg.org/#interface-attr //! [attr]: https://dom.spec.whatwg.org/#interface-attr
use app_units::Au; use app_units::Au;
use crate::properties::PropertyDeclarationBlock;
use crate::shared_lock::Locked;
use crate::str::str_join;
use crate::str::{read_exponent, read_fraction, HTML_SPACE_CHARACTERS};
use crate::str::{read_numbers, split_commas, split_html_space_chars};
use crate::values::specified::Length;
use crate::{Atom, LocalName, Namespace, Prefix};
use cssparser::{self, Color, RGBA}; use cssparser::{self, Color, RGBA};
use euclid::num::Zero; use euclid::num::Zero;
use num_traits::ToPrimitive; use num_traits::ToPrimitive;
use properties::PropertyDeclarationBlock;
use selectors::attr::AttrSelectorOperation; use selectors::attr::AttrSelectorOperation;
use servo_arc::Arc; use servo_arc::Arc;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use shared_lock::Locked;
use std::str::FromStr; 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 values::specified::Length;
use {Atom, LocalName, Namespace, Prefix};
// Duplicated from script::dom::values. // Duplicated from script::dom::values.
const UNSIGNED_LONG_MAX: u32 = 2147483647; const UNSIGNED_LONG_MAX: u32 = 2147483647;

View file

@ -5,16 +5,16 @@
//! A set of author stylesheets and their computed representation, such as the //! A set of author stylesheets and their computed representation, such as the
//! ones used for ShadowRoot and XBL. //! ones used for ShadowRoot and XBL.
use context::QuirksMode; use crate::context::QuirksMode;
use dom::TElement; use crate::dom::TElement;
use crate::invalidation::media_queries::ToMediaListKey;
use crate::media_queries::Device;
use crate::shared_lock::SharedRwLockReadGuard;
use crate::stylesheet_set::AuthorStylesheetSet;
use crate::stylesheets::StylesheetInDocument;
use crate::stylist::CascadeData;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI}; use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use invalidation::media_queries::ToMediaListKey;
use media_queries::Device;
use shared_lock::SharedRwLockReadGuard;
use stylesheet_set::AuthorStylesheetSet;
use stylesheets::StylesheetInDocument;
use stylist::CascadeData;
/// A set of author stylesheets and their computed representation, such as the /// A set of author stylesheets and their computed representation, such as the
/// ones used for ShadowRoot and XBL. /// ones used for ShadowRoot and XBL.

View file

@ -8,7 +8,7 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use values::CSSFloat; use crate::values::CSSFloat;
const NEWTON_METHOD_ITERATIONS: u8 = 8; const NEWTON_METHOD_ITERATIONS: u8 = 8;

View file

@ -8,7 +8,7 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use atomic_refcell::{AtomicRefCell, AtomicRefMut}; use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use dom::{SendElement, TElement}; use crate::dom::{SendElement, TElement};
use owning_ref::OwningHandle; use owning_ref::OwningHandle;
use selectors::bloom::BloomFilter; use selectors::bloom::BloomFilter;
use servo_arc::Arc; use servo_arc::Arc;

View file

@ -4,29 +4,36 @@
//! The context within which style is calculated. //! The context within which style is calculated.
#[cfg(feature = "servo")]
use animation::Animation;
use app_units::Au; use app_units::Au;
use bloom::StyleBloom;
use data::{EagerPseudoStyles, ElementData};
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use dom::OpaqueNode; use crate::animation::Animation;
use dom::{SendElement, TElement}; use crate::bloom::StyleBloom;
use crate::data::{EagerPseudoStyles, ElementData};
#[cfg(feature = "servo")]
use crate::dom::OpaqueNode;
use crate::dom::{SendElement, TElement};
use crate::font_metrics::FontMetricsProvider;
use crate::parallel::{STACK_SAFETY_MARGIN_KB, STYLE_THREAD_STACK_SIZE_KB};
use crate::properties::ComputedValues;
#[cfg(feature = "servo")]
use crate::properties::PropertyId;
use crate::rule_cache::RuleCache;
use crate::rule_tree::StrongRuleNode;
use crate::selector_parser::{SnapshotMap, EAGER_PSEUDO_COUNT};
use crate::shared_lock::StylesheetGuards;
use crate::sharing::StyleSharingCache;
use crate::stylist::Stylist;
use crate::thread_state::{self, ThreadState};
use crate::timer::Timer;
use crate::traversal::DomTraversal;
use crate::traversal_flags::TraversalFlags;
use euclid::Size2D; use euclid::Size2D;
use euclid::TypedScale; use euclid::TypedScale;
use font_metrics::FontMetricsProvider;
use fxhash::FxHashMap; use fxhash::FxHashMap;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::structs; use gecko_bindings::structs;
use parallel::{STACK_SAFETY_MARGIN_KB, STYLE_THREAD_STACK_SIZE_KB};
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use parking_lot::RwLock; use parking_lot::RwLock;
use properties::ComputedValues;
#[cfg(feature = "servo")]
use properties::PropertyId;
use rule_cache::RuleCache;
use rule_tree::StrongRuleNode;
use selector_parser::{SnapshotMap, EAGER_PSEUDO_COUNT};
use selectors::matching::ElementSelectorFlags; use selectors::matching::ElementSelectorFlags;
use selectors::NthIndexCache; use selectors::NthIndexCache;
use servo_arc::Arc; use servo_arc::Arc;
@ -34,8 +41,6 @@ use servo_arc::Arc;
use servo_atoms::Atom; use servo_atoms::Atom;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use servo_channel::Sender; use servo_channel::Sender;
use shared_lock::StylesheetGuards;
use sharing::StyleSharingCache;
use std::fmt; use std::fmt;
use std::ops; use std::ops;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
@ -44,12 +49,7 @@ use style_traits::CSSPixel;
use style_traits::DevicePixel; use style_traits::DevicePixel;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use style_traits::SpeculativePainter; use style_traits::SpeculativePainter;
use stylist::Stylist;
use thread_state::{self, ThreadState};
use time; use time;
use timer::Timer;
use traversal::DomTraversal;
use traversal_flags::TraversalFlags;
use uluru::{Entry, LRUCache}; use uluru::{Entry, LRUCache};
pub use selectors::matching::QuirksMode; pub use selectors::matching::QuirksMode;

View file

@ -6,22 +6,22 @@
//! //!
//! [counter-style]: https://drafts.csswg.org/css-counter-styles/ //! [counter-style]: https://drafts.csswg.org/css-counter-styles/
use crate::error_reporting::ContextualParseError;
use crate::parser::{Parse, ParserContext};
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::values::specified::Integer;
use crate::values::CustomIdent;
use crate::Atom;
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser}; use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser};
use cssparser::{CowRcStr, Parser, SourceLocation, Token}; use cssparser::{CowRcStr, Parser, SourceLocation, Token};
use error_reporting::ContextualParseError;
use parser::{Parse, ParserContext};
use selectors::parser::SelectorParseErrorKind; use selectors::parser::SelectorParseErrorKind;
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::mem; use std::mem;
use std::num::Wrapping; use std::num::Wrapping;
use std::ops::Range; use std::ops::Range;
use str::CssStringWriter;
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError}; use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
use style_traits::{StyleParseErrorKind, ToCss}; use style_traits::{StyleParseErrorKind, ToCss};
use values::specified::Integer;
use values::CustomIdent;
use Atom;
/// Parse a counter style name reference. /// Parse a counter style name reference.
/// ///
@ -370,7 +370,7 @@ impl Parse for System {
"symbolic" => Ok(System::Symbolic), "symbolic" => Ok(System::Symbolic),
"additive" => Ok(System::Additive), "additive" => Ok(System::Additive),
"fixed" => { "fixed" => {
let first_symbol_value = input.try(|i| Integer::parse(context, i)).ok(); let first_symbol_value = input.r#try(|i| Integer::parse(context, i)).ok();
Ok(System::Fixed { first_symbol_value: first_symbol_value }) Ok(System::Fixed { first_symbol_value: first_symbol_value })
} }
"extends" => { "extends" => {
@ -457,7 +457,7 @@ impl Parse for Negative {
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
Ok(Negative( Ok(Negative(
Symbol::parse(context, input)?, Symbol::parse(context, input)?,
input.try(|input| Symbol::parse(context, input)).ok(), input.r#try(|input| Symbol::parse(context, input)).ok(),
)) ))
} }
} }
@ -483,7 +483,7 @@ impl Parse for Ranges {
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
if input if input
.try(|input| input.expect_ident_matching("auto")) .r#try(|input| input.expect_ident_matching("auto"))
.is_ok() .is_ok()
{ {
Ok(Ranges(Vec::new())) Ok(Ranges(Vec::new()))
@ -512,7 +512,7 @@ fn parse_bound<'i, 't>(
context: &ParserContext, context: &ParserContext,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<CounterBound, ParseError<'i>> { ) -> Result<CounterBound, ParseError<'i>> {
if let Ok(integer) = input.try(|input| Integer::parse(context, input)) { if let Ok(integer) = input.r#try(|input| Integer::parse(context, input)) {
return Ok(CounterBound::Integer(integer)); return Ok(CounterBound::Integer(integer));
} }
input.expect_ident_matching("infinite")?; input.expect_ident_matching("infinite")?;
@ -556,7 +556,7 @@ impl Parse for Pad {
context: &ParserContext, context: &ParserContext,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
let pad_with = input.try(|input| Symbol::parse(context, input)); let pad_with = input.r#try(|input| Symbol::parse(context, input));
let min_length = Integer::parse_non_negative(context, input)?; let min_length = Integer::parse_non_negative(context, input)?;
let pad_with = pad_with.or_else(|_| Symbol::parse(context, input))?; let pad_with = pad_with.or_else(|_| Symbol::parse(context, input))?;
Ok(Pad(min_length, pad_with)) Ok(Pad(min_length, pad_with))
@ -588,7 +588,7 @@ impl Parse for Symbols {
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
let mut symbols = Vec::new(); let mut symbols = Vec::new();
loop { loop {
if let Ok(s) = input.try(|input| Symbol::parse(context, input)) { if let Ok(s) = input.r#try(|input| Symbol::parse(context, input)) {
symbols.push(s) symbols.push(s)
} else { } else {
if symbols.is_empty() { if symbols.is_empty() {
@ -640,7 +640,7 @@ impl Parse for AdditiveTuple {
context: &ParserContext, context: &ParserContext,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
let symbol = input.try(|input| Symbol::parse(context, input)); let symbol = input.r#try(|input| Symbol::parse(context, input));
let weight = Integer::parse_non_negative(context, input)?; let weight = Integer::parse_non_negative(context, input)?;
let symbol = symbol.or_else(|_| Symbol::parse(context, input))?; let symbol = symbol.or_else(|_| Symbol::parse(context, input))?;
Ok(AdditiveTuple { Ok(AdditiveTuple {
@ -673,7 +673,7 @@ impl Parse for SpeakAs {
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
let mut is_spell_out = false; let mut is_spell_out = false;
let result = input.try(|input| { let result = input.r#try(|input| {
let ident = input.expect_ident().map_err(|_| ())?; let ident = input.expect_ident().map_err(|_| ())?;
match_ignore_ascii_case! { &*ident, match_ignore_ascii_case! { &*ident,
"auto" => Ok(SpeakAs::Auto), "auto" => Ok(SpeakAs::Auto),

View file

@ -6,11 +6,12 @@
//! //!
//! [custom]: https://drafts.csswg.org/css-variables/ //! [custom]: https://drafts.csswg.org/css-variables/
use crate::hash::map::Entry;
use crate::properties::{CSSWideKeyword, CustomDeclarationValue};
use crate::selector_map::{PrecomputedHashMap, PrecomputedHashSet};
use crate::Atom;
use cssparser::{Delimiter, Parser, ParserInput, SourcePosition, Token, TokenSerializationType}; use cssparser::{Delimiter, Parser, ParserInput, SourcePosition, Token, TokenSerializationType};
use hash::map::Entry;
use precomputed_hash::PrecomputedHash; use precomputed_hash::PrecomputedHash;
use properties::{CSSWideKeyword, CustomDeclarationValue};
use selector_map::{PrecomputedHashMap, PrecomputedHashSet};
use selectors::parser::SelectorParseErrorKind; use selectors::parser::SelectorParseErrorKind;
use servo_arc::Arc; use servo_arc::Arc;
use smallvec::SmallVec; use smallvec::SmallVec;
@ -19,7 +20,6 @@ use std::cmp;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::hash::Hash; use std::hash::Hash;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
use Atom;
/// The environment from which to get `env` function values. /// The environment from which to get `env` function values.
/// ///
@ -553,7 +553,7 @@ fn parse_var_function<'i, 't>(
let name = parse_name(&name).map_err(|()| { let name = parse_name(&name).map_err(|()| {
input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone())) input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone()))
})?; })?;
if input.try(|input| input.expect_comma()).is_ok() { if input.r#try(|input| input.expect_comma()).is_ok() {
parse_fallback(input)?; parse_fallback(input)?;
} }
if let Some(refs) = references { if let Some(refs) = references {
@ -569,7 +569,7 @@ fn parse_env_function<'i, 't>(
// TODO(emilio): This should be <custom-ident> per spec, but no other // TODO(emilio): This should be <custom-ident> per spec, but no other
// browser does that, see https://github.com/w3c/csswg-drafts/issues/3262. // browser does that, see https://github.com/w3c/csswg-drafts/issues/3262.
input.expect_ident()?; input.expect_ident()?;
if input.try(|input| input.expect_comma()).is_ok() { if input.r#try(|input| input.expect_comma()).is_ok() {
parse_fallback(input)?; parse_fallback(input)?;
} }
if let Some(references) = references { if let Some(references) = references {

View file

@ -4,22 +4,22 @@
//! Per-node data used in style calculation. //! Per-node data used in style calculation.
use context::{SharedStyleContext, StackLimitChecker}; use crate::context::{SharedStyleContext, StackLimitChecker};
use dom::TElement; use crate::dom::TElement;
use invalidation::element::invalidator::InvalidationResult; use crate::invalidation::element::invalidator::InvalidationResult;
use invalidation::element::restyle_hints::RestyleHint; use crate::invalidation::element::restyle_hints::RestyleHint;
use crate::properties::ComputedValues;
use crate::rule_tree::StrongRuleNode;
use crate::selector_parser::{PseudoElement, RestyleDamage, EAGER_PSEUDO_COUNT};
use crate::shared_lock::StylesheetGuards;
use crate::style_resolver::{PrimaryStyle, ResolvedElementStyles, ResolvedStyle};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::MallocSizeOfOps; use malloc_size_of::MallocSizeOfOps;
use properties::ComputedValues;
use rule_tree::StrongRuleNode;
use selector_parser::{PseudoElement, RestyleDamage, EAGER_PSEUDO_COUNT};
use selectors::NthIndexCache; use selectors::NthIndexCache;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::StylesheetGuards;
use std::fmt; use std::fmt;
use std::mem; use std::mem;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use style_resolver::{PrimaryStyle, ResolvedElementStyles, ResolvedStyle};
bitflags! { bitflags! {
/// Various flags stored on ElementData. /// Various flags stored on ElementData.
@ -255,8 +255,8 @@ impl ElementData {
return InvalidationResult::empty(); return InvalidationResult::empty();
} }
use invalidation::element::invalidator::TreeStyleInvalidator; use crate::invalidation::element::invalidator::TreeStyleInvalidator;
use invalidation::element::state_and_attributes::StateAndAttrInvalidationProcessor; use crate::invalidation::element::state_and_attributes::StateAndAttrInvalidationProcessor;
debug!( debug!(
"invalidate_style_if_needed: {:?}, flags: {:?}, has_snapshot: {}, \ "invalidate_style_if_needed: {:?}, flags: {:?}, has_snapshot: {}, \

View file

@ -7,30 +7,30 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
#![deny(missing_docs)] #![deny(missing_docs)]
use applicable_declarations::ApplicableDeclarationBlock;
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use context::PostAnimationTasks; use context::PostAnimationTasks;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use context::UpdateAnimationsTasks; use context::UpdateAnimationsTasks;
use data::ElementData; use crate::applicable_declarations::ApplicableDeclarationBlock;
use element_state::ElementState; use crate::data::ElementData;
use font_metrics::FontMetricsProvider; use crate::element_state::ElementState;
use media_queries::Device; use crate::font_metrics::FontMetricsProvider;
use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock}; use crate::media_queries::Device;
use selector_parser::{AttrValue, Lang, PseudoElement, SelectorImpl}; use crate::properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock};
use crate::selector_parser::{AttrValue, Lang, PseudoElement, SelectorImpl};
use crate::shared_lock::Locked;
use crate::stylist::CascadeData;
use crate::traversal_flags::TraversalFlags;
use crate::{Atom, LocalName, Namespace, WeakAtom};
use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode}; use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode};
use selectors::sink::Push; use selectors::sink::Push;
use selectors::Element as SelectorsElement; use selectors::Element as SelectorsElement;
use servo_arc::{Arc, ArcBorrow}; use servo_arc::{Arc, ArcBorrow};
use shared_lock::Locked;
use std::fmt; use std::fmt;
use std::fmt::Debug; use std::fmt::Debug;
use std::hash::Hash; use std::hash::Hash;
use std::ops::Deref; 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 /// 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 /// back into a non-opaque representation. The only safe operation that can be

View file

@ -5,17 +5,17 @@
//! Generic implementations of some DOM APIs so they can be shared between Servo //! Generic implementations of some DOM APIs so they can be shared between Servo
//! and Gecko. //! and Gecko.
use context::QuirksMode; use crate::context::QuirksMode;
use dom::{TDocument, TElement, TNode, TShadowRoot}; use crate::dom::{TDocument, TElement, TNode, TShadowRoot};
use invalidation::element::invalidator::{DescendantInvalidationLists, Invalidation}; use crate::invalidation::element::invalidator::{DescendantInvalidationLists, Invalidation};
use invalidation::element::invalidator::{InvalidationProcessor, InvalidationVector}; use crate::invalidation::element::invalidator::{InvalidationProcessor, InvalidationVector};
use crate::Atom;
use selectors::attr::CaseSensitivity; use selectors::attr::CaseSensitivity;
use selectors::matching::{self, MatchingContext, MatchingMode}; use selectors::matching::{self, MatchingContext, MatchingMode};
use selectors::parser::{Combinator, Component, LocalName, SelectorImpl}; use selectors::parser::{Combinator, Component, LocalName, SelectorImpl};
use selectors::{Element, NthIndexCache, SelectorList}; use selectors::{Element, NthIndexCache, SelectorList};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::borrow::Borrow; use std::borrow::Borrow;
use Atom;
/// <https://dom.spec.whatwg.org/#dom-element-matches> /// <https://dom.spec.whatwg.org/#dom-element-matches>
pub fn element_matches<E>( pub fn element_matches<E>(
@ -594,7 +594,7 @@ pub fn query_selector<E, Q>(
E: TElement, E: TElement,
Q: SelectorQuery<E>, Q: SelectorQuery<E>,
{ {
use invalidation::element::invalidator::TreeStyleInvalidator; use crate::invalidation::element::invalidator::TreeStyleInvalidator;
let quirks_mode = root.owner_doc().quirks_mode(); let quirks_mode = root.owner_doc().quirks_mode();

View file

@ -7,17 +7,17 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use context::{PerThreadTraversalStatistics, StyleContext}; use crate::context::{PerThreadTraversalStatistics, StyleContext};
use context::{ThreadLocalStyleContext, TraversalStatistics}; use crate::context::{ThreadLocalStyleContext, TraversalStatistics};
use dom::{SendNode, TElement, TNode}; use crate::dom::{SendNode, TElement, TNode};
use parallel; use crate::parallel;
use parallel::{DispatchMode, WORK_UNIT_MAX}; use crate::parallel::{DispatchMode, WORK_UNIT_MAX};
use crate::scoped_tls::ScopedTLS;
use crate::traversal::{DomTraversal, PerLevelTraversalData, PreTraverseToken};
use rayon; use rayon;
use scoped_tls::ScopedTLS;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::mem; use std::mem;
use time; use time;
use traversal::{DomTraversal, PerLevelTraversalData, PreTraverseToken};
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
fn should_report_statistics() -> bool { fn should_report_statistics() -> bool {

View file

@ -6,15 +6,15 @@
extern crate encoding_rs; extern crate encoding_rs;
use context::QuirksMode; use crate::context::QuirksMode;
use crate::error_reporting::ParseErrorReporter;
use crate::media_queries::MediaList;
use crate::shared_lock::SharedRwLock;
use crate::stylesheets::{Origin, Stylesheet, StylesheetLoader, UrlExtraData};
use cssparser::{stylesheet_encoding, EncodingSupport}; use cssparser::{stylesheet_encoding, EncodingSupport};
use error_reporting::ParseErrorReporter;
use media_queries::MediaList;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::SharedRwLock;
use std::borrow::Cow; use std::borrow::Cow;
use std::str; use std::str;
use stylesheets::{Origin, Stylesheet, StylesheetLoader, UrlExtraData};
struct EncodingRs; struct EncodingRs;

View file

@ -6,10 +6,10 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use crate::stylesheets::UrlExtraData;
use cssparser::{BasicParseErrorKind, ParseErrorKind, SourceLocation, Token}; use cssparser::{BasicParseErrorKind, ParseErrorKind, SourceLocation, Token};
use std::fmt; use std::fmt;
use style_traits::ParseError; use style_traits::ParseError;
use stylesheets::UrlExtraData;
/// Errors that can be encountered while parsing CSS. /// Errors that can be encountered while parsing CSS.
#[derive(Debug)] #[derive(Debug)]

View file

@ -6,29 +6,29 @@
//! //!
//! [ff]: https://drafts.csswg.org/css-fonts/#at-font-face-rule //! [ff]: https://drafts.csswg.org/css-fonts/#at-font-face-rule
use crate::error_reporting::ContextualParseError;
use crate::parser::{Parse, ParserContext};
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::values::computed::font::FamilyName;
use crate::values::generics::font::FontStyle as GenericFontStyle;
use crate::values::specified::font::SpecifiedFontStyle;
use crate::values::specified::font::{AbsoluteFontWeight, FontStretch};
use crate::values::specified::url::SpecifiedUrl;
use crate::values::specified::Angle;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use cssparser::UnicodeRange; use cssparser::UnicodeRange;
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser}; use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use cssparser::{CowRcStr, SourceLocation}; use cssparser::{CowRcStr, SourceLocation};
use error_reporting::ContextualParseError;
use parser::{Parse, ParserContext};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use properties::longhands::font_language_override; use properties::longhands::font_language_override;
use selectors::parser::SelectorParseErrorKind; use selectors::parser::SelectorParseErrorKind;
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
use style_traits::values::SequenceWriter; use style_traits::values::SequenceWriter;
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError}; use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
use style_traits::{StyleParseErrorKind, ToCss}; use style_traits::{StyleParseErrorKind, ToCss};
use values::computed::font::FamilyName;
use values::generics::font::FontStyle as GenericFontStyle;
use values::specified::font::SpecifiedFontStyle;
use values::specified::font::{AbsoluteFontWeight, FontStretch};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings}; use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings};
use values::specified::url::SpecifiedUrl;
use values::specified::Angle;
/// A source for a font-face rule. /// A source for a font-face rule.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
@ -118,7 +118,7 @@ macro_rules! impl_range {
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
let first = $component::parse(context, input)?; let first = $component::parse(context, input)?;
let second = input let second = input
.try(|input| $component::parse(context, input)) .r#try(|input| $component::parse(context, input))
.unwrap_or_else(|_| first.clone()); .unwrap_or_else(|_| first.clone());
Ok($range(first, second)) Ok($range(first, second))
} }
@ -232,7 +232,7 @@ impl Parse for FontStyle {
GenericFontStyle::Italic => FontStyle::Italic, GenericFontStyle::Italic => FontStyle::Italic,
GenericFontStyle::Oblique(angle) => { GenericFontStyle::Oblique(angle) => {
let second_angle = input let second_angle = input
.try(|input| SpecifiedFontStyle::parse_angle(context, input)) .r#try(|input| SpecifiedFontStyle::parse_angle(context, input))
.unwrap_or_else(|_| angle.clone()); .unwrap_or_else(|_| angle.clone());
FontStyle::Oblique(angle, second_angle) FontStyle::Oblique(angle, second_angle)
@ -378,7 +378,7 @@ impl Parse for Source {
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Source, ParseError<'i>> { ) -> Result<Source, ParseError<'i>> {
if input if input
.try(|input| input.expect_function_matching("local")) .r#try(|input| input.expect_function_matching("local"))
.is_ok() .is_ok()
{ {
return input return input
@ -390,7 +390,7 @@ impl Parse for Source {
// Parsing optional format() // Parsing optional format()
let format_hints = if input let format_hints = if input
.try(|input| input.expect_function_matching("format")) .r#try(|input| input.expect_function_matching("format"))
.is_ok() .is_ok()
{ {
input.parse_nested_block(|input| { input.parse_nested_block(|input| {

View file

@ -7,11 +7,11 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use app_units::Au; use app_units::Au;
use context::SharedStyleContext; use crate::context::SharedStyleContext;
use logical_geometry::WritingMode; use crate::logical_geometry::WritingMode;
use media_queries::Device; use crate::media_queries::Device;
use properties::style_structs::Font; use crate::properties::style_structs::Font;
use Atom; use crate::Atom;
/// Represents the font metrics that style needs from a font to compute the /// Represents the font metrics that style needs from a font to compute the
/// value of certain CSS units like `ex`. /// value of certain CSS units like `ex`.

View file

@ -4,13 +4,13 @@
//! An invalidation processor for style changes due to document state changes. //! An invalidation processor for style changes due to document state changes.
use dom::TElement; use crate::dom::TElement;
use element_state::DocumentState; use crate::element_state::DocumentState;
use invalidation::element::invalidator::{DescendantInvalidationLists, InvalidationVector}; use crate::invalidation::element::invalidator::{DescendantInvalidationLists, InvalidationVector};
use invalidation::element::invalidator::{Invalidation, InvalidationProcessor}; use crate::invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
use invalidation::element::state_and_attributes; use crate::invalidation::element::state_and_attributes;
use crate::stylist::CascadeData;
use selectors::matching::{MatchingContext, MatchingMode, QuirksMode, VisitedHandlingMode}; use selectors::matching::{MatchingContext, MatchingMode, QuirksMode, VisitedHandlingMode};
use stylist::CascadeData;
/// A struct holding the members necessary to invalidate document state /// A struct holding the members necessary to invalidate document state
/// selectors. /// selectors.

View file

@ -5,16 +5,16 @@
//! A wrapper over an element and a snapshot, that allows us to selector-match //! A wrapper over an element and a snapshot, that allows us to selector-match
//! against a past state of the element. //! against a past state of the element.
use dom::TElement; use crate::dom::TElement;
use element_state::ElementState; use crate::element_state::ElementState;
use selector_parser::{AttrValue, NonTSPseudoClass, PseudoElement, SelectorImpl}; use crate::selector_parser::{AttrValue, NonTSPseudoClass, PseudoElement, SelectorImpl};
use selector_parser::{Snapshot, SnapshotMap}; use crate::selector_parser::{Snapshot, SnapshotMap};
use crate::{Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom};
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint}; use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
use selectors::matching::{ElementSelectorFlags, MatchingContext}; use selectors::matching::{ElementSelectorFlags, MatchingContext};
use selectors::{Element, OpaqueElement}; use selectors::{Element, OpaqueElement};
use std::cell::Cell; use std::cell::Cell;
use std::fmt; use std::fmt;
use {Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom};
/// In order to compute restyle hints, we perform a selector match against a /// In order to compute restyle hints, we perform a selector match against a
/// list of partial selectors whose rightmost simple selector may be sensitive /// list of partial selectors whose rightmost simple selector may be sensitive
@ -60,7 +60,7 @@ pub trait ElementSnapshot: Sized {
/// A callback that should be called for each class of the snapshot. Should /// A callback that should be called for each class of the snapshot. Should
/// only be called if `has_attrs()` returns true. /// only be called if `has_attrs()` returns true.
fn each_class<F>(&self, F) fn each_class<F>(&self, _: F)
where where
F: FnMut(&Atom); F: FnMut(&Atom);

View file

@ -4,18 +4,18 @@
//! Code for invalidations due to state or attribute changes. //! Code for invalidations due to state or attribute changes.
use context::QuirksMode; use crate::context::QuirksMode;
use element_state::{DocumentState, ElementState}; use crate::element_state::{DocumentState, ElementState};
use crate::selector_map::{MaybeCaseInsensitiveHashMap, SelectorMap, SelectorMapEntry};
use crate::selector_parser::SelectorImpl;
use crate::{Atom, LocalName, Namespace};
use fallible::FallibleVec; use fallible::FallibleVec;
use hashglobe::FailedAllocationError; use hashglobe::FailedAllocationError;
use selector_map::{MaybeCaseInsensitiveHashMap, SelectorMap, SelectorMapEntry};
use selector_parser::SelectorImpl;
use selectors::attr::NamespaceConstraint; use selectors::attr::NamespaceConstraint;
use selectors::parser::{Combinator, Component}; use selectors::parser::{Combinator, Component};
use selectors::parser::{Selector, SelectorIter, Visit}; use selectors::parser::{Selector, SelectorIter, Visit};
use selectors::visitor::SelectorVisitor; use selectors::visitor::SelectorVisitor;
use smallvec::SmallVec; use smallvec::SmallVec;
use {Atom, LocalName, Namespace};
/// Mapping between (partial) CompoundSelectors (and the combinator to their /// Mapping between (partial) CompoundSelectors (and the combinator to their
/// right) and the states and attributes they depend on. /// right) and the states and attributes they depend on.

View file

@ -5,9 +5,9 @@
//! The struct that takes care of encapsulating all the logic on where and how //! The struct that takes care of encapsulating all the logic on where and how
//! element styles need to be invalidated. //! element styles need to be invalidated.
use context::StackLimitChecker; use crate::context::StackLimitChecker;
use dom::{TElement, TNode, TShadowRoot}; use crate::dom::{TElement, TNode, TShadowRoot};
use selector_parser::SelectorImpl; use crate::selector_parser::SelectorImpl;
use selectors::matching::matches_compound_selector_from; use selectors::matching::matches_compound_selector_from;
use selectors::matching::{CompoundSelectorMatchingResult, MatchingContext}; use selectors::matching::{CompoundSelectorMatchingResult, MatchingContext};
use selectors::parser::{Combinator, Component, Selector}; use selectors::parser::{Combinator, Component, Selector};

View file

@ -4,9 +4,9 @@
//! Restyle hints: an optimization to avoid unnecessarily matching selectors. //! Restyle hints: an optimization to avoid unnecessarily matching selectors.
use crate::traversal_flags::TraversalFlags;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::structs::nsRestyleHint; use gecko_bindings::structs::nsRestyleHint;
use traversal_flags::TraversalFlags;
bitflags! { bitflags! {
/// The kind of restyle we need to do for a given element. /// The kind of restyle we need to do for a given element.

View file

@ -5,24 +5,24 @@
//! An invalidation processor for style changes due to state and attribute //! An invalidation processor for style changes due to state and attribute
//! changes. //! changes.
use context::SharedStyleContext; use crate::context::SharedStyleContext;
use data::ElementData; use crate::data::ElementData;
use dom::TElement; use crate::dom::TElement;
use element_state::ElementState; use crate::element_state::ElementState;
use invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper}; use crate::invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
use invalidation::element::invalidation_map::*; use crate::invalidation::element::invalidation_map::*;
use invalidation::element::invalidator::{DescendantInvalidationLists, InvalidationVector}; use crate::invalidation::element::invalidator::{DescendantInvalidationLists, InvalidationVector};
use invalidation::element::invalidator::{Invalidation, InvalidationProcessor}; use crate::invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
use invalidation::element::restyle_hints::RestyleHint; use crate::invalidation::element::restyle_hints::RestyleHint;
use selector_map::SelectorMap; use crate::selector_map::SelectorMap;
use selector_parser::Snapshot; use crate::selector_parser::Snapshot;
use crate::stylesheets::origin::{Origin, OriginSet};
use crate::{Atom, WeakAtom};
use selectors::attr::CaseSensitivity; use selectors::attr::CaseSensitivity;
use selectors::matching::matches_selector; use selectors::matching::matches_selector;
use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode}; use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode};
use selectors::NthIndexCache; use selectors::NthIndexCache;
use smallvec::SmallVec; use smallvec::SmallVec;
use stylesheets::origin::{Origin, OriginSet};
use {Atom, WeakAtom};
/// The collector implementation. /// The collector implementation.
struct Collector<'a, 'b: 'a, 'selectors: 'a, E> struct Collector<'a, 'b: 'a, 'selectors: 'a, E>

View file

@ -4,12 +4,12 @@
//! Code related to the invalidation of media-query-affected rules. //! Code related to the invalidation of media-query-affected rules.
use context::QuirksMode; use crate::context::QuirksMode;
use crate::media_queries::Device;
use crate::shared_lock::SharedRwLockReadGuard;
use crate::stylesheets::{DocumentRule, ImportRule, MediaRule};
use crate::stylesheets::{NestedRuleIterationCondition, Stylesheet, SupportsRule};
use fxhash::FxHashSet; use fxhash::FxHashSet;
use media_queries::Device;
use shared_lock::SharedRwLockReadGuard;
use stylesheets::{DocumentRule, ImportRule, MediaRule};
use stylesheets::{NestedRuleIterationCondition, Stylesheet, SupportsRule};
/// A key for a given media query result. /// A key for a given media query result.
/// ///
@ -115,7 +115,7 @@ impl NestedRuleIterationCondition for PotentiallyEffectiveMediaRules {
quirks_mode: QuirksMode, quirks_mode: QuirksMode,
rule: &DocumentRule, rule: &DocumentRule,
) -> bool { ) -> bool {
use stylesheets::EffectiveRules; use crate::stylesheets::EffectiveRules;
EffectiveRules::process_document(guard, device, quirks_mode, rule) EffectiveRules::process_document(guard, device, quirks_mode, rule)
} }
@ -126,7 +126,7 @@ impl NestedRuleIterationCondition for PotentiallyEffectiveMediaRules {
quirks_mode: QuirksMode, quirks_mode: QuirksMode,
rule: &SupportsRule, rule: &SupportsRule,
) -> bool { ) -> bool {
use stylesheets::EffectiveRules; use crate::stylesheets::EffectiveRules;
EffectiveRules::process_supports(guard, device, quirks_mode, rule) EffectiveRules::process_supports(guard, device, quirks_mode, rule)
} }
} }

View file

@ -7,19 +7,19 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
use dom::{TDocument, TElement, TNode}; use crate::dom::{TDocument, TElement, TNode};
use crate::invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
use crate::invalidation::element::restyle_hints::RestyleHint;
use crate::media_queries::Device;
use crate::selector_parser::{SelectorImpl, Snapshot, SnapshotMap};
use crate::shared_lock::SharedRwLockReadGuard;
use crate::stylesheets::{CssRule, StylesheetInDocument};
use crate::Atom;
use crate::CaseSensitivityExt;
use crate::LocalName as SelectorLocalName;
use fxhash::FxHashSet; use fxhash::FxHashSet;
use invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
use invalidation::element::restyle_hints::RestyleHint;
use media_queries::Device;
use selector_parser::{SelectorImpl, Snapshot, SnapshotMap};
use selectors::attr::CaseSensitivity; use selectors::attr::CaseSensitivity;
use selectors::parser::{Component, LocalName, Selector}; 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 /// 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 /// need to be restyled. Whether it represents a whole subtree or just a single
@ -419,7 +419,7 @@ impl StylesheetInvalidationSet {
guard: &SharedRwLockReadGuard, guard: &SharedRwLockReadGuard,
device: &Device, device: &Device,
) { ) {
use stylesheets::CssRule::*; use crate::stylesheets::CssRule::*;
debug!("StylesheetInvalidationSet::collect_invalidations_for_rule"); debug!("StylesheetInvalidationSet::collect_invalidations_for_rule");
debug_assert!(!self.fully_invalid, "Not worth to be here!"); debug_assert!(!self.fully_invalid, "Not worth to be here!");

View file

@ -215,10 +215,10 @@ macro_rules! reexport_computed_values {
/// [computed]: https://drafts.csswg.org/css-cascade/#computed /// [computed]: https://drafts.csswg.org/css-cascade/#computed
pub mod computed_values { pub mod computed_values {
$( $(
pub use properties::longhands::$name::computed_value as $name; pub use crate::properties::longhands::$name::computed_value as $name;
)+ )+
// Don't use a side-specific name needlessly: // Don't use a side-specific name needlessly:
pub use properties::longhands::border_top_style::computed_value as border_style; pub use crate::properties::longhands::border_top_style::computed_value as border_style;
} }
} }
} }

View file

@ -4,9 +4,9 @@
//! Geometry in flow-relative space. //! Geometry in flow-relative space.
use crate::properties::style_structs;
use euclid::num::Zero; use euclid::num::Zero;
use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
use properties::style_structs;
use std::cmp::{max, min}; use std::cmp::{max, min};
use std::fmt::{self, Debug, Error, Formatter}; use std::fmt::{self, Debug, Error, Formatter};
use std::ops::{Add, Sub}; use std::ops::{Add, Sub};
@ -42,8 +42,8 @@ bitflags!(
impl WritingMode { impl WritingMode {
/// Return a WritingMode bitflags from the relevant CSS properties. /// Return a WritingMode bitflags from the relevant CSS properties.
pub fn new(inheritedbox_style: &style_structs::InheritedBox) -> Self { pub fn new(inheritedbox_style: &style_structs::InheritedBox) -> Self {
use properties::longhands::direction::computed_value::T as Direction; use crate::properties::longhands::direction::computed_value::T as Direction;
use properties::longhands::writing_mode::computed_value::T as SpecifiedWritingMode; use crate::properties::longhands::writing_mode::computed_value::T as SpecifiedWritingMode;
let mut flags = WritingMode::empty(); let mut flags = WritingMode::empty();

View file

@ -7,19 +7,19 @@
#![allow(unsafe_code)] #![allow(unsafe_code)]
#![deny(missing_docs)] #![deny(missing_docs)]
use context::{ElementCascadeInputs, QuirksMode, SelectorFlagsMap}; use crate::context::{ElementCascadeInputs, QuirksMode, SelectorFlagsMap};
use context::{SharedStyleContext, StyleContext}; use crate::context::{SharedStyleContext, StyleContext};
use data::ElementData; use crate::data::ElementData;
use dom::TElement; use crate::dom::TElement;
use invalidation::element::restyle_hints::RestyleHint; use crate::invalidation::element::restyle_hints::RestyleHint;
use properties::longhands::display::computed_value::T as Display; use crate::properties::longhands::display::computed_value::T as Display;
use properties::ComputedValues; use crate::properties::ComputedValues;
use rule_tree::{CascadeLevel, StrongRuleNode}; use crate::rule_tree::{CascadeLevel, StrongRuleNode};
use selector_parser::{PseudoElement, RestyleDamage}; use crate::selector_parser::{PseudoElement, RestyleDamage};
use crate::style_resolver::ResolvedElementStyles;
use crate::traversal_flags::TraversalFlags;
use selectors::matching::ElementSelectorFlags; use selectors::matching::ElementSelectorFlags;
use servo_arc::{Arc, ArcBorrow}; use servo_arc::{Arc, ArcBorrow};
use style_resolver::ResolvedElementStyles;
use traversal_flags::TraversalFlags;
/// Represents the result of comparing an element's old and new style. /// Represents the result of comparing an element's old and new style.
#[derive(Debug)] #[derive(Debug)]
@ -93,8 +93,8 @@ trait PrivateMatchMethods: TElement {
cascade_visited: CascadeVisitedMode, cascade_visited: CascadeVisitedMode,
cascade_inputs: &mut ElementCascadeInputs, cascade_inputs: &mut ElementCascadeInputs,
) -> bool { ) -> bool {
use properties::PropertyDeclarationBlock; use crate::properties::PropertyDeclarationBlock;
use shared_lock::Locked; use crate::shared_lock::Locked;
debug_assert!( debug_assert!(
replacements.intersects(RestyleHint::replacements()) && replacements.intersects(RestyleHint::replacements()) &&
@ -419,8 +419,8 @@ trait PrivateMatchMethods: TElement {
_restyle_hint: RestyleHint, _restyle_hint: RestyleHint,
_important_rules_changed: bool, _important_rules_changed: bool,
) { ) {
use animation; use crate::animation;
use dom::TNode; use crate::dom::TNode;
let mut possibly_expired_animations = vec![]; let mut possibly_expired_animations = vec![];
let shared_context = context.shared; let shared_context = context.shared;
@ -583,11 +583,11 @@ trait PrivateMatchMethods: TElement {
&self, &self,
context: &SharedStyleContext, context: &SharedStyleContext,
style: &mut Arc<ComputedValues>, style: &mut Arc<ComputedValues>,
possibly_expired_animations: &mut Vec<::animation::PropertyAnimation>, possibly_expired_animations: &mut Vec<crate::animation::PropertyAnimation>,
font_metrics: &::font_metrics::FontMetricsProvider, font_metrics: &crate::font_metrics::FontMetricsProvider,
) { ) {
use animation::{self, Animation, AnimationUpdate}; use crate::animation::{self, Animation, AnimationUpdate};
use dom::TNode; use crate::dom::TNode;
// Finish any expired transitions. // Finish any expired transitions.
let this_opaque = self.as_node().opaque(); let this_opaque = self.as_node().opaque();

View file

@ -7,9 +7,9 @@
//! https://drafts.csswg.org/mediaqueries-4/#typedef-media-condition //! https://drafts.csswg.org/mediaqueries-4/#typedef-media-condition
use super::{Device, MediaFeatureExpression}; use super::{Device, MediaFeatureExpression};
use context::QuirksMode; use crate::context::QuirksMode;
use crate::parser::ParserContext;
use cssparser::{Parser, Token}; use cssparser::{Parser, Token};
use parser::ParserContext;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
@ -114,7 +114,7 @@ impl MediaCondition {
// ParenthesisBlock. // ParenthesisBlock.
let first_condition = Self::parse_paren_block(context, input)?; let first_condition = Self::parse_paren_block(context, input)?;
let operator = match input.try(Operator::parse) { let operator = match input.r#try(Operator::parse) {
Ok(op) => op, Ok(op) => op,
Err(..) => return Ok(first_condition), Err(..) => return Ok(first_condition),
}; };
@ -133,7 +133,7 @@ impl MediaCondition {
}; };
loop { loop {
if input.try(|i| i.expect_ident_matching(delim)).is_err() { if input.r#try(|i| i.expect_ident_matching(delim)).is_err() {
return Ok(MediaCondition::Operation( return Ok(MediaCondition::Operation(
conditions.into_boxed_slice(), conditions.into_boxed_slice(),
operator, operator,
@ -159,7 +159,7 @@ impl MediaCondition {
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
input.parse_nested_block(|input| { input.parse_nested_block(|input| {
// Base case. // Base case.
if let Ok(inner) = input.try(|i| Self::parse(context, i)) { if let Ok(inner) = input.r#try(|i| Self::parse(context, i)) {
return Ok(MediaCondition::InParens(Box::new(inner))); return Ok(MediaCondition::InParens(Box::new(inner)));
} }
let expr = MediaFeatureExpression::parse_in_parenthesis_block(context, input)?; let expr = MediaFeatureExpression::parse_in_parenthesis_block(context, input)?;

View file

@ -6,12 +6,12 @@
use super::media_feature_expression::{AspectRatio, RangeOrOperator}; use super::media_feature_expression::{AspectRatio, RangeOrOperator};
use super::Device; use super::Device;
use crate::parser::ParserContext;
use crate::values::computed::{CSSPixelLength, Resolution};
use crate::Atom;
use cssparser::Parser; use cssparser::Parser;
use parser::ParserContext;
use std::fmt; use std::fmt;
use style_traits::ParseError; use style_traits::ParseError;
use values::computed::{CSSPixelLength, Resolution};
use Atom;
/// A generic discriminant for an enum value. /// A generic discriminant for an enum value.
pub type KeywordDiscriminant = u8; pub type KeywordDiscriminant = u8;

View file

@ -8,21 +8,21 @@
use super::media_feature::{Evaluator, MediaFeatureDescription}; use super::media_feature::{Evaluator, MediaFeatureDescription};
use super::media_feature::{KeywordDiscriminant, ParsingRequirements}; use super::media_feature::{KeywordDiscriminant, ParsingRequirements};
use super::Device; use super::Device;
use context::QuirksMode; use crate::context::QuirksMode;
use crate::parser::{Parse, ParserContext};
use crate::str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
use crate::stylesheets::Origin;
use crate::values::computed::{self, ToComputedValue};
use crate::values::specified::{Integer, Length, Number, Resolution};
use crate::values::{serialize_atom_identifier, CSSFloat};
use crate::Atom;
use cssparser::{Parser, Token}; use cssparser::{Parser, Token};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::structs; use gecko_bindings::structs;
use num_traits::Zero; use num_traits::Zero;
use parser::{Parse, ParserContext};
use std::cmp::{Ordering, PartialOrd}; use std::cmp::{Ordering, PartialOrd};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
use stylesheets::Origin;
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. /// An aspect ratio, with a numerator and denominator.
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)] #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
@ -221,14 +221,14 @@ fn consume_operation_or_colon(input: &mut Parser) -> Result<Option<Operator>, ()
Ok(Some(match first_delim { Ok(Some(match first_delim {
'=' => Operator::Equal, '=' => Operator::Equal,
'>' => { '>' => {
if input.try(|i| i.expect_delim('=')).is_ok() { if input.r#try(|i| i.expect_delim('=')).is_ok() {
Operator::GreaterThanEqual Operator::GreaterThanEqual
} else { } else {
Operator::GreaterThan Operator::GreaterThan
} }
}, },
'<' => { '<' => {
if input.try(|i| i.expect_delim('=')).is_ok() { if input.r#try(|i| i.expect_delim('=')).is_ok() {
Operator::LessThanEqual Operator::LessThanEqual
} else { } else {
Operator::LessThan Operator::LessThan
@ -270,10 +270,10 @@ impl MediaFeatureExpression {
context: &ParserContext, context: &ParserContext,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
#[cfg(feature = "servo")]
use crate::servo::media_queries::MEDIA_FEATURES;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko::media_features::MEDIA_FEATURES; use gecko::media_features::MEDIA_FEATURES;
#[cfg(feature = "servo")]
use servo::media_queries::MEDIA_FEATURES;
// FIXME: remove extra indented block when lifetimes are non-lexical // FIXME: remove extra indented block when lifetimes are non-lexical
let feature; let feature;
@ -350,7 +350,7 @@ impl MediaFeatureExpression {
} }
} }
let operator = input.try(consume_operation_or_colon); let operator = input.r#try(consume_operation_or_colon);
let operator = match operator { let operator = match operator {
Err(..) => { Err(..) => {
// If there's no colon, this is a media query of the // If there's no colon, this is a media query of the

View file

@ -7,11 +7,11 @@
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query-list //! https://drafts.csswg.org/mediaqueries/#typedef-media-query-list
use super::{Device, MediaQuery, Qualifier}; use super::{Device, MediaQuery, Qualifier};
use context::QuirksMode; use crate::context::QuirksMode;
use crate::error_reporting::ContextualParseError;
use crate::parser::ParserContext;
use cssparser::{Delimiter, Parser}; use cssparser::{Delimiter, Parser};
use cssparser::{ParserInput, Token}; use cssparser::{ParserInput, Token};
use error_reporting::ContextualParseError;
use parser::ParserContext;
/// A type that encapsulates a media query list. /// A type that encapsulates a media query list.
#[css(comma, derive_debug)] #[css(comma, derive_debug)]

View file

@ -7,13 +7,13 @@
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query //! https://drafts.csswg.org/mediaqueries/#typedef-media-query
use super::media_condition::MediaCondition; use super::media_condition::MediaCondition;
use crate::parser::ParserContext;
use crate::str::string_as_ascii_lowercase;
use crate::values::CustomIdent;
use crate::Atom;
use cssparser::Parser; use cssparser::Parser;
use parser::ParserContext;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::string_as_ascii_lowercase;
use style_traits::{CssWriter, ParseError, ToCss}; use style_traits::{CssWriter, ParseError, ToCss};
use values::CustomIdent;
use Atom;
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix> /// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)] #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
@ -125,8 +125,8 @@ impl MediaQuery {
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
let (qualifier, explicit_media_type) = input let (qualifier, explicit_media_type) = input
.try(|input| -> Result<_, ()> { .r#try(|input| -> Result<_, ()> {
let qualifier = input.try(Qualifier::parse).ok(); let qualifier = input.r#try(Qualifier::parse).ok();
let ident = input.expect_ident().map_err(|_| ())?; let ident = input.expect_ident().map_err(|_| ())?;
let media_type = MediaQueryType::parse(&ident)?; let media_type = MediaQueryType::parse(&ident)?;
Ok((qualifier, Some(media_type))) Ok((qualifier, Some(media_type)))
@ -135,7 +135,7 @@ impl MediaQuery {
let condition = if explicit_media_type.is_none() { let condition = if explicit_media_type.is_none() {
Some(MediaCondition::parse(context, input)?) Some(MediaCondition::parse(context, input)?)
} else if input.try(|i| i.expect_ident_matching("and")).is_ok() { } else if input.r#try(|i| i.expect_ident_matching("and")).is_ok() {
Some(MediaCondition::parse_disallow_or(context, input)?) Some(MediaCondition::parse_disallow_or(context, input)?)
} else { } else {
None None

View file

@ -18,7 +18,7 @@ pub use self::media_feature_expression::MediaFeatureExpression;
pub use self::media_list::MediaList; pub use self::media_list::MediaList;
pub use self::media_query::{MediaQuery, MediaQueryType, MediaType, Qualifier}; pub use self::media_query::{MediaQuery, MediaQueryType, MediaType, Qualifier};
#[cfg(feature = "servo")]
pub use crate::servo::media_queries::Device;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use gecko::media_queries::Device; pub use gecko::media_queries::Device;
#[cfg(feature = "servo")]
pub use servo::media_queries::Device;

View file

@ -23,13 +23,13 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use arrayvec::ArrayVec; use arrayvec::ArrayVec;
use context::{StyleContext, ThreadLocalStyleContext}; use crate::context::{StyleContext, ThreadLocalStyleContext};
use dom::{OpaqueNode, SendNode, TElement}; use crate::dom::{OpaqueNode, SendNode, TElement};
use crate::scoped_tls::ScopedTLS;
use crate::traversal::{DomTraversal, PerLevelTraversalData};
use itertools::Itertools; use itertools::Itertools;
use rayon; use rayon;
use scoped_tls::ScopedTLS;
use smallvec::SmallVec; use smallvec::SmallVec;
use traversal::{DomTraversal, PerLevelTraversalData};
/// The minimum stack size for a thread in the styling pool, in kilobytes. /// The minimum stack size for a thread in the styling pool, in kilobytes.
pub const STYLE_THREAD_STACK_SIZE_KB: usize = 256; pub const STYLE_THREAD_STACK_SIZE_KB: usize = 256;

View file

@ -4,12 +4,12 @@
//! The context within which CSS code is parsed. //! The context within which CSS code is parsed.
use context::QuirksMode; use crate::context::QuirksMode;
use crate::error_reporting::{ContextualParseError, ParseErrorReporter};
use crate::stylesheets::{CssRuleType, Namespaces, Origin, UrlExtraData};
use crate::use_counters::UseCounters;
use cssparser::{Parser, SourceLocation, UnicodeRange}; use cssparser::{Parser, SourceLocation, UnicodeRange};
use error_reporting::{ContextualParseError, ParseErrorReporter};
use style_traits::{OneOrMoreSeparated, ParseError, ParsingMode, Separator}; use style_traits::{OneOrMoreSeparated, ParseError, ParsingMode, Separator};
use stylesheets::{CssRuleType, Namespaces, Origin, UrlExtraData};
use use_counters::UseCounters;
/// Asserts that all ParsingMode flags have a matching ParsingMode value in gecko. /// Asserts that all ParsingMode flags have a matching ParsingMode value in gecko.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]

View file

@ -4,27 +4,27 @@
//! The main cascading algorithm of the style system. //! The main cascading algorithm of the style system.
use context::QuirksMode; use crate::context::QuirksMode;
use custom_properties::CustomPropertiesBuilder; use crate::custom_properties::CustomPropertiesBuilder;
use dom::TElement; use crate::dom::TElement;
use font_metrics::FontMetricsProvider; use crate::font_metrics::FontMetricsProvider;
use logical_geometry::WritingMode; use crate::logical_geometry::WritingMode;
use media_queries::Device; use crate::media_queries::Device;
use properties::{ComputedValues, StyleBuilder}; use crate::properties::{ComputedValues, StyleBuilder};
use properties::{LonghandId, LonghandIdSet}; use crate::properties::{LonghandId, LonghandIdSet};
use properties::{PropertyDeclaration, PropertyDeclarationId, DeclarationImportanceIterator}; use crate::properties::{PropertyDeclaration, PropertyDeclarationId, DeclarationImportanceIterator};
use properties::CASCADE_PROPERTY; use crate::properties::CASCADE_PROPERTY;
use rule_cache::{RuleCache, RuleCacheConditions}; use crate::rule_cache::{RuleCache, RuleCacheConditions};
use rule_tree::{CascadeLevel, StrongRuleNode}; use crate::rule_tree::{CascadeLevel, StrongRuleNode};
use selector_parser::PseudoElement; use crate::selector_parser::PseudoElement;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::StylesheetGuards; use crate::shared_lock::StylesheetGuards;
use smallbitvec::SmallBitVec; use smallbitvec::SmallBitVec;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::borrow::Cow; use std::borrow::Cow;
use std::cell::RefCell; use std::cell::RefCell;
use style_adjuster::StyleAdjuster; use crate::style_adjuster::StyleAdjuster;
use values::computed; use crate::values::computed;
/// We split the cascade in two phases: 'early' properties, and 'late' /// We split the cascade in two phases: 'early' properties, and 'late'
/// properties. /// properties.

View file

@ -6,25 +6,25 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use context::QuirksMode; use crate::context::QuirksMode;
use cssparser::{DeclarationListParser, parse_important, ParserInput, CowRcStr}; use cssparser::{DeclarationListParser, parse_important, ParserInput, CowRcStr};
use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter, ParseErrorKind}; use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter, ParseErrorKind};
use custom_properties::{CustomPropertiesBuilder, CssEnvironment}; use crate::custom_properties::{CustomPropertiesBuilder, CssEnvironment};
use error_reporting::{ParseErrorReporter, ContextualParseError}; use crate::error_reporting::{ParseErrorReporter, ContextualParseError};
use itertools::Itertools; use itertools::Itertools;
use parser::ParserContext; use crate::parser::ParserContext;
use properties::animated_properties::{AnimationValue, AnimationValueMap}; use crate::properties::animated_properties::{AnimationValue, AnimationValueMap};
use shared_lock::Locked; use crate::shared_lock::Locked;
use smallbitvec::{self, SmallBitVec}; use smallbitvec::{self, SmallBitVec};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::iter::{DoubleEndedIterator, Zip}; use std::iter::{DoubleEndedIterator, Zip};
use std::slice::Iter; use std::slice::Iter;
use str::{CssString, CssStringBorrow, CssStringWriter}; use crate::str::{CssString, CssStringBorrow, CssStringWriter};
use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss};
use stylesheets::{CssRuleType, Origin, UrlExtraData}; use crate::stylesheets::{CssRuleType, Origin, UrlExtraData};
use super::*; use super::*;
use values::computed::Context; use crate::values::computed::Context;
/// The animation rules. /// The animation rules.
/// ///
@ -144,7 +144,7 @@ pub struct AnimationValueIterator<'a, 'cx, 'cx_a:'cx> {
context: &'cx mut Context<'cx_a>, context: &'cx mut Context<'cx_a>,
default_values: &'a ComputedValues, default_values: &'a ComputedValues,
/// Custom properties in a keyframe if exists. /// Custom properties in a keyframe if exists.
extra_custom_properties: Option<&'a Arc<::custom_properties::CustomPropertiesMap>>, extra_custom_properties: Option<&'a Arc<crate::custom_properties::CustomPropertiesMap>>,
} }
impl<'a, 'cx, 'cx_a:'cx> AnimationValueIterator<'a, 'cx, 'cx_a> { impl<'a, 'cx, 'cx_a:'cx> AnimationValueIterator<'a, 'cx, 'cx_a> {
@ -152,7 +152,7 @@ impl<'a, 'cx, 'cx_a:'cx> AnimationValueIterator<'a, 'cx, 'cx_a> {
declarations: &'a PropertyDeclarationBlock, declarations: &'a PropertyDeclarationBlock,
context: &'cx mut Context<'cx_a>, context: &'cx mut Context<'cx_a>,
default_values: &'a ComputedValues, default_values: &'a ComputedValues,
extra_custom_properties: Option<&'a Arc<::custom_properties::CustomPropertiesMap>>, extra_custom_properties: Option<&'a Arc<crate::custom_properties::CustomPropertiesMap>>,
) -> AnimationValueIterator<'a, 'cx, 'cx_a> { ) -> AnimationValueIterator<'a, 'cx, 'cx_a> {
AnimationValueIterator { AnimationValueIterator {
iter: declarations.declaration_importance_iter(), iter: declarations.declaration_importance_iter(),
@ -258,7 +258,7 @@ impl PropertyDeclarationBlock {
&'a self, &'a self,
context: &'cx mut Context<'cx_a>, context: &'cx mut Context<'cx_a>,
default_values: &'a ComputedValues, default_values: &'a ComputedValues,
extra_custom_properties: Option<&'a Arc<::custom_properties::CustomPropertiesMap>>, extra_custom_properties: Option<&'a Arc<crate::custom_properties::CustomPropertiesMap>>,
) -> AnimationValueIterator<'a, 'cx, 'cx_a> { ) -> AnimationValueIterator<'a, 'cx, 'cx_a> {
AnimationValueIterator::new(self, context, default_values, extra_custom_properties) AnimationValueIterator::new(self, context, default_values, extra_custom_properties)
} }
@ -467,7 +467,7 @@ impl PropertyDeclarationBlock {
// //
// TODO(emilio): Unship. // TODO(emilio): Unship.
if let PropertyDeclaration::Display(old_display) = *slot { if let PropertyDeclaration::Display(old_display) = *slot {
use properties::longhands::display::computed_value::T as display; use crate::properties::longhands::display::computed_value::T as display;
if let PropertyDeclaration::Display(new_display) = declaration { if let PropertyDeclaration::Display(new_display) = declaration {
if display::should_ignore_parsed_value(old_display, new_display) { if display::should_ignore_parsed_value(old_display, new_display) {
@ -841,7 +841,7 @@ impl PropertyDeclarationBlock {
pub fn cascade_custom_properties_with_context( pub fn cascade_custom_properties_with_context(
&self, &self,
context: &Context, context: &Context,
) -> Option<Arc<::custom_properties::CustomPropertiesMap>> { ) -> Option<Arc<crate::custom_properties::CustomPropertiesMap>> {
self.cascade_custom_properties( self.cascade_custom_properties(
context.style().custom_properties(), context.style().custom_properties(),
context.device().environment(), context.device().environment(),
@ -853,9 +853,9 @@ impl PropertyDeclarationBlock {
/// properties. /// properties.
fn cascade_custom_properties( fn cascade_custom_properties(
&self, &self,
inherited_custom_properties: Option<&Arc<::custom_properties::CustomPropertiesMap>>, inherited_custom_properties: Option<&Arc<crate::custom_properties::CustomPropertiesMap>>,
environment: &CssEnvironment, environment: &CssEnvironment,
) -> Option<Arc<::custom_properties::CustomPropertiesMap>> { ) -> Option<Arc<crate::custom_properties::CustomPropertiesMap>> {
let mut builder = CustomPropertiesBuilder::new( let mut builder = CustomPropertiesBuilder::new(
inherited_custom_properties, inherited_custom_properties,
environment, environment,

View file

@ -5,15 +5,15 @@
//! A cache from rule node to computed values, in order to cache reset //! A cache from rule node to computed values, in order to cache reset
//! properties. //! properties.
use crate::logical_geometry::WritingMode;
use crate::properties::{ComputedValues, StyleBuilder};
use crate::rule_tree::StrongRuleNode;
use crate::selector_parser::PseudoElement;
use crate::shared_lock::StylesheetGuards;
use crate::values::computed::NonNegativeLength;
use fxhash::FxHashMap; use fxhash::FxHashMap;
use logical_geometry::WritingMode;
use properties::{ComputedValues, StyleBuilder};
use rule_tree::StrongRuleNode;
use selector_parser::PseudoElement;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::StylesheetGuards;
use smallvec::SmallVec; use smallvec::SmallVec;
use values::computed::NonNegativeLength;
/// The conditions for caching and matching a style in the rule cache. /// The conditions for caching and matching a style in the rule cache.
#[derive(Clone, Debug, Default)] #[derive(Clone, Debug, Default)]

View file

@ -6,21 +6,21 @@
//! The rule tree. //! The rule tree.
use applicable_declarations::ApplicableDeclarationList; use crate::applicable_declarations::ApplicableDeclarationList;
use crate::properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use crate::stylesheets::StyleRule;
use crate::thread_state;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko::selector_parser::PseudoElement; use gecko::selector_parser::PseudoElement;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
use servo_arc::{Arc, ArcBorrow, ArcUnion, ArcUnionBorrow}; use servo_arc::{Arc, ArcBorrow, ArcUnion, ArcUnionBorrow};
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::io::{self, Write}; use std::io::{self, Write};
use std::mem; use std::mem;
use std::ptr; use std::ptr;
use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
use stylesheets::StyleRule;
use thread_state;
/// The rule tree, the structure servo uses to preserve the results of selector /// The rule tree, the structure servo uses to preserve the results of selector
/// matching. /// matching.
@ -1149,7 +1149,7 @@ impl StrongRuleNode {
unsafe fn assert_free_list_has_no_duplicates_or_null(&self) { unsafe fn assert_free_list_has_no_duplicates_or_null(&self) {
assert!(cfg!(debug_assertions), "This is an expensive check!"); assert!(cfg!(debug_assertions), "This is an expensive check!");
use hash::FxHashSet; use crate::hash::FxHashSet;
let me = &*self.ptr(); let me = &*self.ptr();
assert!(me.is_root()); assert!(me.is_root());
@ -1430,7 +1430,7 @@ impl StrongRuleNode {
&self, &self,
guards: &StylesheetGuards, guards: &StylesheetGuards,
) -> (LonghandIdSet, bool) { ) -> (LonghandIdSet, bool) {
use properties::PropertyDeclarationId; use crate::properties::PropertyDeclarationId;
// We want to iterate over cascade levels that override the animations // We want to iterate over cascade levels that override the animations
// level, i.e. !important levels and the transitions level. // level, i.e. !important levels and the transitions level.

View file

@ -5,22 +5,22 @@
//! A data structure to efficiently index structs containing selectors by local //! A data structure to efficiently index structs containing selectors by local
//! name, ids and hash. //! name, ids and hash.
use applicable_declarations::ApplicableDeclarationList; use crate::applicable_declarations::ApplicableDeclarationList;
use context::QuirksMode; use crate::context::QuirksMode;
use dom::TElement; use crate::dom::TElement;
use crate::hash::map as hash_map;
use crate::hash::{HashMap, HashSet};
use crate::rule_tree::{CascadeLevel, ShadowCascadeOrder};
use crate::selector_parser::SelectorImpl;
use crate::stylist::Rule;
use crate::{Atom, LocalName, Namespace, WeakAtom};
use fallible::FallibleVec; use fallible::FallibleVec;
use hash::map as hash_map;
use hash::{HashMap, HashSet};
use hashglobe::FailedAllocationError; use hashglobe::FailedAllocationError;
use precomputed_hash::PrecomputedHash; use precomputed_hash::PrecomputedHash;
use rule_tree::{CascadeLevel, ShadowCascadeOrder};
use selector_parser::SelectorImpl;
use selectors::matching::{matches_selector, ElementSelectorFlags, MatchingContext}; use selectors::matching::{matches_selector, ElementSelectorFlags, MatchingContext};
use selectors::parser::{Combinator, Component, SelectorIter}; use selectors::parser::{Combinator, Component, SelectorIter};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::hash::{BuildHasherDefault, Hash, Hasher}; 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 /// A hasher implementation that doesn't hash anything, because it expects its
/// input to be a suitable u32 hash. /// input to be a suitable u32 hash.

View file

@ -6,33 +6,33 @@
#![deny(missing_docs)] #![deny(missing_docs)]
use crate::element_state::ElementState;
use crate::stylesheets::{Namespaces, Origin, UrlExtraData};
use crate::values::serialize_atom_identifier;
use crate::Atom;
use cssparser::{Parser as CssParser, ParserInput}; use cssparser::{Parser as CssParser, ParserInput};
use element_state::ElementState;
use selectors::parser::SelectorList; use selectors::parser::SelectorList;
use std::fmt::{self, Debug, Write}; use std::fmt::{self, Debug, Write};
use style_traits::{CssWriter, ParseError, ToCss}; 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 /// A convenient alias for the type that represents an attribute value used for
/// selector parser implementation. /// selector parser implementation.
pub type AttrValue = <SelectorImpl as ::selectors::SelectorImpl>::AttrValue; pub type AttrValue = <SelectorImpl as ::selectors::SelectorImpl>::AttrValue;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
pub use servo::selector_parser::*; pub use crate::servo::selector_parser::*;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use gecko::selector_parser::*; pub use gecko::selector_parser::*;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
pub use servo::selector_parser::ServoElementSnapshot as Snapshot; pub use crate::servo::selector_parser::ServoElementSnapshot as Snapshot;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use gecko::snapshot::GeckoElementSnapshot as Snapshot; pub use gecko::snapshot::GeckoElementSnapshot as Snapshot;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
pub use servo::restyle_damage::ServoRestyleDamage as RestyleDamage; pub use crate::servo::restyle_damage::ServoRestyleDamage as RestyleDamage;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use gecko::restyle_damage::GeckoRestyleDamage as RestyleDamage; pub use gecko::restyle_damage::GeckoRestyleDamage as RestyleDamage;

View file

@ -5,20 +5,20 @@
//! Servo's media-query device and expression representation. //! Servo's media-query device and expression representation.
use app_units::Au; use app_units::Au;
use crate::custom_properties::CssEnvironment;
use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements};
use crate::media_queries::media_feature::{Evaluator, MediaFeatureDescription};
use crate::media_queries::media_feature_expression::RangeOrOperator;
use crate::media_queries::MediaType;
use crate::properties::ComputedValues;
use crate::values::computed::font::FontSize;
use crate::values::computed::CSSPixelLength;
use crate::values::KeyframesName;
use cssparser::RGBA; use cssparser::RGBA;
use custom_properties::CssEnvironment;
use euclid::{Size2D, TypedScale, TypedSize2D}; use euclid::{Size2D, TypedScale, TypedSize2D};
use media_queries::media_feature::{AllowsRanges, ParsingRequirements};
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 std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
use style_traits::viewport::ViewportConstraints; use style_traits::viewport::ViewportConstraints;
use style_traits::{CSSPixel, DevicePixel}; 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 /// A device is a structure that represents the current media a given document
/// is displayed in. /// is displayed in.

View file

@ -5,9 +5,9 @@
//! The restyle damage is a hint that tells layout which kind of operations may //! The restyle damage is a hint that tells layout which kind of operations may
//! be needed in presence of incremental style changes. //! be needed in presence of incremental style changes.
use computed_values::display::T as Display; use crate::computed_values::display::T as Display;
use matching::{StyleChange, StyleDifference}; use crate::matching::{StyleChange, StyleDifference};
use properties::ComputedValues; use crate::properties::ComputedValues;
use std::fmt; use std::fmt;
bitflags! { bitflags! {

View file

@ -6,16 +6,19 @@
//! Servo's selector parser. //! Servo's selector parser.
use attr::{AttrIdentifier, AttrValue}; use crate::attr::{AttrIdentifier, AttrValue};
use crate::dom::{OpaqueNode, TElement, TNode};
use crate::element_state::{DocumentState, ElementState};
use crate::invalidation::element::document_state::InvalidationMatchingData;
use crate::invalidation::element::element_wrapper::ElementSnapshot;
use crate::properties::longhands::display::computed_value::T as Display;
use crate::properties::{ComputedValues, PropertyFlags};
use crate::selector_parser::{
AttrValue as SelectorAttrValue, PseudoElementCascadeType, SelectorParser,
};
use crate::{Atom, CaseSensitivityExt, LocalName, Namespace, Prefix};
use cssparser::{serialize_identifier, CowRcStr, Parser as CssParser, SourceLocation, ToCss}; use cssparser::{serialize_identifier, CowRcStr, Parser as CssParser, SourceLocation, ToCss};
use dom::{OpaqueNode, TElement, TNode};
use element_state::{DocumentState, ElementState};
use fxhash::FxHashMap; use fxhash::FxHashMap;
use invalidation::element::document_state::InvalidationMatchingData;
use invalidation::element::element_wrapper::ElementSnapshot;
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::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
use selectors::parser::{SelectorParseErrorKind, Visit}; use selectors::parser::{SelectorParseErrorKind, Visit};
use selectors::visitor::SelectorVisitor; use selectors::visitor::SelectorVisitor;
@ -23,7 +26,6 @@ use std::fmt;
use std::mem; use std::mem;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};
use style_traits::{ParseError, StyleParseErrorKind}; use style_traits::{ParseError, StyleParseErrorKind};
use {Atom, CaseSensitivityExt, LocalName, Namespace, Prefix};
/// A pseudo-element, both public and private. /// A pseudo-element, both public and private.
/// ///
@ -349,7 +351,7 @@ impl NonTSPseudoClass {
/// selector matching, and it's set from the DOM. /// selector matching, and it's set from the DOM.
pub fn state_flag(&self) -> ElementState { pub fn state_flag(&self) -> ElementState {
use self::NonTSPseudoClass::*; use self::NonTSPseudoClass::*;
use element_state::ElementState; use crate::element_state::ElementState;
match *self { match *self {
Active => ElementState::IN_ACTIVE_STATE, Active => ElementState::IN_ACTIVE_STATE,
Focus => ElementState::IN_FOCUS_STATE, Focus => ElementState::IN_FOCUS_STATE,

View file

@ -4,16 +4,16 @@
//! Common handling for the specified value CSS url() values. //! Common handling for the specified value CSS url() values.
use crate::parser::{Parse, ParserContext};
use cssparser::Parser; use cssparser::Parser;
use parser::{Parse, ParserContext};
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
// Note: We use std::sync::Arc rather than servo_arc::Arc here because the // Note: We use std::sync::Arc rather than servo_arc::Arc here because the
// nonzero optimization is important in keeping the size of SpecifiedUrl below // nonzero optimization is important in keeping the size of SpecifiedUrl below
// the threshold. // the threshold.
use crate::values::computed::{Context, ToComputedValue};
use std::sync::Arc; use std::sync::Arc;
use style_traits::{CssWriter, ParseError, ToCss}; use style_traits::{CssWriter, ParseError, ToCss};
use values::computed::{Context, ToComputedValue};
/// A CSS url() value for servo. /// A CSS url() value for servo.
/// ///

View file

@ -6,6 +6,8 @@
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use crate::str::{CssString, CssStringWriter};
use crate::stylesheets::Origin;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
use parking_lot::RwLock; use parking_lot::RwLock;
use servo_arc::Arc; use servo_arc::Arc;
@ -15,8 +17,6 @@ use std::fmt;
use std::mem; use std::mem;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use std::ptr; use std::ptr;
use str::{CssString, CssStringWriter};
use stylesheets::Origin;
/// A shared read/write lock that can protect multiple objects. /// A shared read/write lock that can protect multiple objects.
/// ///

View file

@ -6,11 +6,11 @@
//! quickly whether it's worth to share style, and whether two different //! quickly whether it's worth to share style, and whether two different
//! elements can indeed share the same style. //! elements can indeed share the same style.
use bloom::StyleBloom; use crate::bloom::StyleBloom;
use context::{SelectorFlagsMap, SharedStyleContext}; use crate::context::{SelectorFlagsMap, SharedStyleContext};
use dom::TElement; use crate::dom::TElement;
use crate::sharing::{StyleSharingCandidate, StyleSharingTarget};
use selectors::NthIndexCache; use selectors::NthIndexCache;
use sharing::{StyleSharingCandidate, StyleSharingTarget};
/// Determines whether a target and a candidate have compatible parents for /// Determines whether a target and a candidate have compatible parents for
/// sharing. /// sharing.

View file

@ -64,15 +64,18 @@
//! selectors are effectively stripped off, so that matching them all against //! selectors are effectively stripped off, so that matching them all against
//! elements makes sense. //! elements makes sense.
use applicable_declarations::ApplicableDeclarationBlock;
use atomic_refcell::{AtomicRefCell, AtomicRefMut}; use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use bloom::StyleBloom; use crate::applicable_declarations::ApplicableDeclarationBlock;
use context::{SelectorFlagsMap, SharedStyleContext, StyleContext}; use crate::bloom::StyleBloom;
use dom::{SendElement, TElement}; use crate::context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
use matching::MatchMethods; use crate::dom::{SendElement, TElement};
use crate::matching::MatchMethods;
use crate::properties::ComputedValues;
use crate::rule_tree::StrongRuleNode;
use crate::style_resolver::{PrimaryStyle, ResolvedElementStyles};
use crate::stylist::Stylist;
use crate::Atom;
use owning_ref::OwningHandle; use owning_ref::OwningHandle;
use properties::ComputedValues;
use rule_tree::StrongRuleNode;
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode}; use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
use selectors::NthIndexCache; use selectors::NthIndexCache;
use servo_arc::Arc; use servo_arc::Arc;
@ -82,10 +85,7 @@ use std::marker::PhantomData;
use std::mem; use std::mem;
use std::ops::Deref; use std::ops::Deref;
use std::ptr::NonNull; use std::ptr::NonNull;
use style_resolver::{PrimaryStyle, ResolvedElementStyles};
use stylist::Stylist;
use uluru::{Entry, LRUCache}; use uluru::{Entry, LRUCache};
use Atom;
mod checks; mod checks;

View file

@ -6,13 +6,13 @@
//! a computed style needs in order for it to adhere to the CSS spec. //! a computed style needs in order for it to adhere to the CSS spec.
use app_units::Au; use app_units::Au;
use dom::TElement; use crate::dom::TElement;
use properties::computed_value_flags::ComputedValueFlags; use crate::properties::computed_value_flags::ComputedValueFlags;
use properties::longhands::display::computed_value::T as Display; use crate::properties::longhands::display::computed_value::T as Display;
use properties::longhands::float::computed_value::T as Float; use crate::properties::longhands::float::computed_value::T as Float;
use properties::longhands::overflow_x::computed_value::T as Overflow; use crate::properties::longhands::overflow_x::computed_value::T as Overflow;
use properties::longhands::position::computed_value::T as Position; use crate::properties::longhands::position::computed_value::T as Position;
use properties::{self, ComputedValues, StyleBuilder}; use crate::properties::{self, ComputedValues, StyleBuilder};
/// A struct that implements all the adjustment methods. /// A struct that implements all the adjustment methods.
/// ///
@ -362,8 +362,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
/// See https://github.com/servo/servo/issues/15229 /// See https://github.com/servo/servo/issues/15229
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
fn adjust_for_alignment(&mut self, layout_parent_style: &ComputedValues) { fn adjust_for_alignment(&mut self, layout_parent_style: &ComputedValues) {
use computed_values::align_items::T as AlignItems; use crate::computed_values::align_items::T as AlignItems;
use computed_values::align_self::T as AlignSelf; use crate::computed_values::align_self::T as AlignSelf;
if self.style.get_position().clone_align_self() == AlignSelf::Auto && if self.style.get_position().clone_align_self() == AlignSelf::Auto &&
!self.style.out_of_flow_positioned() !self.style.out_of_flow_positioned()
@ -534,7 +534,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
/// and Blink have with this very same thing. /// and Blink have with this very same thing.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
fn adjust_for_text_decorations_in_effect(&mut self) { fn adjust_for_text_decorations_in_effect(&mut self) {
use values::computed::text::TextDecorationsInEffect; use crate::values::computed::text::TextDecorationsInEffect;
let decorations_in_effect = TextDecorationsInEffect::from_style(&self.style); let decorations_in_effect = TextDecorationsInEffect::from_style(&self.style);
if self.style.get_inherited_text().text_decorations_in_effect != decorations_in_effect { if self.style.get_inherited_text().text_decorations_in_effect != decorations_in_effect {

View file

@ -4,21 +4,21 @@
//! Style resolution for a given element or pseudo-element. //! Style resolution for a given element or pseudo-element.
use applicable_declarations::ApplicableDeclarationList; use crate::applicable_declarations::ApplicableDeclarationList;
use context::{CascadeInputs, ElementCascadeInputs, StyleContext}; use crate::context::{CascadeInputs, ElementCascadeInputs, StyleContext};
use data::{EagerPseudoStyles, ElementStyles}; use crate::data::{EagerPseudoStyles, ElementStyles};
use dom::TElement; use crate::dom::TElement;
use crate::matching::MatchMethods;
use crate::properties::longhands::display::computed_value::T as Display;
use crate::properties::{AnimationRules, ComputedValues};
use crate::rule_tree::StrongRuleNode;
use crate::selector_parser::{PseudoElement, SelectorImpl};
use crate::stylist::RuleInclusion;
use log::Level::Trace; use log::Level::Trace;
use matching::MatchMethods;
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::{ use selectors::matching::{
ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode, ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode,
}; };
use servo_arc::Arc; use servo_arc::Arc;
use stylist::RuleInclusion;
/// Whether pseudo-elements should be resolved or not. /// Whether pseudo-elements should be resolved or not.
#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Eq, PartialEq)]
@ -111,7 +111,7 @@ fn eager_pseudo_is_definitely_not_generated(
pseudo: &PseudoElement, pseudo: &PseudoElement,
style: &ComputedValues, style: &ComputedValues,
) -> bool { ) -> bool {
use properties::computed_value_flags::ComputedValueFlags; use crate::properties::computed_value_flags::ComputedValueFlags;
if !pseudo.is_before_or_after() { if !pseudo.is_before_or_after() {
return false; return false;

View file

@ -4,13 +4,13 @@
//! A centralized set of stylesheets for a document. //! A centralized set of stylesheets for a document.
use dom::TElement; use crate::dom::TElement;
use invalidation::stylesheets::StylesheetInvalidationSet; use crate::invalidation::stylesheets::StylesheetInvalidationSet;
use media_queries::Device; use crate::media_queries::Device;
use selector_parser::SnapshotMap; use crate::selector_parser::SnapshotMap;
use shared_lock::SharedRwLockReadGuard; use crate::shared_lock::SharedRwLockReadGuard;
use crate::stylesheets::{Origin, OriginSet, OriginSetIterator, PerOrigin, StylesheetInDocument};
use std::{mem, slice}; use std::{mem, slice};
use stylesheets::{Origin, OriginSet, OriginSetIterator, PerOrigin, StylesheetInDocument};
/// Entry for a StylesheetSet. /// Entry for a StylesheetSet.
#[derive(MallocSizeOf)] #[derive(MallocSizeOf)]

View file

@ -4,4 +4,4 @@
#![allow(missing_docs)] #![allow(missing_docs)]
pub use counter_style::CounterStyleRuleData as CounterStyleRule; pub use crate::counter_style::CounterStyleRuleData as CounterStyleRule;

View file

@ -6,19 +6,19 @@
//! initially in CSS Conditional Rules Module Level 3, @document has been postponed to the level 4. //! initially in CSS Conditional Rules Module Level 3, @document has been postponed to the level 4.
//! We implement the prefixed `@-moz-document`. //! We implement the prefixed `@-moz-document`.
use crate::media_queries::Device;
use crate::parser::{Parse, ParserContext};
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::stylesheets::CssRules;
use crate::values::CssUrl;
use cssparser::{Parser, SourceLocation}; use cssparser::{Parser, SourceLocation};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf}; use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
use media_queries::Device;
use parser::{Parse, ParserContext};
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
use stylesheets::CssRules;
use values::CssUrl;
#[derive(Debug)] #[derive(Debug)]
/// A @-moz-document rule /// A @-moz-document rule
@ -135,7 +135,7 @@ impl DocumentMatchingFunction {
context: &ParserContext, context: &ParserContext,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> { ) -> Result<Self, ParseError<'i>> {
if let Ok(url) = input.try(|input| CssUrl::parse(context, input)) { if let Ok(url) = input.r#try(|input| CssUrl::parse(context, input)) {
return Ok(DocumentMatchingFunction::Url(url)); return Ok(DocumentMatchingFunction::Url(url));
} }

View file

@ -4,4 +4,4 @@
#![allow(missing_docs)] #![allow(missing_docs)]
pub use font_face::FontFaceRuleData as FontFaceRule; pub use crate::font_face::FontFaceRuleData as FontFaceRule;

View file

@ -6,23 +6,23 @@
//! //!
//! [font-feature-values]: https://drafts.csswg.org/css-fonts-3/#at-font-feature-values-rule //! [font-feature-values]: https://drafts.csswg.org/css-fonts-3/#at-font-feature-values-rule
use crate::error_reporting::ContextualParseError;
use crate::parser::{Parse, ParserContext};
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::stylesheets::CssRuleType;
use crate::values::computed::font::FamilyName;
use crate::values::serialize_atom_identifier;
use crate::Atom;
use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr}; use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr};
use cssparser::{DeclarationListParser, DeclarationParser, Parser}; use cssparser::{DeclarationListParser, DeclarationParser, Parser};
use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, Token}; use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, Token};
use error_reporting::ContextualParseError;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::bindings::Gecko_AppendFeatureValueHashEntry; use gecko_bindings::bindings::Gecko_AppendFeatureValueHashEntry;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::structs::{self, gfxFontFeatureValueSet, nsTArray}; use gecko_bindings::structs::{self, gfxFontFeatureValueSet, nsTArray};
use parser::{Parse, ParserContext};
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; 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. /// A @font-feature-values block declaration.
/// It is `<ident>: <integer>+`. /// It is `<ident>: <integer>+`.

View file

@ -6,16 +6,16 @@
//! //!
//! [import]: https://drafts.csswg.org/css-cascade-3/#at-import //! [import]: https://drafts.csswg.org/css-cascade-3/#at-import
use context::QuirksMode; use crate::context::QuirksMode;
use crate::media_queries::MediaList;
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock};
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::stylesheets::{CssRule, Origin, StylesheetInDocument};
use crate::values::CssUrl;
use cssparser::SourceLocation; use cssparser::SourceLocation;
use media_queries::MediaList;
use shared_lock::{DeepCloneParams, DeepCloneWithLock};
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
use stylesheets::{CssRule, Origin, StylesheetInDocument};
use values::CssUrl;
/// With asynchronous stylesheet parsing, we can't synchronously create a /// With asynchronous stylesheet parsing, we can't synchronously create a
/// GeckoStyleSheet. So we use this placeholder instead. /// GeckoStyleSheet. So we use this placeholder instead.
@ -124,7 +124,7 @@ impl StylesheetInDocument for ImportSheet {
/// A sheet that is held from an import rule. /// A sheet that is held from an import rule.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
#[derive(Debug)] #[derive(Debug)]
pub struct ImportSheet(pub ::servo_arc::Arc<::stylesheets::Stylesheet>); pub struct ImportSheet(pub ::servo_arc::Arc<crate::stylesheets::Stylesheet>);
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
impl StylesheetInDocument for ImportSheet { impl StylesheetInDocument for ImportSheet {

View file

@ -4,24 +4,24 @@
//! Keyframes: https://drafts.csswg.org/css-animations/#keyframes //! Keyframes: https://drafts.csswg.org/css-animations/#keyframes
use crate::error_reporting::ContextualParseError;
use crate::parser::ParserContext;
use crate::properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
use crate::properties::LonghandIdSet;
use crate::properties::{Importance, PropertyDeclaration};
use crate::properties::{LonghandId, PropertyDeclarationBlock, PropertyId};
use crate::properties::{PropertyDeclarationId, SourcePropertyDeclaration};
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard};
use crate::shared_lock::{Locked, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::stylesheets::rule_parser::VendorPrefix;
use crate::stylesheets::{CssRuleType, StylesheetContents};
use crate::values::{serialize_percentage, KeyframesName};
use cssparser::{parse_one_rule, DeclarationListParser, DeclarationParser, SourceLocation, Token}; use cssparser::{parse_one_rule, DeclarationListParser, DeclarationParser, SourceLocation, Token};
use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser}; 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 servo_arc::Arc; use servo_arc::Arc;
use shared_lock::{DeepCloneParams, DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard};
use shared_lock::{Locked, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss};
use stylesheets::rule_parser::VendorPrefix;
use stylesheets::{CssRuleType, StylesheetContents};
use values::{serialize_percentage, KeyframesName};
/// A [`@keyframes`][keyframes] rule. /// A [`@keyframes`][keyframes] rule.
/// ///

View file

@ -5,13 +5,13 @@
//! The stylesheet loader is the abstraction used to trigger network requests //! The stylesheet loader is the abstraction used to trigger network requests
//! for `@import` rules. //! for `@import` rules.
use crate::media_queries::MediaList;
use crate::parser::ParserContext;
use crate::shared_lock::{Locked, SharedRwLock};
use crate::stylesheets::import_rule::ImportRule;
use crate::values::CssUrl;
use cssparser::SourceLocation; use cssparser::SourceLocation;
use media_queries::MediaList;
use parser::ParserContext;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::{Locked, SharedRwLock};
use stylesheets::import_rule::ImportRule;
use values::CssUrl;
/// The stylesheet loader is the abstraction used to trigger network requests /// The stylesheet loader is the abstraction used to trigger network requests
/// for `@import` rules. /// for `@import` rules.

View file

@ -6,17 +6,17 @@
//! //!
//! [media]: https://drafts.csswg.org/css-conditional/#at-ruledef-media //! [media]: https://drafts.csswg.org/css-conditional/#at-ruledef-media
use crate::media_queries::MediaList;
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::stylesheets::CssRules;
use cssparser::SourceLocation; use cssparser::SourceLocation;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf}; use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
use media_queries::MediaList;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
use stylesheets::CssRules;
/// An [`@media`][media] urle. /// An [`@media`][media] urle.
/// ///

View file

@ -23,15 +23,15 @@ mod stylesheet;
pub mod supports_rule; pub mod supports_rule;
pub mod viewport_rule; pub mod viewport_rule;
use crate::parser::ParserContext;
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use cssparser::{parse_one_rule, Parser, ParserInput}; use cssparser::{parse_one_rule, Parser, ParserInput};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf}; use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
use parser::ParserContext;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt; use std::fmt;
use str::CssStringWriter;
use style_traits::ParsingMode; use style_traits::ParsingMode;
pub use self::counter_style_rule::CounterStyleRule; pub use self::counter_style_rule::CounterStyleRule;

View file

@ -4,11 +4,11 @@
//! The `@namespace` at-rule. //! The `@namespace` at-rule.
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::{Namespace, Prefix};
use cssparser::SourceLocation; use cssparser::SourceLocation;
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
use {Namespace, Prefix};
/// A `@namespace` rule. /// A `@namespace` rule.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]

View file

@ -6,15 +6,15 @@
//! //!
//! [page]: https://drafts.csswg.org/css2/page.html#page-box //! [page]: https://drafts.csswg.org/css2/page.html#page-box
use crate::properties::PropertyDeclarationBlock;
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use cssparser::SourceLocation; use cssparser::SourceLocation;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps, MallocUnconditionalShallowSizeOf}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
use properties::PropertyDeclarationBlock;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
/// A [`@page`][page] rule. /// A [`@page`][page] rule.
/// ///

View file

@ -4,17 +4,17 @@
//! A list of CSS rules. //! A list of CSS rules.
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::stylesheets::loader::StylesheetLoader;
use crate::stylesheets::rule_parser::{InsertRuleContext, State};
use crate::stylesheets::stylesheet::StylesheetContents;
use crate::stylesheets::{CssRule, RulesMutateError};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocShallowSizeOf, MallocSizeOfOps};
use servo_arc::{Arc, RawOffsetArc}; use servo_arc::{Arc, RawOffsetArc};
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
use stylesheets::loader::StylesheetLoader;
use stylesheets::rule_parser::{InsertRuleContext, State};
use stylesheets::stylesheet::StylesheetContents;
use stylesheets::{CssRule, RulesMutateError};
/// A list of CSS rules. /// A list of CSS rules.
#[derive(Debug)] #[derive(Debug)]

View file

@ -4,32 +4,32 @@
//! Parsing of the stylesheet contents. //! Parsing of the stylesheet contents.
use counter_style::{parse_counter_style_body, parse_counter_style_name_definition}; use crate::counter_style::{parse_counter_style_body, parse_counter_style_name_definition};
use crate::error_reporting::ContextualParseError;
use crate::font_face::parse_font_face_block;
use crate::media_queries::MediaList;
use crate::parser::{Parse, ParserContext};
use crate::properties::parse_property_declaration_list;
use crate::selector_parser::{SelectorImpl, SelectorParser};
use crate::shared_lock::{Locked, SharedRwLock};
use crate::str::starts_with_ignore_ascii_case;
use crate::stylesheets::document_rule::DocumentCondition;
use crate::stylesheets::font_feature_values_rule::parse_family_name_list;
use crate::stylesheets::keyframes_rule::parse_keyframe_list;
use crate::stylesheets::stylesheet::Namespaces;
use crate::stylesheets::supports_rule::SupportsCondition;
use crate::stylesheets::viewport_rule;
use crate::stylesheets::{CssRule, CssRuleType, CssRules, RulesMutateError, StylesheetLoader};
use crate::stylesheets::{DocumentRule, FontFeatureValuesRule, KeyframesRule, MediaRule};
use crate::stylesheets::{NamespaceRule, PageRule, StyleRule, SupportsRule, ViewportRule};
use crate::values::computed::font::FamilyName;
use crate::values::{CssUrl, CustomIdent, KeyframesName};
use crate::{Namespace, Prefix};
use cssparser::{AtRuleParser, AtRuleType, Parser, QualifiedRuleParser, RuleListParser}; use cssparser::{AtRuleParser, AtRuleType, Parser, QualifiedRuleParser, RuleListParser};
use cssparser::{BasicParseError, BasicParseErrorKind, CowRcStr, SourceLocation}; use cssparser::{BasicParseError, BasicParseErrorKind, CowRcStr, SourceLocation};
use error_reporting::ContextualParseError;
use font_face::parse_font_face_block;
use media_queries::MediaList;
use parser::{Parse, ParserContext};
use properties::parse_property_declaration_list;
use selector_parser::{SelectorImpl, SelectorParser};
use selectors::SelectorList; use selectors::SelectorList;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::{Locked, SharedRwLock};
use str::starts_with_ignore_ascii_case;
use style_traits::{ParseError, StyleParseErrorKind}; use style_traits::{ParseError, StyleParseErrorKind};
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 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. /// The information we need particularly to do CSSOM insertRule stuff.
pub struct InsertRuleContext<'a> { pub struct InsertRuleContext<'a> {
@ -202,7 +202,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedNamespaceRule)) return Err(input.new_custom_error(StyleParseErrorKind::UnexpectedNamespaceRule))
} }
let prefix = input.try(|i| i.expect_ident_cloned()) let prefix = input.r#try(|i| i.expect_ident_cloned())
.map(|s| Prefix::from(s.as_ref())).ok(); .map(|s| Prefix::from(s.as_ref())).ok();
let maybe_namespace = match input.expect_url_or_string() { let maybe_namespace = match input.expect_url_or_string() {
Ok(url_or_string) => url_or_string, Ok(url_or_string) => url_or_string,

View file

@ -4,13 +4,13 @@
//! An iterator over a list of rules. //! An iterator over a list of rules.
use context::QuirksMode; use crate::context::QuirksMode;
use media_queries::Device; use crate::media_queries::Device;
use shared_lock::SharedRwLockReadGuard; use crate::shared_lock::SharedRwLockReadGuard;
use crate::stylesheets::StylesheetInDocument;
use crate::stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::slice; use std::slice;
use stylesheets::StylesheetInDocument;
use stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule};
/// An iterator over a list of rules. /// An iterator over a list of rules.
pub struct RulesIterator<'a, 'b, C> pub struct RulesIterator<'a, 'b, C>

View file

@ -4,19 +4,19 @@
//! A style rule. //! A style rule.
use crate::properties::PropertyDeclarationBlock;
use crate::selector_parser::SelectorImpl;
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use cssparser::SourceLocation; use cssparser::SourceLocation;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::MallocUnconditionalShallowSizeOf; use malloc_size_of::MallocUnconditionalShallowSizeOf;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use properties::PropertyDeclarationBlock;
use selector_parser::SelectorImpl;
use selectors::SelectorList; use selectors::SelectorList;
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use str::CssStringWriter;
/// A style rule, with selectors and declarations. /// A style rule, with selectors and declarations.
#[derive(Debug)] #[derive(Debug)]

View file

@ -2,31 +2,31 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use context::QuirksMode; use crate::context::QuirksMode;
use cssparser::{Parser, ParserInput, RuleListParser}; use crate::error_reporting::{ContextualParseError, ParseErrorReporter};
use error_reporting::{ContextualParseError, ParseErrorReporter}; use crate::invalidation::media_queries::{MediaListKey, ToMediaListKey};
use fallible::FallibleVec; use crate::media_queries::{Device, MediaList};
use fxhash::FxHashMap; use crate::parser::ParserContext;
use invalidation::media_queries::{MediaListKey, ToMediaListKey}; use crate::shared_lock::{
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
use media_queries::{Device, MediaList};
use parking_lot::RwLock;
use parser::ParserContext;
use servo_arc::Arc;
use shared_lock::{
DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard,
}; };
use crate::stylesheets::loader::StylesheetLoader;
use crate::stylesheets::rule_parser::{State, TopLevelRuleParser};
use crate::stylesheets::rules_iterator::{EffectiveRules, EffectiveRulesIterator};
use crate::stylesheets::rules_iterator::{NestedRuleIterationCondition, RulesIterator};
use crate::stylesheets::{CssRule, CssRules, Origin, UrlExtraData};
use crate::use_counters::UseCounters;
use crate::{Namespace, Prefix};
use cssparser::{Parser, ParserInput, RuleListParser};
use fallible::FallibleVec;
use fxhash::FxHashMap;
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
use parking_lot::RwLock;
use servo_arc::Arc;
use std::mem; use std::mem;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use style_traits::ParsingMode; use style_traits::ParsingMode;
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. /// This structure holds the user-agent and user stylesheets.
pub struct UserAgentStylesheets { pub struct UserAgentStylesheets {
@ -166,9 +166,9 @@ macro_rules! rule_filter {
$( $(
#[allow(missing_docs)] #[allow(missing_docs)]
fn $method<F>(&self, device: &Device, guard: &SharedRwLockReadGuard, mut f: F) fn $method<F>(&self, device: &Device, guard: &SharedRwLockReadGuard, mut f: F)
where F: FnMut(&::stylesheets::$rule_type), where F: FnMut(&crate::stylesheets::$rule_type),
{ {
use stylesheets::CssRule; use crate::stylesheets::CssRule;
for rule in self.effective_rules(device, guard) { for rule in self.effective_rules(device, guard) {
if let CssRule::$variant(ref lock) = *rule { if let CssRule::$variant(ref lock) = *rule {

View file

@ -4,24 +4,24 @@
//! [@supports rules](https://drafts.csswg.org/css-conditional-3/#at-supports) //! [@supports rules](https://drafts.csswg.org/css-conditional-3/#at-supports)
use crate::parser::ParserContext;
use crate::properties::{PropertyDeclaration, PropertyId, SourcePropertyDeclaration};
use crate::selector_parser::{SelectorImpl, SelectorParser};
use crate::shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use crate::shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::stylesheets::{CssRuleType, CssRules, Namespaces};
use cssparser::parse_important; use cssparser::parse_important;
use cssparser::{Delimiter, Parser, SourceLocation, Token}; use cssparser::{Delimiter, Parser, SourceLocation, Token};
use cssparser::{ParseError as CssParseError, ParserInput}; use cssparser::{ParseError as CssParseError, ParserInput};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf}; use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
use parser::ParserContext;
use properties::{PropertyDeclaration, PropertyId, SourcePropertyDeclaration};
use selector_parser::{SelectorImpl, SelectorParser};
use selectors::parser::{Selector, SelectorParseErrorKind}; use selectors::parser::{Selector, SelectorParseErrorKind};
use servo_arc::Arc; use servo_arc::Arc;
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
use std::ffi::{CStr, CString}; use std::ffi::{CStr, CString};
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::str; use std::str;
use str::CssStringWriter;
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
use stylesheets::{CssRuleType, CssRules, Namespaces};
/// An [`@supports`][supports] rule. /// An [`@supports`][supports] rule.
/// ///
@ -103,7 +103,7 @@ impl SupportsCondition {
/// ///
/// <https://drafts.csswg.org/css-conditional/#supports_condition> /// <https://drafts.csswg.org/css-conditional/#supports_condition>
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> { pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
if input.try(|i| i.expect_ident_matching("not")).is_ok() { if input.r#try(|i| i.expect_ident_matching("not")).is_ok() {
let inner = SupportsCondition::parse_in_parens(input)?; let inner = SupportsCondition::parse_in_parens(input)?;
return Ok(SupportsCondition::Not(Box::new(inner))); return Ok(SupportsCondition::Not(Box::new(inner)));
} }
@ -129,7 +129,7 @@ impl SupportsCondition {
loop { loop {
conditions.push(SupportsCondition::parse_in_parens(input)?); conditions.push(SupportsCondition::parse_in_parens(input)?);
if input if input
.try(|input| input.expect_ident_matching(keyword)) .r#try(|input| input.expect_ident_matching(keyword))
.is_err() .is_err()
{ {
// Did not find the expected keyword. // Did not find the expected keyword.
@ -175,20 +175,20 @@ impl SupportsCondition {
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`, // Whitespace is normally taken care of in `Parser::next`,
// but we want to not include it in `pos` for the SupportsCondition::FutureSyntax cases. // but we want to not include it in `pos` for the SupportsCondition::FutureSyntax cases.
while input.try(Parser::expect_whitespace).is_ok() {} while input.r#try(Parser::expect_whitespace).is_ok() {}
let pos = input.position(); let pos = input.position();
let location = input.current_source_location(); let location = input.current_source_location();
// FIXME: remove clone() when lifetimes are non-lexical // FIXME: remove clone() when lifetimes are non-lexical
match input.next()?.clone() { match input.next()?.clone() {
Token::ParenthesisBlock => { Token::ParenthesisBlock => {
let nested = let nested =
input.try(|input| input.parse_nested_block(parse_condition_or_declaration)); input.r#try(|input| input.parse_nested_block(parse_condition_or_declaration));
if nested.is_ok() { if nested.is_ok() {
return nested; return nested;
} }
}, },
Token::Function(ident) => { Token::Function(ident) => {
let nested = input.try(|input| { let nested = input.r#try(|input| {
input.parse_nested_block(|input| { input.parse_nested_block(|input| {
SupportsCondition::parse_functional(&ident, input) SupportsCondition::parse_functional(&ident, input)
}) })
@ -240,7 +240,7 @@ fn eval_moz_bool_pref(_: &CStr, _: &ParserContext) -> bool {
pub fn parse_condition_or_declaration<'i, 't>( pub fn parse_condition_or_declaration<'i, 't>(
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<SupportsCondition, ParseError<'i>> { ) -> Result<SupportsCondition, ParseError<'i>> {
if let Ok(condition) = input.try(SupportsCondition::parse) { if let Ok(condition) = input.r#try(SupportsCondition::parse) {
Ok(SupportsCondition::Parenthesized(Box::new(condition))) Ok(SupportsCondition::Parenthesized(Box::new(condition)))
} else { } else {
Declaration::parse(input).map(SupportsCondition::Declaration) Declaration::parse(input).map(SupportsCondition::Declaration)
@ -418,7 +418,7 @@ impl Declaration {
PropertyDeclaration::parse_into(&mut declarations, id, &context, input) PropertyDeclaration::parse_into(&mut declarations, id, &context, input)
.map_err(|_| input.new_custom_error(())) .map_err(|_| input.new_custom_error(()))
})?; })?;
let _ = input.try(parse_important); let _ = input.r#try(parse_important);
Ok(()) Ok(())
}) })
.is_ok() .is_ok()

View file

@ -8,29 +8,29 @@
//! [meta]: https://drafts.csswg.org/css-device-adapt/#viewport-meta //! [meta]: https://drafts.csswg.org/css-device-adapt/#viewport-meta
use app_units::Au; use app_units::Au;
use context::QuirksMode; use crate::context::QuirksMode;
use crate::error_reporting::ContextualParseError;
use crate::font_metrics::get_metrics_provider_for_product;
use crate::media_queries::Device;
use crate::parser::ParserContext;
use crate::properties::StyleBuilder;
use crate::rule_cache::RuleCacheConditions;
use crate::shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::stylesheets::{Origin, StylesheetInDocument};
use crate::values::computed::{Context, ToComputedValue};
use crate::values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
use cssparser::CowRcStr; use cssparser::CowRcStr;
use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser}; use cssparser::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
use error_reporting::ContextualParseError;
use euclid::TypedSize2D; use euclid::TypedSize2D;
use font_metrics::get_metrics_provider_for_product;
use media_queries::Device;
use parser::ParserContext;
use properties::StyleBuilder;
use rule_cache::RuleCacheConditions;
use selectors::parser::SelectorParseErrorKind; use selectors::parser::SelectorParseErrorKind;
use shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard};
use std::borrow::Cow; use std::borrow::Cow;
use std::cell::RefCell; use std::cell::RefCell;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::iter::Enumerate; use std::iter::Enumerate;
use std::str::Chars; use std::str::Chars;
use str::CssStringWriter;
use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom}; use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom};
use style_traits::{CssWriter, ParseError, PinchZoomFactor, StyleParseErrorKind, ToCss}; use style_traits::{CssWriter, ParseError, PinchZoomFactor, StyleParseErrorKind, ToCss};
use stylesheets::{Origin, StylesheetInDocument};
use values::computed::{Context, ToComputedValue};
use values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
/// Whether parsing and processing of `@viewport` rules is enabled. /// Whether parsing and processing of `@viewport` rules is enabled.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
@ -265,7 +265,7 @@ fn parse_shorthand<'i, 't>(
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<(ViewportLength, ViewportLength), ParseError<'i>> { ) -> Result<(ViewportLength, ViewportLength), ParseError<'i>> {
let min = ViewportLength::parse(context, input)?; let min = ViewportLength::parse(context, input)?;
match input.try(|i| ViewportLength::parse(context, i)) { match input.r#try(|i| ViewportLength::parse(context, i)) {
Err(_) => Ok((min.clone(), min)), Err(_) => Ok((min.clone(), min)),
Ok(max) => Ok((min, max)), Ok(max) => Ok((min, max)),
} }
@ -289,8 +289,8 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> {
) -> Result<Vec<ViewportDescriptorDeclaration>, ParseError<'i>> { ) -> Result<Vec<ViewportDescriptorDeclaration>, ParseError<'i>> {
macro_rules! declaration { macro_rules! declaration {
($declaration:ident($parse:expr)) => { ($declaration:ident($parse:expr)) => {
declaration!($declaration(value: try!($parse(input)), declaration!($declaration(value: r#try!($parse(input)),
important: input.try(parse_important).is_ok())) important: input.r#try(parse_important).is_ok()))
}; };
($declaration:ident(value: $value:expr, important: $important:expr)) => { ($declaration:ident(value: $value:expr, important: $important:expr)) => {
ViewportDescriptorDeclaration::new( ViewportDescriptorDeclaration::new(
@ -306,7 +306,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> {
}; };
(shorthand -> [$min:ident, $max:ident]) => {{ (shorthand -> [$min:ident, $max:ident]) => {{
let shorthand = parse_shorthand(self.context, input)?; let shorthand = parse_shorthand(self.context, input)?;
let important = input.try(parse_important).is_ok(); let important = input.r#try(parse_important).is_ok();
Ok(vec![ Ok(vec![
declaration!($min(value: shorthand.0, important: important)), declaration!($min(value: shorthand.0, important: important)),

View file

@ -4,27 +4,37 @@
//! Selector matching. //! Selector matching.
use applicable_declarations::{ApplicableDeclarationBlock, ApplicableDeclarationList}; use crate::applicable_declarations::{ApplicableDeclarationBlock, ApplicableDeclarationList};
use context::{CascadeInputs, QuirksMode}; use crate::context::{CascadeInputs, QuirksMode};
use dom::{TElement, TShadowRoot}; use crate::dom::{TElement, TShadowRoot};
use element_state::{DocumentState, ElementState}; use crate::element_state::{DocumentState, ElementState};
use font_metrics::FontMetricsProvider; use crate::font_metrics::FontMetricsProvider;
use crate::invalidation::element::invalidation_map::InvalidationMap;
use crate::invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey};
use crate::media_queries::Device;
use crate::properties::{self, CascadeMode, ComputedValues};
use crate::properties::{AnimationRules, PropertyDeclarationBlock};
use crate::rule_cache::{RuleCache, RuleCacheConditions};
use crate::rule_tree::{CascadeLevel, RuleTree, ShadowCascadeOrder, StrongRuleNode, StyleSource};
use crate::selector_map::{PrecomputedHashMap, PrecomputedHashSet, SelectorMap, SelectorMapEntry};
use crate::selector_parser::{PerPseudoElementMap, PseudoElement, SelectorImpl, SnapshotMap};
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use crate::stylesheet_set::{DataValidity, DocumentStylesheetSet, SheetRebuildKind};
use crate::stylesheet_set::{DocumentStylesheetFlusher, SheetCollectionFlusher};
use crate::stylesheets::keyframes_rule::KeyframesAnimation;
use crate::stylesheets::viewport_rule::{self, MaybeNew, ViewportRule};
use crate::stylesheets::StyleRule;
use crate::stylesheets::StylesheetInDocument;
use crate::stylesheets::{CssRule, Origin, OriginSet, PerOrigin, PerOriginIter};
use crate::thread_state::{self, ThreadState};
use crate::{Atom, LocalName, Namespace, WeakAtom};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::structs::{ServoStyleSetSizes, StyleRuleInclusion}; use gecko_bindings::structs::{ServoStyleSetSizes, StyleRuleInclusion};
use hashglobe::FailedAllocationError; use hashglobe::FailedAllocationError;
use invalidation::element::invalidation_map::InvalidationMap;
use invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::MallocUnconditionalShallowSizeOf; use malloc_size_of::MallocUnconditionalShallowSizeOf;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps}; use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
use media_queries::Device;
use properties::{self, CascadeMode, ComputedValues};
use properties::{AnimationRules, PropertyDeclarationBlock};
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::attr::{CaseSensitivity, NamespaceConstraint}; use selectors::attr::{CaseSensitivity, NamespaceConstraint};
use selectors::bloom::BloomFilter; use selectors::bloom::BloomFilter;
use selectors::matching::VisitedHandlingMode; use selectors::matching::VisitedHandlingMode;
@ -34,27 +44,17 @@ use selectors::parser::{SelectorIter, Visit};
use selectors::visitor::SelectorVisitor; use selectors::visitor::SelectorVisitor;
use selectors::NthIndexCache; use selectors::NthIndexCache;
use servo_arc::{Arc, ArcBorrow}; use servo_arc::{Arc, ArcBorrow};
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use smallbitvec::SmallBitVec; use smallbitvec::SmallBitVec;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::ops; use std::ops;
use std::sync::Mutex; use std::sync::Mutex;
use style_traits::viewport::ViewportConstraints; 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")] #[cfg(feature = "gecko")]
use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule}; use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule};
use stylesheets::{CssRule, Origin, OriginSet, PerOrigin, PerOriginIter};
use thread_state::{self, ThreadState};
use {Atom, LocalName, Namespace, WeakAtom};
/// The type of the stylesheets that the stylist contains. /// The type of the stylesheets that the stylist contains.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
pub type StylistSheet = ::stylesheets::DocumentStyleSheet; pub type StylistSheet = crate::stylesheets::DocumentStyleSheet;
/// The type of the stylesheets that the stylist contains. /// The type of the stylesheets that the stylist contains.
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
@ -719,7 +719,7 @@ impl Stylist {
where where
E: TElement, E: TElement,
{ {
use font_metrics::ServoMetricsProvider; use crate::font_metrics::ServoMetricsProvider;
self.precomputed_values_for_pseudo::<E>( self.precomputed_values_for_pseudo::<E>(
guards, guards,
&pseudo, &pseudo,
@ -1556,7 +1556,7 @@ impl Stylist {
where where
E: TElement, E: TElement,
{ {
use font_metrics::get_metrics_provider_for_product; use crate::font_metrics::get_metrics_provider_for_product;
let block = declarations.read_with(guards.author); let block = declarations.read_with(guards.author);
let iter_declarations = || { let iter_declarations = || {
@ -2333,7 +2333,7 @@ impl CascadeData {
where where
S: StylesheetInDocument + ToMediaListKey + 'static, S: StylesheetInDocument + ToMediaListKey + 'static,
{ {
use invalidation::media_queries::PotentiallyEffectiveMediaRules; use crate::invalidation::media_queries::PotentiallyEffectiveMediaRules;
let effective_now = stylesheet.is_effective_for_device(device, guard); let effective_now = stylesheet.is_effective_for_device(device, guard);

View file

@ -4,18 +4,18 @@
//! Traversing the DOM tree; the bloom filter. //! Traversing the DOM tree; the bloom filter.
use context::{ElementCascadeInputs, SharedStyleContext, StyleContext}; use crate::context::{ElementCascadeInputs, SharedStyleContext, StyleContext};
use data::{ElementData, ElementStyles}; use crate::data::{ElementData, ElementStyles};
use dom::{NodeInfo, OpaqueNode, TElement, TNode}; use crate::dom::{NodeInfo, OpaqueNode, TElement, TNode};
use invalidation::element::restyle_hints::RestyleHint; use crate::invalidation::element::restyle_hints::RestyleHint;
use matching::{ChildCascadeRequirement, MatchMethods}; use crate::matching::{ChildCascadeRequirement, MatchMethods};
use selector_parser::PseudoElement; use crate::selector_parser::PseudoElement;
use crate::sharing::StyleSharingTarget;
use crate::style_resolver::{PseudoElementResolution, StyleResolverForElement};
use crate::stylist::RuleInclusion;
use crate::traversal_flags::TraversalFlags;
use selectors::NthIndexCache; use selectors::NthIndexCache;
use sharing::StyleSharingTarget;
use smallvec::SmallVec; use smallvec::SmallVec;
use style_resolver::{PseudoElementResolution, StyleResolverForElement};
use stylist::RuleInclusion;
use traversal_flags::TraversalFlags;
/// A per-traversal-level chunk of data. This is sent down by the traversal, and /// A per-traversal-level chunk of data. This is sent down by the traversal, and
/// currently only holds the dom depth for the bloom filter. /// currently only holds the dom depth for the bloom filter.
@ -307,7 +307,7 @@ pub fn resolve_style<E>(
where where
E: TElement, E: TElement,
{ {
use style_resolver::StyleResolverForElement; use crate::style_resolver::StyleResolverForElement;
debug_assert!( debug_assert!(
rule_inclusion == RuleInclusion::DefaultOnly || rule_inclusion == RuleInclusion::DefaultOnly ||
@ -406,8 +406,8 @@ pub fn recalc_style_at<E, D, F>(
D: DomTraversal<E>, D: DomTraversal<E>,
F: FnMut(E::ConcreteNode), F: FnMut(E::ConcreteNode),
{ {
use crate::traversal_flags::TraversalFlags;
use std::cmp; use std::cmp;
use traversal_flags::TraversalFlags;
let flags = context.shared.traversal_flags; let flags = context.shared.traversal_flags;
let is_initial_style = !data.has_styles(); let is_initial_style = !data.has_styles();
@ -586,7 +586,7 @@ fn compute_style<E>(
where where
E: TElement, E: TElement,
{ {
use data::RestyleKind::*; use crate::data::RestyleKind::*;
context.thread_local.statistics.elements_styled += 1; context.thread_local.statistics.elements_styled += 1;
let kind = data.restyle_kind(context.shared); let kind = data.restyle_kind(context.shared);
@ -719,9 +719,9 @@ fn notify_paint_worklet<E>(context: &StyleContext<E>, data: &ElementData)
where where
E: TElement, E: TElement,
{ {
use crate::values::generics::image::Image;
use crate::values::Either;
use style_traits::ToCss; use style_traits::ToCss;
use values::generics::image::Image;
use values::Either;
// We speculatively evaluate any paint worklets during styling. // We speculatively evaluate any paint worklets during styling.
// This allows us to run paint worklets in parallel with style and layout. // This allows us to run paint worklets in parallel with style and layout.
@ -811,7 +811,7 @@ fn note_children<E, D, F>(
child_hint |= RestyleHint::RECASCADE_SELF | RestyleHint::RECASCADE_DESCENDANTS; child_hint |= RestyleHint::RECASCADE_SELF | RestyleHint::RECASCADE_DESCENDANTS;
}, },
ChildCascadeRequirement::MustCascadeChildrenIfInheritResetStyle => { ChildCascadeRequirement::MustCascadeChildrenIfInheritResetStyle => {
use properties::computed_value_flags::ComputedValueFlags; use crate::properties::computed_value_flags::ComputedValueFlags;
if child_data if child_data
.styles .styles
.primary() .primary()

View file

@ -4,9 +4,9 @@
//! Various stuff for CSS property use counters. //! Various stuff for CSS property use counters.
use crate::properties::{NonCustomPropertyId, NON_CUSTOM_PROPERTY_ID_COUNT};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI}; use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use properties::{NonCustomPropertyId, NON_CUSTOM_PROPERTY_ID_COUNT};
use std::cell::Cell; use std::cell::Cell;
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]

View file

@ -4,9 +4,9 @@
//! Animated types for CSS colors. //! Animated types for CSS colors.
use values::animated::{Animate, Procedure, ToAnimatedZero}; use crate::values::animated::{Animate, Procedure, ToAnimatedZero};
use values::distance::{ComputeSquaredDistance, SquaredDistance}; use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use values::generics::color::{Color as GenericColor, ComplexColorRatios}; use crate::values::generics::color::{Color as GenericColor, ComplexColorRatios};
/// An animated RGBA color. /// An animated RGBA color.
/// ///

View file

@ -4,16 +4,16 @@
//! Animated types for CSS values related to effects. //! Animated types for CSS values related to effects.
use values::animated::color::Color; use crate::values::animated::color::Color;
use values::computed::length::Length; use crate::values::computed::length::Length;
use crate::values::computed::{Angle, Number};
use crate::values::generics::effects::BoxShadow as GenericBoxShadow;
use crate::values::generics::effects::Filter as GenericFilter;
use crate::values::generics::effects::SimpleShadow as GenericSimpleShadow;
#[cfg(not(feature = "gecko"))]
use crate::values::Impossible;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use values::computed::url::ComputedUrl; 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`. /// An animated value for a single `box-shadow`.
pub type BoxShadow = GenericBoxShadow<Color, Length, Length, Length>; pub type BoxShadow = GenericBoxShadow<Color, Length, Length, Length>;

View file

@ -5,10 +5,10 @@
//! Animation implementation for various font-related types. //! Animation implementation for various font-related types.
use super::{Animate, Procedure, ToAnimatedZero}; use super::{Animate, Procedure, ToAnimatedZero};
use values::computed::font::{FontVariationSettings, FontWeight}; use crate::values::computed::font::{FontVariationSettings, FontWeight};
use values::computed::Number; use crate::values::computed::Number;
use values::distance::{ComputeSquaredDistance, SquaredDistance}; use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use values::generics::font::{FontSettings as GenericFontSettings, FontTag, VariationValue}; use crate::values::generics::font::{FontSettings as GenericFontSettings, FontTag, VariationValue};
impl ToAnimatedZero for FontWeight { impl ToAnimatedZero for FontWeight {
#[inline] #[inline]

View file

@ -5,11 +5,11 @@
//! Animation implementation for various length-related types. //! Animation implementation for various length-related types.
use super::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero}; use super::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
use values::computed::length::{CalcLengthOrPercentage, Length}; use crate::values::computed::length::{CalcLengthOrPercentage, Length};
use values::computed::length::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use crate::values::computed::length::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use values::computed::MaxLength as ComputedMaxLength; use crate::values::computed::MaxLength as ComputedMaxLength;
use values::computed::MozLength as ComputedMozLength; use crate::values::computed::MozLength as ComputedMozLength;
use values::computed::Percentage; use crate::values::computed::Percentage;
/// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc> /// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc>
impl Animate for CalcLengthOrPercentage { impl Animate for CalcLengthOrPercentage {
@ -74,8 +74,8 @@ impl ToAnimatedValue for ComputedMaxLength {
#[inline] #[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self { fn from_animated_value(animated: Self::AnimatedValue) -> Self {
use values::computed::{Length, LengthOrPercentageOrNone, Percentage}; use crate::values::computed::{Length, LengthOrPercentageOrNone, Percentage};
use values::generics::length::MaxLength as GenericMaxLength; use crate::values::generics::length::MaxLength as GenericMaxLength;
match animated { match animated {
GenericMaxLength::LengthOrPercentageOrNone(lopn) => { GenericMaxLength::LengthOrPercentageOrNone(lopn) => {
let result = match lopn { let result = match lopn {
@ -104,8 +104,8 @@ impl ToAnimatedValue for ComputedMozLength {
#[inline] #[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self { fn from_animated_value(animated: Self::AnimatedValue) -> Self {
use values::computed::{Length, LengthOrPercentageOrAuto, Percentage}; use crate::values::computed::{Length, LengthOrPercentageOrAuto, Percentage};
use values::generics::length::MozLength as GenericMozLength; use crate::values::generics::length::MozLength as GenericMozLength;
match animated { match animated {
GenericMozLength::LengthOrPercentageOrAuto(lopa) => { GenericMozLength::LengthOrPercentageOrAuto(lopa) => {
let result = match lopa { let result = match lopa {

View file

@ -9,14 +9,14 @@
//! module's raison d'être is to ultimately contain all these types. //! module's raison d'être is to ultimately contain all these types.
use app_units::Au; use app_units::Au;
use crate::properties::PropertyId;
use crate::values::computed::length::CalcLengthOrPercentage;
use crate::values::computed::url::ComputedUrl;
use crate::values::computed::Angle as ComputedAngle;
use crate::values::computed::BorderCornerRadius as ComputedBorderCornerRadius;
use euclid::{Point2D, Size2D}; use euclid::{Point2D, Size2D};
use properties::PropertyId;
use smallvec::SmallVec; use smallvec::SmallVec;
use std::cmp; use std::cmp;
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 color;
pub mod effects; pub mod effects;

View file

@ -5,13 +5,13 @@
//! Animation implementations for various SVG-related types. //! Animation implementations for various SVG-related types.
use super::{Animate, Procedure, ToAnimatedZero}; use super::{Animate, Procedure, ToAnimatedZero};
use properties::animated_properties::ListAnimation; use crate::properties::animated_properties::ListAnimation;
use values::animated::color::Color as AnimatedColor; use crate::values::animated::color::Color as AnimatedColor;
use values::computed::url::ComputedUrl; use crate::values::computed::url::ComputedUrl;
use values::computed::{LengthOrPercentage, Number, NumberOrPercentage}; use crate::values::computed::{LengthOrPercentage, Number, NumberOrPercentage};
use values::distance::{ComputeSquaredDistance, SquaredDistance}; use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use values::generics::svg::{SVGLength, SVGPaint, SvgLengthOrPercentageOrNumber}; use crate::values::generics::svg::{SVGLength, SVGPaint, SvgLengthOrPercentageOrNumber};
use values::generics::svg::{SVGOpacity, SVGStrokeDashArray}; use crate::values::generics::svg::{SVGOpacity, SVGStrokeDashArray};
/// Animated SVGPaint. /// Animated SVGPaint.
pub type IntermediateSVGPaint = SVGPaint<AnimatedColor, ComputedUrl>; pub type IntermediateSVGPaint = SVGPaint<AnimatedColor, ComputedUrl>;

View file

@ -4,14 +4,14 @@
//! Computed angles. //! Computed angles.
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use crate::values::CSSFloat;
use num_traits::Zero; use num_traits::Zero;
use std::f64::consts::PI; use std::f64::consts::PI;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::ops::Add; use std::ops::Add;
use std::{f32, f64}; use std::{f32, f64};
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
use values::distance::{ComputeSquaredDistance, SquaredDistance};
use values::CSSFloat;
/// A computed angle in degrees. /// A computed angle in degrees.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]

View file

@ -4,13 +4,13 @@
//! Computed types for CSS values related to backgrounds. //! Computed types for CSS values related to backgrounds.
use crate::values::computed::length::NonNegativeLengthOrPercentageOrAuto;
use crate::values::computed::{Context, ToComputedValue};
use crate::values::generics::background::BackgroundSize as GenericBackgroundSize;
use crate::values::specified::background::BackgroundRepeat as SpecifiedBackgroundRepeat;
use crate::values::specified::background::BackgroundRepeatKeyword;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
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;
/// A computed value for the `background-size` property. /// A computed value for the `background-size` property.
pub type BackgroundSize = GenericBackgroundSize<NonNegativeLengthOrPercentageOrAuto>; pub type BackgroundSize = GenericBackgroundSize<NonNegativeLengthOrPercentageOrAuto>;

View file

@ -7,14 +7,14 @@
//! //!
//! [basic-shape]: https://drafts.csswg.org/css-shapes/#typedef-basic-shape //! [basic-shape]: https://drafts.csswg.org/css-shapes/#typedef-basic-shape
use crate::values::computed::url::ComputedUrl;
use crate::values::computed::{Image, LengthOrPercentage};
use crate::values::generics::basic_shape as generic;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
use values::computed::url::ComputedUrl;
use values::computed::{Image, LengthOrPercentage};
use values::generics::basic_shape as generic;
/// A computed alias for FillRule. /// A computed alias for FillRule.
pub use values::generics::basic_shape::FillRule; pub use crate::values::generics::basic_shape::FillRule;
/// A computed clipping shape. /// A computed clipping shape.
pub type ClippingShape = generic::ClippingShape<BasicShape, ComputedUrl>; pub type ClippingShape = generic::ClippingShape<BasicShape, ComputedUrl>;

View file

@ -5,18 +5,18 @@
//! Computed types for CSS values related to borders. //! Computed types for CSS values related to borders.
use app_units::Au; use app_units::Au;
use values::animated::ToAnimatedZero; use crate::values::animated::ToAnimatedZero;
use values::computed::length::{LengthOrPercentage, NonNegativeLength}; use crate::values::computed::length::{LengthOrPercentage, NonNegativeLength};
use values::computed::{Number, NumberOrPercentage}; use crate::values::computed::{Number, NumberOrPercentage};
use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius; use crate::values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
use values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth; use crate::values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth;
use values::generics::border::BorderImageSlice as GenericBorderImageSlice; use crate::values::generics::border::BorderImageSlice as GenericBorderImageSlice;
use values::generics::border::BorderRadius as GenericBorderRadius; use crate::values::generics::border::BorderRadius as GenericBorderRadius;
use values::generics::border::BorderSpacing as GenericBorderSpacing; use crate::values::generics::border::BorderSpacing as GenericBorderSpacing;
use values::generics::rect::Rect; use crate::values::generics::rect::Rect;
use values::generics::size::Size; use crate::values::generics::size::Size;
pub use values::specified::border::BorderImageRepeat; pub use crate::values::specified::border::BorderImageRepeat;
/// A computed value for the `border-image-width` property. /// A computed value for the `border-image-width` property.
pub type BorderImageWidth = Rect<BorderImageSideWidth>; pub type BorderImageWidth = Rect<BorderImageSideWidth>;

View file

@ -4,16 +4,18 @@
//! Computed types for box properties. //! Computed types for box properties.
use values::computed::length::{LengthOrPercentage, NonNegativeLength}; use crate::values::computed::length::{LengthOrPercentage, NonNegativeLength};
use values::computed::{Context, Number, ToComputedValue}; use crate::values::computed::{Context, Number, ToComputedValue};
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount; use crate::values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
use values::generics::box_::Perspective as GenericPerspective; use crate::values::generics::box_::Perspective as GenericPerspective;
use values::generics::box_::VerticalAlign as GenericVerticalAlign; use crate::values::generics::box_::VerticalAlign as GenericVerticalAlign;
use values::specified::box_ as specified; use crate::values::specified::box_ as specified;
pub use values::specified::box_::{AnimationName, Appearance, Contain, Display, OverflowClipBox}; pub use crate::values::specified::box_::{
pub use values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat}; AnimationName, Appearance, Contain, Display, OverflowClipBox,
pub use values::specified::box_::{ };
pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
pub use crate::values::specified::box_::{
OverscrollBehavior, ScrollSnapType, TouchAction, TransitionProperty, WillChange, OverscrollBehavior, ScrollSnapType, TouchAction, TransitionProperty, WillChange,
}; };

View file

@ -4,12 +4,12 @@
//! Computed color values. //! Computed color values.
use crate::values::animated::color::RGBA as AnimatedRGBA;
use crate::values::animated::ToAnimatedValue;
use crate::values::generics::color::Color as GenericColor;
use cssparser::{Color as CSSParserColor, RGBA}; use cssparser::{Color as CSSParserColor, RGBA};
use std::fmt; use std::fmt;
use style_traits::{CssWriter, ToCss}; use style_traits::{CssWriter, ToCss};
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. /// Computed value type for the specified RGBAColor.
pub type RGBAColor = RGBA; pub type RGBAColor = RGBA;

View file

@ -4,8 +4,8 @@
//! Computed types for the column properties. //! Computed types for the column properties.
use values::computed::PositiveInteger; use crate::values::computed::PositiveInteger;
use values::generics::column::ColumnCount as GenericColumnCount; use crate::values::generics::column::ColumnCount as GenericColumnCount;
/// A computed type for `column-count` values. /// A computed type for `column-count` values.
pub type ColumnCount = GenericColumnCount<PositiveInteger>; pub type ColumnCount = GenericColumnCount<PositiveInteger>;

View file

@ -4,10 +4,10 @@
//! Computed values for counter properties //! Computed values for counter properties
use values::computed::url::ComputedImageUrl; use crate::values::computed::url::ComputedImageUrl;
use values::generics::counters as generics; use crate::values::generics::counters as generics;
use values::generics::counters::CounterIncrement as GenericCounterIncrement; use crate::values::generics::counters::CounterIncrement as GenericCounterIncrement;
use values::generics::counters::CounterReset as GenericCounterReset; use crate::values::generics::counters::CounterReset as GenericCounterReset;
/// A computed value for the `counter-increment` property. /// A computed value for the `counter-increment` property.
pub type CounterIncrement = GenericCounterIncrement<i32>; pub type CounterIncrement = GenericCounterIncrement<i32>;

Some files were not shown because too many files have changed in this diff Show more