diff --git a/components/style/keyframes.rs b/components/style/keyframes.rs index 831627d42c3..474e4c8b539 100644 --- a/components/style/keyframes.rs +++ b/components/style/keyframes.rs @@ -14,7 +14,7 @@ use std::sync::Arc; use style_traits::ToCss; use stylesheets::{MemoryHoleReporter, Stylesheet}; -/// A number from 1 to 100, indicating the percentage of the animation where +/// A number from 0 to 1, indicating the percentage of the animation where /// this keyframe should run. #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] @@ -30,6 +30,12 @@ impl ::std::cmp::Ord for KeyframePercentage { impl ::std::cmp::Eq for KeyframePercentage { } +impl ToCss for KeyframePercentage { + fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { + write!(dest, "{}%", self.0 * 100.0) + } +} + impl KeyframePercentage { #[inline] pub fn new(value: f32) -> KeyframePercentage { @@ -93,10 +99,10 @@ pub struct Keyframe { impl ToCss for Keyframe { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let mut iter = self.selector.percentages().iter(); - try!(write!(dest, "{}%", iter.next().unwrap().0)); + try!(iter.next().unwrap().to_css(dest)); for percentage in iter { try!(write!(dest, ", ")); - try!(write!(dest, "{}%", percentage.0)); + try!(percentage.to_css(dest)); } try!(dest.write_str(" { ")); try!(self.block.read().to_css(dest)); diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 2176f9ef317..3e6746c6922 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -39677,12 +39677,42 @@ "deleted_reftests": {}, "items": { "testharness": { + "cssom/CSSKeyframesRule.html": [ + { + "path": "cssom/CSSKeyframesRule.html", + "url": "/cssom/CSSKeyframesRule.html" + } + ], + "cssom/CSSNamespaceRule.html": [ + { + "path": "cssom/CSSNamespaceRule.html", + "url": "/cssom/CSSNamespaceRule.html" + } + ], + "cssom/CSSRuleList.html": [ + { + "path": "cssom/CSSRuleList.html", + "url": "/cssom/CSSRuleList.html" + } + ], + "cssom/CSSStyleSheet.html": [ + { + "path": "cssom/CSSStyleSheet.html", + "url": "/cssom/CSSStyleSheet.html" + } + ], "cssom/MediaList.html": [ { "path": "cssom/MediaList.html", "url": "/cssom/MediaList.html" } ], + "cssom/StyleSheetList.html": [ + { + "path": "cssom/StyleSheetList.html", + "url": "/cssom/StyleSheetList.html" + } + ], "cssom/shorthand-serialization.html": [ { "path": "cssom/shorthand-serialization.html", diff --git a/tests/wpt/web-platform-tests/cssom/CSSKeyframesRule.html b/tests/wpt/web-platform-tests/cssom/CSSKeyframesRule.html new file mode 100644 index 00000000000..b97d988c9ac --- /dev/null +++ b/tests/wpt/web-platform-tests/cssom/CSSKeyframesRule.html @@ -0,0 +1,58 @@ + + + + + CSSOM - CSSKeyframesRule interface + + + + + + + diff --git a/tests/wpt/web-platform-tests/cssom/CSSNamespaceRule.html b/tests/wpt/web-platform-tests/cssom/CSSNamespaceRule.html new file mode 100644 index 00000000000..64ed94b6e7f --- /dev/null +++ b/tests/wpt/web-platform-tests/cssom/CSSNamespaceRule.html @@ -0,0 +1,31 @@ + + + + + CSSOM - CSSNamespaceRule interface + + + + + + + diff --git a/tests/wpt/web-platform-tests/cssom/CSSRuleList.html b/tests/wpt/web-platform-tests/cssom/CSSRuleList.html new file mode 100644 index 00000000000..a394779617d --- /dev/null +++ b/tests/wpt/web-platform-tests/cssom/CSSRuleList.html @@ -0,0 +1,26 @@ + + + + + CSSOM - CSSRuleList interface + + + + + + + diff --git a/tests/wpt/web-platform-tests/cssom/CSSStyleSheet.html b/tests/wpt/web-platform-tests/cssom/CSSStyleSheet.html new file mode 100644 index 00000000000..62ad133d5f6 --- /dev/null +++ b/tests/wpt/web-platform-tests/cssom/CSSStyleSheet.html @@ -0,0 +1,43 @@ + + + + + CSSOM - CSSStyleSheet interface + + + + + + + diff --git a/tests/wpt/web-platform-tests/cssom/StyleSheetList.html b/tests/wpt/web-platform-tests/cssom/StyleSheetList.html new file mode 100644 index 00000000000..358264009a4 --- /dev/null +++ b/tests/wpt/web-platform-tests/cssom/StyleSheetList.html @@ -0,0 +1,33 @@ + + + + + CSSOM - StyleSheetList interface + + + + + + +