aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/attr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/style/attr.rs')
-rw-r--r--components/style/attr.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/components/style/attr.rs b/components/style/attr.rs
index 0569b235a9c..aa7eb621839 100644
--- a/components/style/attr.rs
+++ b/components/style/attr.rs
@@ -6,7 +6,7 @@ use cssparser::RGBA;
use std::ops::Deref;
use string_cache::{Atom, Namespace};
use util::str::{DOMString, LengthOrPercentageOrAuto, parse_unsigned_integer, parse_legacy_color, parse_length};
-use util::str::{split_html_space_chars, str_join, parse_integer};
+use util::str::{parse_nonzero_length, split_html_space_chars, str_join, parse_integer};
use values::specified::{Length};
// Duplicated from script::dom::values.
@@ -96,6 +96,11 @@ impl AttrValue {
AttrValue::Dimension(string, parsed)
}
+ pub fn from_nonzero_dimension(string: DOMString) -> AttrValue {
+ let parsed = parse_nonzero_length(&string);
+ AttrValue::Dimension(string, parsed)
+ }
+
/// Assumes the `AttrValue` is a `TokenList` and returns its tokens
///
/// ## Panics