2008-11-25  Chris Marrin  <cmarrin@apple.com>

        Reviewed by Dan Bernstein.

        Fix for https://bugs.webkit.org/show_bug.cgi?id=22487
        I was not checking for the case of 0 length keyframe lists and dereffing a null pointer.

        Tests: animations/empty-keyframes.html
               animations/fill-unset-properties.html

        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::keyframeStylesForAnimation):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38776 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/animations/fill-unset-properties.html b/LayoutTests/animations/fill-unset-properties.html
new file mode 100644
index 0000000..b47a286
--- /dev/null
+++ b/LayoutTests/animations/fill-unset-properties.html
@@ -0,0 +1,65 @@
+<html> 
+<head>
+<title>Unfilled Properties Test</title> 
+<style type="text/css" media="screen">
+#box {
+    height: 50px;
+    width: 200px;
+    background-color: blue;
+    -webkit-transition-duration: 1s,2s;
+    -webkit-transition-property: opacity, left, opacity, top, width, opacity, height, opacity;
+    -webkit-transition-delay: 3s,4s,5s;
+    -webkit-transition-timing-function: linear;
+    -webkit-animation-name: a, b, c, d, e;
+    -webkit-animation-duration: 10s, 20s;
+    -webkit-animation-delay: 1s;
+}
+@-webkit-keyframes a { }
+@-webkit-keyframes b { }
+@-webkit-keyframes c { }
+@-webkit-keyframes d { }
+@-webkit-keyframes e { }
+</style>
+  <script type="text/javascript" charset="utf-8">
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+  
+    const kExpectedResults = [
+      { 'property': 'webkitTransitionDuration', 'value': '2s, 2s, 1s, 1s, 2s' },
+      { 'property': 'webkitTransitionProperty', 'value': 'left, top, width, height, opacity' },
+      { 'property': 'webkitTransitionDelay',    'value': '4s, 3s, 4s, 3s, 4s' },
+      { 'property': 'webkitTransitionTimingFunction', 'value': 'cubic-bezier(0, 0, 1, 1), cubic-bezier(0, 0, 1, 1), cubic-bezier(0, 0, 1, 1), cubic-bezier(0, 0, 1, 1), cubic-bezier(0, 0, 1, 1)' },
+      { 'property': 'webkitAnimationName',      'value': 'a, b, c, d, e' },
+      { 'property': 'webkitAnimationDuration',  'value': '10s, 20s, 10s, 20s, 10s' },
+      { 'property': 'webkitAnimationDelay',     'value': '1s, 1s, 1s, 1s, 1s' },
+    ];
+    
+    function start()
+    {
+        var box = document.getElementById('box');
+        var resultsString = "";
+        var boxStyle = window.getComputedStyle(box);
+        
+        kExpectedResults.forEach(function(curItem) {
+          var computedValue = boxStyle[curItem.property];
+          var expectedValue = curItem.value;
+          if (computedValue == expectedValue)
+            resultsString += "Testing " + curItem.property + ": PASS" + "<br>";
+          else
+            resultsString += "Testing " + curItem.property + " expected <code>" + curItem.value + "</code> got <code>" + computedValue + "</code>: FAIL" + "<br>";
+        });
+
+        var results = document.getElementById('result');
+        results.innerHTML = resultsString;
+    }
+    
+    window.addEventListener('load', start, false);
+  </script>
+</head> 
+<body>
+<div id="box">
+</div>
+<div id="result">
+</div>
+</body>
+</html>