REGRESSION (r105401-105403): Blue flash on css border transition
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Feb 2012 18:21:22 +0000 (18:21 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Feb 2012 18:21:22 +0000 (18:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77491

Reviewed by Simon Fraser.

Source/WebCore:

The new blend function added with r105403 takes unsigned as parameters therefore
we have to be careful to not overflow in case the to is less than from (animating
from 400 to 0 for example).

Test: animations/animation-border-overflow.html

* platform/animation/AnimationUtilities.h:
(WebCore::blend):

LayoutTests:

* animations/animation-border-overflow-expected.txt: Added.
* animations/animation-border-overflow.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106672 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/animations/animation-border-overflow-expected.txt [new file with mode: 0644]
LayoutTests/animations/animation-border-overflow.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/animation/AnimationUtilities.h

index 49998c3..c9262a7 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-03  Alexis Menard  <alexis.menard@openbossa.org>
+
+        REGRESSION (r105401-105403): Blue flash on css border transition
+        https://bugs.webkit.org/show_bug.cgi?id=77491
+
+        Reviewed by Simon Fraser.
+
+        * animations/animation-border-overflow-expected.txt: Added.
+        * animations/animation-border-overflow.html: Added.
+
 2012-02-03  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
 
         [Qt][WK2] Incorrect line number dumping
diff --git a/LayoutTests/animations/animation-border-overflow-expected.txt b/LayoutTests/animations/animation-border-overflow-expected.txt
new file mode 100644 (file)
index 0000000..73d9304
--- /dev/null
@@ -0,0 +1,3 @@
+This test performs an animation of the border-top-width property from a given value to 0. It tests if an intermediate value is correct.
+PASS - "border-top-width" property for "box" element at 0.1s saw something close to: 200
+
diff --git a/LayoutTests/animations/animation-border-overflow.html b/LayoutTests/animations/animation-border-overflow.html
new file mode 100644 (file)
index 0000000..d8cd3ed
--- /dev/null
@@ -0,0 +1,40 @@
+<html>
+<head>
+<title>Unfilled Animation Test</title>
+<style type="text/css" media="screen">
+#box {
+    height: 100px;
+    width: 100px;
+    border-top-width: 300px;
+    border-style: solid;
+    -webkit-animation-duration: 1s;
+    -webkit-animation-timing-function: ease-in-out;
+    -webkit-animation-name: "anim";
+}
+@-webkit-keyframes "anim" {
+    from { border-top-width: 200px; }
+    to   { border-top-width: 0px; }
+}
+
+</style>
+    <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
+    <script type="text/javascript" charset="utf-8">
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    const expectedValues = [
+      // [animation-name, time, element-id, property, expected-value, tolerance]
+      ["anim", 0.1, "box", "border-top-width", 200, 20],
+    ];
+
+    runAnimationTest(expectedValues);
+    </script>
+</head>
+<body>
+This test performs an animation of the border-top-width property from a given value to 0. It tests if an intermediate value is correct.
+<div id="box">
+</div>
+<div id="result">
+</div>
+</body>
+</html>
index 6be9b20..ff07492 100644 (file)
@@ -1,3 +1,19 @@
+2012-02-03  Alexis Menard  <alexis.menard@openbossa.org>
+
+        REGRESSION (r105401-105403): Blue flash on css border transition
+        https://bugs.webkit.org/show_bug.cgi?id=77491
+
+        Reviewed by Simon Fraser.
+
+        The new blend function added with r105403 takes unsigned as parameters therefore
+        we have to be careful to not overflow in case the to is less than from (animating
+        from 400 to 0 for example).
+
+        Test: animations/animation-border-overflow.html
+
+        * platform/animation/AnimationUtilities.h:
+        (WebCore::blend):
+
 2012-02-03  Justin Novosad  <junov@chromium.org>
 
         [Chromium] ImageBufferSkia: remove unnecessary overload of flush in
index aebca46..87dabe6 100644 (file)
@@ -37,7 +37,7 @@ inline int blend(int from, int to, double progress)
 
 inline unsigned blend(unsigned from, unsigned to, double progress)
 {
-    return static_cast<unsigned>(lround(static_cast<double>(from) + static_cast<double>(to - from) * progress));
+    return static_cast<unsigned>(lround(to > from ? static_cast<double>(from) + static_cast<double>(to - from) * progress : static_cast<double>(from) - static_cast<double>(from - to) * progress));
 }
 
 inline double blend(double from, double to, double progress)