aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/attr.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-11-05 09:48:55 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-11-05 09:48:55 +0530
commit0d15101323b67e06f06451e22b64b15398269d0f (patch)
treee8159d52728e28d2f8819767e21fddf3a856a4c1 /components/script/dom/attr.rs
parent65a1a28860ac8858a02be6d26b262a61d040beb1 (diff)
parent1940c3d7d6ab67f0eb1f72231654f93a021d916a (diff)
downloadservo-0d15101323b67e06f06451e22b64b15398269d0f.tar.gz
servo-0d15101323b67e06f06451e22b64b15398269d0f.zip
Auto merge of #8336 - eefriedman:tablecell-attributes, r=frewsxcv
Remove HTMLTableCellElement fields with parsed attribute values <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8336) <!-- Reviewable:end -->
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