aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/attr.rs
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2015-10-16 13:25:21 -0700
committerEli Friedman <eli.friedman@gmail.com>2015-11-04 17:09:26 -0800
commit1940c3d7d6ab67f0eb1f72231654f93a021d916a (patch)
treeaefeed97743cc99d9686c7e48e194f14d2d40f68 /components/script/dom/attr.rs
parentb4d234107e7fcc02e88915f37c06bf651842c1dd (diff)
downloadservo-1940c3d7d6ab67f0eb1f72231654f93a021d916a.tar.gz
servo-1940c3d7d6ab67f0eb1f72231654f93a021d916a.zip
Remove HTMLTableCellElement fields with parsed attribute values.
Diffstat (limited to 'components/script/dom/attr.rs')
-rw-r--r--components/script/dom/attr.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs
index 024522acfe8..856fb90aa5b 100644
--- a/components/script/dom/attr.rs
+++ b/components/script/dom/attr.rs
@@ -21,7 +21,8 @@ use std::mem;
use std::ops::Deref;
use string_cache::{Atom, Namespace};
use style::values::specified::Length;
-use util::str::{DOMString, parse_unsigned_integer, split_html_space_chars, str_join};
+use util::str::{DOMString, parse_unsigned_integer, parse_legacy_color};
+use util::str::{split_html_space_chars, str_join};
#[derive(JSTraceable, PartialEq, Clone, HeapSizeOf)]
pub enum AttrValue {
@@ -77,6 +78,11 @@ impl AttrValue {
AttrValue::Atom(value)
}
+ pub fn from_legacy_color(string: DOMString) -> AttrValue {
+ let parsed = parse_legacy_color(&string).ok();
+ AttrValue::Color(string, parsed)
+ }
+
/// Assumes the `AttrValue` is a `TokenList` and returns its tokens
///
/// ## Panics