diff options
5 files changed, 32 insertions, 4 deletions
diff --git a/components/script/dom/stylepropertymapreadonly.rs b/components/script/dom/stylepropertymapreadonly.rs index 323f5dae5a9..02f8a342321 100644 --- a/components/script/dom/stylepropertymapreadonly.rs +++ b/components/script/dom/stylepropertymapreadonly.rs @@ -13,8 +13,10 @@ use dom::cssstylevalue::CSSStyleValue; use dom::globalscope::GlobalScope; use dom_struct::dom_struct; use servo_atoms::Atom; +use std::cmp::Ordering; use std::collections::HashMap; use std::iter::Iterator; +use style::custom_properties; #[dom_struct] pub struct StylePropertyMapReadOnly { @@ -63,4 +65,29 @@ impl StylePropertyMapReadOnlyMethods for StylePropertyMapReadOnly { // TODO: avoid constructing an Atom self.entries.contains_key(&Atom::from(property)) } + + /// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-getproperties + fn GetProperties(&self) -> Vec<DOMString> { + let mut result: Vec<DOMString> = self.entries.keys() + .map(|key| DOMString::from(&**key)) + .collect(); + // https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymap-getproperties + // requires this sort order + result.sort_by(|key1, key2| { + if let Ok(key1) = custom_properties::parse_name(key1) { + if let Ok(key2) = custom_properties::parse_name(key2) { + key1.cmp(key2) + } else { + Ordering::Greater + } + } else { + if let Ok(_) = custom_properties::parse_name(key2) { + Ordering::Less + } else { + key1.cmp(key2) + } + } + }); + result + } } diff --git a/components/script/dom/webidls/StylePropertyMapReadOnly.webidl b/components/script/dom/webidls/StylePropertyMapReadOnly.webidl index 7557a0d6071..360e3af909d 100644 --- a/components/script/dom/webidls/StylePropertyMapReadOnly.webidl +++ b/components/script/dom/webidls/StylePropertyMapReadOnly.webidl @@ -10,6 +10,7 @@ interface StylePropertyMapReadOnly { // sequence<CSSStyleValue> getAll(DOMString property); boolean has(DOMString property); // iterable<DOMString, (CSSStyleValue or sequence<CSSStyleValue>)>; - // sequence<DOMString> getProperties(); + sequence<DOMString> getProperties(); + // https://github.com/w3c/css-houdini-drafts/issues/268 // stringifier; }; diff --git a/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-background-image.html.ini b/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-background-image.html.ini index 5632e4c5931..b5b74284aa0 100644 --- a/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-background-image.html.ini +++ b/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-background-image.html.ini @@ -1,4 +1,4 @@ [style-background-image.html] type: reftest expected: FAIL - bug: https://github.com/servo/servo/issues/17579 + bug: https://github.com/servo/servo/issues/17378 diff --git a/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-before-pseudo.html.ini b/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-before-pseudo.html.ini index c3ae11d8b7c..8e3e18c50ad 100644 --- a/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-before-pseudo.html.ini +++ b/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-before-pseudo.html.ini @@ -1,4 +1,4 @@ [style-before-pseudo.html] type: reftest expected: FAIL - bug: https://github.com/servo/servo/issues/17579 + bug: https://github.com/servo/servo/issues/17854 diff --git a/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-first-letter-pseudo.html.ini b/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-first-letter-pseudo.html.ini index 521e635bece..55518de2716 100644 --- a/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-first-letter-pseudo.html.ini +++ b/tests/wpt/mozilla/meta/mozilla/css-paint-api/style-first-letter-pseudo.html.ini @@ -1,4 +1,4 @@ [style-first-letter-pseudo.html] type: reftest expected: FAIL - bug: https://github.com/servo/servo/issues/17579 + bug: https://github.com/servo/servo/issues/17854 |