2009-09-24 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Sep 2009 03:53:04 +0000 (03:53 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Sep 2009 03:53:04 +0000 (03:53 +0000)
        Reviewed by Dan Bernstein.

        REGRESSION: webkit-transform scale no longer works properly in nightly build
        https://bugs.webkit.org/show_bug.cgi?id=29730

        When the initial or final state of a scale animation does not specify a transform,
        use a default scale of 1, rather than zero.

        Test: compositing/transitions/scale-transition-no-start.html

        * platform/graphics/mac/GraphicsLayerCA.mm:
        (WebCore::getTransformFunctionValue):

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

LayoutTests/ChangeLog
LayoutTests/compositing/transitions/scale-transition-no-start.html [new file with mode: 0644]
LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/graphics/mac/GraphicsLayerCA.mm

index 1a4106b..f0b1630 100644 (file)
@@ -1,3 +1,17 @@
+2009-09-24  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        REGRESSION: webkit-transform scale no longer works properly in nightly build
+        https://bugs.webkit.org/show_bug.cgi?id=29730
+        
+        Test that a scale transition with no initial value uses a starting scale of 1.
+
+        * compositing/transitions/scale-transition-no-start.html: Added.
+        * platform/mac/compositing/transitions/scale-transition-no-start-expected.checksum: Added.
+        * platform/mac/compositing/transitions/scale-transition-no-start-expected.png: Added.
+        * platform/mac/compositing/transitions/scale-transition-no-start-expected.txt: Added.
+
 2009-09-24  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/compositing/transitions/scale-transition-no-start.html b/LayoutTests/compositing/transitions/scale-transition-no-start.html
new file mode 100644 (file)
index 0000000..7d80b08
--- /dev/null
@@ -0,0 +1,72 @@
+<!DOCTYPE>
+
+<html>
+<head>
+  <title>Scale without initial value.</title>
+  <style type="text/css" media="screen">
+    .box {
+      height: 200px;
+      width: 200px;
+      border: 1px solid #EEE;
+    }
+    
+    .indicator {
+      position: absolute;
+      height: 150px;
+      width: 150px;
+      margin: 25px;
+      -webkit-box-sizing: border-box;
+      border: 1px solid black;
+    }
+    
+    .inner {
+      height: 100px;
+      width: 100px;
+      margin: 50px;
+      background-color: green;
+      opacity: 0.7;
+      -webkit-transition: -webkit-transform 1s linear;
+    }
+
+    .box.final #inner1 {
+      -webkit-transform: scale(2);
+    }
+
+    .box.final #inner2 {
+      -webkit-transform: scaleX(2);
+    }
+  </style>
+  
+  <script src="../../transitions/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, 'inner1', '-webkit-transform.0', 1.5, 0.1],
+      [0.5, 'inner2', '-webkit-transform.0', 1.5, 0.1],
+    ];
+
+    function setupTest()
+    {
+      var boxes = document.querySelectorAll('.box');
+      boxes[0].className = 'box final';
+      boxes[1].className = 'box final';
+    }
+    runTransitionTest(expectedValues, setupTest, true, true /* pixel test */);
+  </script>
+</head>
+<body>
+  <p>In the pixel result, the green boxes should be coincident with the black outline.</p>
+  <div class="box" id="box1">
+    <div class="indicator"></div>
+    <div class="inner" id="inner1"></div>
+  </div>
+
+  <div class="box" id="box2">
+    <div class="indicator"></div>
+    <div class="inner" id="inner2"></div>
+  </div>
+
+  <div id="result"></div>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.checksum b/LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.checksum
new file mode 100644 (file)
index 0000000..645fbab
--- /dev/null
@@ -0,0 +1 @@
+2bcd1cf2e8e8127de59b84f99d97199a
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.png b/LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.png
new file mode 100644 (file)
index 0000000..8ec66d6
Binary files /dev/null and b/LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.png differ
diff --git a/LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.txt b/LayoutTests/platform/mac/compositing/transitions/scale-transition-no-start-expected.txt
new file mode 100644 (file)
index 0000000..ee67894
--- /dev/null
@@ -0,0 +1,25 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 494x18
+          text run at (0,0) width 494: "In the pixel result, the green boxes should be coincident with the black outline."
+      RenderBlock {DIV} at (0,34) size 202x202 [border: (1px solid #EEEEEE)]
+      RenderBlock {DIV} at (0,236) size 202x202 [border: (1px solid #EEEEEE)]
+      RenderBlock {DIV} at (0,438) size 784x36
+        RenderText {#text} at (0,0) size 604x18
+          text run at (0,0) width 604: "PASS - \"-webkit-transform.0\" property for \"inner1\" element at 0.5s saw something close to: 1.5"
+        RenderBR {BR} at (604,14) size 0x0
+        RenderText {#text} at (0,18) size 604x18
+          text run at (0,18) width 604: "PASS - \"-webkit-transform.0\" property for \"inner2\" element at 0.5s saw something close to: 1.5"
+        RenderBR {BR} at (604,32) size 0x0
+layer at (34,68) size 150x150
+  RenderBlock (positioned) {DIV} at (34,68) size 150x150 [border: (1px solid #000000)]
+layer at (59,93) size 100x100
+  RenderBlock {DIV} at (51,51) size 100x100 [bgcolor=#008000]
+layer at (34,270) size 150x150
+  RenderBlock (positioned) {DIV} at (34,270) size 150x150 [border: (1px solid #000000)]
+layer at (59,295) size 100x100
+  RenderBlock {DIV} at (51,51) size 100x100 [bgcolor=#008000]
index 8a82464..3102cb2 100644 (file)
@@ -1,3 +1,18 @@
+2009-09-24  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        REGRESSION: webkit-transform scale no longer works properly in nightly build
+        https://bugs.webkit.org/show_bug.cgi?id=29730
+        
+        When the initial or final state of a scale animation does not specify a transform,
+        use a default scale of 1, rather than zero.
+
+        Test: compositing/transitions/scale-transition-no-start.html
+
+        * platform/graphics/mac/GraphicsLayerCA.mm:
+        (WebCore::getTransformFunctionValue):
+
 2009-09-24  John Gregg  <johnnyg@google.com>
 
         Reviewed by Eric Seidel.
index 7e93ffc..2afcea4 100644 (file)
@@ -148,11 +148,11 @@ static NSValue* getTransformFunctionValue(const TransformOperation* transformOp,
         case TransformOperation::ROTATE_Y:
             return [NSNumber numberWithDouble:transformOp ? deg2rad(static_cast<const RotateTransformOperation*>(transformOp)->angle()) : 0];
         case TransformOperation::SCALE_X:
-            return [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->x() : 0];
+            return [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->x() : 1];
         case TransformOperation::SCALE_Y:
-            return [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->y() : 0];
+            return [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->y() : 1];
         case TransformOperation::SCALE_Z:
-            return [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->z() : 0];
+            return [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->z() : 1];
         case TransformOperation::TRANSLATE_X:
             return [NSNumber numberWithDouble:transformOp ? static_cast<const TranslateTransformOperation*>(transformOp)->x(size) : 0];
         case TransformOperation::TRANSLATE_Y:
@@ -162,9 +162,9 @@ static NSValue* getTransformFunctionValue(const TransformOperation* transformOp,
         case TransformOperation::SCALE:
         case TransformOperation::SCALE_3D:
             return [NSArray arrayWithObjects:
-                        [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->x() : 0],
-                        [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->y() : 0],
-                        [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->z() : 0],
+                        [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->x() : 1],
+                        [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->y() : 1],
+                        [NSNumber numberWithDouble:transformOp ? static_cast<const ScaleTransformOperation*>(transformOp)->z() : 1],
                         nil];
         case TransformOperation::TRANSLATE:
         case TransformOperation::TRANSLATE_3D: