aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-07-05 02:04:42 -0700
committerGitHub <noreply@github.com>2016-07-05 02:04:42 -0700
commitbb916bb38bc4298477bfc8134b94dc906054bce1 (patch)
tree5f592efcb4b1db3836f87e0af31f81aada26912b
parent181261004d3b217605cb2d8fbdc00ad0785532ba (diff)
parent8ecb5962f3c2d2ec1cc031ef1e893ab81142c730 (diff)
downloadservo-bb916bb38bc4298477bfc8134b94dc906054bce1.tar.gz
servo-bb916bb38bc4298477bfc8134b94dc906054bce1.zip
Auto merge of #12256 - nox:die-util-die, r=Ms2ger
Move some stuff from util to style <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12256) <!-- Reviewable:end -->
-rw-r--r--components/gfx/text/text_run.rs2
-rw-r--r--components/layout/fragment.rs9
-rw-r--r--components/script/dom/document.rs2
-rw-r--r--components/script/dom/domtokenlist.rs2
-rw-r--r--components/script/dom/htmlcollection.rs2
-rw-r--r--components/script/dom/htmlfontelement.rs2
-rw-r--r--components/script/dom/htmlformelement.rs2
-rw-r--r--components/script/dom/htmlinputelement.rs2
-rw-r--r--components/script/dom/htmllinkelement.rs2
-rw-r--r--components/script/dom/htmlmetaelement.rs2
-rw-r--r--components/script/dom/htmloptionelement.rs2
-rw-r--r--components/script/dom/htmlscriptelement.rs2
-rw-r--r--components/script/dom/window.rs2
-rw-r--r--components/script/layout_wrapper.rs2
-rw-r--r--components/servo/Cargo.lock1
-rw-r--r--components/style/attr.rs5
-rw-r--r--components/style/lib.rs2
-rw-r--r--components/style/str.rs (renamed from components/util/str.rs)0
-rw-r--r--components/style/tid.rs (renamed from components/util/tid.rs)0
-rw-r--r--components/style/traversal.rs2
-rw-r--r--components/util/Cargo.toml1
-rw-r--r--components/util/lib.rs3
-rw-r--r--ports/cef/Cargo.lock1
-rw-r--r--ports/geckolib/Cargo.lock1
-rw-r--r--tests/unit/style/lib.rs1
-rw-r--r--tests/unit/style/str.rs (renamed from tests/unit/util/str.rs)2
-rw-r--r--tests/unit/util/lib.rs1
27 files changed, 25 insertions, 30 deletions
diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs
index 24024908ddc..390f8b5c3d3 100644
--- a/components/gfx/text/text_run.rs
+++ b/components/gfx/text/text_run.rs
@@ -11,8 +11,8 @@ use std::cell::Cell;
use std::cmp::{Ordering, max};
use std::slice::Iter;
use std::sync::Arc;
+use style::str::char_is_whitespace;
use text::glyph::{ByteIndex, GlyphStore};
-use util::str::char_is_whitespace;
use webrender_traits;
use xi_unicode::LineBreakIterator;
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 92edd5f2d4c..4561a1bf5a2 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -44,6 +44,7 @@ use style::computed_values::{transform_style, vertical_align, white_space, word_
use style::dom::TRestyleDamage;
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
use style::properties::{ComputedValues, ServoComputedValues};
+use style::str::char_is_whitespace;
use style::values::computed::LengthOrPercentageOrNone;
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
use text;
@@ -2358,7 +2359,7 @@ impl Fragment {
match self.specific {
SpecificFragmentInfo::ScannedText(ref mut scanned_text_fragment_info) => {
let leading_whitespace_byte_count = scanned_text_fragment_info.text()
- .find(|c| !util::str::char_is_whitespace(c))
+ .find(|c| !char_is_whitespace(c))
.unwrap_or(scanned_text_fragment_info.text().len());
let whitespace_len = ByteIndex(leading_whitespace_byte_count as isize);
@@ -2382,7 +2383,7 @@ impl Fragment {
new_text_string.push(character);
continue
}
- if util::str::char_is_whitespace(character) {
+ if char_is_whitespace(character) {
modified = true;
continue
}
@@ -2413,7 +2414,7 @@ impl Fragment {
SpecificFragmentInfo::ScannedText(ref mut scanned_text_fragment_info) => {
let mut trailing_whitespace_start_byte = 0;
for (i, c) in scanned_text_fragment_info.text().char_indices().rev() {
- if !util::str::char_is_whitespace(c) {
+ if !char_is_whitespace(c) {
trailing_whitespace_start_byte = i + c.len_utf8();
break;
}
@@ -2440,7 +2441,7 @@ impl Fragment {
trailing_bidi_control_characters_to_retain.push(character);
continue
}
- if util::str::char_is_whitespace(character) {
+ if char_is_whitespace(character) {
modified = true;
continue
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 8c3ee29bf1a..2160a3a4556 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -124,11 +124,11 @@ use style::attr::AttrValue;
use style::context::ReflowGoal;
use style::restyle_hints::ElementSnapshot;
use style::servo::Stylesheet;
+use style::str::{split_html_space_chars, str_join};
use time;
use url::Url;
use url::percent_encoding::percent_decode;
use util::prefs::PREFS;
-use util::str::{split_html_space_chars, str_join};
#[derive(JSTraceable, PartialEq, HeapSizeOf)]
pub enum IsHTMLDocument {
diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs
index 1fb53e6ce06..364b6366282 100644
--- a/components/script/dom/domtokenlist.rs
+++ b/components/script/dom/domtokenlist.rs
@@ -13,7 +13,7 @@ use dom::bindings::str::DOMString;
use dom::element::Element;
use dom::node::window_from_node;
use string_cache::Atom;
-use util::str::HTML_SPACE_CHARACTERS;
+use style::str::HTML_SPACE_CHARACTERS;
#[dom_struct]
pub struct DOMTokenList {
diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs
index bbacf5c7a0d..798d0731b2c 100644
--- a/components/script/dom/htmlcollection.rs
+++ b/components/script/dom/htmlcollection.rs
@@ -17,7 +17,7 @@ use dom::window::Window;
use std::ascii::AsciiExt;
use std::cell::Cell;
use string_cache::{Atom, Namespace, QualName};
-use util::str::split_html_space_chars;
+use style::str::split_html_space_chars;
pub trait CollectionFilter : JSTraceable {
fn filter<'a>(&self, elem: &'a Element, root: &'a Node) -> bool;
diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs
index 5968efc7948..85dd000d183 100644
--- a/components/script/dom/htmlfontelement.rs
+++ b/components/script/dom/htmlfontelement.rs
@@ -15,8 +15,8 @@ use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use string_cache::Atom;
use style::attr::AttrValue;
+use style::str::{HTML_SPACE_CHARACTERS, read_numbers};
use style::values::specified;
-use util::str::{HTML_SPACE_CHARACTERS, read_numbers};
#[dom_struct]
pub struct HTMLFontElement {
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index 515d49c0f7c..27e954c9abc 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -51,10 +51,10 @@ use std::cell::Cell;
use std::sync::mpsc::Sender;
use string_cache::Atom;
use style::attr::AttrValue;
+use style::str::split_html_space_chars;
use task_source::TaskSource;
use task_source::dom_manipulation::DOMManipulationTask;
use url::form_urlencoded;
-use util::str::split_html_space_chars;
#[derive(JSTraceable, PartialEq, Clone, Copy, HeapSizeOf)]
pub struct GenerationId(u32);
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 762c10aa76d..0ee2023e44a 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -42,10 +42,10 @@ use std::ops::Range;
use string_cache::Atom;
use style::attr::AttrValue;
use style::element_state::*;
+use style::str::split_commas;
use textinput::KeyReaction::{DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction};
use textinput::Lines::Single;
use textinput::{TextInput, SelectionDirection};
-use util::str::split_commas;
const DEFAULT_SUBMIT_VALUE: &'static str = "Submit";
const DEFAULT_RESET_VALUE: &'static str = "Reset";
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index 0b84bc38501..ed6754afde6 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -40,9 +40,9 @@ use style::attr::AttrValue;
use style::media_queries::{MediaQueryList, parse_media_query_list};
use style::parser::ParserContextExtraData;
use style::servo::Stylesheet;
+use style::str::HTML_SPACE_CHARACTERS;
use style::stylesheets::Origin;
use url::Url;
-use util::str::HTML_SPACE_CHARACTERS;
no_jsmanaged_fields!(Stylesheet);
diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs
index 3a289b6c1bc..14d8d300bb6 100644
--- a/components/script/dom/htmlmetaelement.rs
+++ b/components/script/dom/htmlmetaelement.rs
@@ -21,9 +21,9 @@ use std::sync::Arc;
use string_cache::Atom;
use style::attr::AttrValue;
use style::servo::Stylesheet;
+use style::str::HTML_SPACE_CHARACTERS;
use style::stylesheets::{CSSRule, Origin};
use style::viewport::ViewportRule;
-use util::str::HTML_SPACE_CHARACTERS;
#[dom_struct]
pub struct HTMLMetaElement {
diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs
index 67cb4983258..7d0eeb45752 100644
--- a/components/script/dom/htmloptionelement.rs
+++ b/components/script/dom/htmloptionelement.rs
@@ -22,7 +22,7 @@ use dom::virtualmethods::VirtualMethods;
use std::cell::Cell;
use string_cache::Atom;
use style::element_state::*;
-use util::str::{split_html_space_chars, str_join};
+use style::str::{split_html_space_chars, str_join};
#[dom_struct]
pub struct HTMLOptionElement {
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index 5aeb607ee93..e4ce7fb068f 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -38,8 +38,8 @@ use std::cell::Cell;
use std::mem;
use std::sync::{Arc, Mutex};
use string_cache::Atom;
+use style::str::{HTML_SPACE_CHARACTERS, StaticStringVec};
use url::Url;
-use util::str::{HTML_SPACE_CHARACTERS, StaticStringVec};
#[dom_struct]
pub struct HTMLScriptElement {
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 4eaa1c6e568..a098edcb43c 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -84,6 +84,7 @@ use style::context::ReflowGoal;
use style::error_reporting::ParseErrorReporter;
use style::properties::longhands::overflow_x;
use style::selector_impl::PseudoElement;
+use style::str::HTML_SPACE_CHARACTERS;
use task_source::dom_manipulation::DOMManipulationTaskSource;
use task_source::file_reading::FileReadingTaskSource;
use task_source::history_traversal::HistoryTraversalTaskSource;
@@ -96,7 +97,6 @@ use tinyfiledialogs::{self, MessageBoxIcon};
use url::Url;
use util::geometry::{self, MAX_RECT};
use util::prefs::PREFS;
-use util::str::HTML_SPACE_CHARACTERS;
use util::{breakpoint, opts};
use webdriver_handlers::jsval_to_webdriver;
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index 779c37a5d52..7085fcae002 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -63,8 +63,8 @@ use style::restyle_hints::ElementSnapshot;
use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl};
use style::servo::{PrivateStyleData, SharedStyleContext};
use style::sink::Push;
+use style::str::is_whitespace;
use url::Url;
-use util::str::is_whitespace;
#[derive(Copy, Clone)]
pub struct ServoLayoutNode<'a> {
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 4dcd8197b2e..3424416cead 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -2465,7 +2465,6 @@ dependencies = [
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/components/style/attr.rs b/components/style/attr.rs
index 883cc5441b5..409f6bdbd56 100644
--- a/components/style/attr.rs
+++ b/components/style/attr.rs
@@ -12,10 +12,10 @@ use euclid::num::Zero;
use num_traits::ToPrimitive;
use std::ascii::AsciiExt;
use std::str::FromStr;
+use str::{HTML_SPACE_CHARACTERS, read_exponent, read_fraction};
+use str::{read_numbers, split_commas, split_html_space_chars, str_join};
use string_cache::{Atom, Namespace};
use url::Url;
-use util::str::{HTML_SPACE_CHARACTERS, read_exponent, read_fraction};
-use util::str::{read_numbers, split_commas, split_html_space_chars};
use values::specified::Length;
// Duplicated from script::dom::values.
@@ -148,7 +148,6 @@ impl AttrValue {
#[cfg(not(feature = "gecko"))] // Gecko can't borrow atoms as UTF-8.
pub fn from_atomic_tokens(atoms: Vec<Atom>) -> AttrValue {
- use util::str::str_join;
// TODO(ajeffrey): effecient conversion of Vec<Atom> to String
let tokens = String::from(str_join(&atoms, "\x20"));
AttrValue::TokenList(tokens, atoms)
diff --git a/components/style/lib.rs b/components/style/lib.rs
index 325c89fdd46..6e45d9a9411 100644
--- a/components/style/lib.rs
+++ b/components/style/lib.rs
@@ -92,7 +92,9 @@ pub mod selector_matching;
pub mod sequential;
pub mod servo;
pub mod sink;
+pub mod str;
pub mod stylesheets;
+mod tid;
pub mod traversal;
#[macro_use]
#[allow(non_camel_case_types)]
diff --git a/components/util/str.rs b/components/style/str.rs
index 73518625b6e..73518625b6e 100644
--- a/components/util/str.rs
+++ b/components/style/str.rs
diff --git a/components/util/tid.rs b/components/style/tid.rs
index a60c321a984..a60c321a984 100644
--- a/components/util/tid.rs
+++ b/components/style/tid.rs
diff --git a/components/style/traversal.rs b/components/style/traversal.rs
index f76b0b3f5da..91ba161b3f8 100644
--- a/components/style/traversal.rs
+++ b/components/style/traversal.rs
@@ -11,8 +11,8 @@ use selector_impl::SelectorImplExt;
use selectors::Element;
use selectors::bloom::BloomFilter;
use std::cell::RefCell;
+use tid::tid;
use util::opts;
-use util::tid::tid;
/// Every time we do another layout, the old bloom filters are invalid. This is
/// detected by ticking a generation number every layout.
diff --git a/components/util/Cargo.toml b/components/util/Cargo.toml
index 8f8b26bcae2..f5c87179cfc 100644
--- a/components/util/Cargo.toml
+++ b/components/util/Cargo.toml
@@ -24,7 +24,6 @@ ipc-channel = {git = "https://github.com/servo/ipc-channel", optional = true}
lazy_static = "0.2"
log = "0.3.5"
num_cpus = "0.2.2"
-num-traits = "0.1.32"
rand = "0.3"
rustc-serialize = "0.3"
serde = {version = "0.7.11", optional = true}
diff --git a/components/util/lib.rs b/components/util/lib.rs
index fed8c9b0178..15fdaa5f332 100644
--- a/components/util/lib.rs
+++ b/components/util/lib.rs
@@ -21,7 +21,6 @@ extern crate getopts;
#[allow(unused_extern_crates)] #[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
extern crate num_cpus;
-extern crate num_traits;
extern crate rand;
extern crate rustc_serialize;
#[cfg(feature = "servo")] extern crate serde;
@@ -39,10 +38,8 @@ pub mod geometry;
#[cfg(feature = "servo")] pub mod panicking;
pub mod prefs;
pub mod resource_files;
-pub mod str;
pub mod thread;
pub mod thread_state;
-pub mod tid;
#[cfg(feature = "servo")]
#[allow(unsafe_code)]
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index 8ddc81e43ac..d2acbc92d13 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -2334,7 +2334,6 @@ dependencies = [
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ports/geckolib/Cargo.lock b/ports/geckolib/Cargo.lock
index c3a78c1ecca..3fe70abd1d9 100644
--- a/ports/geckolib/Cargo.lock
+++ b/ports/geckolib/Cargo.lock
@@ -572,7 +572,6 @@ dependencies = [
"ipc-channel 0.2.4 (git+https://github.com/servo/ipc-channel)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/tests/unit/style/lib.rs b/tests/unit/style/lib.rs
index 6f117388acb..fd725d79635 100644
--- a/tests/unit/style/lib.rs
+++ b/tests/unit/style/lib.rs
@@ -21,6 +21,7 @@ mod attr;
mod logical_geometry;
mod media_queries;
mod properties;
+mod str;
mod stylesheets;
mod viewport;
diff --git a/tests/unit/util/str.rs b/tests/unit/style/str.rs
index a0eb750934c..dafbd8fb7da 100644
--- a/tests/unit/util/str.rs
+++ b/tests/unit/style/str.rs
@@ -2,7 +2,7 @@
* 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 util::str::{split_html_space_chars, str_join};
+use style::str::{split_html_space_chars, str_join};
#[test]
pub fn split_html_space_chars_whitespace() {
diff --git a/tests/unit/util/lib.rs b/tests/unit/util/lib.rs
index c79c763eb13..af5de45579d 100644
--- a/tests/unit/util/lib.rs
+++ b/tests/unit/util/lib.rs
@@ -9,5 +9,4 @@ extern crate util;
mod cache;
mod opts;
mod prefs;
-mod str;
mod thread;