diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2013-10-14 18:17:44 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2013-10-14 21:44:24 +0100 |
commit | dc882b8ecfc698baa7da42d57cd6c39a639a72c0 (patch) | |
tree | 191c46455c77227bf994741aef0136abfbf20cfb /src/components/style/parsing_utils.rs | |
parent | c0a5e8f6eb10148f8e56ba242140fc7565a563df (diff) | |
download | servo-dc882b8ecfc698baa7da42d57cd6c39a639a72c0.tar.gz servo-dc882b8ecfc698baa7da42d57cd6c39a639a72c0.zip |
Move the content of 'script/style' into the new 'style' crate.
Diffstat (limited to 'src/components/style/parsing_utils.rs')
-rw-r--r-- | src/components/style/parsing_utils.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/components/style/parsing_utils.rs b/src/components/style/parsing_utils.rs new file mode 100644 index 00000000000..062e4f5a6ae --- /dev/null +++ b/src/components/style/parsing_utils.rs @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * 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 std::ascii::StrAsciiExt; +use cssparser::*; + + +pub fn one_component_value<'a>(input: &'a [ComponentValue]) -> Option<&'a ComponentValue> { + let mut iter = input.skip_whitespace(); + iter.next().filtered(|_| iter.next().is_none()) +} + + +pub fn get_ident_lower(component_value: &ComponentValue) -> Option<~str> { + match component_value { + &Ident(ref value) => Some(value.to_ascii_lower()), + _ => None, + } +} |