mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Move util::str to style
This commit is contained in:
parent
744b94346a
commit
8ecb5962f3
25 changed files with 23 additions and 28 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -85,6 +85,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;
|
||||
|
@ -97,7 +98,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;
|
||||
|
||||
|
|
|
@ -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> {
|
||||
|
|
1
components/servo/Cargo.lock
generated
1
components/servo/Cargo.lock
generated
|
@ -2467,7 +2467,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)",
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -92,6 +92,7 @@ pub mod selector_matching;
|
|||
pub mod sequential;
|
||||
pub mod servo;
|
||||
pub mod sink;
|
||||
pub mod str;
|
||||
pub mod stylesheets;
|
||||
mod tid;
|
||||
pub mod traversal;
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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,7 +38,6 @@ 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;
|
||||
|
||||
|
|
1
ports/cef/Cargo.lock
generated
1
ports/cef/Cargo.lock
generated
|
@ -2336,7 +2336,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)",
|
||||
|
|
1
ports/geckolib/Cargo.lock
generated
1
ports/geckolib/Cargo.lock
generated
|
@ -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)",
|
||||
|
|
|
@ -21,6 +21,7 @@ mod attr;
|
|||
mod logical_geometry;
|
||||
mod media_queries;
|
||||
mod properties;
|
||||
mod str;
|
||||
mod stylesheets;
|
||||
mod viewport;
|
||||
|
||||
|
|
|
@ -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() {
|
|
@ -9,5 +9,4 @@ extern crate util;
|
|||
mod cache;
|
||||
mod opts;
|
||||
mod prefs;
|
||||
mod str;
|
||||
mod thread;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue