Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare stylo crates for switching to the 2018 edition #22083

Merged
merged 5 commits into from Nov 10, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -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;
#[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;
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
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;

/// A set of author stylesheets and their computed representation, such as the
/// ones used for ShadowRoot and XBL.
@@ -76,10 +76,10 @@ where
}

#[cfg(feature = "gecko")]
unsafe impl HasFFI for AuthorStyles<::gecko::data::GeckoStyleSheet> {
type FFIType = ::gecko_bindings::bindings::RawServoAuthorStyles;
unsafe impl HasFFI for AuthorStyles<crate::gecko::data::GeckoStyleSheet> {
type FFIType = crate::gecko_bindings::bindings::RawServoAuthorStyles;
}
#[cfg(feature = "gecko")]
unsafe impl HasSimpleFFI for AuthorStyles<::gecko::data::GeckoStyleSheet> {}
unsafe impl HasSimpleFFI for AuthorStyles<crate::gecko::data::GeckoStyleSheet> {}
#[cfg(feature = "gecko")]
unsafe impl HasBoxFFI for AuthorStyles<::gecko::data::GeckoStyleSheet> {}
unsafe impl HasBoxFFI for AuthorStyles<crate::gecko::data::GeckoStyleSheet> {}
@@ -8,7 +8,7 @@

#![deny(missing_docs)]

use values::CSSFloat;
use crate::values::CSSFloat;

const NEWTON_METHOD_ITERATIONS: u8 = 8;

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.