aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2017-06-17 20:13:12 -0700
committerBobby Holley <bobbyholley@gmail.com>2017-06-20 11:59:10 -0700
commitdb8f59407f93e07111cf2bf0c5d691fcef4e40c9 (patch)
tree26eecb27588f7e3ccb89ad06f15ddd9b7fdd76e2
parent2159d48382203ebb3deb75358d5cb06e0e55b103 (diff)
downloadservo-db8f59407f93e07111cf2bf0c5d691fcef4e40c9.tar.gz
servo-db8f59407f93e07111cf2bf0c5d691fcef4e40c9.zip
Hoist sink into selectors.
It probably makes more sense (eventually) to put it in SmallVec. MozReview-Commit-ID: AIBKCLiMNN2
-rw-r--r--components/script/dom/element.rs2
-rw-r--r--components/script/layout_wrapper.rs2
-rw-r--r--components/selectors/lib.rs1
-rw-r--r--components/selectors/sink.rs (renamed from components/style/sink.rs)22
-rw-r--r--components/style/dom.rs2
-rw-r--r--components/style/gecko/wrapper.rs2
-rw-r--r--components/style/lib.rs1
-rw-r--r--components/style/stylist.rs2
8 files changed, 6 insertions, 28 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index c0570ad83cc..9d522982717 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -89,6 +89,7 @@ use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivit
use selectors::matching::{ElementSelectorFlags, LocalMatchingContext, MatchingContext, MatchingMode};
use selectors::matching::{HAS_EDGE_CHILD_SELECTOR, HAS_SLOW_SELECTOR, HAS_SLOW_SELECTOR_LATER_SIBLINGS};
use selectors::matching::{RelevantLinkStatus, matches_selector_list};
+use selectors::sink::Push;
use servo_atoms::Atom;
use std::ascii::AsciiExt;
use std::borrow::Cow;
@@ -109,7 +110,6 @@ use style::rule_tree::CascadeLevel;
use style::selector_parser::{NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl, SelectorParser};
use style::selector_parser::extended_filtering;
use style::shared_lock::{SharedRwLock, Locked};
-use style::sink::Push;
use style::stylearc::Arc;
use style::thread_state;
use style::values::{CSSFloat, Either};
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index aaaf5cce107..d26493589c2 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -52,6 +52,7 @@ use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayou
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
use selectors::matching::{ElementSelectorFlags, LocalMatchingContext, MatchingContext, RelevantLinkStatus};
use selectors::matching::VisitedHandlingMode;
+use selectors::sink::Push;
use servo_atoms::Atom;
use servo_url::ServoUrl;
use std::fmt;
@@ -75,7 +76,6 @@ use style::properties::{ComputedValues, PropertyDeclarationBlock};
use style::selector_parser::{AttrValue as SelectorAttrValue, NonTSPseudoClass, PseudoClassStringArg};
use style::selector_parser::{PseudoElement, SelectorImpl, extended_filtering};
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked};
-use style::sink::Push;
use style::str::is_whitespace;
use style::stylearc::Arc;
diff --git a/components/selectors/lib.rs b/components/selectors/lib.rs
index 16a7949cfa9..bde7acef189 100644
--- a/components/selectors/lib.rs
+++ b/components/selectors/lib.rs
@@ -20,6 +20,7 @@ pub mod matching;
pub mod parser;
#[cfg(test)] mod size_of_tests;
#[cfg(any(test, feature = "gecko_like_types"))] pub mod gecko_like_types;
+pub mod sink;
mod tree;
pub mod visitor;
diff --git a/components/style/sink.rs b/components/selectors/sink.rs
index 343bf07d869..3c57aa143c4 100644
--- a/components/style/sink.rs
+++ b/components/selectors/sink.rs
@@ -6,7 +6,6 @@
#![deny(missing_docs)]
use smallvec::{Array, SmallVec};
-use std::marker::PhantomData;
/// A trait to abstract over a `push` method that may be implemented for
/// different kind of types.
@@ -30,24 +29,3 @@ impl<A: Array> Push<A::Item> for SmallVec<A> {
SmallVec::push(self, value);
}
}
-
-/// A struct that implements `Push`, but only stores whether it's empty.
-pub struct ForgetfulSink<T>(bool, PhantomData<T>);
-
-impl<T> ForgetfulSink<T> {
- /// Trivially construct a new `ForgetfulSink`.
- pub fn new() -> Self {
- ForgetfulSink(true, PhantomData)
- }
-
- /// Whether this sink is empty or not.
- pub fn is_empty(&self) -> bool {
- self.0
- }
-}
-
-impl<T> Push<T> for ForgetfulSink<T> {
- fn push(&mut self, _value: T) {
- self.0 = false;
- }
-}
diff --git a/components/style/dom.rs b/components/style/dom.rs
index 545463f4bd0..9cc7b2c1e4b 100644
--- a/components/style/dom.rs
+++ b/components/style/dom.rs
@@ -21,8 +21,8 @@ use rule_tree::CascadeLevel;
use selector_parser::{AttrValue, ElementExt, PreExistingComputedValues};
use selector_parser::{PseudoClassStringArg, PseudoElement};
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
+use selectors::sink::Push;
use shared_lock::Locked;
-use sink::Push;
use smallvec::VecLike;
use std::fmt;
#[cfg(feature = "gecko")] use std::collections::HashMap;
diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs
index 42c9997e691..602e500de0d 100644
--- a/components/style/gecko/wrapper.rs
+++ b/components/style/gecko/wrapper.rs
@@ -76,8 +76,8 @@ use selectors::Element;
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator, CaseSensitivity, NamespaceConstraint};
use selectors::matching::{ElementSelectorFlags, LocalMatchingContext, MatchingContext};
use selectors::matching::{RelevantLinkStatus, VisitedHandlingMode};
+use selectors::sink::Push;
use shared_lock::Locked;
-use sink::Push;
use smallvec::VecLike;
use std::cell::RefCell;
use std::collections::HashMap;
diff --git a/components/style/lib.rs b/components/style/lib.rs
index 05b147d12be..e2ed31d1467 100644
--- a/components/style/lib.rs
+++ b/components/style/lib.rs
@@ -126,7 +126,6 @@ pub mod sharing;
pub mod stylist;
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod servo;
pub mod sequential;
-pub mod sink;
pub mod str;
pub mod style_adjuster;
pub mod stylesheet_set;
diff --git a/components/style/stylist.rs b/components/style/stylist.rs
index ae63d62a52d..5a849a0ab7f 100644
--- a/components/style/stylist.rs
+++ b/components/style/stylist.rs
@@ -31,9 +31,9 @@ use selectors::matching::{ElementSelectorFlags, matches_selector, MatchingContex
use selectors::matching::AFFECTED_BY_PRESENTATIONAL_HINTS;
use selectors::parser::{AncestorHashes, Combinator, Component, Selector, SelectorAndHashes};
use selectors::parser::{SelectorIter, SelectorMethods};
+use selectors::sink::Push;
use selectors::visitor::SelectorVisitor;
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
-use sink::Push;
use smallvec::VecLike;
use std::fmt::Debug;
#[cfg(feature = "servo")]