Bug 505115 - Part 21 - Enable 3D transforms by default. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 30 Sep 2011 14:39:40 +1300
changeset 77893 730a82c21c53b68542d5092122642f599ca90176
parent 77892 a08928f32bcea8d90170ed1469403a2042bb8250
child 77894 1f897ad16ac6fd2684483c8df2dc5d9d9bb5b4f1
push id2286
push usermwoodrow@mozilla.com
push dateFri, 30 Sep 2011 01:40:43 +0000
treeherdermozilla-inbound@730a82c21c53 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs505115
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 505115 - Part 21 - Enable 3D transforms by default. r=roc
dom/interfaces/css/nsIDOMCSS2Properties.idl
layout/reftests/reftest.list
layout/style/nsCSSProps.cpp
layout/style/nsDOMCSSDeclaration.h
layout/style/test/ListCSSProperties.cpp
layout/style/test/property_database.js
layout/style/test/test_transitions_per_property.html
modules/libpref/src/init/all.js
--- a/dom/interfaces/css/nsIDOMCSS2Properties.idl
+++ b/dom/interfaces/css/nsIDOMCSS2Properties.idl
@@ -46,17 +46,17 @@
  * The nsIDOMCSS2Properties interface is a datatype for additional
  * reflection of data already provided in nsIDOMCSSStyleDeclaration in
  * the Document Object Model.
  *
  * For more information on this interface please see
  * http://www.w3.org/TR/DOM-Level-2-Style
  */
 
-[builtinclass, scriptable, uuid(79b66107-f9d2-42ac-bc68-b558d79037ec)]
+[builtinclass, scriptable, uuid(519ae4fa-0fee-4aaa-bcb9-34b503236801)]
 interface nsIDOMCSS2Properties : nsISupports
 {
            attribute DOMString        background;
                                         // raises(DOMException) on setting
 
            attribute DOMString        backgroundAttachment;
                                         // raises(DOMException) on setting
 
@@ -679,16 +679,28 @@ interface nsIDOMCSS2Properties : nsISupp
                                         // raises(DOMException) on setting
 
            attribute DOMString        MozTransform;
                                         // raises(DOMException) on setting
 
            attribute DOMString        MozTransformOrigin;
                                         // raises(DOMException) on setting 
 
+           attribute DOMString        MozPerspective;
+                                        // raises(DOMException) on setting
+
+           attribute DOMString        MozPerspectiveOrigin;
+                                        // raises(DOMException) on setting
+
+           attribute DOMString        MozBackfaceVisibility;
+                                        // raises(DOMException) on setting
+
+           attribute DOMString        MozTransformStyle;
+                                        // raises(DOMException) on setting
+
            attribute DOMString        MozWindowShadow;
                                         // raises(DOMException) on setting
 
            attribute DOMString        backgroundSize;
                                         // raises(DOMException) on setting
 
            attribute DOMString        MozTextBlink;
                                         // raises(DOMException) on setting
--- a/layout/reftests/reftest.list
+++ b/layout/reftests/reftest.list
@@ -268,18 +268,18 @@ skip-if(Android) include text-shadow/ref
 include ../../toolkit/themes/pinstripe/reftests/reftest.list
 
 # text-transform/
 include text-transform/reftest.list
 
 # -moz-transform/
 include transform/reftest.list
 
-# 3d transforms - disabled currently
-#include transform-3d/reftest.list
+# 3d transforms
+include transform-3d/reftest.list
 
 # unicode/ (verify that we don't do expend effort doing unicode-aware case checks)
 include unicode/reftest.list
 
 # widget/
 include ../../widget/reftests/reftest.list
 
 # xml-stylesheet/
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -347,22 +347,16 @@ nsCSSProps::LookupProperty(const nsACStr
                             *alias_end = gAliases + NS_ARRAY_LENGTH(gAliases);
          alias < alias_end; ++alias) {
       if (aProperty.LowerCaseEqualsASCII(alias->name)) {
         res = alias->id;
         break;
       }
     }
   }
-  
-  if (res == eCSSProperty_perspective || res == eCSSProperty_perspective_origin || 
-      res == eCSSProperty_backface_visibility || res == eCSSProperty_transform_style) {
-    return eCSSProperty_UNKNOWN;
-  }
-
   return res;
 }
 
 nsCSSProperty
 nsCSSProps::LookupProperty(const nsAString& aProperty)
 {
   // This is faster than converting and calling
   // LookupProperty(nsACString&).  The table will do its own
@@ -374,22 +368,16 @@ nsCSSProps::LookupProperty(const nsAStri
                             *alias_end = gAliases + NS_ARRAY_LENGTH(gAliases);
          alias < alias_end; ++alias) {
       if (aProperty.LowerCaseEqualsASCII(alias->name)) {
         res = alias->id;
         break;
       }
     }
   }
-  
-  if (res == eCSSProperty_perspective || res == eCSSProperty_perspective_origin || 
-      res == eCSSProperty_backface_visibility || res == eCSSProperty_transform_style) {
-    return eCSSProperty_UNKNOWN;
-  }
-
   return res;
 }
 
 nsCSSFontDesc
 nsCSSProps::LookupFontDesc(const nsACString& aFontDesc)
 {
   NS_ABORT_IF_FALSE(gFontDescTable, "no lookup table, needs addref");
   return nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc));
--- a/layout/style/nsDOMCSSDeclaration.h
+++ b/layout/style/nsDOMCSSDeclaration.h
@@ -62,25 +62,16 @@ class nsDOMCSSDeclaration : public nsICS
 {
 public:
   // Only implement QueryInterface; subclasses have the responsibility
   // of implementing AddRef/Release.
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
 
   NS_DECL_NSICSSDECLARATION
 
-  NS_IMETHOD GetMozPerspective(nsAString_internal&);
-  NS_IMETHOD SetMozPerspective(const nsAString_internal&);
-  NS_IMETHOD GetMozPerspectiveOrigin(nsAString_internal&);
-  NS_IMETHOD SetMozPerspectiveOrigin(const nsAString_internal&);
-  NS_IMETHOD GetMozBackfaceVisibility(nsAString_internal&);
-  NS_IMETHOD SetMozBackfaceVisibility(const nsAString_internal&);
-  NS_IMETHOD GetMozTransformStyle(nsAString_internal&);
-  NS_IMETHOD SetMozTransformStyle(const nsAString_internal&);
-
   // Require subclasses to implement |GetParentRule|.
   //NS_DECL_NSIDOMCSSSTYLEDECLARATION
   NS_IMETHOD GetCssText(nsAString & aCssText);
   NS_IMETHOD SetCssText(const nsAString & aCssText);
   NS_IMETHOD GetPropertyValue(const nsAString & propertyName,
                               nsAString & _retval);
   NS_IMETHOD GetPropertyCSSValue(const nsAString & propertyName,
                                  nsIDOMCSSValue **_retval);
--- a/layout/style/test/ListCSSProperties.cpp
+++ b/layout/style/test/ListCSSProperties.cpp
@@ -188,24 +188,16 @@ print_array(const char *aName,
         const PropertyInfo *p = aProps + i;
 
         if (is_inaccessible(p->propName))
             // inaccessible properties never have DOM props, so don't
             // worry about incrementing j.  The assertion below will
             // catch if they do.
             continue;
 
-        if (strcmp(p->propName, "-moz-perspective") == 0 ||
-            strcmp(p->propName, "-moz-perspective-origin") == 0 ||
-            strcmp(p->propName, "-moz-backface-visibility") == 0 ||
-            strcmp(p->propName, "-moz-transform-style") == 0) {
-            ++j;
-            continue;
-        }
-
         if (first)
             first = 0;
         else
             printf(",\n");
 
         printf("\t{ name: \"%s\", prop: ", p->propName);
         if (j >= aDOMPropsLength || strcmp(p->propName, aDOMProps[j]) != 0)
             printf("null");
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -976,16 +976,67 @@ var gCSSProperties = {
 			"-moz-calc(20px + 50%) -moz-calc(50% - 10px)",
 			"-moz-calc(-20px) -moz-calc(-50%)",
 			"-moz-calc(-20%) -moz-calc(-50%)"
 		],
 		invalid_values: ["red", "auto", "none", "0.5 0.5", "40px #0000ff",
 						 "border", "center red", "right diagonal",
 						 "#00ffff bottom"]
 	},
+    "-moz-perspective-origin": {
+        domProp: "MozPerspectiveOrigin",
+        inherited: false,
+        type: CSS_TYPE_LONGHAND,
+        /* no subproperties */
+        prerequisites: { "width": "10px", "height": "10px", "display": "block"},
+        initial_values: [ "50% 50%", "center", "center center" ],
+        other_values: [ "25% 25%", "5px 5px", "20% 3em", "0 0", "0in 1in",
+                        "top", "bottom","top left", "top right",
+                        "top center", "center left", "center right",
+                        "bottom left", "bottom right", "bottom center",
+                        "20% center", "5px center", "13in bottom",
+                        "left 50px", "right 13%", "center 40px",
+                        "-moz-calc(20px)",
+                        "-moz-calc(20px) 10px",
+                        "10px -moz-calc(20px)",
+                        "-moz-calc(20px) 25%",
+                        "25% -moz-calc(20px)",
+                        "-moz-calc(20px) -moz-calc(20px)",
+                        "-moz-calc(20px + 1em) -moz-calc(20px / 2)",
+                        "-moz-calc(20px + 50%) -moz-calc(50% - 10px)",
+                        "-moz-calc(-20px) -moz-calc(-50%)",
+                        "-moz-calc(-20%) -moz-calc(-50%)" ],
+        invalid_values: [ "red", "auto", "none", "0.5 0.5", "40px #0000ff",
+                          "border", "center red", "right diagonal",
+                          "#00ffff bottom"]
+    },
+    "-moz-perspective": {
+		domProp: "MozPerspective",
+		inherited: false,
+		type: CSS_TYPE_LONGHAND,
+		initial_values: [ "none", "0" ],
+		other_values: [ "1000px", "500.2px", "-100px", "-27.2em" ],
+		invalid_values: [ "pants", "200" ]
+	},
+    "-moz-backface-visibility": {
+        domProp: "MozBackfaceVisibility",
+        inherited: false,
+        type: CSS_TYPE_LONGHAND,
+        initial_values: [ "visible" ],
+        other_values: [ "hidden" ],
+        invalid_values: [ "collapse" ]
+    },
+	"-moz-transform-style": {
+		domProp: "MozTransformStyle",
+		inherited: false,
+		type: CSS_TYPE_LONGHAND,
+		initial_values: [ "flat" ],
+		other_values: [ "preserve-3d" ],
+		invalid_values: []
+	},
 	"-moz-user-focus": {
 		domProp: "MozUserFocus",
 		inherited: true,
 		type: CSS_TYPE_LONGHAND,
 		initial_values: [ "none" ],
 		other_values: [ "normal", "ignore", "select-all", "select-before", "select-after", "select-same", "select-menu" ],
 		invalid_values: []
 	},
--- a/layout/style/test/test_transitions_per_property.html
+++ b/layout/style/test/test_transitions_per_property.html
@@ -75,16 +75,19 @@ var supported_properties = {
     "-moz-outline-radius-topleft": [ test_radius_transition ],
     "-moz-outline-radius-topright": [ test_radius_transition ],
     "-moz-text-decoration-color": [ test_color_transition,
                                     test_border_color_transition ],
     "-moz-transform": [ test_transform_transition ],
     "-moz-transform-origin": [ test_length_pair_transition,
                                test_length_percent_pair_transition,
                                test_length_percent_pair_unclamped ],
+    "-moz-perspective-origin": [ test_length_pair_transition,
+                                 test_length_percent_pair_transition,
+                                 test_length_percent_pair_unclamped ],
     "background-color": [ test_color_transition ],
     "background-position": [ test_background_position_transition,
                              // FIXME: We don't currently test clamping,
                              // since background-position uses calc() as
                              // an intermediate form.
                              /* test_length_percent_pair_unclamped */ ],
     "background-size": [ test_background_size_transition,
                          // FIXME: We don't currently test clamping,
@@ -185,16 +188,17 @@ var supported_properties = {
                       test_length_percent_calc_transition,
                       test_length_clamped, test_percent_clamped ],
     "padding-right": [ test_length_transition, test_percent_transition,
                        test_length_percent_calc_transition,
                        test_length_clamped, test_percent_clamped ],
     "padding-top": [ test_length_transition, test_percent_transition,
                      test_length_percent_calc_transition,
                      test_length_clamped, test_percent_clamped ],
+    "-moz-perspective": [ test_length_transition ],
     "right": [ test_length_transition, test_percent_transition,
                test_length_percent_calc_transition,
                test_length_unclamped, test_percent_unclamped ],
     "stop-color": [ test_color_transition ],
     "stop-opacity" : [ test_float_zeroToOne_transition,
                        // opacity is clamped in computed style
                        // (not parsing/interpolation)
                        test_float_zeroToOne_clamped ],
@@ -1318,21 +1322,21 @@ function test_transform_transition(prop)
     { start: 'translateX(-20px)', end: 'none',
       expected_uncomputed: 'translateX(-15px)',
       expected: 'matrix(1, 0, 0, 1, -15px, 0px)' },
     { start: 'translateY(-40px)', end: 'none',
       expected_uncomputed: 'translateY(-30px)',
       expected: 'matrix(1, 0, 0, 1, 0px, -30px)' },
     { start: 'translateZ(40px)', end: 'none',
       expected_uncomputed: 'translateZ(30px)',
-      expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 30, 1)',
+      expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0px, 0px, 30px, 1)',
       requires_3d: true },
     { start: 'none', end: 'translate3D(40px, 60px, -40px)',
       expected_uncomputed: 'translate3D(10px, 15px, -10px)',
-      expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10, 15, -10, 1)',
+      expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10px, 15px, -10px, 1)',
       requires_3d: true },
     // percentages are relative to 300px (width) and 50px (height)
     // per the prerequisites in property_database.js
     { start: 'translate(20%)', end: 'none',
       expected_uncomputed: 'translate(15%)',
       expected: 'matrix(1, 0, 0, 1, 45px, 0px)',
       round_error_ok: true },
     { start: 'translate(20%, 12%)', end: 'none',
@@ -1395,21 +1399,21 @@ function test_transform_transition(prop)
     { start: 'scaleX(3)', end: 'none',
       expected_uncomputed: 'scaleX(2.5)',
       expected: 'matrix(2.5, 0, 0, 1, 0px, 0px)' },
     { start: 'scaleY(5)', end: 'none',
       expected_uncomputed: 'scaleY(4)',
       expected: 'matrix(1, 0, 0, 4, 0px, 0px)' },
     { start: 'scaleZ(5)', end: 'none',
       expected_uncomputed: 'scaleZ(4)',
-      expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 0, 0, 0, 0, 1)',
+      expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 0, 0px, 0px, 0px, 1)',
       requires_3d: true },
     { start: 'none', end: 'scale3D(5, 5, 5)',
       expected_uncomputed: 'scale3D(2, 2, 2)',
-      expected: 'matrix3d(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)',
+      expected: 'matrix3d(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0px, 0px, 0px, 1)',
       requires_3d: true },
 
     // skew
     { start: 'skewX(45deg)', end: 'none',
       expected_uncomputed: 'skewX(33.75deg)' },
     { start: 'skewY(45deg)', end: 'none',
       expected_uncomputed: 'skewY(33.75deg)' },
     { start: 'skew(45deg)', end: 'none',
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -3357,9 +3357,9 @@ pref("full-screen-api.enabled", false);
 pref("full-screen-api.allow-trusted-requests-only", true);
 pref("full-screen-api.key-input-restricted", true);
 
 // Time limit, in milliseconds, for nsEventStateManager::IsHandlingUserInput().
 // Used to detect long running handlers of user-generated events.
 pref("dom.event.handling-user-input-time-limit", 1000);
  
 //3D Transforms
-pref("layout.3d-transforms.enabled", false);
+pref("layout.3d-transforms.enabled", true);