Add support for animation of -moz-column-count. (Bug 524854) r=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Fri, 11 Dec 2009 08:13:19 -0800
changeset 35568 eabbfb401338bf12a9fd9a2c587d949055f26bdb
parent 35567 b232fe0878bd1105c637187021794c59c76f0fa4
child 35569 fa46cff7f78d136e9e5335e35b1def2329663a08
push id10636
push userdbaron@mozilla.com
push dateFri, 11 Dec 2009 16:15:23 +0000
treeherdermozilla-central@b06d6479f8a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs524854
milestone1.9.3a1pre
Add support for animation of -moz-column-count. (Bug 524854) r=bzbarsky
layout/style/nsCSSPropList.h
layout/style/nsStyleAnimation.cpp
layout/style/test/test_transitions_per_property.html
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -1208,18 +1208,18 @@ CSS_PROP_COLUMN(
     -moz-column-count,
     _moz_column_count,
     MozColumnCount,
     0,
     Column,
     mColumnCount,
     eCSSType_Value,
     nsnull,
-    CSS_PROP_NO_OFFSET,
-    eStyleAnimType_None)
+    offsetof(nsStyleColumn, mColumnCount),
+    eStyleAnimType_Custom)
 CSS_PROP_COLUMN(
     -moz-column-width,
     _moz_column_width,
     MozColumnWidth,
     0,
     Column,
     mColumnWidth,
     eCSSType_Value,
--- a/layout/style/nsStyleAnimation.cpp
+++ b/layout/style/nsStyleAnimation.cpp
@@ -1122,16 +1122,28 @@ nsStyleAnimation::ExtractComputedValue(n
         #else
           if (!styleOutline->GetOutlineColor(color))
             color = aStyleContext->GetStyleColor()->mColor;
         #endif
           aComputedValue.SetColorValue(color);
           break;
         }
 
+        case eCSSProperty__moz_column_count: {
+          const nsStyleColumn *styleColumn =
+            static_cast<const nsStyleColumn*>(styleStruct);
+          if (styleColumn->mColumnCount == NS_STYLE_COLUMN_COUNT_AUTO) {
+            aComputedValue.SetAutoValue();
+          } else {
+            aComputedValue.SetIntValue(styleColumn->mColumnCount,
+                                       eUnit_Integer);
+          }
+          break;
+        }
+
         case eCSSProperty_stroke_dasharray: {
           const nsStyleSVG *svg = static_cast<const nsStyleSVG*>(styleStruct);
           NS_ABORT_IF_FALSE((svg->mStrokeDasharray != nsnull) ==
                             (svg->mStrokeDasharrayLength != 0),
                             "pointer/length mismatch");
           nsAutoPtr<nsCSSValueList> result;
           if (svg->mStrokeDasharray) {
             NS_ABORT_IF_FALSE(svg->mStrokeDasharrayLength > 0,
--- a/layout/style/test/test_transitions_per_property.html
+++ b/layout/style/test/test_transitions_per_property.html
@@ -49,16 +49,17 @@ function any_unit_to_num(str)
 var supported_properties = {
     "-moz-border-radius-bottomleft": [ test_radius_transition ],
     "-moz-border-radius-bottomright": [ test_radius_transition ],
     "-moz-border-radius-topleft": [ test_radius_transition ],
     "-moz-border-radius-topright": [ test_radius_transition ],
     "-moz-box-flex": [ test_float_zeroToOne_transition,
                        test_float_aboveOne_transition ],
     "-moz-box-shadow": [ test_shadow_transition ],
+    "-moz-column-count": [ test_pos_integer_or_auto_transition ],
     "-moz-column-gap": [ test_length_transition ],
     "-moz-column-rule-color": [ test_color_transition ],
     "-moz-column-width": [ test_length_transition ],
     "-moz-outline-radius-bottomleft": [ test_radius_transition ],
     "-moz-outline-radius-bottomright": [ test_radius_transition ],
     "-moz-outline-radius-topleft": [ test_radius_transition ],
     "-moz-outline-radius-topright": [ test_radius_transition ],
     "background-color": [ test_color_transition ],
@@ -113,17 +114,17 @@ var supported_properties = {
     "stroke-opacity" : [ test_float_zeroToOne_transition ],
     "stroke-width": [ test_length_transition, test_percent_transition ],
     "text-indent": [ test_length_transition, test_percent_transition ],
     "text-shadow": [ test_shadow_transition ],
     "top": [ test_length_transition, test_percent_transition ],
     "vertical-align": [ test_length_transition, test_percent_transition ],
     "width": [ test_length_transition, test_percent_transition ],
     "word-spacing": [ test_length_transition ],
-    "z-index": [ test_zindex_transition ],
+    "z-index": [ test_zindex_transition, test_pos_integer_or_auto_transition ],
 };
 
 var div = document.getElementById("display");
 var cs = getComputedStyle(div, "");
 
 var prop;
 for (prop in supported_properties) {
   // Test that prop is in the property database.
@@ -474,12 +475,32 @@ function test_font_weight(prop) {
   div.style.setProperty(prop, "700", "");
   is(cs.getPropertyValue(prop), "700",
      "font-weight property " + prop + ": computed value before transition");
   div.style.setProperty(prop, "100", "");
   is(cs.getPropertyValue(prop), "400",
      "font-weight property " + prop + ": interpolation of font-weights");
 }
 
+function test_pos_integer_or_auto_transition(prop) {
+  div.style.setProperty("-moz-transition-property", "none", "");
+  div.style.setProperty(prop, "4", "");
+  is(cs.getPropertyValue(prop), "4",
+     "integer-valued property " + prop + ": computed value before transition");
+  div.style.setProperty("-moz-transition-property", prop, "");
+  div.style.setProperty(prop, "7", "");
+  is(cs.getPropertyValue(prop), "5",
+     "integer-valued property " + prop + ": interpolation of lengths");
+  div.style.setProperty(prop, "auto", "");
+  is(cs.getPropertyValue(prop), "auto",
+     "integer-valued property " + prop + ": auto not interpolable");
+  div.style.setProperty(prop, "8", "");
+  is(cs.getPropertyValue(prop), "8",
+     "integer-valued property " + prop + ": computed value before transition");
+  div.style.setProperty(prop, "4", "");
+  is(cs.getPropertyValue(prop), "6",
+     "integer-valued property " + prop + ": interpolation of lengths");
+}
+
 </script>
 </pre>
 </body>
 </html>