Title: [154909] trunk/Source/WebCore
Revision
154909
Author
[email protected]
Date
2013-08-30 14:32:17 -0700 (Fri, 30 Aug 2013)

Log Message

Animations should use double for key values, not floats
https://bugs.webkit.org/show_bug.cgi?id=120547

Reviewed by Simon Fraser.

Merge https://chromium.googlesource.com/chromium/blink/+/71de046541c77120874b9bff82958ee9e0e20c7c

Some files have been renamed in the Blink port, and they have made some
improvements, but I took what applied to us.

All our existing tests passed.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::keyframeStylesForAnimation):
* css/WebKitCSSKeyframeRule.cpp:
(WebCore::StyleKeyframe::parseKeyString):
* css/WebKitCSSKeyframeRule.h:
(WebCore::StyleKeyframe::getKeys):
* platform/graphics/GraphicsLayer.h:
(WebCore::AnimationValue::keyTime):
(WebCore::AnimationValue::AnimationValue):
(WebCore::FloatAnimationValue::create):
(WebCore::FloatAnimationValue::FloatAnimationValue):
(WebCore::TransformAnimationValue::create):
(WebCore::TransformAnimationValue::TransformAnimationValue):
(WebCore::FilterAnimationValue::create):
(WebCore::FilterAnimationValue::FilterAnimationValue):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::startAnimation):
* rendering/style/KeyframeList.h:
(WebCore::KeyframeValue::KeyframeValue):
(WebCore::KeyframeValue::key):
(WebCore::KeyframeValue::setKey):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154908 => 154909)


--- trunk/Source/WebCore/ChangeLog	2013-08-30 20:17:27 UTC (rev 154908)
+++ trunk/Source/WebCore/ChangeLog	2013-08-30 21:32:17 UTC (rev 154909)
@@ -1,3 +1,39 @@
+2013-08-30  Dean Jackson  <[email protected]>
+
+        Animations should use double for key values, not floats
+        https://bugs.webkit.org/show_bug.cgi?id=120547
+
+        Reviewed by Simon Fraser.
+
+        Merge https://chromium.googlesource.com/chromium/blink/+/71de046541c77120874b9bff82958ee9e0e20c7c
+
+        Some files have been renamed in the Blink port, and they have made some
+        improvements, but I took what applied to us.
+
+        All our existing tests passed.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::keyframeStylesForAnimation):
+        * css/WebKitCSSKeyframeRule.cpp:
+        (WebCore::StyleKeyframe::parseKeyString):
+        * css/WebKitCSSKeyframeRule.h:
+        (WebCore::StyleKeyframe::getKeys):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::AnimationValue::keyTime):
+        (WebCore::AnimationValue::AnimationValue):
+        (WebCore::FloatAnimationValue::create):
+        (WebCore::FloatAnimationValue::FloatAnimationValue):
+        (WebCore::TransformAnimationValue::create):
+        (WebCore::TransformAnimationValue::TransformAnimationValue):
+        (WebCore::FilterAnimationValue::create):
+        (WebCore::FilterAnimationValue::FilterAnimationValue):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::startAnimation):
+        * rendering/style/KeyframeList.h:
+        (WebCore::KeyframeValue::KeyframeValue):
+        (WebCore::KeyframeValue::key):
+        (WebCore::KeyframeValue::setKey):
+
 2013-08-30  Brendan Long  <[email protected]>
 
         [GStreamer] support in-band text tracks

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (154908 => 154909)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2013-08-30 20:17:27 UTC (rev 154908)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2013-08-30 21:32:17 UTC (rev 154909)
@@ -940,7 +940,7 @@
         keyframeValue.setStyle(styleForKeyframe(elementStyle, keyframe, keyframeValue));
 
         // Add this keyframe style to all the indicated key times
-        Vector<float> keys;
+        Vector<double> keys;
         keyframe->getKeys(keys);
         for (size_t keyIndex = 0; keyIndex < keys.size(); ++keyIndex) {
             keyframeValue.setKey(keys[keyIndex]);

Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp (154908 => 154909)


--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp	2013-08-30 20:17:27 UTC (rev 154908)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp	2013-08-30 21:32:17 UTC (rev 154909)
@@ -50,14 +50,14 @@
 }
 
 /* static */
-void StyleKeyframe::parseKeyString(const String& s, Vector<float>& keys)
+void StyleKeyframe::parseKeyString(const String& s, Vector<double>& keys)
 {
     keys.clear();
     Vector<String> strings;
     s.split(',', strings);
 
     for (size_t i = 0; i < strings.size(); ++i) {
-        float key = -1;
+        double key = -1;
         String cur = strings[i].stripWhiteSpace();
         
         // For now the syntax MUST be 'xxx%' or 'from' or 'to', where xxx is a legal floating point number
@@ -66,7 +66,7 @@
         else if (cur == "to")
             key = 1;
         else if (cur.endsWith('%')) {
-            float k = cur.substring(0, cur.length() - 1).toFloat();
+            double k = cur.substring(0, cur.length() - 1).toDouble();
             if (k >= 0 && k <= 100)
                 key = k/100;
         }

Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h (154908 => 154909)


--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h	2013-08-30 20:17:27 UTC (rev 154908)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.h	2013-08-30 21:32:17 UTC (rev 154909)
@@ -47,7 +47,7 @@
     String keyText() const { return m_key; }
     void setKeyText(const String& s) { m_key = s; }
 
-    void getKeys(Vector<float>& keys) const   { parseKeyString(m_key, keys); }
+    void getKeys(Vector<double>& keys) const   { parseKeyString(m_key, keys); }
     
     const StylePropertySet& properties() const { return *m_properties; }
     MutableStylePropertySet* mutableProperties();
@@ -57,7 +57,7 @@
 private:
     StyleKeyframe(PassRefPtr<StylePropertySet>);
     
-    static void parseKeyString(const String&, Vector<float>& keys);
+    static void parseKeyString(const String&, Vector<double>& keys);
     
     RefPtr<StylePropertySet> m_properties;
     // FIXME: This should be a parsed vector of floats.

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (154908 => 154909)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2013-08-30 20:17:27 UTC (rev 154908)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2013-08-30 21:32:17 UTC (rev 154909)
@@ -74,19 +74,19 @@
 public:
     virtual ~AnimationValue() { }
 
-    float keyTime() const { return m_keyTime; }
+    double keyTime() const { return m_keyTime; }
     const TimingFunction* timingFunction() const { return m_timingFunction.get(); }
     virtual PassOwnPtr<AnimationValue> clone() const = 0;
 
 protected:
-    AnimationValue(float keyTime, PassRefPtr<TimingFunction> timingFunction = 0)
+    AnimationValue(double keyTime, PassRefPtr<TimingFunction> timingFunction = 0)
         : m_keyTime(keyTime)
         , m_timingFunction(timingFunction)
     {
     }
 
 private:
-    float m_keyTime;
+    double m_keyTime;
     RefPtr<TimingFunction> m_timingFunction;
 };
 
@@ -94,7 +94,7 @@
 // FIXME: Should be moved to its own header file.
 class FloatAnimationValue : public AnimationValue {
 public:
-    static PassOwnPtr<FloatAnimationValue> create(float keyTime, float value, PassRefPtr<TimingFunction> timingFunction = 0)
+    static PassOwnPtr<FloatAnimationValue> create(double keyTime, float value, PassRefPtr<TimingFunction> timingFunction = 0)
     {
         return adoptPtr(new FloatAnimationValue(keyTime, value, timingFunction));
     }
@@ -107,7 +107,7 @@
     float value() const { return m_value; }
 
 private:
-    FloatAnimationValue(float keyTime, float value, PassRefPtr<TimingFunction> timingFunction)
+    FloatAnimationValue(double keyTime, float value, PassRefPtr<TimingFunction> timingFunction)
         : AnimationValue(keyTime, timingFunction)
         , m_value(value)
     {
@@ -120,7 +120,7 @@
 // FIXME: Should be moved to its own header file.
 class TransformAnimationValue : public AnimationValue {
 public:
-    static PassOwnPtr<TransformAnimationValue> create(float keyTime, const TransformOperations& value, PassRefPtr<TimingFunction> timingFunction = 0)
+    static PassOwnPtr<TransformAnimationValue> create(double keyTime, const TransformOperations& value, PassRefPtr<TimingFunction> timingFunction = 0)
     {
         return adoptPtr(new TransformAnimationValue(keyTime, value, timingFunction));
     }
@@ -133,7 +133,7 @@
     const TransformOperations& value() const { return m_value; }
 
 private:
-    TransformAnimationValue(float keyTime, const TransformOperations& value, PassRefPtr<TimingFunction> timingFunction)
+    TransformAnimationValue(double keyTime, const TransformOperations& value, PassRefPtr<TimingFunction> timingFunction)
         : AnimationValue(keyTime, timingFunction)
         , m_value(value)
     {
@@ -147,7 +147,7 @@
 // FIXME: Should be moved to its own header file.
 class FilterAnimationValue : public AnimationValue {
 public:
-    static PassOwnPtr<FilterAnimationValue> create(float keyTime, const FilterOperations& value, PassRefPtr<TimingFunction> timingFunction = 0)
+    static PassOwnPtr<FilterAnimationValue> create(double keyTime, const FilterOperations& value, PassRefPtr<TimingFunction> timingFunction = 0)
     {
         return adoptPtr(new FilterAnimationValue(keyTime, value, timingFunction));
     }
@@ -160,7 +160,7 @@
     const FilterOperations& value() const { return m_value; }
 
 private:
-    FilterAnimationValue(float keyTime, const FilterOperations& value, PassRefPtr<TimingFunction> timingFunction)
+    FilterAnimationValue(double keyTime, const FilterOperations& value, PassRefPtr<TimingFunction> timingFunction)
         : AnimationValue(keyTime, timingFunction)
         , m_value(value)
     {

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (154908 => 154909)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-08-30 20:17:27 UTC (rev 154908)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-08-30 21:32:17 UTC (rev 154909)
@@ -2087,7 +2087,7 @@
     for (size_t i = 0; i < numKeyframes; ++i) {
         const KeyframeValue& currentKeyframe = keyframes[i];
         const RenderStyle* keyframeStyle = currentKeyframe.style();
-        float key = currentKeyframe.key();
+        double key = currentKeyframe.key();
 
         if (!keyframeStyle)
             continue;

Modified: trunk/Source/WebCore/rendering/style/KeyframeList.h (154908 => 154909)


--- trunk/Source/WebCore/rendering/style/KeyframeList.h	2013-08-30 20:17:27 UTC (rev 154908)
+++ trunk/Source/WebCore/rendering/style/KeyframeList.h	2013-08-30 21:32:17 UTC (rev 154909)
@@ -39,7 +39,7 @@
 
 class KeyframeValue {
 public:
-    KeyframeValue(float key, PassRefPtr<RenderStyle> style)
+    KeyframeValue(double key, PassRefPtr<RenderStyle> style)
         : m_key(key)
         , m_style(style)
     {
@@ -49,14 +49,14 @@
     bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); }
     const HashSet<CSSPropertyID>& properties() const { return m_properties; }
 
-    float key() const { return m_key; }
-    void setKey(float key) { m_key = key; }
+    double key() const { return m_key; }
+    void setKey(double key) { m_key = key; }
 
     const RenderStyle* style() const { return m_style.get(); }
     void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; }
 
 private:
-    float m_key;
+    double m_key;
     HashSet<CSSPropertyID> m_properties; // The properties specified in this keyframe.
     RefPtr<RenderStyle> m_style;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to