Title: [123837] trunk
Revision
123837
Author
[email protected]
Date
2012-07-26 21:32:08 -0700 (Thu, 26 Jul 2012)

Log Message

Make transitions work between different Length types
https://bugs.webkit.org/show_bug.cgi?id=92220

Reviewed by Simon Fraser.

Source/WebCore:

Use the existing CSS calc machinery for blending between two calculations
to blend between two Lengths of differing types.

Test: transitions/mixed-type.html

* platform/Length.cpp:
(WebCore::Length::blendMixedTypes):
* platform/Length.h:
(WebCore::Length::blend):
(Length):

LayoutTests:

* transitions/mixed-type-expected.txt: Added.
* transitions/mixed-type.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123836 => 123837)


--- trunk/LayoutTests/ChangeLog	2012-07-27 04:07:48 UTC (rev 123836)
+++ trunk/LayoutTests/ChangeLog	2012-07-27 04:32:08 UTC (rev 123837)
@@ -1,3 +1,13 @@
+2012-07-26  Mike Lawther  <[email protected]>
+
+        Make transitions work between different Length types
+        https://bugs.webkit.org/show_bug.cgi?id=92220
+
+        Reviewed by Simon Fraser.
+
+        * transitions/mixed-type-expected.txt: Added.
+        * transitions/mixed-type.html: Added.
+
 2012-07-26  Yoshifumi Inoue  <[email protected]>
 
         [Tests] Rename fast/forms/{number,time}/*-validity-state-* to *-validity-*

Added: trunk/LayoutTests/transitions/mixed-type-expected.txt (0 => 123837)


--- trunk/LayoutTests/transitions/mixed-type-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/transitions/mixed-type-expected.txt	2012-07-27 04:32:08 UTC (rev 123837)
@@ -0,0 +1,4 @@
+Tests transitions to and from a mix of absolute and percent values
+PASS - "width" property for "box" element at 0.5s saw something close to: 225
+PASS - "height" property for "box" element at 0.5s saw something close to: 275
+

Added: trunk/LayoutTests/transitions/mixed-type.html (0 => 123837)


--- trunk/LayoutTests/transitions/mixed-type.html	                        (rev 0)
+++ trunk/LayoutTests/transitions/mixed-type.html	2012-07-27 04:32:08 UTC (rev 123837)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<style>
+#box {
+    width: 10%;
+    height: 100px;
+    background-color: green;
+    -webkit-transition: all 1s linear;
+}
+
+#box.final {
+    width: 400px;
+    height: 90%;
+}
+</style>
+Tests transitions to and from a mix of absolute and percent values
+</p>
+<div style="width: 500px; height: 500px;">
+  <div id="box"></div>
+</div>
+
+<div id="result">
+<script src=""
+<script type="text/_javascript_">
+
+const expectedValues = [
+  // [time, element-id, property, expected-value, tolerance]
+  // The transition takes 1 second, so we compute tolerance to allow
+  // 10% or 100ms variance, (endValue - startValue) / 10.
+  [0.5, 'box', 'width', 225, 35],
+  [0.5, 'box', 'height', 275, 35],
+];
+
+function setupTest()
+{
+  var box = document.getElementById('box');
+  box.className = 'final';
+}
+
+runTransitionTest(expectedValues, setupTest, usePauseAPI);
+</script>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (123836 => 123837)


--- trunk/Source/WebCore/ChangeLog	2012-07-27 04:07:48 UTC (rev 123836)
+++ trunk/Source/WebCore/ChangeLog	2012-07-27 04:32:08 UTC (rev 123837)
@@ -1,3 +1,21 @@
+2012-07-26  Mike Lawther  <[email protected]>
+
+        Make transitions work between different Length types
+        https://bugs.webkit.org/show_bug.cgi?id=92220
+
+        Reviewed by Simon Fraser.
+
+        Use the existing CSS calc machinery for blending between two calculations
+        to blend between two Lengths of differing types.
+
+        Test: transitions/mixed-type.html
+
+        * platform/Length.cpp:
+        (WebCore::Length::blendMixedTypes):
+        * platform/Length.h:
+        (WebCore::Length::blend):
+        (Length):
+
 2012-07-26  Dan Bernstein  <[email protected]>
 
         Blocks with reverse column progression don’t have layout overflow for overflowing columns

Modified: trunk/Source/WebCore/platform/Length.cpp (123836 => 123837)


--- trunk/Source/WebCore/platform/Length.cpp	2012-07-27 04:07:48 UTC (rev 123836)
+++ trunk/Source/WebCore/platform/Length.cpp	2012-07-27 04:32:08 UTC (rev 123837)
@@ -202,7 +202,7 @@
     m_intValue = calcHandles().insert(calc);
 }
         
-Length Length::blendCalculation(const Length& from, double progress) const
+Length Length::blendMixedTypes(const Length& from, double progress) const
 {
     if (progress <= 0.0)
         return from;

Modified: trunk/Source/WebCore/platform/Length.h (123836 => 123837)


--- trunk/Source/WebCore/platform/Length.h	2012-07-27 04:07:48 UTC (rev 123836)
+++ trunk/Source/WebCore/platform/Length.h	2012-07-27 04:32:08 UTC (rev 123837)
@@ -231,10 +231,10 @@
     {
         // Blend two lengths to produce a new length that is in between them.  Used for animation.
         if (from.type() == Calculated || type() == Calculated)
-            return blendCalculation(from, progress);
+            return blendMixedTypes(from, progress);
         
         if (!from.isZero() && !isZero() && from.type() != type())
-            return *this;
+            return blendMixedTypes(from, progress);
 
         if (from.isZero() && isZero())
             return *this;
@@ -292,7 +292,7 @@
             incrementCalculatedRef();
     }
 
-    Length blendCalculation(const Length& from, double progress) const;
+    Length blendMixedTypes(const Length& from, double progress) const;
 
     int calculationHandle() const
     {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to