Bug 530983, patch 2: Enable SMIL animation for 'clip' property. r=roc
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 04 Jan 2010 16:32:11 -0800
changeset 36838 a59a5f030021c7a9cf7682277e59795a4ddca64e
parent 36837 6e0620377c26a82e215d33ea2841fc1193268403
child 36839 ca1c43fda0a9c873ff974ca0f0e1ed6734c2fb09
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs530983
milestone1.9.3a1pre
Bug 530983, patch 2: Enable SMIL animation for 'clip' property. r=roc
content/smil/nsSMILCSSProperty.cpp
content/smil/test/db_smilCSSFromBy.js
content/smil/test/db_smilCSSFromTo.js
content/smil/test/db_smilCSSPaced.js
--- a/content/smil/nsSMILCSSProperty.cpp
+++ b/content/smil/nsSMILCSSProperty.cpp
@@ -194,56 +194,49 @@ nsSMILCSSProperty::IsPropertyAnimatable(
   //   color-profile
   //   color-rendering
   //   glyph-orientation-horizontal
   //   glyph-orientation-vertical
   //   kerning
   //   writing-mode
 
   switch (aPropID) {
-    // SHORTHAND PROPERTIES
-    case eCSSProperty_font:
-    case eCSSProperty_marker:
-    case eCSSProperty_overflow:
-      return PR_TRUE;
-
-    // PROPERTIES OF TYPE eCSSType_Rect
     case eCSSProperty_clip:
-      // XXXdholbert Rect type not yet supported by nsStyleAnimation
-      return PR_FALSE;
-
     case eCSSProperty_clip_rule:
     case eCSSProperty_clip_path:
     case eCSSProperty_color:
     case eCSSProperty_color_interpolation:
     case eCSSProperty_color_interpolation_filters:
     case eCSSProperty_cursor:
     case eCSSProperty_display:
     case eCSSProperty_dominant_baseline:
     case eCSSProperty_fill:
     case eCSSProperty_fill_opacity:
     case eCSSProperty_fill_rule:
     case eCSSProperty_filter:
     case eCSSProperty_flood_color:
     case eCSSProperty_flood_opacity:
+    case eCSSProperty_font:
     case eCSSProperty_font_family:
     case eCSSProperty_font_size:
     case eCSSProperty_font_size_adjust:
     case eCSSProperty_font_stretch:
     case eCSSProperty_font_style:
     case eCSSProperty_font_variant:
     case eCSSProperty_font_weight:
     case eCSSProperty_image_rendering:
     case eCSSProperty_letter_spacing:
     case eCSSProperty_lighting_color:
+    case eCSSProperty_marker:
     case eCSSProperty_marker_end:
     case eCSSProperty_marker_mid:
     case eCSSProperty_marker_start:
     case eCSSProperty_mask:
     case eCSSProperty_opacity:
+    case eCSSProperty_overflow:
     case eCSSProperty_pointer_events:
     case eCSSProperty_shape_rendering:
     case eCSSProperty_stop_color:
     case eCSSProperty_stop_opacity:
     case eCSSProperty_stroke:
     case eCSSProperty_stroke_dasharray:
     case eCSSProperty_stroke_dashoffset:
     case eCSSProperty_stroke_linecap:
--- a/content/smil/test/db_smilCSSFromBy.js
+++ b/content/smil/test/db_smilCSSFromBy.js
@@ -82,16 +82,37 @@ var _fromByTestLists =
     new AnimTestcaseFromBy("none", "url(#idB)"),
     new AnimTestcaseFromBy("url(#idB)", "inherit"),
   ],
 };
 
 // List of attribute/testcase-list bundles to be tested
 var gFromByBundles =
 [
+  new TestcaseBundle(gPropList.clip, [
+    new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)",
+                           "rect(10px, 20px, 30px, 40px)",
+                           { midComp: "rect(6px, 12px, 18px, 24px)",
+                             toComp:  "rect(11px, 22px, 33px, 44px)"}),
+    // Adding "auto" (either as a standalone value or a subcomponent value)
+    // should cause animation to fail.
+    new AnimTestcaseFromBy("auto", "auto", { noEffect: 1 }),
+    new AnimTestcaseFromBy("auto",
+                           "rect(auto, auto, auto, auto)", { noEffect: 1 }),
+    new AnimTestcaseFromBy("rect(auto, auto, auto, auto)",
+                           "rect(auto, auto, auto, auto)", { noEffect: 1 }),
+    new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)", "auto", { noEffect: 1 }),
+    new AnimTestcaseFromBy("auto", "rect(1px, 2px, 3px, 4px)", { noEffect: 1 }),
+    new AnimTestcaseFromBy("rect(1px, 2px, 3px, auto)",
+                           "rect(10px, 20px, 30px, 40px)", { noEffect: 1 }),
+    new AnimTestcaseFromBy("rect(1px, auto, 3px, 4px)",
+                           "rect(10px, auto, 30px, 40px)", { noEffect: 1 }),
+    new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)",
+                           "rect(10px, auto, 30px, 40px)", { noEffect: 1 }),
+  ]),
   // Check that 'by' animations for 'cursor' has no effect
   new TestcaseBundle(gPropList.cursor, [
     new AnimTestcaseFromBy("crosshair", "move"),
   ]),
   new TestcaseBundle(gPropList.fill, [].concat(_fromByTestLists.color,
                                                _fromByTestLists.paint)),
   // Check that 'by' animations involving URIs have no effect
   new TestcaseBundle(gPropList.filter,         _fromByTestLists.URIsAndNone),
--- a/content/smil/test/db_smilCSSFromTo.js
+++ b/content/smil/test/db_smilCSSFromTo.js
@@ -146,21 +146,33 @@ var _fromToTestLists = {
                            { fromComp: "url(\"" + document.URL + "#idB\")",
                              toComp: "none"}),
   ],
 };
 
 // List of attribute/testcase-list bundles to be tested
 var gFromToBundles = [
   new TestcaseBundle(gPropList.clip, [
-    // XXXdholbert Add more rect-valued testcases once we support rect values
     new AnimTestcaseFromTo("rect(1px, 2px, 3px, 4px)",
                            "rect(11px, 22px, 33px, 44px)",
                            { midComp: "rect(6px, 12px, 18px, 24px)" }),
-  ], "need support for rect() values"),
+    new AnimTestcaseFromTo("rect(1px, auto, 3px, 4px)",
+                           "rect(11px, auto, 33px, 44px)",
+                           { midComp: "rect(6px, auto, 18px, 24px)" }),
+    new AnimTestcaseFromTo("auto", "auto"),
+    new AnimTestcaseFromTo("rect(auto, auto, auto, auto)",
+                           "rect(auto, auto, auto, auto)"),
+    // Interpolation not supported in these next cases (with auto --> px-value)
+    new AnimTestcaseFromTo("rect(1px, auto, 3px, auto)",
+                           "rect(11px, auto, 33px, 44px)"),
+    new AnimTestcaseFromTo("rect(1px, 2px, 3px, 4px)",
+                           "rect(11px, auto, 33px, 44px)"),
+    new AnimTestcaseFromTo("rect(1px, 2px, 3px, 4px)", "auto"),
+    new AnimTestcaseFromTo("auto", "rect(1px, 2px, 3px, 4px)"),
+  ]),
   new TestcaseBundle(gPropList.clip_path, _fromToTestLists.URIsAndNone),
   new TestcaseBundle(gPropList.clip_rule, [
     new AnimTestcaseFromTo("nonzero", "evenodd"),
     new AnimTestcaseFromTo("evenodd", "inherit", { toComp: "nonzero" }),
   ]),
   new TestcaseBundle(gPropList.color,
                      [].concat(_fromToTestLists.color, [
     // Note: inherited value is rgb(50, 50, 50) (set on <svg>)
--- a/content/smil/test/db_smilCSSPaced.js
+++ b/content/smil/test/db_smilCSSPaced.js
@@ -158,26 +158,68 @@ var _pacedTestLists =
                           "rect(20px, 10px, 50px, 8px); " +
                           "rect(20px, 30px, 130px, 4px)",
                           { comp0:   "rect(10px, 10px, 10px, 10px)",
                             comp1_6: "rect(15px, 10px, 30px, 9px)",
                             comp1_3: "rect(20px, 10px, 50px, 8px)",
                             comp2_3: "rect(20px, 20px, 90px, 6px)",
                             comp1:   "rect(20px, 30px, 130px, 4px)"
                           }),
-    // XXXdholbert Test "inherit" & "auto" as rect values, & test "auto" as
-    // a component value
+    new AnimTestcasePaced("rect(10px, auto, 10px, 10px); " +
+                          "rect(20px, auto, 50px, 8px); " +
+                          "rect(40px, auto, 130px, 4px)",
+                          { comp0:   "rect(10px, auto, 10px, 10px)",
+                            comp1_6: "rect(15px, auto, 30px, 9px)",
+                            comp1_3: "rect(20px, auto, 50px, 8px)",
+                            comp2_3: "rect(30px, auto, 90px, 6px)",
+                            comp1:   "rect(40px, auto, 130px, 4px)"
+                          }),
+    // Paced-mode animation is not supported in these next few cases
+    // (Can't compute subcomponent distance between 'auto' & px-values)
+    new AnimTestcasePaced("rect(10px, 10px, 10px, auto); " +
+                          "rect(20px, 10px, 50px, 8px); " +
+                          "rect(20px, 30px, 130px, 4px)",
+                          { comp0:   "rect(10px, 10px, 10px, auto)",
+                            comp1_6: "rect(10px, 10px, 10px, auto)",
+                            comp1_3: "rect(20px, 10px, 50px, 8px)",
+                            comp2_3: "rect(20px, 30px, 130px, 4px)",
+                            comp1:   "rect(20px, 30px, 130px, 4px)"
+                          }),
+    new AnimTestcasePaced("rect(10px, 10px, 10px, 10px); " +
+                          "rect(20px, 10px, 50px, 8px); " +
+                          "auto",
+                          { comp0:   "rect(10px, 10px, 10px, 10px)",
+                            comp1_6: "rect(10px, 10px, 10px, 10px)",
+                            comp1_3: "rect(20px, 10px, 50px, 8px)",
+                            comp2_3: "auto",
+                            comp1:   "auto"
+                          }),
+    new AnimTestcasePaced("auto; " +
+                          "auto; " +
+                          "rect(20px, 30px, 130px, 4px)",
+                          { comp0:   "auto",
+                            comp1_6: "auto",
+                            comp1_3: "auto",
+                            comp2_3: "rect(20px, 30px, 130px, 4px)",
+                            comp1:   "rect(20px, 30px, 130px, 4px)"
+                          }),
+    new AnimTestcasePaced("auto; auto; auto",
+                          { comp0:   "auto",
+                            comp1_6: "auto",
+                            comp1_3: "auto",
+                            comp2_3: "auto",
+                            comp1:   "auto"
+                          }),
   ],
 };
 
 // TODO: test more properties here.
 var gPacedBundles =
 [
-  new TestcaseBundle(gPropList.clip, _pacedTestLists.rect,
-                    "need support for animating rect-valued properties"),
+  new TestcaseBundle(gPropList.clip,  _pacedTestLists.rect),
   new TestcaseBundle(gPropList.color, _pacedTestLists.color),
   new TestcaseBundle(gPropList.direction, [
     new AnimTestcasePaced("rtl; ltr; rtl")
   ]),
   new TestcaseBundle(gPropList.fill,
                      [].concat(_pacedTestLists.color,
                                _pacedTestLists.paintServer)),
   new TestcaseBundle(gPropList.font_size,