Bug 505115 - Part 21 - Enable 3D transforms by default. r=roc

This commit is contained in:
Matt Woodrow 2011-09-30 14:39:40 +13:00
parent e23cc710a1
commit bc10d9cf93
8 changed files with 75 additions and 37 deletions

View File

@ -51,7 +51,7 @@
* 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;
@ -684,6 +684,18 @@ interface nsIDOMCSS2Properties : nsISupports
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

View File

@ -273,8 +273,8 @@ 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

View File

@ -352,12 +352,6 @@ nsCSSProps::LookupProperty(const nsACString& aProperty)
}
}
}
if (res == eCSSProperty_perspective || res == eCSSProperty_perspective_origin ||
res == eCSSProperty_backface_visibility || res == eCSSProperty_transform_style) {
return eCSSProperty_UNKNOWN;
}
return res;
}
@ -379,12 +373,6 @@ nsCSSProps::LookupProperty(const nsAString& aProperty)
}
}
}
if (res == eCSSProperty_perspective || res == eCSSProperty_perspective_origin ||
res == eCSSProperty_backface_visibility || res == eCSSProperty_transform_style) {
return eCSSProperty_UNKNOWN;
}
return res;
}

View File

@ -67,15 +67,6 @@ public:
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);

View File

@ -193,14 +193,6 @@ print_array(const char *aName,
// 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

View File

@ -981,6 +981,57 @@ var gCSSProperties = {
"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,

View File

@ -80,6 +80,9 @@ var supported_properties = {
"-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,
@ -190,6 +193,7 @@ var supported_properties = {
"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 ],
@ -1323,11 +1327,11 @@ function test_transform_transition(prop) {
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
@ -1400,11 +1404,11 @@ function test_transform_transition(prop) {
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

View File

@ -3362,4 +3362,4 @@ pref("full-screen-api.key-input-restricted", true);
pref("dom.event.handling-user-input-time-limit", 1000);
//3D Transforms
pref("layout.3d-transforms.enabled", false);
pref("layout.3d-transforms.enabled", true);