зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1506391 - `cargo fix --edition`. r=emilio
This commit is contained in:
Родитель
078d2c6545
Коммит
4f9e2bcf36
|
@ -26,7 +26,7 @@ pub use std::collections::hash_set::{IntoIter as SetIntoIter, Iter as SetIter};
|
|||
#[derive(Clone)]
|
||||
pub struct HashMap<K, V, S = RandomState>(StdMap<K, V, S>);
|
||||
|
||||
use FailedAllocationError;
|
||||
use crate::FailedAllocationError;
|
||||
|
||||
impl<K, V, S> Deref for HashMap<K, V, S> {
|
||||
type Target = StdMap<K, V, S>;
|
||||
|
|
|
@ -23,7 +23,7 @@ use std::ops::{Deref, Index};
|
|||
use super::table::BucketState::{Empty, Full};
|
||||
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
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use alloc::{alloc, dealloc};
|
||||
use shim::{Shared, Unique};
|
||||
use crate::alloc::{alloc, dealloc};
|
||||
use crate::shim::{Shared, Unique};
|
||||
use std::cmp;
|
||||
use std::hash::{BuildHasher, Hash, Hasher};
|
||||
use std::marker;
|
||||
|
@ -18,7 +18,7 @@ use std::ops::{Deref, DerefMut};
|
|||
use std::ptr;
|
||||
|
||||
use self::BucketState::*;
|
||||
use FailedAllocationError;
|
||||
use crate::FailedAllocationError;
|
||||
|
||||
/// Integer type used for stored hash values.
|
||||
///
|
||||
|
@ -795,7 +795,7 @@ impl<K, V> RawTable<K, V> {
|
|||
let buffer = alloc(size, alignment);
|
||||
|
||||
if buffer.is_null() {
|
||||
use AllocationInfo;
|
||||
use crate::AllocationInfo;
|
||||
return Err(FailedAllocationError {
|
||||
reason: "out of memory when allocating RawTable",
|
||||
allocation_info: Some(AllocationInfo { size, alignment }),
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::parser::SelectorImpl;
|
||||
use cssparser::ToCss;
|
||||
use parser::SelectorImpl;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
//! is non-trivial. This module encapsulates those details and presents an
|
||||
//! 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 sink::Push;
|
||||
use smallvec::{self, SmallVec};
|
||||
use std::cmp;
|
||||
use std::iter;
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use attr::CaseSensitivity;
|
||||
use bloom::BloomFilter;
|
||||
use nth_index_cache::NthIndexCache;
|
||||
use parser::SelectorImpl;
|
||||
use tree::{Element, OpaqueElement};
|
||||
use crate::attr::CaseSensitivity;
|
||||
use crate::bloom::BloomFilter;
|
||||
use crate::nth_index_cache::NthIndexCache;
|
||||
use crate::parser::SelectorImpl;
|
||||
use crate::tree::{Element, OpaqueElement};
|
||||
|
||||
/// What kind of selector matching mode we should use.
|
||||
///
|
||||
|
|
|
@ -31,6 +31,6 @@ pub mod sink;
|
|||
mod tree;
|
||||
pub mod visitor;
|
||||
|
||||
pub use nth_index_cache::NthIndexCache;
|
||||
pub use parser::{Parser, SelectorImpl, SelectorList};
|
||||
pub use tree::{Element, OpaqueElement};
|
||||
pub use crate::nth_index_cache::NthIndexCache;
|
||||
pub use crate::parser::{Parser, SelectorImpl, SelectorList};
|
||||
pub use crate::tree::{Element, OpaqueElement};
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use attr::{AttrSelectorOperation, NamespaceConstraint, ParsedAttrSelectorOperation};
|
||||
use bloom::{BloomFilter, BLOOM_HASH_MASK};
|
||||
use nth_index_cache::NthIndexCacheInner;
|
||||
use parser::{AncestorHashes, Combinator, Component, LocalName};
|
||||
use parser::{NonTSPseudoClass, Selector, SelectorImpl, SelectorIter, SelectorList};
|
||||
use crate::attr::{AttrSelectorOperation, NamespaceConstraint, ParsedAttrSelectorOperation};
|
||||
use crate::bloom::{BloomFilter, BLOOM_HASH_MASK};
|
||||
use crate::nth_index_cache::NthIndexCacheInner;
|
||||
use crate::parser::{AncestorHashes, Combinator, Component, LocalName};
|
||||
use crate::parser::{NonTSPseudoClass, Selector, SelectorImpl, SelectorIter, SelectorList};
|
||||
use crate::tree::Element;
|
||||
use std::borrow::Borrow;
|
||||
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
|
||||
// positive rate until it has this many selectors in it, then it will
|
||||
|
@ -678,7 +678,7 @@ where
|
|||
element.namespace() == url.borrow()
|
||||
},
|
||||
Component::ExplicitNoNamespace => {
|
||||
let ns = ::parser::namespace_empty_string::<E::Impl>();
|
||||
let ns = crate::parser::namespace_empty_string::<E::Impl>();
|
||||
element.namespace() == ns.borrow()
|
||||
},
|
||||
Component::ID(ref id) => {
|
||||
|
@ -693,7 +693,7 @@ where
|
|||
} => {
|
||||
let is_html = element.is_html_element_in_html_document();
|
||||
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),
|
||||
&AttrSelectorOperation::Exists,
|
||||
)
|
||||
|
@ -710,7 +710,7 @@ where
|
|||
}
|
||||
let is_html = element.is_html_element_in_html_document();
|
||||
element.attr_matches(
|
||||
&NamespaceConstraint::Specific(&::parser::namespace_empty_string::<E::Impl>()),
|
||||
&NamespaceConstraint::Specific(&crate::parser::namespace_empty_string::<E::Impl>()),
|
||||
local_name,
|
||||
&AttrSelectorOperation::WithValue {
|
||||
operator: operator,
|
||||
|
@ -728,7 +728,7 @@ where
|
|||
let namespace = match attr_sel.namespace() {
|
||||
Some(ns) => ns,
|
||||
None => {
|
||||
empty_string = ::parser::namespace_empty_string::<E::Impl>();
|
||||
empty_string = crate::parser::namespace_empty_string::<E::Impl>();
|
||||
NamespaceConstraint::Specific(&empty_string)
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::tree::OpaqueElement;
|
||||
use fxhash::FxHashMap;
|
||||
use tree::OpaqueElement;
|
||||
|
||||
/// A cache to speed up matching of nth-index-like selectors.
|
||||
///
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use attr::{AttrSelectorOperator, AttrSelectorWithOptionalNamespace};
|
||||
use attr::{NamespaceConstraint, ParsedAttrSelectorOperation};
|
||||
use attr::{ParsedCaseSensitivity, SELECTOR_WHITESPACE};
|
||||
use bloom::BLOOM_HASH_MASK;
|
||||
use builder::{SelectorBuilder, SpecificityAndFlags};
|
||||
use context::QuirksMode;
|
||||
use crate::attr::{AttrSelectorOperator, AttrSelectorWithOptionalNamespace};
|
||||
use crate::attr::{NamespaceConstraint, ParsedAttrSelectorOperation};
|
||||
use crate::attr::{ParsedCaseSensitivity, SELECTOR_WHITESPACE};
|
||||
use crate::bloom::BLOOM_HASH_MASK;
|
||||
use crate::builder::{SelectorBuilder, SpecificityAndFlags};
|
||||
use crate::context::QuirksMode;
|
||||
use crate::sink::Push;
|
||||
pub use crate::visitor::{SelectorVisitor, Visit};
|
||||
use cssparser::{parse_nth, serialize_identifier};
|
||||
use cssparser::{BasicParseError, BasicParseErrorKind, ParseError, ParseErrorKind};
|
||||
use cssparser::{CowRcStr, Delimiter, SourceLocation};
|
||||
use cssparser::{CssStringWriter, Parser as CssParser, ToCss, Token};
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use servo_arc::ThinArc;
|
||||
use sink::Push;
|
||||
use smallvec::SmallVec;
|
||||
use std::borrow::{Borrow, Cow};
|
||||
use std::fmt::{self, Debug, Display, Write};
|
||||
use std::iter::Rev;
|
||||
use std::slice;
|
||||
use thin_slice::ThinBoxedSlice;
|
||||
pub use visitor::{SelectorVisitor, Visit};
|
||||
|
||||
/// A trait that represents a pseudo-element.
|
||||
pub trait PseudoElement: Sized + ToCss {
|
||||
|
@ -465,7 +465,7 @@ where
|
|||
let namespace = match attr_selector.namespace() {
|
||||
Some(ns) => ns,
|
||||
None => {
|
||||
empty_string = ::parser::namespace_empty_string::<Impl>();
|
||||
empty_string = crate::parser::namespace_empty_string::<Impl>();
|
||||
NamespaceConstraint::Specific(&empty_string)
|
||||
},
|
||||
};
|
||||
|
@ -2147,9 +2147,9 @@ where
|
|||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
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 parser;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
//! Traits that nodes must implement. Breaks the otherwise-cyclic dependency
|
||||
//! between layout and style.
|
||||
|
||||
use attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use matching::{ElementSelectorFlags, MatchingContext};
|
||||
use parser::SelectorImpl;
|
||||
use crate::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use crate::matching::{ElementSelectorFlags, MatchingContext};
|
||||
use crate::parser::SelectorImpl;
|
||||
use std::fmt::Debug;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use attr::NamespaceConstraint;
|
||||
use parser::{Combinator, Component, SelectorImpl};
|
||||
use crate::attr::NamespaceConstraint;
|
||||
use crate::parser::{Combinator, Component, SelectorImpl};
|
||||
|
||||
/// A trait to visit selector properties.
|
||||
///
|
||||
|
|
|
@ -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> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
use ArcUnionBorrow::*;
|
||||
use crate::ArcUnionBorrow::*;
|
||||
match (self.borrow(), other.borrow()) {
|
||||
(First(x), First(y)) => x == y,
|
||||
(Second(x), Second(y)) => x == y,
|
||||
|
|
|
@ -8,29 +8,29 @@
|
|||
// compile it out so that people remember it exists, thus the cfg'd Sender
|
||||
// import.
|
||||
|
||||
use bezier::Bezier;
|
||||
use context::SharedStyleContext;
|
||||
use dom::{OpaqueNode, TElement};
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use properties::animated_properties::AnimatedProperty;
|
||||
use properties::longhands::animation_direction::computed_value::single_value::T as AnimationDirection;
|
||||
use properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
|
||||
use properties::{self, CascadeMode, ComputedValues, LonghandId};
|
||||
use rule_tree::CascadeLevel;
|
||||
use crate::bezier::Bezier;
|
||||
use crate::context::SharedStyleContext;
|
||||
use crate::dom::{OpaqueNode, TElement};
|
||||
use crate::font_metrics::FontMetricsProvider;
|
||||
use crate::properties::animated_properties::AnimatedProperty;
|
||||
use crate::properties::longhands::animation_direction::computed_value::single_value::T as AnimationDirection;
|
||||
use crate::properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
|
||||
use crate::properties::{self, CascadeMode, ComputedValues, LonghandId};
|
||||
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;
|
||||
#[cfg(feature = "servo")]
|
||||
use servo_channel::Sender;
|
||||
use std::fmt;
|
||||
#[cfg(feature = "gecko")]
|
||||
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.
|
||||
///
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
//! Applicable declarations management.
|
||||
|
||||
use properties::PropertyDeclarationBlock;
|
||||
use rule_tree::{CascadeLevel, ShadowCascadeOrder, StyleSource};
|
||||
use crate::properties::PropertyDeclarationBlock;
|
||||
use crate::rule_tree::{CascadeLevel, ShadowCascadeOrder, StyleSource};
|
||||
use crate::shared_lock::Locked;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::Locked;
|
||||
use smallvec::SmallVec;
|
||||
use std::fmt::{self, Debug};
|
||||
|
||||
|
|
|
@ -7,20 +7,20 @@
|
|||
//! [attr]: https://dom.spec.whatwg.org/#interface-attr
|
||||
|
||||
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 euclid::num::Zero;
|
||||
use num_traits::ToPrimitive;
|
||||
use properties::PropertyDeclarationBlock;
|
||||
use selectors::attr::AttrSelectorOperation;
|
||||
use servo_arc::Arc;
|
||||
use servo_url::ServoUrl;
|
||||
use shared_lock::Locked;
|
||||
use std::str::FromStr;
|
||||
use str::str_join;
|
||||
use str::{read_exponent, read_fraction, HTML_SPACE_CHARACTERS};
|
||||
use str::{read_numbers, split_commas, split_html_space_chars};
|
||||
use values::specified::Length;
|
||||
use {Atom, LocalName, Namespace, Prefix};
|
||||
|
||||
// Duplicated from script::dom::values.
|
||||
const UNSIGNED_LONG_MAX: u32 = 2147483647;
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
//! A set of author stylesheets and their computed representation, such as the
|
||||
//! ones used for ShadowRoot and XBL.
|
||||
|
||||
use context::QuirksMode;
|
||||
use dom::TElement;
|
||||
use crate::context::QuirksMode;
|
||||
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")]
|
||||
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
|
||||
/// ones used for ShadowRoot and XBL.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use values::CSSFloat;
|
||||
use crate::values::CSSFloat;
|
||||
|
||||
const NEWTON_METHOD_ITERATIONS: u8 = 8;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#![deny(missing_docs)]
|
||||
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
use dom::{SendElement, TElement};
|
||||
use crate::dom::{SendElement, TElement};
|
||||
use owning_ref::OwningHandle;
|
||||
use selectors::bloom::BloomFilter;
|
||||
use servo_arc::Arc;
|
||||
|
|
|
@ -4,29 +4,36 @@
|
|||
|
||||
//! The context within which style is calculated.
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
use animation::Animation;
|
||||
use app_units::Au;
|
||||
use bloom::StyleBloom;
|
||||
use data::{EagerPseudoStyles, ElementData};
|
||||
#[cfg(feature = "servo")]
|
||||
use dom::OpaqueNode;
|
||||
use dom::{SendElement, TElement};
|
||||
use crate::animation::Animation;
|
||||
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::TypedScale;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use fxhash::FxHashMap;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::structs;
|
||||
use parallel::{STACK_SAFETY_MARGIN_KB, STYLE_THREAD_STACK_SIZE_KB};
|
||||
#[cfg(feature = "servo")]
|
||||
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::NthIndexCache;
|
||||
use servo_arc::Arc;
|
||||
|
@ -34,8 +41,6 @@ use servo_arc::Arc;
|
|||
use servo_atoms::Atom;
|
||||
#[cfg(feature = "servo")]
|
||||
use servo_channel::Sender;
|
||||
use shared_lock::StylesheetGuards;
|
||||
use sharing::StyleSharingCache;
|
||||
use std::fmt;
|
||||
use std::ops;
|
||||
#[cfg(feature = "servo")]
|
||||
|
@ -44,12 +49,7 @@ use style_traits::CSSPixel;
|
|||
use style_traits::DevicePixel;
|
||||
#[cfg(feature = "servo")]
|
||||
use style_traits::SpeculativePainter;
|
||||
use stylist::Stylist;
|
||||
use thread_state::{self, ThreadState};
|
||||
use time;
|
||||
use timer::Timer;
|
||||
use traversal::DomTraversal;
|
||||
use traversal_flags::TraversalFlags;
|
||||
use uluru::{Entry, LRUCache};
|
||||
|
||||
pub use selectors::matching::QuirksMode;
|
||||
|
|
|
@ -6,22 +6,22 @@
|
|||
//!
|
||||
//! [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::{CowRcStr, Parser, SourceLocation, Token};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::{Parse, ParserContext};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use std::mem;
|
||||
use std::num::Wrapping;
|
||||
use std::ops::Range;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
|
||||
use style_traits::{StyleParseErrorKind, ToCss};
|
||||
use values::specified::Integer;
|
||||
use values::CustomIdent;
|
||||
use Atom;
|
||||
|
||||
/// Parse a counter style name reference.
|
||||
///
|
||||
|
@ -370,7 +370,7 @@ impl Parse for System {
|
|||
"symbolic" => Ok(System::Symbolic),
|
||||
"additive" => Ok(System::Additive),
|
||||
"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 })
|
||||
}
|
||||
"extends" => {
|
||||
|
@ -457,7 +457,7 @@ impl Parse for Negative {
|
|||
) -> Result<Self, ParseError<'i>> {
|
||||
Ok(Negative(
|
||||
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>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input
|
||||
.try(|input| input.expect_ident_matching("auto"))
|
||||
.r#try(|input| input.expect_ident_matching("auto"))
|
||||
.is_ok()
|
||||
{
|
||||
Ok(Ranges(Vec::new()))
|
||||
|
@ -512,7 +512,7 @@ fn parse_bound<'i, 't>(
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> 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));
|
||||
}
|
||||
input.expect_ident_matching("infinite")?;
|
||||
|
@ -556,7 +556,7 @@ impl Parse for Pad {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> 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 pad_with = pad_with.or_else(|_| Symbol::parse(context, input))?;
|
||||
Ok(Pad(min_length, pad_with))
|
||||
|
@ -588,7 +588,7 @@ impl Parse for Symbols {
|
|||
) -> Result<Self, ParseError<'i>> {
|
||||
let mut symbols = Vec::new();
|
||||
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)
|
||||
} else {
|
||||
if symbols.is_empty() {
|
||||
|
@ -640,7 +640,7 @@ impl Parse for AdditiveTuple {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> 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 symbol = symbol.or_else(|_| Symbol::parse(context, input))?;
|
||||
Ok(AdditiveTuple {
|
||||
|
@ -673,7 +673,7 @@ impl Parse for SpeakAs {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let mut is_spell_out = false;
|
||||
let result = input.try(|input| {
|
||||
let result = input.r#try(|input| {
|
||||
let ident = input.expect_ident().map_err(|_| ())?;
|
||||
match_ignore_ascii_case! { &*ident,
|
||||
"auto" => Ok(SpeakAs::Auto),
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
//!
|
||||
//! [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 hash::map::Entry;
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use properties::{CSSWideKeyword, CustomDeclarationValue};
|
||||
use selector_map::{PrecomputedHashMap, PrecomputedHashSet};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use servo_arc::Arc;
|
||||
use smallvec::SmallVec;
|
||||
|
@ -19,7 +20,6 @@ use std::cmp;
|
|||
use std::fmt::{self, Write};
|
||||
use std::hash::Hash;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use Atom;
|
||||
|
||||
/// The environment from which to get `env` function values.
|
||||
///
|
||||
|
@ -553,7 +553,7 @@ fn parse_var_function<'i, 't>(
|
|||
let name = parse_name(&name).map_err(|()| {
|
||||
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)?;
|
||||
}
|
||||
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
|
||||
// browser does that, see https://github.com/w3c/csswg-drafts/issues/3262.
|
||||
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)?;
|
||||
}
|
||||
if let Some(references) = references {
|
||||
|
|
|
@ -4,22 +4,22 @@
|
|||
|
||||
//! Per-node data used in style calculation.
|
||||
|
||||
use context::{SharedStyleContext, StackLimitChecker};
|
||||
use dom::TElement;
|
||||
use invalidation::element::invalidator::InvalidationResult;
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use crate::context::{SharedStyleContext, StackLimitChecker};
|
||||
use crate::dom::TElement;
|
||||
use crate::invalidation::element::invalidator::InvalidationResult;
|
||||
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")]
|
||||
use malloc_size_of::MallocSizeOfOps;
|
||||
use properties::ComputedValues;
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::{PseudoElement, RestyleDamage, EAGER_PSEUDO_COUNT};
|
||||
use selectors::NthIndexCache;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::StylesheetGuards;
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use style_resolver::{PrimaryStyle, ResolvedElementStyles, ResolvedStyle};
|
||||
|
||||
bitflags! {
|
||||
/// Various flags stored on ElementData.
|
||||
|
@ -255,8 +255,8 @@ impl ElementData {
|
|||
return InvalidationResult::empty();
|
||||
}
|
||||
|
||||
use invalidation::element::invalidator::TreeStyleInvalidator;
|
||||
use invalidation::element::state_and_attributes::StateAndAttrInvalidationProcessor;
|
||||
use crate::invalidation::element::invalidator::TreeStyleInvalidator;
|
||||
use crate::invalidation::element::state_and_attributes::StateAndAttrInvalidationProcessor;
|
||||
|
||||
debug!(
|
||||
"invalidate_style_if_needed: {:?}, flags: {:?}, has_snapshot: {}, \
|
||||
|
|
|
@ -7,30 +7,30 @@
|
|||
#![allow(unsafe_code)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
#[cfg(feature = "gecko")]
|
||||
use context::PostAnimationTasks;
|
||||
#[cfg(feature = "gecko")]
|
||||
use context::UpdateAnimationsTasks;
|
||||
use data::ElementData;
|
||||
use element_state::ElementState;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use media_queries::Device;
|
||||
use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock};
|
||||
use selector_parser::{AttrValue, Lang, PseudoElement, SelectorImpl};
|
||||
use crate::applicable_declarations::ApplicableDeclarationBlock;
|
||||
use crate::data::ElementData;
|
||||
use crate::element_state::ElementState;
|
||||
use crate::font_metrics::FontMetricsProvider;
|
||||
use crate::media_queries::Device;
|
||||
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::sink::Push;
|
||||
use selectors::Element as SelectorsElement;
|
||||
use servo_arc::{Arc, ArcBorrow};
|
||||
use shared_lock::Locked;
|
||||
use std::fmt;
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
use std::ops::Deref;
|
||||
use stylist::CascadeData;
|
||||
use traversal_flags::TraversalFlags;
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// An opaque handle to a node, which, unlike UnsafeNode, cannot be transformed
|
||||
/// back into a non-opaque representation. The only safe operation that can be
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
//! Generic implementations of some DOM APIs so they can be shared between Servo
|
||||
//! and Gecko.
|
||||
|
||||
use context::QuirksMode;
|
||||
use dom::{TDocument, TElement, TNode, TShadowRoot};
|
||||
use invalidation::element::invalidator::{DescendantInvalidationLists, Invalidation};
|
||||
use invalidation::element::invalidator::{InvalidationProcessor, InvalidationVector};
|
||||
use crate::context::QuirksMode;
|
||||
use crate::dom::{TDocument, TElement, TNode, TShadowRoot};
|
||||
use crate::invalidation::element::invalidator::{DescendantInvalidationLists, Invalidation};
|
||||
use crate::invalidation::element::invalidator::{InvalidationProcessor, InvalidationVector};
|
||||
use crate::Atom;
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use selectors::matching::{self, MatchingContext, MatchingMode};
|
||||
use selectors::parser::{Combinator, Component, LocalName, SelectorImpl};
|
||||
use selectors::{Element, NthIndexCache, SelectorList};
|
||||
use smallvec::SmallVec;
|
||||
use std::borrow::Borrow;
|
||||
use Atom;
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#dom-element-matches>
|
||||
pub fn element_matches<E>(
|
||||
|
@ -594,7 +594,7 @@ pub fn query_selector<E, Q>(
|
|||
E: TElement,
|
||||
Q: SelectorQuery<E>,
|
||||
{
|
||||
use invalidation::element::invalidator::TreeStyleInvalidator;
|
||||
use crate::invalidation::element::invalidator::TreeStyleInvalidator;
|
||||
|
||||
let quirks_mode = root.owner_doc().quirks_mode();
|
||||
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use context::{PerThreadTraversalStatistics, StyleContext};
|
||||
use context::{ThreadLocalStyleContext, TraversalStatistics};
|
||||
use dom::{SendNode, TElement, TNode};
|
||||
use parallel;
|
||||
use parallel::{DispatchMode, WORK_UNIT_MAX};
|
||||
use crate::context::{PerThreadTraversalStatistics, StyleContext};
|
||||
use crate::context::{ThreadLocalStyleContext, TraversalStatistics};
|
||||
use crate::dom::{SendNode, TElement, TNode};
|
||||
use crate::parallel;
|
||||
use crate::parallel::{DispatchMode, WORK_UNIT_MAX};
|
||||
use crate::scoped_tls::ScopedTLS;
|
||||
use crate::traversal::{DomTraversal, PerLevelTraversalData, PreTraverseToken};
|
||||
use rayon;
|
||||
use scoped_tls::ScopedTLS;
|
||||
use std::collections::VecDeque;
|
||||
use std::mem;
|
||||
use time;
|
||||
use traversal::{DomTraversal, PerLevelTraversalData, PreTraverseToken};
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
fn should_report_statistics() -> bool {
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
|
||||
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 error_reporting::ParseErrorReporter;
|
||||
use media_queries::MediaList;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::SharedRwLock;
|
||||
use std::borrow::Cow;
|
||||
use std::str;
|
||||
use stylesheets::{Origin, Stylesheet, StylesheetLoader, UrlExtraData};
|
||||
|
||||
struct EncodingRs;
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use crate::stylesheets::UrlExtraData;
|
||||
use cssparser::{BasicParseErrorKind, ParseErrorKind, SourceLocation, Token};
|
||||
use std::fmt;
|
||||
use style_traits::ParseError;
|
||||
use stylesheets::UrlExtraData;
|
||||
|
||||
/// Errors that can be encountered while parsing CSS.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -6,29 +6,29 @@
|
|||
//!
|
||||
//! [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")]
|
||||
use cssparser::UnicodeRange;
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::{CowRcStr, SourceLocation};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::{Parse, ParserContext};
|
||||
#[cfg(feature = "gecko")]
|
||||
use properties::longhands::font_language_override;
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::values::SequenceWriter;
|
||||
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
|
||||
use style_traits::{StyleParseErrorKind, ToCss};
|
||||
use 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")]
|
||||
use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings};
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
use values::specified::Angle;
|
||||
|
||||
/// A source for a font-face rule.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
|
@ -118,7 +118,7 @@ macro_rules! impl_range {
|
|||
) -> Result<Self, ParseError<'i>> {
|
||||
let first = $component::parse(context, input)?;
|
||||
let second = input
|
||||
.try(|input| $component::parse(context, input))
|
||||
.r#try(|input| $component::parse(context, input))
|
||||
.unwrap_or_else(|_| first.clone());
|
||||
Ok($range(first, second))
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ impl Parse for FontStyle {
|
|||
GenericFontStyle::Italic => FontStyle::Italic,
|
||||
GenericFontStyle::Oblique(angle) => {
|
||||
let second_angle = input
|
||||
.try(|input| SpecifiedFontStyle::parse_angle(context, input))
|
||||
.r#try(|input| SpecifiedFontStyle::parse_angle(context, input))
|
||||
.unwrap_or_else(|_| angle.clone());
|
||||
|
||||
FontStyle::Oblique(angle, second_angle)
|
||||
|
@ -378,7 +378,7 @@ impl Parse for Source {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Source, ParseError<'i>> {
|
||||
if input
|
||||
.try(|input| input.expect_function_matching("local"))
|
||||
.r#try(|input| input.expect_function_matching("local"))
|
||||
.is_ok()
|
||||
{
|
||||
return input
|
||||
|
@ -390,7 +390,7 @@ impl Parse for Source {
|
|||
|
||||
// Parsing optional format()
|
||||
let format_hints = if input
|
||||
.try(|input| input.expect_function_matching("format"))
|
||||
.r#try(|input| input.expect_function_matching("format"))
|
||||
.is_ok()
|
||||
{
|
||||
input.parse_nested_block(|input| {
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
#![deny(missing_docs)]
|
||||
|
||||
use app_units::Au;
|
||||
use context::SharedStyleContext;
|
||||
use logical_geometry::WritingMode;
|
||||
use media_queries::Device;
|
||||
use properties::style_structs::Font;
|
||||
use Atom;
|
||||
use crate::context::SharedStyleContext;
|
||||
use crate::logical_geometry::WritingMode;
|
||||
use crate::media_queries::Device;
|
||||
use crate::properties::style_structs::Font;
|
||||
use crate::Atom;
|
||||
|
||||
/// Represents the font metrics that style needs from a font to compute the
|
||||
/// value of certain CSS units like `ex`.
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
//! An invalidation processor for style changes due to document state changes.
|
||||
|
||||
use dom::TElement;
|
||||
use element_state::DocumentState;
|
||||
use invalidation::element::invalidator::{DescendantInvalidationLists, InvalidationVector};
|
||||
use invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
|
||||
use invalidation::element::state_and_attributes;
|
||||
use crate::dom::TElement;
|
||||
use crate::element_state::DocumentState;
|
||||
use crate::invalidation::element::invalidator::{DescendantInvalidationLists, InvalidationVector};
|
||||
use crate::invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
|
||||
use crate::invalidation::element::state_and_attributes;
|
||||
use crate::stylist::CascadeData;
|
||||
use selectors::matching::{MatchingContext, MatchingMode, QuirksMode, VisitedHandlingMode};
|
||||
use stylist::CascadeData;
|
||||
|
||||
/// A struct holding the members necessary to invalidate document state
|
||||
/// selectors.
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
//! A wrapper over an element and a snapshot, that allows us to selector-match
|
||||
//! against a past state of the element.
|
||||
|
||||
use dom::TElement;
|
||||
use element_state::ElementState;
|
||||
use selector_parser::{AttrValue, NonTSPseudoClass, PseudoElement, SelectorImpl};
|
||||
use selector_parser::{Snapshot, SnapshotMap};
|
||||
use crate::dom::TElement;
|
||||
use crate::element_state::ElementState;
|
||||
use crate::selector_parser::{AttrValue, NonTSPseudoClass, PseudoElement, SelectorImpl};
|
||||
use crate::selector_parser::{Snapshot, SnapshotMap};
|
||||
use crate::{Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom};
|
||||
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use std::cell::Cell;
|
||||
use std::fmt;
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// In order to compute restyle hints, we perform a selector match against a
|
||||
/// list of partial selectors whose rightmost simple selector may be sensitive
|
||||
|
@ -60,7 +60,7 @@ pub trait ElementSnapshot: Sized {
|
|||
|
||||
/// A callback that should be called for each class of the snapshot. Should
|
||||
/// only be called if `has_attrs()` returns true.
|
||||
fn each_class<F>(&self, F)
|
||||
fn each_class<F>(&self, _: F)
|
||||
where
|
||||
F: FnMut(&Atom);
|
||||
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
|
||||
//! Code for invalidations due to state or attribute changes.
|
||||
|
||||
use context::QuirksMode;
|
||||
use element_state::{DocumentState, ElementState};
|
||||
use crate::context::QuirksMode;
|
||||
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 hashglobe::FailedAllocationError;
|
||||
use selector_map::{MaybeCaseInsensitiveHashMap, SelectorMap, SelectorMapEntry};
|
||||
use selector_parser::SelectorImpl;
|
||||
use selectors::attr::NamespaceConstraint;
|
||||
use selectors::parser::{Combinator, Component};
|
||||
use selectors::parser::{Selector, SelectorIter, Visit};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use smallvec::SmallVec;
|
||||
use {Atom, LocalName, Namespace};
|
||||
|
||||
/// Mapping between (partial) CompoundSelectors (and the combinator to their
|
||||
/// right) and the states and attributes they depend on.
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
//! The struct that takes care of encapsulating all the logic on where and how
|
||||
//! element styles need to be invalidated.
|
||||
|
||||
use context::StackLimitChecker;
|
||||
use dom::{TElement, TNode, TShadowRoot};
|
||||
use selector_parser::SelectorImpl;
|
||||
use crate::context::StackLimitChecker;
|
||||
use crate::dom::{TElement, TNode, TShadowRoot};
|
||||
use crate::selector_parser::SelectorImpl;
|
||||
use selectors::matching::matches_compound_selector_from;
|
||||
use selectors::matching::{CompoundSelectorMatchingResult, MatchingContext};
|
||||
use selectors::parser::{Combinator, Component, Selector};
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
//! Restyle hints: an optimization to avoid unnecessarily matching selectors.
|
||||
|
||||
use crate::traversal_flags::TraversalFlags;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::structs::nsRestyleHint;
|
||||
use traversal_flags::TraversalFlags;
|
||||
|
||||
bitflags! {
|
||||
/// The kind of restyle we need to do for a given element.
|
||||
|
|
|
@ -5,24 +5,24 @@
|
|||
//! An invalidation processor for style changes due to state and attribute
|
||||
//! changes.
|
||||
|
||||
use context::SharedStyleContext;
|
||||
use data::ElementData;
|
||||
use dom::TElement;
|
||||
use element_state::ElementState;
|
||||
use invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
|
||||
use invalidation::element::invalidation_map::*;
|
||||
use invalidation::element::invalidator::{DescendantInvalidationLists, InvalidationVector};
|
||||
use invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use selector_map::SelectorMap;
|
||||
use selector_parser::Snapshot;
|
||||
use crate::context::SharedStyleContext;
|
||||
use crate::data::ElementData;
|
||||
use crate::dom::TElement;
|
||||
use crate::element_state::ElementState;
|
||||
use crate::invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
|
||||
use crate::invalidation::element::invalidation_map::*;
|
||||
use crate::invalidation::element::invalidator::{DescendantInvalidationLists, InvalidationVector};
|
||||
use crate::invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
|
||||
use crate::invalidation::element::restyle_hints::RestyleHint;
|
||||
use crate::selector_map::SelectorMap;
|
||||
use crate::selector_parser::Snapshot;
|
||||
use crate::stylesheets::origin::{Origin, OriginSet};
|
||||
use crate::{Atom, WeakAtom};
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use selectors::matching::matches_selector;
|
||||
use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode};
|
||||
use selectors::NthIndexCache;
|
||||
use smallvec::SmallVec;
|
||||
use stylesheets::origin::{Origin, OriginSet};
|
||||
use {Atom, WeakAtom};
|
||||
|
||||
/// The collector implementation.
|
||||
struct Collector<'a, 'b: 'a, 'selectors: 'a, E>
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
//! 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 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.
|
||||
///
|
||||
|
@ -115,7 +115,7 @@ impl NestedRuleIterationCondition for PotentiallyEffectiveMediaRules {
|
|||
quirks_mode: QuirksMode,
|
||||
rule: &DocumentRule,
|
||||
) -> bool {
|
||||
use stylesheets::EffectiveRules;
|
||||
use crate::stylesheets::EffectiveRules;
|
||||
EffectiveRules::process_document(guard, device, quirks_mode, rule)
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ impl NestedRuleIterationCondition for PotentiallyEffectiveMediaRules {
|
|||
quirks_mode: QuirksMode,
|
||||
rule: &SupportsRule,
|
||||
) -> bool {
|
||||
use stylesheets::EffectiveRules;
|
||||
use crate::stylesheets::EffectiveRules;
|
||||
EffectiveRules::process_supports(guard, device, quirks_mode, rule)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,19 +7,19 @@
|
|||
|
||||
#![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 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::parser::{Component, LocalName, Selector};
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use stylesheets::{CssRule, StylesheetInDocument};
|
||||
use Atom;
|
||||
use CaseSensitivityExt;
|
||||
use LocalName as SelectorLocalName;
|
||||
|
||||
/// A style sheet invalidation represents a kind of element or subtree that may
|
||||
/// need to be restyled. Whether it represents a whole subtree or just a single
|
||||
|
@ -419,7 +419,7 @@ impl StylesheetInvalidationSet {
|
|||
guard: &SharedRwLockReadGuard,
|
||||
device: &Device,
|
||||
) {
|
||||
use stylesheets::CssRule::*;
|
||||
use crate::stylesheets::CssRule::*;
|
||||
debug!("StylesheetInvalidationSet::collect_invalidations_for_rule");
|
||||
debug_assert!(!self.fully_invalid, "Not worth to be here!");
|
||||
|
||||
|
|
|
@ -216,10 +216,10 @@ macro_rules! reexport_computed_values {
|
|||
/// [computed]: https://drafts.csswg.org/css-cascade/#computed
|
||||
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:
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
//! Geometry in flow-relative space.
|
||||
|
||||
use crate::properties::style_structs;
|
||||
use euclid::num::Zero;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use properties::style_structs;
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt::{self, Debug, Error, Formatter};
|
||||
use std::ops::{Add, Sub};
|
||||
|
@ -42,8 +42,8 @@ bitflags!(
|
|||
impl WritingMode {
|
||||
/// Return a WritingMode bitflags from the relevant CSS properties.
|
||||
pub fn new(inheritedbox_style: &style_structs::InheritedBox) -> Self {
|
||||
use properties::longhands::direction::computed_value::T as Direction;
|
||||
use properties::longhands::writing_mode::computed_value::T as SpecifiedWritingMode;
|
||||
use crate::properties::longhands::direction::computed_value::T as Direction;
|
||||
use crate::properties::longhands::writing_mode::computed_value::T as SpecifiedWritingMode;
|
||||
|
||||
let mut flags = WritingMode::empty();
|
||||
|
||||
|
|
|
@ -7,19 +7,19 @@
|
|||
#![allow(unsafe_code)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use context::{ElementCascadeInputs, QuirksMode, SelectorFlagsMap};
|
||||
use context::{SharedStyleContext, StyleContext};
|
||||
use data::ElementData;
|
||||
use dom::TElement;
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::ComputedValues;
|
||||
use rule_tree::{CascadeLevel, StrongRuleNode};
|
||||
use selector_parser::{PseudoElement, RestyleDamage};
|
||||
use crate::context::{ElementCascadeInputs, QuirksMode, SelectorFlagsMap};
|
||||
use crate::context::{SharedStyleContext, StyleContext};
|
||||
use crate::data::ElementData;
|
||||
use crate::dom::TElement;
|
||||
use crate::invalidation::element::restyle_hints::RestyleHint;
|
||||
use crate::properties::longhands::display::computed_value::T as Display;
|
||||
use crate::properties::ComputedValues;
|
||||
use crate::rule_tree::{CascadeLevel, StrongRuleNode};
|
||||
use crate::selector_parser::{PseudoElement, RestyleDamage};
|
||||
use crate::style_resolver::ResolvedElementStyles;
|
||||
use crate::traversal_flags::TraversalFlags;
|
||||
use selectors::matching::ElementSelectorFlags;
|
||||
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.
|
||||
#[derive(Debug)]
|
||||
|
@ -93,8 +93,8 @@ trait PrivateMatchMethods: TElement {
|
|||
cascade_visited: CascadeVisitedMode,
|
||||
cascade_inputs: &mut ElementCascadeInputs,
|
||||
) -> bool {
|
||||
use properties::PropertyDeclarationBlock;
|
||||
use shared_lock::Locked;
|
||||
use crate::properties::PropertyDeclarationBlock;
|
||||
use crate::shared_lock::Locked;
|
||||
|
||||
debug_assert!(
|
||||
replacements.intersects(RestyleHint::replacements()) &&
|
||||
|
@ -419,8 +419,8 @@ trait PrivateMatchMethods: TElement {
|
|||
_restyle_hint: RestyleHint,
|
||||
_important_rules_changed: bool,
|
||||
) {
|
||||
use animation;
|
||||
use dom::TNode;
|
||||
use crate::animation;
|
||||
use crate::dom::TNode;
|
||||
|
||||
let mut possibly_expired_animations = vec![];
|
||||
let shared_context = context.shared;
|
||||
|
@ -583,11 +583,11 @@ trait PrivateMatchMethods: TElement {
|
|||
&self,
|
||||
context: &SharedStyleContext,
|
||||
style: &mut Arc<ComputedValues>,
|
||||
possibly_expired_animations: &mut Vec<::animation::PropertyAnimation>,
|
||||
font_metrics: &::font_metrics::FontMetricsProvider,
|
||||
possibly_expired_animations: &mut Vec<crate::animation::PropertyAnimation>,
|
||||
font_metrics: &crate::font_metrics::FontMetricsProvider,
|
||||
) {
|
||||
use animation::{self, Animation, AnimationUpdate};
|
||||
use dom::TNode;
|
||||
use crate::animation::{self, Animation, AnimationUpdate};
|
||||
use crate::dom::TNode;
|
||||
|
||||
// Finish any expired transitions.
|
||||
let this_opaque = self.as_node().opaque();
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
//! https://drafts.csswg.org/mediaqueries-4/#typedef-media-condition
|
||||
|
||||
use super::{Device, MediaFeatureExpression};
|
||||
use context::QuirksMode;
|
||||
use crate::context::QuirksMode;
|
||||
use crate::parser::ParserContext;
|
||||
use cssparser::{Parser, Token};
|
||||
use parser::ParserContext;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
|
||||
|
@ -114,7 +114,7 @@ impl MediaCondition {
|
|||
|
||||
// ParenthesisBlock.
|
||||
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,
|
||||
Err(..) => return Ok(first_condition),
|
||||
};
|
||||
|
@ -133,7 +133,7 @@ impl MediaCondition {
|
|||
};
|
||||
|
||||
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(
|
||||
conditions.into_boxed_slice(),
|
||||
operator,
|
||||
|
@ -159,7 +159,7 @@ impl MediaCondition {
|
|||
) -> Result<Self, ParseError<'i>> {
|
||||
input.parse_nested_block(|input| {
|
||||
// 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)));
|
||||
}
|
||||
let expr = MediaFeatureExpression::parse_in_parenthesis_block(context, input)?;
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
|
||||
use super::media_feature_expression::{AspectRatio, RangeOrOperator};
|
||||
use super::Device;
|
||||
use crate::parser::ParserContext;
|
||||
use crate::values::computed::{CSSPixelLength, Resolution};
|
||||
use crate::Atom;
|
||||
use cssparser::Parser;
|
||||
use parser::ParserContext;
|
||||
use std::fmt;
|
||||
use style_traits::ParseError;
|
||||
use values::computed::{CSSPixelLength, Resolution};
|
||||
use Atom;
|
||||
|
||||
/// A generic discriminant for an enum value.
|
||||
pub type KeywordDiscriminant = u8;
|
||||
|
|
|
@ -8,21 +8,21 @@
|
|||
use super::media_feature::{Evaluator, MediaFeatureDescription};
|
||||
use super::media_feature::{KeywordDiscriminant, ParsingRequirements};
|
||||
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};
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::structs;
|
||||
use num_traits::Zero;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::cmp::{Ordering, PartialOrd};
|
||||
use std::fmt::{self, Write};
|
||||
use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::Origin;
|
||||
use values::computed::{self, ToComputedValue};
|
||||
use values::specified::{Integer, Length, Number, Resolution};
|
||||
use values::{serialize_atom_identifier, CSSFloat};
|
||||
use Atom;
|
||||
|
||||
/// An aspect ratio, with a numerator and denominator.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
|
@ -221,14 +221,14 @@ fn consume_operation_or_colon(input: &mut Parser) -> Result<Option<Operator>, ()
|
|||
Ok(Some(match first_delim {
|
||||
'=' => Operator::Equal,
|
||||
'>' => {
|
||||
if input.try(|i| i.expect_delim('=')).is_ok() {
|
||||
if input.r#try(|i| i.expect_delim('=')).is_ok() {
|
||||
Operator::GreaterThanEqual
|
||||
} else {
|
||||
Operator::GreaterThan
|
||||
}
|
||||
},
|
||||
'<' => {
|
||||
if input.try(|i| i.expect_delim('=')).is_ok() {
|
||||
if input.r#try(|i| i.expect_delim('=')).is_ok() {
|
||||
Operator::LessThanEqual
|
||||
} else {
|
||||
Operator::LessThan
|
||||
|
@ -270,10 +270,10 @@ impl MediaFeatureExpression {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
#[cfg(feature = "servo")]
|
||||
use crate::servo::media_queries::MEDIA_FEATURES;
|
||||
#[cfg(feature = "gecko")]
|
||||
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
|
||||
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 {
|
||||
Err(..) => {
|
||||
// If there's no colon, this is a media query of the
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query-list
|
||||
|
||||
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::{ParserInput, Token};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::ParserContext;
|
||||
|
||||
/// A type that encapsulates a media query list.
|
||||
#[css(comma, derive_debug)]
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query
|
||||
|
||||
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 parser::ParserContext;
|
||||
use std::fmt::{self, Write};
|
||||
use str::string_as_ascii_lowercase;
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use values::CustomIdent;
|
||||
use Atom;
|
||||
|
||||
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
|
@ -125,8 +125,8 @@ impl MediaQuery {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let (qualifier, explicit_media_type) = input
|
||||
.try(|input| -> Result<_, ()> {
|
||||
let qualifier = input.try(Qualifier::parse).ok();
|
||||
.r#try(|input| -> Result<_, ()> {
|
||||
let qualifier = input.r#try(Qualifier::parse).ok();
|
||||
let ident = input.expect_ident().map_err(|_| ())?;
|
||||
let media_type = MediaQueryType::parse(&ident)?;
|
||||
Ok((qualifier, Some(media_type)))
|
||||
|
@ -135,7 +135,7 @@ impl MediaQuery {
|
|||
|
||||
let condition = if explicit_media_type.is_none() {
|
||||
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)?)
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -18,7 +18,7 @@ pub use self::media_feature_expression::MediaFeatureExpression;
|
|||
pub use self::media_list::MediaList;
|
||||
pub use self::media_query::{MediaQuery, MediaQueryType, MediaType, Qualifier};
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use crate::servo::media_queries::Device;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko::media_queries::Device;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo::media_queries::Device;
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
#![deny(missing_docs)]
|
||||
|
||||
use arrayvec::ArrayVec;
|
||||
use context::{StyleContext, ThreadLocalStyleContext};
|
||||
use dom::{OpaqueNode, SendNode, TElement};
|
||||
use crate::context::{StyleContext, ThreadLocalStyleContext};
|
||||
use crate::dom::{OpaqueNode, SendNode, TElement};
|
||||
use crate::scoped_tls::ScopedTLS;
|
||||
use crate::traversal::{DomTraversal, PerLevelTraversalData};
|
||||
use itertools::Itertools;
|
||||
use rayon;
|
||||
use scoped_tls::ScopedTLS;
|
||||
use smallvec::SmallVec;
|
||||
use traversal::{DomTraversal, PerLevelTraversalData};
|
||||
|
||||
/// The minimum stack size for a thread in the styling pool, in kilobytes.
|
||||
pub const STYLE_THREAD_STACK_SIZE_KB: usize = 256;
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
//! 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 error_reporting::{ContextualParseError, ParseErrorReporter};
|
||||
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.
|
||||
#[cfg(feature = "gecko")]
|
||||
|
|
|
@ -4,27 +4,27 @@
|
|||
|
||||
//! The main cascading algorithm of the style system.
|
||||
|
||||
use context::QuirksMode;
|
||||
use custom_properties::CustomPropertiesBuilder;
|
||||
use dom::TElement;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use logical_geometry::WritingMode;
|
||||
use media_queries::Device;
|
||||
use properties::{ComputedValues, StyleBuilder};
|
||||
use properties::{LonghandId, LonghandIdSet};
|
||||
use properties::{PropertyDeclaration, PropertyDeclarationId, DeclarationImportanceIterator};
|
||||
use properties::CASCADE_PROPERTY;
|
||||
use rule_cache::{RuleCache, RuleCacheConditions};
|
||||
use rule_tree::{CascadeLevel, StrongRuleNode};
|
||||
use selector_parser::PseudoElement;
|
||||
use crate::context::QuirksMode;
|
||||
use crate::custom_properties::CustomPropertiesBuilder;
|
||||
use crate::dom::TElement;
|
||||
use crate::font_metrics::FontMetricsProvider;
|
||||
use crate::logical_geometry::WritingMode;
|
||||
use crate::media_queries::Device;
|
||||
use crate::properties::{ComputedValues, StyleBuilder};
|
||||
use crate::properties::{LonghandId, LonghandIdSet};
|
||||
use crate::properties::{PropertyDeclaration, PropertyDeclarationId, DeclarationImportanceIterator};
|
||||
use crate::properties::CASCADE_PROPERTY;
|
||||
use crate::rule_cache::{RuleCache, RuleCacheConditions};
|
||||
use crate::rule_tree::{CascadeLevel, StrongRuleNode};
|
||||
use crate::selector_parser::PseudoElement;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::StylesheetGuards;
|
||||
use crate::shared_lock::StylesheetGuards;
|
||||
use smallbitvec::SmallBitVec;
|
||||
use smallvec::SmallVec;
|
||||
use std::borrow::Cow;
|
||||
use std::cell::RefCell;
|
||||
use style_adjuster::StyleAdjuster;
|
||||
use values::computed;
|
||||
use crate::style_adjuster::StyleAdjuster;
|
||||
use crate::values::computed;
|
||||
|
||||
/// We split the cascade in two phases: 'early' properties, and 'late'
|
||||
/// properties.
|
||||
|
|
|
@ -6,25 +6,25 @@
|
|||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use context::QuirksMode;
|
||||
use crate::context::QuirksMode;
|
||||
use cssparser::{DeclarationListParser, parse_important, ParserInput, CowRcStr};
|
||||
use cssparser::{Parser, AtRuleParser, DeclarationParser, Delimiter, ParseErrorKind};
|
||||
use custom_properties::{CustomPropertiesBuilder, CssEnvironment};
|
||||
use error_reporting::{ParseErrorReporter, ContextualParseError};
|
||||
use crate::custom_properties::{CustomPropertiesBuilder, CssEnvironment};
|
||||
use crate::error_reporting::{ParseErrorReporter, ContextualParseError};
|
||||
use itertools::Itertools;
|
||||
use parser::ParserContext;
|
||||
use properties::animated_properties::{AnimationValue, AnimationValueMap};
|
||||
use shared_lock::Locked;
|
||||
use crate::parser::ParserContext;
|
||||
use crate::properties::animated_properties::{AnimationValue, AnimationValueMap};
|
||||
use crate::shared_lock::Locked;
|
||||
use smallbitvec::{self, SmallBitVec};
|
||||
use smallvec::SmallVec;
|
||||
use std::fmt::{self, Write};
|
||||
use std::iter::{DoubleEndedIterator, Zip};
|
||||
use std::slice::Iter;
|
||||
use str::{CssString, CssStringBorrow, CssStringWriter};
|
||||
use crate::str::{CssString, CssStringBorrow, CssStringWriter};
|
||||
use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
use crate::stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
use super::*;
|
||||
use values::computed::Context;
|
||||
use crate::values::computed::Context;
|
||||
|
||||
/// The animation rules.
|
||||
///
|
||||
|
@ -144,7 +144,7 @@ pub struct AnimationValueIterator<'a, 'cx, 'cx_a:'cx> {
|
|||
context: &'cx mut Context<'cx_a>,
|
||||
default_values: &'a ComputedValues,
|
||||
/// 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> {
|
||||
|
@ -152,7 +152,7 @@ impl<'a, 'cx, 'cx_a:'cx> AnimationValueIterator<'a, 'cx, 'cx_a> {
|
|||
declarations: &'a PropertyDeclarationBlock,
|
||||
context: &'cx mut Context<'cx_a>,
|
||||
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 {
|
||||
iter: declarations.declaration_importance_iter(),
|
||||
|
@ -258,7 +258,7 @@ impl PropertyDeclarationBlock {
|
|||
&'a self,
|
||||
context: &'cx mut Context<'cx_a>,
|
||||
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::new(self, context, default_values, extra_custom_properties)
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ impl PropertyDeclarationBlock {
|
|||
//
|
||||
// TODO(emilio): Unship.
|
||||
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 display::should_ignore_parsed_value(old_display, new_display) {
|
||||
|
@ -841,7 +841,7 @@ impl PropertyDeclarationBlock {
|
|||
pub fn cascade_custom_properties_with_context(
|
||||
&self,
|
||||
context: &Context,
|
||||
) -> Option<Arc<::custom_properties::CustomPropertiesMap>> {
|
||||
) -> Option<Arc<crate::custom_properties::CustomPropertiesMap>> {
|
||||
self.cascade_custom_properties(
|
||||
context.style().custom_properties(),
|
||||
context.device().environment(),
|
||||
|
@ -853,9 +853,9 @@ impl PropertyDeclarationBlock {
|
|||
/// properties.
|
||||
fn cascade_custom_properties(
|
||||
&self,
|
||||
inherited_custom_properties: Option<&Arc<::custom_properties::CustomPropertiesMap>>,
|
||||
inherited_custom_properties: Option<&Arc<crate::custom_properties::CustomPropertiesMap>>,
|
||||
environment: &CssEnvironment,
|
||||
) -> Option<Arc<::custom_properties::CustomPropertiesMap>> {
|
||||
) -> Option<Arc<crate::custom_properties::CustomPropertiesMap>> {
|
||||
let mut builder = CustomPropertiesBuilder::new(
|
||||
inherited_custom_properties,
|
||||
environment,
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
//! A cache from rule node to computed values, in order to cache reset
|
||||
//! 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 logical_geometry::WritingMode;
|
||||
use properties::{ComputedValues, StyleBuilder};
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::PseudoElement;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::StylesheetGuards;
|
||||
use smallvec::SmallVec;
|
||||
use values::computed::NonNegativeLength;
|
||||
|
||||
/// The conditions for caching and matching a style in the rule cache.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
|
|
|
@ -6,21 +6,21 @@
|
|||
|
||||
//! 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")]
|
||||
use gecko::selector_parser::PseudoElement;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
|
||||
use servo_arc::{Arc, ArcBorrow, ArcUnion, ArcUnionBorrow};
|
||||
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
|
||||
use smallvec::SmallVec;
|
||||
use std::io::{self, Write};
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
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
|
||||
/// matching.
|
||||
|
@ -1149,7 +1149,7 @@ impl StrongRuleNode {
|
|||
|
||||
unsafe fn assert_free_list_has_no_duplicates_or_null(&self) {
|
||||
assert!(cfg!(debug_assertions), "This is an expensive check!");
|
||||
use hash::FxHashSet;
|
||||
use crate::hash::FxHashSet;
|
||||
|
||||
let me = &*self.ptr();
|
||||
assert!(me.is_root());
|
||||
|
@ -1430,7 +1430,7 @@ impl StrongRuleNode {
|
|||
&self,
|
||||
guards: &StylesheetGuards,
|
||||
) -> (LonghandIdSet, bool) {
|
||||
use properties::PropertyDeclarationId;
|
||||
use crate::properties::PropertyDeclarationId;
|
||||
|
||||
// We want to iterate over cascade levels that override the animations
|
||||
// level, i.e. !important levels and the transitions level.
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
//! A data structure to efficiently index structs containing selectors by local
|
||||
//! name, ids and hash.
|
||||
|
||||
use applicable_declarations::ApplicableDeclarationList;
|
||||
use context::QuirksMode;
|
||||
use dom::TElement;
|
||||
use crate::applicable_declarations::ApplicableDeclarationList;
|
||||
use crate::context::QuirksMode;
|
||||
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 hash::map as hash_map;
|
||||
use hash::{HashMap, HashSet};
|
||||
use hashglobe::FailedAllocationError;
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use rule_tree::{CascadeLevel, ShadowCascadeOrder};
|
||||
use selector_parser::SelectorImpl;
|
||||
use selectors::matching::{matches_selector, ElementSelectorFlags, MatchingContext};
|
||||
use selectors::parser::{Combinator, Component, SelectorIter};
|
||||
use smallvec::SmallVec;
|
||||
use std::hash::{BuildHasherDefault, Hash, Hasher};
|
||||
use stylist::Rule;
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// A hasher implementation that doesn't hash anything, because it expects its
|
||||
/// input to be a suitable u32 hash.
|
||||
|
|
|
@ -6,33 +6,33 @@
|
|||
|
||||
#![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 element_state::ElementState;
|
||||
use selectors::parser::SelectorList;
|
||||
use std::fmt::{self, Debug, Write};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use stylesheets::{Namespaces, Origin, UrlExtraData};
|
||||
use values::serialize_atom_identifier;
|
||||
use Atom;
|
||||
|
||||
/// A convenient alias for the type that represents an attribute value used for
|
||||
/// selector parser implementation.
|
||||
pub type AttrValue = <SelectorImpl as ::selectors::SelectorImpl>::AttrValue;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo::selector_parser::*;
|
||||
pub use crate::servo::selector_parser::*;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko::selector_parser::*;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo::selector_parser::ServoElementSnapshot as Snapshot;
|
||||
pub use crate::servo::selector_parser::ServoElementSnapshot as Snapshot;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko::snapshot::GeckoElementSnapshot as Snapshot;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo::restyle_damage::ServoRestyleDamage as RestyleDamage;
|
||||
pub use crate::servo::restyle_damage::ServoRestyleDamage as RestyleDamage;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko::restyle_damage::GeckoRestyleDamage as RestyleDamage;
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
//! Servo's media-query device and expression representation.
|
||||
|
||||
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 custom_properties::CssEnvironment;
|
||||
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 style_traits::viewport::ViewportConstraints;
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use values::computed::font::FontSize;
|
||||
use values::computed::CSSPixelLength;
|
||||
use values::KeyframesName;
|
||||
|
||||
/// A device is a structure that represents the current media a given document
|
||||
/// is displayed in.
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
//! The restyle damage is a hint that tells layout which kind of operations may
|
||||
//! be needed in presence of incremental style changes.
|
||||
|
||||
use computed_values::display::T as Display;
|
||||
use matching::{StyleChange, StyleDifference};
|
||||
use properties::ComputedValues;
|
||||
use crate::computed_values::display::T as Display;
|
||||
use crate::matching::{StyleChange, StyleDifference};
|
||||
use crate::properties::ComputedValues;
|
||||
use std::fmt;
|
||||
|
||||
bitflags! {
|
||||
|
|
|
@ -6,16 +6,19 @@
|
|||
|
||||
//! 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 dom::{OpaqueNode, TElement, TNode};
|
||||
use element_state::{DocumentState, ElementState};
|
||||
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::parser::{SelectorParseErrorKind, Visit};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
|
@ -23,7 +26,6 @@ use std::fmt;
|
|||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, Prefix};
|
||||
|
||||
/// A pseudo-element, both public and private.
|
||||
///
|
||||
|
@ -349,7 +351,7 @@ impl NonTSPseudoClass {
|
|||
/// selector matching, and it's set from the DOM.
|
||||
pub fn state_flag(&self) -> ElementState {
|
||||
use self::NonTSPseudoClass::*;
|
||||
use element_state::ElementState;
|
||||
use crate::element_state::ElementState;
|
||||
match *self {
|
||||
Active => ElementState::IN_ACTIVE_STATE,
|
||||
Focus => ElementState::IN_FOCUS_STATE,
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
|
||||
//! Common handling for the specified value CSS url() values.
|
||||
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use servo_url::ServoUrl;
|
||||
use std::fmt::{self, Write};
|
||||
// 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
|
||||
// the threshold.
|
||||
use crate::values::computed::{Context, ToComputedValue};
|
||||
use std::sync::Arc;
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
|
||||
/// A CSS url() value for servo.
|
||||
///
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#[cfg(feature = "gecko")]
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use crate::str::{CssString, CssStringWriter};
|
||||
use crate::stylesheets::Origin;
|
||||
#[cfg(feature = "servo")]
|
||||
use parking_lot::RwLock;
|
||||
use servo_arc::Arc;
|
||||
|
@ -15,8 +17,6 @@ use std::fmt;
|
|||
use std::mem;
|
||||
#[cfg(feature = "gecko")]
|
||||
use std::ptr;
|
||||
use str::{CssString, CssStringWriter};
|
||||
use stylesheets::Origin;
|
||||
|
||||
/// A shared read/write lock that can protect multiple objects.
|
||||
///
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
//! quickly whether it's worth to share style, and whether two different
|
||||
//! elements can indeed share the same style.
|
||||
|
||||
use bloom::StyleBloom;
|
||||
use context::{SelectorFlagsMap, SharedStyleContext};
|
||||
use dom::TElement;
|
||||
use crate::bloom::StyleBloom;
|
||||
use crate::context::{SelectorFlagsMap, SharedStyleContext};
|
||||
use crate::dom::TElement;
|
||||
use crate::sharing::{StyleSharingCandidate, StyleSharingTarget};
|
||||
use selectors::NthIndexCache;
|
||||
use sharing::{StyleSharingCandidate, StyleSharingTarget};
|
||||
|
||||
/// Determines whether a target and a candidate have compatible parents for
|
||||
/// sharing.
|
||||
|
|
|
@ -64,15 +64,18 @@
|
|||
//! selectors are effectively stripped off, so that matching them all against
|
||||
//! elements makes sense.
|
||||
|
||||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
use bloom::StyleBloom;
|
||||
use context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
|
||||
use dom::{SendElement, TElement};
|
||||
use matching::MatchMethods;
|
||||
use crate::applicable_declarations::ApplicableDeclarationBlock;
|
||||
use crate::bloom::StyleBloom;
|
||||
use crate::context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
|
||||
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 properties::ComputedValues;
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
|
||||
use selectors::NthIndexCache;
|
||||
use servo_arc::Arc;
|
||||
|
@ -82,10 +85,7 @@ use std::marker::PhantomData;
|
|||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
use std::ptr::NonNull;
|
||||
use style_resolver::{PrimaryStyle, ResolvedElementStyles};
|
||||
use stylist::Stylist;
|
||||
use uluru::{Entry, LRUCache};
|
||||
use Atom;
|
||||
|
||||
mod checks;
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
//! a computed style needs in order for it to adhere to the CSS spec.
|
||||
|
||||
use app_units::Au;
|
||||
use dom::TElement;
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::longhands::float::computed_value::T as Float;
|
||||
use properties::longhands::overflow_x::computed_value::T as Overflow;
|
||||
use properties::longhands::position::computed_value::T as Position;
|
||||
use properties::{self, ComputedValues, StyleBuilder};
|
||||
use crate::dom::TElement;
|
||||
use crate::properties::computed_value_flags::ComputedValueFlags;
|
||||
use crate::properties::longhands::display::computed_value::T as Display;
|
||||
use crate::properties::longhands::float::computed_value::T as Float;
|
||||
use crate::properties::longhands::overflow_x::computed_value::T as Overflow;
|
||||
use crate::properties::longhands::position::computed_value::T as Position;
|
||||
use crate::properties::{self, ComputedValues, StyleBuilder};
|
||||
|
||||
/// 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
|
||||
#[cfg(feature = "servo")]
|
||||
fn adjust_for_alignment(&mut self, layout_parent_style: &ComputedValues) {
|
||||
use computed_values::align_items::T as AlignItems;
|
||||
use computed_values::align_self::T as AlignSelf;
|
||||
use crate::computed_values::align_items::T as AlignItems;
|
||||
use crate::computed_values::align_self::T as AlignSelf;
|
||||
|
||||
if self.style.get_position().clone_align_self() == AlignSelf::Auto &&
|
||||
!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.
|
||||
#[cfg(feature = "servo")]
|
||||
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);
|
||||
if self.style.get_inherited_text().text_decorations_in_effect != decorations_in_effect {
|
||||
|
|
|
@ -4,21 +4,21 @@
|
|||
|
||||
//! Style resolution for a given element or pseudo-element.
|
||||
|
||||
use applicable_declarations::ApplicableDeclarationList;
|
||||
use context::{CascadeInputs, ElementCascadeInputs, StyleContext};
|
||||
use data::{EagerPseudoStyles, ElementStyles};
|
||||
use dom::TElement;
|
||||
use crate::applicable_declarations::ApplicableDeclarationList;
|
||||
use crate::context::{CascadeInputs, ElementCascadeInputs, StyleContext};
|
||||
use crate::data::{EagerPseudoStyles, ElementStyles};
|
||||
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 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::{
|
||||
ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode,
|
||||
};
|
||||
use servo_arc::Arc;
|
||||
use stylist::RuleInclusion;
|
||||
|
||||
/// Whether pseudo-elements should be resolved or not.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
|
@ -111,7 +111,7 @@ fn eager_pseudo_is_definitely_not_generated(
|
|||
pseudo: &PseudoElement,
|
||||
style: &ComputedValues,
|
||||
) -> bool {
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
use crate::properties::computed_value_flags::ComputedValueFlags;
|
||||
|
||||
if !pseudo.is_before_or_after() {
|
||||
return false;
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
//! A centralized set of stylesheets for a document.
|
||||
|
||||
use dom::TElement;
|
||||
use invalidation::stylesheets::StylesheetInvalidationSet;
|
||||
use media_queries::Device;
|
||||
use selector_parser::SnapshotMap;
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use crate::dom::TElement;
|
||||
use crate::invalidation::stylesheets::StylesheetInvalidationSet;
|
||||
use crate::media_queries::Device;
|
||||
use crate::selector_parser::SnapshotMap;
|
||||
use crate::shared_lock::SharedRwLockReadGuard;
|
||||
use crate::stylesheets::{Origin, OriginSet, OriginSetIterator, PerOrigin, StylesheetInDocument};
|
||||
use std::{mem, slice};
|
||||
use stylesheets::{Origin, OriginSet, OriginSetIterator, PerOrigin, StylesheetInDocument};
|
||||
|
||||
/// Entry for a StylesheetSet.
|
||||
#[derive(MallocSizeOf)]
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
#![allow(missing_docs)]
|
||||
|
||||
pub use counter_style::CounterStyleRuleData as CounterStyleRule;
|
||||
pub use crate::counter_style::CounterStyleRuleData as CounterStyleRule;
|
||||
|
|
|
@ -6,19 +6,19 @@
|
|||
//! initially in CSS Conditional Rules Module Level 3, @document has been postponed to the level 4.
|
||||
//! 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};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use media_queries::Device;
|
||||
use parser::{Parse, ParserContext};
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::CssRules;
|
||||
use values::CssUrl;
|
||||
|
||||
#[derive(Debug)]
|
||||
/// A @-moz-document rule
|
||||
|
@ -135,7 +135,7 @@ impl DocumentMatchingFunction {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> 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));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
#![allow(missing_docs)]
|
||||
|
||||
pub use font_face::FontFaceRuleData as FontFaceRule;
|
||||
pub use crate::font_face::FontFaceRuleData as FontFaceRule;
|
||||
|
|
|
@ -6,23 +6,23 @@
|
|||
//!
|
||||
//! [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::{DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, Token};
|
||||
use error_reporting::ContextualParseError;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::bindings::Gecko_AppendFeatureValueHashEntry;
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::structs::{self, gfxFontFeatureValueSet, nsTArray};
|
||||
use parser::{Parse, ParserContext};
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::CssRuleType;
|
||||
use values::computed::font::FamilyName;
|
||||
use values::serialize_atom_identifier;
|
||||
use Atom;
|
||||
|
||||
/// A @font-feature-values block declaration.
|
||||
/// It is `<ident>: <integer>+`.
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
//!
|
||||
//! [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 media_queries::MediaList;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use stylesheets::{CssRule, Origin, StylesheetInDocument};
|
||||
use values::CssUrl;
|
||||
|
||||
/// With asynchronous stylesheet parsing, we can't synchronously create a
|
||||
/// GeckoStyleSheet. So we use this placeholder instead.
|
||||
|
@ -124,7 +124,7 @@ impl StylesheetInDocument for ImportSheet {
|
|||
/// A sheet that is held from an import rule.
|
||||
#[cfg(feature = "servo")]
|
||||
#[derive(Debug)]
|
||||
pub struct ImportSheet(pub ::servo_arc::Arc<::stylesheets::Stylesheet>);
|
||||
pub struct ImportSheet(pub ::servo_arc::Arc<crate::stylesheets::Stylesheet>);
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
impl StylesheetInDocument for ImportSheet {
|
||||
|
|
|
@ -4,24 +4,24 @@
|
|||
|
||||
//! 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::{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 shared_lock::{DeepCloneParams, DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard};
|
||||
use shared_lock::{Locked, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::rule_parser::VendorPrefix;
|
||||
use stylesheets::{CssRuleType, StylesheetContents};
|
||||
use values::{serialize_percentage, KeyframesName};
|
||||
|
||||
/// A [`@keyframes`][keyframes] rule.
|
||||
///
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
//! The stylesheet loader is the abstraction used to trigger network requests
|
||||
//! 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 media_queries::MediaList;
|
||||
use parser::ParserContext;
|
||||
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
|
||||
/// for `@import` rules.
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
//!
|
||||
//! [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;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use media_queries::MediaList;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use stylesheets::CssRules;
|
||||
|
||||
/// An [`@media`][media] urle.
|
||||
///
|
||||
|
|
|
@ -23,15 +23,15 @@ mod stylesheet;
|
|||
pub mod supports_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};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use parser::ParserContext;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::ParsingMode;
|
||||
|
||||
pub use self::counter_style_rule::CounterStyleRule;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
//! The `@namespace` at-rule.
|
||||
|
||||
use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use crate::str::CssStringWriter;
|
||||
use crate::{Namespace, Prefix};
|
||||
use cssparser::SourceLocation;
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use {Namespace, Prefix};
|
||||
|
||||
/// A `@namespace` rule.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
//!
|
||||
//! [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;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||
use properties::PropertyDeclarationBlock;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
|
||||
/// A [`@page`][page] rule.
|
||||
///
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
|
||||
//! 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")]
|
||||
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOfOps};
|
||||
use servo_arc::{Arc, RawOffsetArc};
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
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.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -4,32 +4,32 @@
|
|||
|
||||
//! 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::{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 servo_arc::Arc;
|
||||
use shared_lock::{Locked, SharedRwLock};
|
||||
use str::starts_with_ignore_ascii_case;
|
||||
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.
|
||||
pub struct InsertRuleContext<'a> {
|
||||
|
@ -202,7 +202,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
|
|||
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();
|
||||
let maybe_namespace = match input.expect_url_or_string() {
|
||||
Ok(url_or_string) => url_or_string,
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
//! An iterator over a list of rules.
|
||||
|
||||
use context::QuirksMode;
|
||||
use media_queries::Device;
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use crate::context::QuirksMode;
|
||||
use crate::media_queries::Device;
|
||||
use crate::shared_lock::SharedRwLockReadGuard;
|
||||
use crate::stylesheets::StylesheetInDocument;
|
||||
use crate::stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule};
|
||||
use smallvec::SmallVec;
|
||||
use std::slice;
|
||||
use stylesheets::StylesheetInDocument;
|
||||
use stylesheets::{CssRule, DocumentRule, ImportRule, MediaRule, SupportsRule};
|
||||
|
||||
/// An iterator over a list of rules.
|
||||
pub struct RulesIterator<'a, 'b, C>
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
|
||||
//! 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;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::MallocUnconditionalShallowSizeOf;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use properties::PropertyDeclarationBlock;
|
||||
use selector_parser::SelectorImpl;
|
||||
use selectors::SelectorList;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
|
||||
/// A style rule, with selectors and declarations.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -2,31 +2,31 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Parser, ParserInput, RuleListParser};
|
||||
use error_reporting::{ContextualParseError, ParseErrorReporter};
|
||||
use fallible::FallibleVec;
|
||||
use fxhash::FxHashMap;
|
||||
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||
#[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::{
|
||||
use crate::context::QuirksMode;
|
||||
use crate::error_reporting::{ContextualParseError, ParseErrorReporter};
|
||||
use crate::invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||
use crate::media_queries::{Device, MediaList};
|
||||
use crate::parser::ParserContext;
|
||||
use crate::shared_lock::{
|
||||
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::sync::atomic::{AtomicBool, Ordering};
|
||||
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.
|
||||
pub struct UserAgentStylesheets {
|
||||
|
@ -166,9 +166,9 @@ macro_rules! rule_filter {
|
|||
$(
|
||||
#[allow(missing_docs)]
|
||||
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) {
|
||||
if let CssRule::$variant(ref lock) = *rule {
|
||||
|
|
|
@ -4,24 +4,24 @@
|
|||
|
||||
//! [@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::{Delimiter, Parser, SourceLocation, Token};
|
||||
use cssparser::{ParseError as CssParseError, ParserInput};
|
||||
#[cfg(feature = "gecko")]
|
||||
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 servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, Locked};
|
||||
use shared_lock::{SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::ffi::{CStr, CString};
|
||||
use std::fmt::{self, Write};
|
||||
use std::str;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::{CssRuleType, CssRules, Namespaces};
|
||||
|
||||
/// An [`@supports`][supports] rule.
|
||||
///
|
||||
|
@ -103,7 +103,7 @@ impl SupportsCondition {
|
|||
///
|
||||
/// <https://drafts.csswg.org/css-conditional/#supports_condition>
|
||||
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)?;
|
||||
return Ok(SupportsCondition::Not(Box::new(inner)));
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ impl SupportsCondition {
|
|||
loop {
|
||||
conditions.push(SupportsCondition::parse_in_parens(input)?);
|
||||
if input
|
||||
.try(|input| input.expect_ident_matching(keyword))
|
||||
.r#try(|input| input.expect_ident_matching(keyword))
|
||||
.is_err()
|
||||
{
|
||||
// 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>> {
|
||||
// Whitespace is normally taken care of in `Parser::next`,
|
||||
// but we want to not include it in `pos` for the SupportsCondition::FutureSyntax cases.
|
||||
while input.try(Parser::expect_whitespace).is_ok() {}
|
||||
while input.r#try(Parser::expect_whitespace).is_ok() {}
|
||||
let pos = input.position();
|
||||
let location = input.current_source_location();
|
||||
// FIXME: remove clone() when lifetimes are non-lexical
|
||||
match input.next()?.clone() {
|
||||
Token::ParenthesisBlock => {
|
||||
let nested =
|
||||
input.try(|input| input.parse_nested_block(parse_condition_or_declaration));
|
||||
input.r#try(|input| input.parse_nested_block(parse_condition_or_declaration));
|
||||
if nested.is_ok() {
|
||||
return nested;
|
||||
}
|
||||
},
|
||||
Token::Function(ident) => {
|
||||
let nested = input.try(|input| {
|
||||
let nested = input.r#try(|input| {
|
||||
input.parse_nested_block(|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>(
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> 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)))
|
||||
} else {
|
||||
Declaration::parse(input).map(SupportsCondition::Declaration)
|
||||
|
@ -418,7 +418,7 @@ impl Declaration {
|
|||
PropertyDeclaration::parse_into(&mut declarations, id, &context, input)
|
||||
.map_err(|_| input.new_custom_error(()))
|
||||
})?;
|
||||
let _ = input.try(parse_important);
|
||||
let _ = input.r#try(parse_important);
|
||||
Ok(())
|
||||
})
|
||||
.is_ok()
|
||||
|
|
|
@ -8,29 +8,29 @@
|
|||
//! [meta]: https://drafts.csswg.org/css-device-adapt/#viewport-meta
|
||||
|
||||
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::{parse_important, AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use error_reporting::ContextualParseError;
|
||||
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 shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard};
|
||||
use std::borrow::Cow;
|
||||
use std::cell::RefCell;
|
||||
use std::fmt::{self, Write};
|
||||
use std::iter::Enumerate;
|
||||
use std::str::Chars;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom};
|
||||
use style_traits::{CssWriter, ParseError, PinchZoomFactor, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::{Origin, StylesheetInDocument};
|
||||
use values::computed::{Context, ToComputedValue};
|
||||
use values::specified::{LengthOrPercentageOrAuto, NoCalcLength, ViewportPercentageLength};
|
||||
|
||||
/// Whether parsing and processing of `@viewport` rules is enabled.
|
||||
#[cfg(feature = "servo")]
|
||||
|
@ -265,7 +265,7 @@ fn parse_shorthand<'i, 't>(
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<(ViewportLength, ViewportLength), ParseError<'i>> {
|
||||
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)),
|
||||
Ok(max) => Ok((min, max)),
|
||||
}
|
||||
|
@ -289,8 +289,8 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> {
|
|||
) -> Result<Vec<ViewportDescriptorDeclaration>, ParseError<'i>> {
|
||||
macro_rules! declaration {
|
||||
($declaration:ident($parse:expr)) => {
|
||||
declaration!($declaration(value: try!($parse(input)),
|
||||
important: input.try(parse_important).is_ok()))
|
||||
declaration!($declaration(value: r#try!($parse(input)),
|
||||
important: input.r#try(parse_important).is_ok()))
|
||||
};
|
||||
($declaration:ident(value: $value:expr, important: $important:expr)) => {
|
||||
ViewportDescriptorDeclaration::new(
|
||||
|
@ -306,7 +306,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> {
|
|||
};
|
||||
(shorthand -> [$min:ident, $max:ident]) => {{
|
||||
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![
|
||||
declaration!($min(value: shorthand.0, important: important)),
|
||||
|
|
|
@ -4,28 +4,38 @@
|
|||
|
||||
//! Selector matching.
|
||||
|
||||
use applicable_declarations::{ApplicableDeclarationBlock, ApplicableDeclarationList};
|
||||
use context::{CascadeInputs, QuirksMode};
|
||||
use dom::{TElement, TShadowRoot};
|
||||
use element_state::{DocumentState, ElementState};
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use crate::applicable_declarations::{ApplicableDeclarationBlock, ApplicableDeclarationList};
|
||||
use crate::context::{CascadeInputs, QuirksMode};
|
||||
use crate::dom::{TElement, TShadowRoot};
|
||||
use crate::element_state::{DocumentState, ElementState};
|
||||
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_collector::RuleCollector;
|
||||
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")]
|
||||
use gecko_bindings::structs::{ServoStyleSetSizes, StyleRuleInclusion};
|
||||
use hashglobe::FailedAllocationError;
|
||||
use invalidation::element::invalidation_map::InvalidationMap;
|
||||
use invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey};
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::MallocUnconditionalShallowSizeOf;
|
||||
#[cfg(feature = "gecko")]
|
||||
use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps};
|
||||
use media_queries::Device;
|
||||
use properties::{self, CascadeMode, ComputedValues};
|
||||
use properties::{AnimationRules, PropertyDeclarationBlock};
|
||||
use rule_cache::{RuleCache, RuleCacheConditions};
|
||||
use rule_tree::{CascadeLevel, RuleTree, ShadowCascadeOrder, StrongRuleNode, StyleSource};
|
||||
use rule_collector::RuleCollector;
|
||||
use selector_map::{PrecomputedHashMap, PrecomputedHashSet, SelectorMap, SelectorMapEntry};
|
||||
use selector_parser::{PerPseudoElementMap, PseudoElement, SelectorImpl, SnapshotMap};
|
||||
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::bloom::BloomFilter;
|
||||
use selectors::matching::VisitedHandlingMode;
|
||||
|
@ -35,26 +45,16 @@ use selectors::parser::{SelectorIter, Visit};
|
|||
use selectors::visitor::SelectorVisitor;
|
||||
use selectors::NthIndexCache;
|
||||
use servo_arc::{Arc, ArcBorrow};
|
||||
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
|
||||
use smallbitvec::SmallBitVec;
|
||||
use std::ops;
|
||||
use std::sync::Mutex;
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use stylesheet_set::{DataValidity, DocumentStylesheetSet, SheetRebuildKind};
|
||||
use stylesheet_set::{DocumentStylesheetFlusher, SheetCollectionFlusher};
|
||||
use stylesheets::keyframes_rule::KeyframesAnimation;
|
||||
use stylesheets::viewport_rule::{self, MaybeNew, ViewportRule};
|
||||
use stylesheets::StyleRule;
|
||||
use stylesheets::StylesheetInDocument;
|
||||
#[cfg(feature = "gecko")]
|
||||
use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule};
|
||||
use stylesheets::{CssRule, Origin, OriginSet, PerOrigin, PerOriginIter};
|
||||
use thread_state::{self, ThreadState};
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// The type of the stylesheets that the stylist contains.
|
||||
#[cfg(feature = "servo")]
|
||||
pub type StylistSheet = ::stylesheets::DocumentStyleSheet;
|
||||
pub type StylistSheet = crate::stylesheets::DocumentStyleSheet;
|
||||
|
||||
/// The type of the stylesheets that the stylist contains.
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -728,7 +728,7 @@ impl Stylist {
|
|||
where
|
||||
E: TElement,
|
||||
{
|
||||
use font_metrics::ServoMetricsProvider;
|
||||
use crate::font_metrics::ServoMetricsProvider;
|
||||
self.precomputed_values_for_pseudo::<E>(
|
||||
guards,
|
||||
&pseudo,
|
||||
|
@ -1294,7 +1294,7 @@ impl Stylist {
|
|||
where
|
||||
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 iter_declarations = || {
|
||||
|
@ -2074,7 +2074,7 @@ impl CascadeData {
|
|||
where
|
||||
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);
|
||||
|
||||
|
|
|
@ -4,18 +4,18 @@
|
|||
|
||||
//! Traversing the DOM tree; the bloom filter.
|
||||
|
||||
use context::{ElementCascadeInputs, SharedStyleContext, StyleContext};
|
||||
use data::{ElementData, ElementStyles};
|
||||
use dom::{NodeInfo, OpaqueNode, TElement, TNode};
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use matching::{ChildCascadeRequirement, MatchMethods};
|
||||
use selector_parser::PseudoElement;
|
||||
use crate::context::{ElementCascadeInputs, SharedStyleContext, StyleContext};
|
||||
use crate::data::{ElementData, ElementStyles};
|
||||
use crate::dom::{NodeInfo, OpaqueNode, TElement, TNode};
|
||||
use crate::invalidation::element::restyle_hints::RestyleHint;
|
||||
use crate::matching::{ChildCascadeRequirement, MatchMethods};
|
||||
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 sharing::StyleSharingTarget;
|
||||
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
|
||||
/// currently only holds the dom depth for the bloom filter.
|
||||
|
@ -307,7 +307,7 @@ pub fn resolve_style<E>(
|
|||
where
|
||||
E: TElement,
|
||||
{
|
||||
use style_resolver::StyleResolverForElement;
|
||||
use crate::style_resolver::StyleResolverForElement;
|
||||
|
||||
debug_assert!(
|
||||
rule_inclusion == RuleInclusion::DefaultOnly ||
|
||||
|
@ -406,8 +406,8 @@ pub fn recalc_style_at<E, D, F>(
|
|||
D: DomTraversal<E>,
|
||||
F: FnMut(E::ConcreteNode),
|
||||
{
|
||||
use crate::traversal_flags::TraversalFlags;
|
||||
use std::cmp;
|
||||
use traversal_flags::TraversalFlags;
|
||||
|
||||
let flags = context.shared.traversal_flags;
|
||||
let is_initial_style = !data.has_styles();
|
||||
|
@ -586,7 +586,7 @@ fn compute_style<E>(
|
|||
where
|
||||
E: TElement,
|
||||
{
|
||||
use data::RestyleKind::*;
|
||||
use crate::data::RestyleKind::*;
|
||||
|
||||
context.thread_local.statistics.elements_styled += 1;
|
||||
let kind = data.restyle_kind(context.shared);
|
||||
|
@ -719,9 +719,9 @@ fn notify_paint_worklet<E>(context: &StyleContext<E>, data: &ElementData)
|
|||
where
|
||||
E: TElement,
|
||||
{
|
||||
use crate::values::generics::image::Image;
|
||||
use crate::values::Either;
|
||||
use style_traits::ToCss;
|
||||
use values::generics::image::Image;
|
||||
use values::Either;
|
||||
|
||||
// We speculatively evaluate any paint worklets during styling.
|
||||
// This allows us to run paint worklets in parallel with style and layout.
|
||||
|
@ -811,7 +811,7 @@ fn note_children<E, D, F>(
|
|||
child_hint |= RestyleHint::RECASCADE_SELF | RestyleHint::RECASCADE_DESCENDANTS;
|
||||
},
|
||||
ChildCascadeRequirement::MustCascadeChildrenIfInheritResetStyle => {
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
use crate::properties::computed_value_flags::ComputedValueFlags;
|
||||
if child_data
|
||||
.styles
|
||||
.primary()
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
//! Various stuff for CSS property use counters.
|
||||
|
||||
use crate::properties::{NonCustomPropertyId, NON_CUSTOM_PROPERTY_ID_COUNT};
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||
use properties::{NonCustomPropertyId, NON_CUSTOM_PROPERTY_ID_COUNT};
|
||||
use std::cell::Cell;
|
||||
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
//! Animated types for CSS colors.
|
||||
|
||||
use values::animated::{Animate, Procedure, ToAnimatedZero};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::generics::color::{Color as GenericColor, ComplexColorRatios};
|
||||
use crate::values::animated::{Animate, Procedure, ToAnimatedZero};
|
||||
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use crate::values::generics::color::{Color as GenericColor, ComplexColorRatios};
|
||||
|
||||
/// An animated RGBA color.
|
||||
///
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
|
||||
//! Animated types for CSS values related to effects.
|
||||
|
||||
use values::animated::color::Color;
|
||||
use values::computed::length::Length;
|
||||
use crate::values::animated::color::Color;
|
||||
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")]
|
||||
use values::computed::url::ComputedUrl;
|
||||
use values::computed::{Angle, Number};
|
||||
use values::generics::effects::BoxShadow as GenericBoxShadow;
|
||||
use values::generics::effects::Filter as GenericFilter;
|
||||
use values::generics::effects::SimpleShadow as GenericSimpleShadow;
|
||||
#[cfg(not(feature = "gecko"))]
|
||||
use values::Impossible;
|
||||
|
||||
/// An animated value for a single `box-shadow`.
|
||||
pub type BoxShadow = GenericBoxShadow<Color, Length, Length, Length>;
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
//! Animation implementation for various font-related types.
|
||||
|
||||
use super::{Animate, Procedure, ToAnimatedZero};
|
||||
use values::computed::font::{FontVariationSettings, FontWeight};
|
||||
use values::computed::Number;
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::generics::font::{FontSettings as GenericFontSettings, FontTag, VariationValue};
|
||||
use crate::values::computed::font::{FontVariationSettings, FontWeight};
|
||||
use crate::values::computed::Number;
|
||||
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use crate::values::generics::font::{FontSettings as GenericFontSettings, FontTag, VariationValue};
|
||||
|
||||
impl ToAnimatedZero for FontWeight {
|
||||
#[inline]
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
//! Animation implementation for various length-related types.
|
||||
|
||||
use super::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
||||
use values::computed::length::{CalcLengthOrPercentage, Length};
|
||||
use values::computed::length::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use values::computed::MaxLength as ComputedMaxLength;
|
||||
use values::computed::MozLength as ComputedMozLength;
|
||||
use values::computed::Percentage;
|
||||
use crate::values::computed::length::{CalcLengthOrPercentage, Length};
|
||||
use crate::values::computed::length::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use crate::values::computed::MaxLength as ComputedMaxLength;
|
||||
use crate::values::computed::MozLength as ComputedMozLength;
|
||||
use crate::values::computed::Percentage;
|
||||
|
||||
/// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc>
|
||||
impl Animate for CalcLengthOrPercentage {
|
||||
|
@ -74,8 +74,8 @@ impl ToAnimatedValue for ComputedMaxLength {
|
|||
|
||||
#[inline]
|
||||
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
|
||||
use values::computed::{Length, LengthOrPercentageOrNone, Percentage};
|
||||
use values::generics::length::MaxLength as GenericMaxLength;
|
||||
use crate::values::computed::{Length, LengthOrPercentageOrNone, Percentage};
|
||||
use crate::values::generics::length::MaxLength as GenericMaxLength;
|
||||
match animated {
|
||||
GenericMaxLength::LengthOrPercentageOrNone(lopn) => {
|
||||
let result = match lopn {
|
||||
|
@ -104,8 +104,8 @@ impl ToAnimatedValue for ComputedMozLength {
|
|||
|
||||
#[inline]
|
||||
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
|
||||
use values::computed::{Length, LengthOrPercentageOrAuto, Percentage};
|
||||
use values::generics::length::MozLength as GenericMozLength;
|
||||
use crate::values::computed::{Length, LengthOrPercentageOrAuto, Percentage};
|
||||
use crate::values::generics::length::MozLength as GenericMozLength;
|
||||
match animated {
|
||||
GenericMozLength::LengthOrPercentageOrAuto(lopa) => {
|
||||
let result = match lopa {
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
//! module's raison d'être is to ultimately contain all these types.
|
||||
|
||||
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 properties::PropertyId;
|
||||
use smallvec::SmallVec;
|
||||
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 effects;
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
//! Animation implementations for various SVG-related types.
|
||||
|
||||
use super::{Animate, Procedure, ToAnimatedZero};
|
||||
use properties::animated_properties::ListAnimation;
|
||||
use values::animated::color::Color as AnimatedColor;
|
||||
use values::computed::url::ComputedUrl;
|
||||
use values::computed::{LengthOrPercentage, Number, NumberOrPercentage};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::generics::svg::{SVGLength, SVGPaint, SvgLengthOrPercentageOrNumber};
|
||||
use values::generics::svg::{SVGOpacity, SVGStrokeDashArray};
|
||||
use crate::properties::animated_properties::ListAnimation;
|
||||
use crate::values::animated::color::Color as AnimatedColor;
|
||||
use crate::values::computed::url::ComputedUrl;
|
||||
use crate::values::computed::{LengthOrPercentage, Number, NumberOrPercentage};
|
||||
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use crate::values::generics::svg::{SVGLength, SVGPaint, SvgLengthOrPercentageOrNumber};
|
||||
use crate::values::generics::svg::{SVGOpacity, SVGStrokeDashArray};
|
||||
|
||||
/// Animated SVGPaint.
|
||||
pub type IntermediateSVGPaint = SVGPaint<AnimatedColor, ComputedUrl>;
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
//! Computed angles.
|
||||
|
||||
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use crate::values::CSSFloat;
|
||||
use num_traits::Zero;
|
||||
use std::f64::consts::PI;
|
||||
use std::fmt::{self, Write};
|
||||
use std::ops::Add;
|
||||
use std::{f32, f64};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||
use values::CSSFloat;
|
||||
|
||||
/// A computed angle in degrees.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
//! 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 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.
|
||||
pub type BackgroundSize = GenericBackgroundSize<NonNegativeLengthOrPercentageOrAuto>;
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
//!
|
||||
//! [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 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.
|
||||
pub use values::generics::basic_shape::FillRule;
|
||||
pub use crate::values::generics::basic_shape::FillRule;
|
||||
|
||||
/// A computed clipping shape.
|
||||
pub type ClippingShape = generic::ClippingShape<BasicShape, ComputedUrl>;
|
||||
|
|
|
@ -5,18 +5,18 @@
|
|||
//! Computed types for CSS values related to borders.
|
||||
|
||||
use app_units::Au;
|
||||
use values::animated::ToAnimatedZero;
|
||||
use values::computed::length::{LengthOrPercentage, NonNegativeLength};
|
||||
use values::computed::{Number, NumberOrPercentage};
|
||||
use values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
|
||||
use values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth;
|
||||
use values::generics::border::BorderImageSlice as GenericBorderImageSlice;
|
||||
use values::generics::border::BorderRadius as GenericBorderRadius;
|
||||
use values::generics::border::BorderSpacing as GenericBorderSpacing;
|
||||
use values::generics::rect::Rect;
|
||||
use values::generics::size::Size;
|
||||
use crate::values::animated::ToAnimatedZero;
|
||||
use crate::values::computed::length::{LengthOrPercentage, NonNegativeLength};
|
||||
use crate::values::computed::{Number, NumberOrPercentage};
|
||||
use crate::values::generics::border::BorderCornerRadius as GenericBorderCornerRadius;
|
||||
use crate::values::generics::border::BorderImageSideWidth as GenericBorderImageSideWidth;
|
||||
use crate::values::generics::border::BorderImageSlice as GenericBorderImageSlice;
|
||||
use crate::values::generics::border::BorderRadius as GenericBorderRadius;
|
||||
use crate::values::generics::border::BorderSpacing as GenericBorderSpacing;
|
||||
use crate::values::generics::rect::Rect;
|
||||
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.
|
||||
pub type BorderImageWidth = Rect<BorderImageSideWidth>;
|
||||
|
|
|
@ -4,16 +4,18 @@
|
|||
|
||||
//! Computed types for box properties.
|
||||
|
||||
use values::computed::length::{LengthOrPercentage, NonNegativeLength};
|
||||
use values::computed::{Context, Number, ToComputedValue};
|
||||
use values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
||||
use values::generics::box_::Perspective as GenericPerspective;
|
||||
use values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||
use values::specified::box_ as specified;
|
||||
use crate::values::computed::length::{LengthOrPercentage, NonNegativeLength};
|
||||
use crate::values::computed::{Context, Number, ToComputedValue};
|
||||
use crate::values::generics::box_::AnimationIterationCount as GenericAnimationIterationCount;
|
||||
use crate::values::generics::box_::Perspective as GenericPerspective;
|
||||
use crate::values::generics::box_::VerticalAlign as GenericVerticalAlign;
|
||||
use crate::values::specified::box_ as specified;
|
||||
|
||||
pub use values::specified::box_::{AnimationName, Appearance, Contain, Display, OverflowClipBox};
|
||||
pub use values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
|
||||
pub use values::specified::box_::{
|
||||
pub use crate::values::specified::box_::{
|
||||
AnimationName, Appearance, Contain, Display, OverflowClipBox,
|
||||
};
|
||||
pub use crate::values::specified::box_::{Clear as SpecifiedClear, Float as SpecifiedFloat};
|
||||
pub use crate::values::specified::box_::{
|
||||
OverscrollBehavior, ScrollSnapType, TouchAction, TransitionProperty, WillChange,
|
||||
};
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
//! 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 std::fmt;
|
||||
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.
|
||||
pub type RGBAColor = RGBA;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
//! Computed types for the column properties.
|
||||
|
||||
use values::computed::PositiveInteger;
|
||||
use values::generics::column::ColumnCount as GenericColumnCount;
|
||||
use crate::values::computed::PositiveInteger;
|
||||
use crate::values::generics::column::ColumnCount as GenericColumnCount;
|
||||
|
||||
/// A computed type for `column-count` values.
|
||||
pub type ColumnCount = GenericColumnCount<PositiveInteger>;
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
//! Computed values for counter properties
|
||||
|
||||
use values::computed::url::ComputedImageUrl;
|
||||
use values::generics::counters as generics;
|
||||
use values::generics::counters::CounterIncrement as GenericCounterIncrement;
|
||||
use values::generics::counters::CounterReset as GenericCounterReset;
|
||||
use crate::values::computed::url::ComputedImageUrl;
|
||||
use crate::values::generics::counters as generics;
|
||||
use crate::values::generics::counters::CounterIncrement as GenericCounterIncrement;
|
||||
use crate::values::generics::counters::CounterReset as GenericCounterReset;
|
||||
|
||||
/// A computed value for the `counter-increment` property.
|
||||
pub type CounterIncrement = GenericCounterIncrement<i32>;
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче