Bug 1371150 - style: Don't clamp Opacity values when computing them for SMIL. r?hiro draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 24 Jul 2017 17:00:36 +0800
changeset 614180 8177faf2940644901fefb68169dd858915073c16
parent 614179 7a1b3437652de49c152fe37ba879bb041ece56a5
child 638807 c720a4cce5c6f33ec220bf58447fe20b94460fd8
push id69949
push userbmo:cam@mcc.id.au
push dateMon, 24 Jul 2017 09:02:03 +0000
reviewershiro
bugs1371150
milestone56.0a1
Bug 1371150 - style: Don't clamp Opacity values when computing them for SMIL. r?hiro MozReview-Commit-ID: Hn3KKErzhUT
servo/components/style/values/specified/mod.rs
--- a/servo/components/style/values/specified/mod.rs
+++ b/servo/components/style/values/specified/mod.rs
@@ -558,17 +558,24 @@ impl Parse for Opacity {
     }
 }
 
 impl ToComputedValue for Opacity {
     type ComputedValue = CSSFloat;
 
     #[inline]
     fn to_computed_value(&self, context: &Context) -> CSSFloat {
-        self.0.to_computed_value(context).min(1.0).max(0.0)
+        let value = self.0.to_computed_value(context);
+        if context.for_smil_animation {
+            // SMIL expects to be able to interpolate between out-of-range
+            // opacity values.
+            value
+        } else {
+            value.min(1.0).max(0.0)
+        }
     }
 
     #[inline]
     fn from_computed_value(computed: &CSSFloat) -> Self {
         Opacity(Number::from_computed_value(computed))
     }
 }