2009-10-01 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2009 17:29:32 +0000 (17:29 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2009 17:29:32 +0000 (17:29 +0000)
        Reviewed by Dave Hyatt.

        Odd color transitions on anchors with transition-property: all
        https://bugs.webkit.org/show_bug.cgi?id=29911

        When transitioning maybe-invalid colors, if the source and destination
        color are both invalid, then don't animate.

        This fixes an issue where a child element of an element running a color
        transition, with -webkit-transition-property:all, would show a color change.
        This happened because the "maybe invalid color" logic copied the color style
        into -webkit-text-fill-color for both endpoints, causing -webkit-text-fill-color
        to animate while the transition ran, and to then to disappear when the transition
        finished.

        Test: transitions/color-transition-all.html

        * page/animation/AnimationBase.cpp:
        (WebCore::PropertyWrapperMaybeInvalidColor::equals):
        (WebCore::PropertyWrapperMaybeInvalidColor::blend):

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

LayoutTests/ChangeLog
LayoutTests/transitions/color-transition-all-expected.txt [new file with mode: 0644]
LayoutTests/transitions/color-transition-all.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/page/animation/AnimationBase.cpp

index 961f064..108e592 100644 (file)
@@ -1,3 +1,16 @@
+2009-10-01  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Odd color transitions on anchors with transition-property: all
+        https://bugs.webkit.org/show_bug.cgi?id=29911
+        
+        Testcase for 'color' changing with -webkit-transition-property: all,
+        to test whether -webkit-text-fill-color animates.
+
+        * transitions/color-transition-all-expected.txt: Added.
+        * transitions/color-transition-all.html: Added.
+
 2009-10-01  Victor Wang  <victorw@chromium.org>
 
         Reviewed by Oliver Hunt.
diff --git a/LayoutTests/transitions/color-transition-all-expected.txt b/LayoutTests/transitions/color-transition-all-expected.txt
new file mode 100644 (file)
index 0000000..f4adc27
--- /dev/null
@@ -0,0 +1,6 @@
+inner
+outer
+PASS - "color" property for "outer" element at 0.5s saw something close to: 0,127,127
+PASS - "color" property for "inner" element at 0.5s saw something close to: 255,0,0
+PASS - "-webkit-text-fill-color" property for "inner" element at 0.5s saw something close to: 255,0,0
+
diff --git a/LayoutTests/transitions/color-transition-all.html b/LayoutTests/transitions/color-transition-all.html
new file mode 100644 (file)
index 0000000..8676a32
--- /dev/null
@@ -0,0 +1,51 @@
+<!DOCTYPE>
+
+<html lang="en">
+<head>
+  <title>Color transition with transition-property: all</title>
+  <style type="text/css" media="screen">
+    #outer {
+      font-size: 200%;
+      color: #00F;
+      -webkit-transition: all 1s linear;
+    }
+    
+    #inner {
+      color: #F00;
+    }
+    
+    #outer.changed {
+      color: #0F0;
+    }
+  </style>
+  <script src="transition-test-helpers.js" type="text/javascript" charset="utf-8"></script>
+  <script type="text/javascript" charset="utf-8">
+    const expectedValues = [
+      // [time, element-id, property, expected-value, tolerance]
+      [0.5, 'outer', 'color', [0, 127, 127], 2],
+      [0.5, 'inner', 'color', [255, 0, 0], 2],
+      [0.5, 'inner', '-webkit-text-fill-color', [255, 0, 0], 2],
+    ];
+
+    function setupTest()
+    {
+      document.getElementById('outer').className = 'changed';
+    }
+
+    runTransitionTest(expectedValues, setupTest, true);
+  </script>
+</head>
+<body>
+
+  <div id="outer">
+    <div id="inner">
+      inner
+    </div>
+    outer
+  </div>
+  
+  <div id="result">
+  </div>
+
+</body>
+</html>
\ No newline at end of file
index f36b4ee..32d8e14 100644 (file)
@@ -1,3 +1,26 @@
+2009-10-01  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Odd color transitions on anchors with transition-property: all
+        https://bugs.webkit.org/show_bug.cgi?id=29911
+
+        When transitioning maybe-invalid colors, if the source and destination
+        color are both invalid, then don't animate.
+        
+        This fixes an issue where a child element of an element running a color
+        transition, with -webkit-transition-property:all, would show a color change.
+        This happened because the "maybe invalid color" logic copied the color style
+        into -webkit-text-fill-color for both endpoints, causing -webkit-text-fill-color
+        to animate while the transition ran, and to then to disappear when the transition
+        finished.
+        
+        Test: transitions/color-transition-all.html
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::PropertyWrapperMaybeInvalidColor::equals):
+        (WebCore::PropertyWrapperMaybeInvalidColor::blend):
+
 2009-10-01  Victor Wang  <victorw@chromium.org>
 
         Reviewed by Oliver Hunt.
index e54be8b..dec6f4b 100644 (file)
@@ -361,6 +361,10 @@ public:
     {
         Color fromColor = (a->*m_getter)();
         Color toColor = (b->*m_getter)();
+
+        if (!fromColor.isValid() && !toColor.isValid())
+            return true;
+
         if (!fromColor.isValid())
             fromColor = a->color();
         if (!toColor.isValid())
@@ -373,6 +377,10 @@ public:
     {
         Color fromColor = (a->*m_getter)();
         Color toColor = (b->*m_getter)();
+
+        if (!fromColor.isValid() && !toColor.isValid())
+            return;
+
         if (!fromColor.isValid())
             fromColor = a->color();
         if (!toColor.isValid())