2009-10-07 20:22:42 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=435441
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 435441</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="text/javascript" src="property_database.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
<style type="text/css">
|
|
|
|
|
|
|
|
#display > p { margin-top: 0; margin-bottom: 0; }
|
|
|
|
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=435441">Mozilla Bug 435441</a>
|
|
|
|
|
|
|
|
<!--
|
|
|
|
fixed-height container so percentage heights compute to different
|
|
|
|
(i.e., nonzero) values
|
2009-10-13 19:38:20 -07:00
|
|
|
fixed-width container so that percentages for margin-top and
|
|
|
|
margin-bottom are all relative to the same size container (rather than
|
|
|
|
one that depends on whether we're tall enough to need a scrollbar)
|
2010-06-26 11:58:06 -07:00
|
|
|
|
|
|
|
Use a 20px font size and line-height so that percentage line-height
|
|
|
|
and vertical-align doesn't accumulate rounding error.
|
2009-10-07 20:22:42 -07:00
|
|
|
-->
|
2010-06-26 11:58:06 -07:00
|
|
|
<div style="height: 50px; width: 300px; font-size: 20px; line-height: 20px">
|
2009-10-07 20:22:42 -07:00
|
|
|
|
|
|
|
<div id="display">
|
2013-06-04 20:11:56 -07:00
|
|
|
</div>
|
2009-10-07 20:22:42 -07:00
|
|
|
|
2013-06-04 20:11:56 -07:00
|
|
|
<div id="transformTest" style="height:100px; width:200px; background-color:blue;">
|
2009-10-07 20:22:42 -07:00
|
|
|
</div>
|
2013-06-04 20:11:56 -07:00
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 435441 **/
|
|
|
|
|
2013-06-04 20:11:56 -07:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
function has_num(str)
|
|
|
|
{
|
|
|
|
return !!String(str).match(/^([\d.]+)/);
|
|
|
|
}
|
|
|
|
|
|
|
|
function any_unit_to_num(str)
|
|
|
|
{
|
|
|
|
return Number(String(str).match(/^([\d.]+)/)[1]);
|
|
|
|
}
|
|
|
|
|
2011-05-09 12:02:35 -07:00
|
|
|
var FUNC_NEGATIVE = "cubic-bezier(0.25, -2, 0.75, 1)";
|
2013-01-08 20:37:29 -08:00
|
|
|
var FUNC_OVERONE = "cubic-bezier(0.25, 0, 0.75, 3)";
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
var supported_properties = {
|
2010-09-09 08:21:47 -07:00
|
|
|
"border-bottom-left-radius": [ test_radius_transition ],
|
|
|
|
"border-bottom-right-radius": [ test_radius_transition ],
|
|
|
|
"border-top-left-radius": [ test_radius_transition ],
|
|
|
|
"border-top-right-radius": [ test_radius_transition ],
|
2009-12-11 08:13:19 -08:00
|
|
|
"-moz-box-flex": [ test_float_zeroToOne_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_float_aboveOne_transition,
|
|
|
|
test_float_zeroToOne_clamped ],
|
2010-09-11 09:27:12 -07:00
|
|
|
"box-shadow": [ test_shadow_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"-moz-column-count": [ test_pos_integer_or_auto_transition,
|
|
|
|
test_integer_at_least_one_clamping ],
|
|
|
|
"-moz-column-gap": [ test_length_transition,
|
|
|
|
test_length_clamped ],
|
2010-04-06 19:03:12 -07:00
|
|
|
"-moz-column-rule-color": [ test_color_transition,
|
|
|
|
test_border_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"-moz-column-rule-width": [ test_length_transition,
|
|
|
|
test_length_clamped ],
|
|
|
|
"-moz-column-width": [ test_length_transition,
|
|
|
|
test_length_clamped ],
|
2009-12-21 13:46:25 -08:00
|
|
|
"-moz-image-region": [ test_rect_transition ],
|
2009-10-28 20:22:27 -07:00
|
|
|
"-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 ],
|
2011-03-31 05:26:35 -07:00
|
|
|
"-moz-text-decoration-color": [ test_color_transition,
|
|
|
|
test_border_color_transition ],
|
2009-10-07 20:22:42 -07:00
|
|
|
"background-color": [ test_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"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,
|
|
|
|
// since background-size uses calc() as an
|
|
|
|
// intermediate form.
|
|
|
|
/* test_length_percent_pair_clamped */ ],
|
2010-04-06 19:03:12 -07:00
|
|
|
"border-bottom-color": [ test_color_transition,
|
|
|
|
test_border_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"border-bottom-width": [ test_length_transition,
|
|
|
|
test_length_clamped ],
|
2010-04-06 19:03:12 -07:00
|
|
|
"border-left-color": [ test_color_transition,
|
|
|
|
test_border_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"border-left-width": [ test_length_transition,
|
|
|
|
test_length_clamped ],
|
2010-04-06 19:03:12 -07:00
|
|
|
"border-right-color": [ test_color_transition,
|
|
|
|
test_border_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"border-right-width": [ test_length_transition,
|
|
|
|
test_length_clamped ],
|
|
|
|
"border-spacing": [ test_length_pair_transition,
|
|
|
|
test_length_pair_transition_clamped ],
|
2010-04-06 19:03:12 -07:00
|
|
|
"border-top-color": [ test_color_transition,
|
|
|
|
test_border_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"border-top-width": [ test_length_transition,
|
|
|
|
test_length_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"bottom": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
2009-12-21 13:46:25 -08:00
|
|
|
"clip": [ test_rect_transition ],
|
2009-10-07 20:22:42 -07:00
|
|
|
"color": [ test_color_transition ],
|
|
|
|
"fill": [ test_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"fill-opacity" : [ test_float_zeroToOne_transition,
|
|
|
|
// opacity is clamped in computed style
|
|
|
|
// (not parsing/interpolation)
|
|
|
|
test_float_zeroToOne_clamped ],
|
2009-10-07 20:22:42 -07:00
|
|
|
"flood-color": [ test_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"flood-opacity" : [ test_float_zeroToOne_transition,
|
|
|
|
// opacity is clamped in computed style
|
|
|
|
// (not parsing/interpolation)
|
|
|
|
test_float_zeroToOne_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"font-size": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2009-10-08 18:30:51 -07:00
|
|
|
"font-size-adjust": [ test_float_zeroToOne_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_float_aboveOne_transition,
|
|
|
|
/* FIXME: font-size-adjust treats zero specially */
|
|
|
|
/* test_float_zeroToOne_clamped */ ],
|
2009-11-14 19:16:59 -08:00
|
|
|
"font-stretch": [ test_font_stretch ],
|
|
|
|
"font-weight": [ test_font_weight ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"height": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"left": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
|
|
|
"letter-spacing": [ test_length_transition, test_length_unclamped ],
|
2009-10-07 20:22:42 -07:00
|
|
|
"lighting-color": [ test_color_transition ],
|
2010-09-15 08:11:26 -07:00
|
|
|
// NOTE: when calc() is supported on 'line-height', we should add
|
|
|
|
// test_length_percent_calc_transition.
|
2011-05-09 12:02:35 -07:00
|
|
|
"line-height": [ test_length_transition, test_percent_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"margin-bottom": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"margin-left": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"margin-right": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"margin-top": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
|
|
|
"marker-offset": [ test_length_transition,
|
|
|
|
test_length_unclamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"max-height": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"max-width": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"min-height": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"min-width": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
|
|
|
"opacity" : [ test_float_zeroToOne_transition,
|
|
|
|
// opacity is clamped in computed style
|
|
|
|
// (not parsing/interpolation)
|
|
|
|
test_float_zeroToOne_clamped ],
|
2009-10-13 19:38:20 -07:00
|
|
|
"outline-color": [ test_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"outline-offset": [ test_length_transition, test_length_unclamped ],
|
|
|
|
"outline-width": [ test_length_transition, test_length_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"padding-bottom": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"padding-left": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"padding-right": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"padding-top": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2012-07-01 23:23:54 -07:00
|
|
|
"perspective": [ test_length_transition ],
|
|
|
|
"perspective-origin": [ test_length_pair_transition,
|
|
|
|
test_length_percent_pair_transition,
|
|
|
|
test_length_percent_pair_unclamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"right": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
2009-10-07 20:22:42 -07:00
|
|
|
"stop-color": [ test_color_transition ],
|
2011-05-09 12:02:35 -07:00
|
|
|
"stop-opacity" : [ test_float_zeroToOne_transition,
|
|
|
|
// opacity is clamped in computed style
|
|
|
|
// (not parsing/interpolation)
|
|
|
|
test_float_zeroToOne_clamped ],
|
2009-10-07 20:22:42 -07:00
|
|
|
"stroke": [ test_color_transition ],
|
2009-10-21 07:17:40 -07:00
|
|
|
"stroke-dasharray": [ test_dasharray_transition ],
|
2010-09-15 08:11:26 -07:00
|
|
|
// NOTE: when calc() is supported on 'stroke-dashoffset', we should
|
|
|
|
// add test_length_percent_calc_transition.
|
2011-05-09 12:02:35 -07:00
|
|
|
"stroke-dashoffset": [ test_length_transition, test_percent_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
|
|
|
"stroke-miterlimit": [ test_float_aboveOne_transition,
|
|
|
|
test_float_aboveOne_clamped ],
|
|
|
|
"stroke-opacity" : [ test_float_zeroToOne_transition,
|
|
|
|
// opacity is clamped in computed style
|
|
|
|
// (not parsing/interpolation)
|
|
|
|
test_float_zeroToOne_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
// NOTE: when calc() is supported on 'stroke-width', we should add
|
|
|
|
// test_length_percent_calc_transition.
|
2011-05-09 12:02:35 -07:00
|
|
|
"stroke-width": [ test_length_transition, test_percent_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"text-indent": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
2009-10-21 03:53:46 -07:00
|
|
|
"text-shadow": [ test_shadow_transition ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"top": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
2012-07-01 23:23:54 -07:00
|
|
|
"transform": [ test_transform_transition ],
|
|
|
|
"transform-origin": [ test_length_pair_transition,
|
|
|
|
test_length_percent_pair_transition,
|
|
|
|
test_length_percent_pair_unclamped ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"vertical-align": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_unclamped, test_percent_unclamped ],
|
2009-12-21 13:46:25 -08:00
|
|
|
"visibility": [ test_visibility_transition ],
|
2010-09-15 08:11:26 -07:00
|
|
|
"width": [ test_length_transition, test_percent_transition,
|
2011-05-09 12:02:35 -07:00
|
|
|
test_length_percent_calc_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
|
|
|
"word-spacing": [ test_length_transition, test_length_unclamped ],
|
2012-07-06 17:06:19 -07:00
|
|
|
"z-index": [ test_integer_transition, test_pos_integer_or_auto_transition ],
|
2009-10-07 20:22:42 -07:00
|
|
|
};
|
|
|
|
|
2012-10-03 18:44:11 -07:00
|
|
|
// Automatically add pref-controlled CSS properties & keywords
|
|
|
|
// to supported_properties, if the flexbox pref is enabled.
|
|
|
|
if (SpecialPowers.getBoolPref("layout.css.flexbox.enabled")) {
|
|
|
|
var flexbox_properties = {
|
2012-10-15 12:42:43 -07:00
|
|
|
"flex-basis": [ test_length_transition, test_percent_transition,
|
|
|
|
test_length_clamped, test_percent_clamped ],
|
|
|
|
"flex-grow": [ test_float_zeroToOne_transition,
|
|
|
|
test_float_aboveOne_transition ],
|
|
|
|
"flex-shrink": [ test_float_zeroToOne_transition,
|
|
|
|
test_float_aboveOne_transition ],
|
|
|
|
"order": [ test_integer_transition ]
|
2012-10-03 18:44:11 -07:00
|
|
|
};
|
|
|
|
for (var prop in flexbox_properties) {
|
|
|
|
supported_properties[prop] = flexbox_properties[prop];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
var div = document.getElementById("display");
|
2013-06-04 20:11:56 -07:00
|
|
|
var transformDiv = document.getElementById("transformTest");
|
2009-10-07 20:22:42 -07:00
|
|
|
var cs = getComputedStyle(div, "");
|
2013-06-04 20:11:56 -07:00
|
|
|
var transformCs = getComputedStyle(transformDiv, "");
|
|
|
|
var winUtils = SpecialPowers.getDOMWindowUtils(window);
|
2009-10-07 20:22:42 -07:00
|
|
|
|
2013-06-04 20:11:56 -07:00
|
|
|
function computeMatrix(v) {
|
|
|
|
div.style.setProperty("transform", v, "");
|
|
|
|
var result = cs.getPropertyValue("transform");
|
|
|
|
div.style.removeProperty("transform");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
var c_rot_15 = computeMatrix("rotate(15deg)");
|
|
|
|
is(c_rot_15.substring(0,6), "matrix", "should compute to matrix value");
|
|
|
|
var c_rot_60 = computeMatrix("rotate(60deg)");
|
|
|
|
is(c_rot_60.substring(0,6), "matrix", "should compute to matrix value");
|
|
|
|
|
2013-06-04 20:11:56 -07:00
|
|
|
var transformTestIndex = 0;
|
2013-06-04 20:11:56 -07:00
|
|
|
var transformTests = [
|
|
|
|
// rotate
|
|
|
|
{ start: 'none', end: 'rotate(60deg)',
|
|
|
|
expected_uncomputed: 'rotate(15deg)',
|
|
|
|
expected: c_rot_15 },
|
|
|
|
{ start: 'rotate(0)', end: 'rotate(60deg)',
|
|
|
|
expected_uncomputed: 'rotate(15deg)',
|
|
|
|
expected: c_rot_15 },
|
|
|
|
{ start: 'rotate(0deg)', end: 'rotate(60deg)',
|
|
|
|
expected_uncomputed: 'rotate(15deg)',
|
|
|
|
expected: c_rot_15 },
|
|
|
|
{ start: 'none', end: c_rot_60,
|
|
|
|
expected: c_rot_15 },
|
|
|
|
{ start: 'none', end: 'rotate(360deg)',
|
|
|
|
expected_uncomputed: 'rotate(90deg)',
|
|
|
|
expected: computeMatrix('rotate(90deg)') },
|
|
|
|
{ start: 'none', end: 'rotatez(360deg)',
|
|
|
|
expected_uncomputed: 'rotate(90deg)',
|
|
|
|
expected: computeMatrix('rotate(90deg)'),
|
|
|
|
requires_3d: true },
|
|
|
|
{ start: 'none', end: 'rotate(720deg)',
|
|
|
|
expected_uncomputed: 'rotate(180deg)',
|
|
|
|
expected: computeMatrix('rotate(180deg)') },
|
|
|
|
{ start: 'none', end: 'rotate(720deg)',
|
|
|
|
expected_uncomputed: 'rotatez(180deg)',
|
|
|
|
expected: computeMatrix('rotate(180deg)'),
|
|
|
|
requires_3d: true },
|
|
|
|
{ start: 'none', end: 'rotate(1080deg)',
|
|
|
|
expected_uncomputed: 'rotate(270deg)',
|
|
|
|
expected: computeMatrix('rotate(270deg)') },
|
|
|
|
{ start: 'none', end: 'rotate(1080deg)',
|
|
|
|
expected_uncomputed: 'rotate(270deg)',
|
|
|
|
expected: computeMatrix('rotatez(270deg)'),
|
|
|
|
requires_3d: true },
|
|
|
|
{ start: 'none', end: 'rotate(1440deg)',
|
|
|
|
expected_uncomputed: 'rotate(360deg)',
|
|
|
|
expected: computeMatrix('scale(1)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'none', end: 'rotatey(60deg)',
|
|
|
|
expected_uncomputed: 'rotatey(15deg)',
|
|
|
|
expected: computeMatrix('rotatey(15deg)'),
|
|
|
|
requires_3d: true },
|
|
|
|
{ start: 'none', end: 'rotatey(720deg)',
|
|
|
|
expected_uncomputed: 'rotatey(180deg)',
|
|
|
|
expected: computeMatrix('rotatey(180deg)'),
|
|
|
|
requires_3d: true },
|
|
|
|
{ start: 'none', end: 'rotatex(60deg)',
|
|
|
|
expected_uncomputed: 'rotatex(15deg)',
|
|
|
|
expected: computeMatrix('rotatex(15deg)'),
|
|
|
|
requires_3d: true },
|
|
|
|
{ start: 'none', end: 'rotatex(720deg)',
|
|
|
|
expected_uncomputed: 'rotatex(180deg)',
|
|
|
|
expected: computeMatrix('rotatex(180deg)'),
|
|
|
|
requires_3d: true },
|
|
|
|
|
|
|
|
// translate
|
|
|
|
{ start: 'translate(20px)', end: 'none',
|
|
|
|
expected_uncomputed: 'translate(15px)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, 15, 0)' },
|
|
|
|
{ start: 'translate(20px, 12px)', end: 'none',
|
|
|
|
expected_uncomputed: 'translate(15px, 9px)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, 15, 9)' },
|
|
|
|
{ start: 'translateX(-20px)', end: 'none',
|
|
|
|
expected_uncomputed: 'translateX(-15px)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, -15, 0)' },
|
|
|
|
{ start: 'translateY(-40px)', end: 'none',
|
|
|
|
expected_uncomputed: 'translateY(-30px)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, 0, -30)' },
|
|
|
|
{ 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)',
|
|
|
|
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)',
|
|
|
|
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, 45, 0)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'translate(20%, 12%)', end: 'none',
|
|
|
|
expected_uncomputed: 'translate(15%, 9%)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, 45, 4.5)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'translateX(-20%)', end: 'none',
|
|
|
|
expected_uncomputed: 'translateX(-15%)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, -45, 0)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'translateY(-40%)', end: 'none',
|
|
|
|
expected_uncomputed: 'translateY(-30%)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, 0, -15)',
|
2013-06-04 20:11:56 -07:00
|
|
|
round_error_ok: true,
|
|
|
|
big_omta_round_error: true },
|
2013-06-04 20:11:56 -07:00
|
|
|
{ start: 'none', end: 'rotate(90deg) translate(20%, 20%) rotate(-90deg)',
|
|
|
|
expected_uncomputed: 'rotate(22.5deg) translate(5%, 5%) rotate(-22.5deg)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'none', end: 'rotate(-90deg) translate(20%, 20%) rotate(90deg)',
|
|
|
|
expected_uncomputed: 'rotate(-22.5deg) translate(5%, 5%) rotate(22.5deg)',
|
|
|
|
round_error_ok: true },
|
|
|
|
// test percent translation using matrix decomposition
|
|
|
|
{ start: 'rotate(45deg) rotate(-45deg)',
|
|
|
|
end: 'rotate(90deg) translate(20%, 20%) rotate(-90deg)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, -2.5, 15)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'rotate(45deg) rotate(-45deg)',
|
|
|
|
end: 'rotate(-90deg) translate(20%, 20%) rotate(90deg)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, 2.5, -15)',
|
|
|
|
round_error_ok: true },
|
|
|
|
// test calc() in translate
|
|
|
|
// Note that font-size: is 20px, and that percentages are relative
|
|
|
|
// to 300px (width) and 50px (height) per the prerequisites in
|
|
|
|
// property_database.js
|
|
|
|
{ start: 'translateX(20%)', /* 60px */
|
|
|
|
end: 'translateX(calc(10% + 1em))', /* 30px + 20px = 50px */
|
|
|
|
expected_uncomputed: 'translateX(calc(17.5% + 0.25em))',
|
2013-06-04 20:11:56 -07:00
|
|
|
expected: 'matrix(1, 0, 0, 1, 57.5, 0)',
|
|
|
|
big_omta_round_error: true },
|
2013-06-04 20:11:56 -07:00
|
|
|
{ start: 'translate(calc(0.75 * 3em + 1.5 * 10%), calc(0.5 * 5em + 0.5 * 8%))', /* 90px, 52px */
|
|
|
|
end: 'rotate(90deg) translateY(20%) rotate(90deg) translateY(calc(10% + 0.5em)) rotate(180deg)', /* -10px, -15px */
|
2013-06-04 20:11:56 -07:00
|
|
|
expected: 'matrix(1, 0, 0, 1, 65, 35.25)',
|
|
|
|
big_omta_round_error: true },
|
2013-06-04 20:11:56 -07:00
|
|
|
|
|
|
|
// scale
|
|
|
|
{ start: 'scale(2)', end: 'none',
|
|
|
|
expected_uncomputed: 'scale(1.75)',
|
|
|
|
expected: 'matrix(1.75, 0, 0, 1.75, 0, 0)' },
|
|
|
|
{ start: 'none', end: 'scale(0.4)',
|
|
|
|
expected_uncomputed: 'scale(0.85)',
|
|
|
|
expected: 'matrix(0.85, 0, 0, 0.85, 0, 0)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'scale(2)', end: 'scale(-2)',
|
|
|
|
expected_uncomputed: 'scale(1)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, 0, 0)' },
|
|
|
|
{ start: 'scale(2)', end: 'scale(-6)',
|
|
|
|
expected_uncomputed: 'scale(0)',
|
|
|
|
expected: 'matrix(0, 0, 0, 0, 0, 0)' },
|
|
|
|
{ start: 'scale(2, 0.4)', end: 'none',
|
|
|
|
expected_uncomputed: 'scale(1.75, 0.55)',
|
|
|
|
expected: 'matrix(1.75, 0, 0, 0.55, 0, 0)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'scaleX(3)', end: 'none',
|
|
|
|
expected_uncomputed: 'scaleX(2.5)',
|
|
|
|
expected: 'matrix(2.5, 0, 0, 1, 0, 0)' },
|
|
|
|
{ start: 'scaleY(5)', end: 'none',
|
|
|
|
expected_uncomputed: 'scaleY(4)',
|
|
|
|
expected: 'matrix(1, 0, 0, 4, 0, 0)' },
|
|
|
|
{ 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)',
|
|
|
|
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)',
|
|
|
|
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',
|
|
|
|
expected_uncomputed: 'skew(33.75deg)' },
|
|
|
|
{ start: 'skew(45deg, 45deg)', end: 'none',
|
|
|
|
expected_uncomputed: 'skew(33.75deg, 33.75deg)' },
|
|
|
|
{ start: 'skewX(45deg)', end: 'skewX(-45deg)',
|
|
|
|
expected_uncomputed: 'skewX(22.5deg)' },
|
|
|
|
{ start: 'skewX(0)', end: 'skewX(-45deg)',
|
|
|
|
expected_uncomputed: 'skewX(-11.25deg)' },
|
|
|
|
{ start: 'skewY(45deg)', end: 'skewY(-45deg)',
|
|
|
|
expected_uncomputed: 'skewY(22.5deg)' },
|
|
|
|
|
|
|
|
// matrix : skewX
|
|
|
|
{ start: 'matrix(1, 0, 3, 1, 0, 0)', end: 'none',
|
|
|
|
expected: 'matrix(1, 0, ' + 3 * 0.75 + ', 1, 0, 0)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'skewX(0)', end: 'skewX(-45deg) translate(0)',
|
|
|
|
expected: 'matrix(1, 0, -0.25, 1, 0, 0)',
|
|
|
|
round_error_ok: true },
|
|
|
|
// matrix : rotate
|
|
|
|
{ start: 'rotate(-30deg)', end: 'matrix(0, 1, -1, 0, 0, 0)',
|
|
|
|
expected: 'matrix(1, 0, 0, 1, 0, 0)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'rotate(-30deg) translateX(0)',
|
|
|
|
end: 'translateX(0) rotate(-90deg)',
|
|
|
|
expected: computeMatrix('rotate(-45deg)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
// matrix decomposition of skewY
|
|
|
|
{ start: 'skewY(60deg)', end: 'skewY(-60deg) translateX(0)',
|
|
|
|
/* rotate(30deg) skewX(60deg)/2 scale(2, 0.5) */
|
|
|
|
expected: computeMatrix('rotate(30deg) skewX(' + Math.atan(Math.tan(Math.PI * 60/180) / 2) + 'rad) scale(2, 0.5)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
|
|
|
|
// matrix decomposition
|
|
|
|
|
|
|
|
// Four pairs of the same matrix expressed different ways.
|
|
|
|
{ start: 'matrix(-1, 0, 0, -1, 0, 0)', /* rotate(180deg) */
|
|
|
|
end: 'matrix(1, 0, 0, 1, 0, 0)',
|
|
|
|
expected: computeMatrix('rotate(135deg)') },
|
|
|
|
{ start: 'scale(-1)', end: 'none',
|
|
|
|
expected_uncomputed: 'scale(-0.5)',
|
|
|
|
expected: 'matrix(-0.5, 0, 0, -0.5, 0, 0)' },
|
|
|
|
{ start: 'rotate(180deg)', end: 'none',
|
|
|
|
expected_uncomputed: 'rotate(135deg)' },
|
|
|
|
{ start: 'rotate(-180deg)', end: 'none',
|
|
|
|
expected_uncomputed: 'rotate(-135deg)',
|
|
|
|
expected: computeMatrix('rotate(225deg)') },
|
|
|
|
|
|
|
|
// matrix followed by scale
|
|
|
|
{ start: 'matrix(2, 0, 0, 2, 10, 20) scale(2)',
|
|
|
|
end: 'none',
|
|
|
|
expected: 'matrix(3.0625, 0, 0, 3.0625, 7.5, 15)' },
|
|
|
|
|
|
|
|
// ... and a bunch of similar possibilities. The spec isn't settled
|
|
|
|
// here; there are multiple options. See:
|
|
|
|
// http://lists.w3.org/Archives/Public/www-style/2010Jun/0602.html
|
|
|
|
{ start: 'matrix(-1, 0, 0, 1, 0, 0)', /* scaleX(-1) */
|
|
|
|
end: 'matrix(1, 0, 0, 1, 0, 0)',
|
|
|
|
expected: computeMatrix('scaleX(-0.5)') },
|
|
|
|
|
|
|
|
{ start: 'matrix(1, 0, 0, -1, 0, 0)', /* rotate(-180deg) scaleX(-1) */
|
|
|
|
end: 'matrix(1, 0, 0, 1, 0, 0)',
|
|
|
|
expected: computeMatrix('rotate(-135deg) scaleX(-0.5)') },
|
|
|
|
|
|
|
|
{ start: 'matrix(0, 1, 1, 0, 0, 0)', /* rotate(-90deg) scaleX(-1) */
|
|
|
|
end: 'matrix(1, 0, 0, 1, 0, 0)',
|
|
|
|
expected: computeMatrix('rotate(-67.5deg) scaleX(-0.5)') },
|
|
|
|
|
|
|
|
{ start: 'matrix(0, -1, 1, 0, 0, 0)', /* rotate(-90deg) */
|
|
|
|
end: 'matrix(1, 0, 0, 1, 0, 0)',
|
|
|
|
expected: computeMatrix('rotate(-67.5deg)') },
|
|
|
|
|
|
|
|
{ start: 'matrix(0, 1, -1, 0, 0, 0)', /* rotate(90deg) */
|
|
|
|
end: 'matrix(1, 0, 0, 1, 0, 0)',
|
|
|
|
expected: computeMatrix('rotate(67.5deg)') },
|
|
|
|
|
|
|
|
{ start: 'matrix(0, -1, -1, 0, 0, 0)', /* rotate(90deg) scaleX(-1) */
|
|
|
|
end: 'matrix(1, 0, 0, 1, 0, 0)',
|
|
|
|
expected: computeMatrix('rotate(67.5deg) scaleX(-0.5)') },
|
|
|
|
|
|
|
|
// Similar decomposition tests, but with skewX. I checked visually
|
|
|
|
// that the sign of the skew was correct by checking visually that
|
|
|
|
// the animations in
|
|
|
|
// http://dbaron.org/css/test/2010/transition-negative-determinant
|
|
|
|
// don't flip when they finish, and then wrote tests corresponding
|
|
|
|
// to the current code's behavior.
|
|
|
|
// ... start with four with positive determinants
|
|
|
|
{ start: 'none',
|
|
|
|
end: 'matrix(1, 0, 1.5, 1, 0, 0)',
|
|
|
|
/* skewX(atan(1.5)) */
|
|
|
|
expected: 'matrix(1, 0, ' + 1.5 * 0.25 + ', 1, 0, 0)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'none',
|
|
|
|
end: 'matrix(-1, 0, 2, -1, 0, 0)',
|
|
|
|
/* rotate(180deg) skewX(atan(-2)) */
|
|
|
|
expected: computeMatrix('rotate(45deg) matrix(1, 0, ' + -2 * 0.25 + ', 1, 0, 0)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'none',
|
|
|
|
end: 'matrix(0, -1, 1, -3, 0, 0)',
|
|
|
|
/* rotate(-90deg) skewX(atan(3)) */
|
|
|
|
expected: computeMatrix('rotate(-22.5deg) matrix(1, 0, ' + 3 * 0.25 + ', 1, 0, 0)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'none',
|
|
|
|
end: 'matrix(0, 1, -1, 4, 0, 0)',
|
|
|
|
/* rotate(90deg) skewX(atan(4)) */
|
|
|
|
expected: computeMatrix('rotate(22.5deg) matrix(1, 0, ' + 4 * 0.25 + ', 1, 0, 0)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
// and then four with negative determinants
|
|
|
|
{ start: 'none',
|
|
|
|
end: 'matrix(1, 0, 1, -1, 0, 0)',
|
|
|
|
/* rotate(-180deg) skewX(atan(-1)) scaleX(-1) */
|
|
|
|
expected: computeMatrix('rotate(-45deg) matrix(1, 0, ' + -1 * 0.25 + ', 1, 0, 0) scaleX(0.5)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'none',
|
|
|
|
end: 'matrix(-1, 0, -1, 1, 0, 0)',
|
|
|
|
/* skewX(atan(-1)) scaleX(-1) */
|
|
|
|
expected: computeMatrix('matrix(1, 0, ' + -1 * 0.25 + ', 1, 0, 0) scaleX(0.5)') },
|
|
|
|
{ start: 'none',
|
|
|
|
end: 'matrix(0, 1, 1, -2, 0, 0)',
|
|
|
|
/* rotate(-90deg) skewX(atan(2)) scaleX(-1) */
|
|
|
|
expected: computeMatrix('rotate(-22.5deg) matrix(1, 0, ' + 2 * 0.25 + ', 1, 0, 0) scaleX(0.5)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'none',
|
|
|
|
end: 'matrix(0, -1, -1, 0.5, 0, 0)',
|
|
|
|
/* rotate(90deg) skewX(atan(0.5)) scaleX(-1) */
|
|
|
|
expected: computeMatrix('rotate(22.5deg) matrix(1, 0, ' + 0.5 * 0.25 + ', 1, 0, 0) scaleX(0.5)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
|
|
|
|
// lists vs. matrix decomposition
|
|
|
|
{ start: 'translate(10px) skewY(45deg)',
|
|
|
|
end: 'translate(30px) skewY(-45deg)',
|
|
|
|
expected_uncomputed: 'translate(15px) skewY(22.5deg)' },
|
|
|
|
{ start: 'skewY(45deg) rotate(90deg)',
|
|
|
|
end: 'skewY(-45deg) rotate(90deg)',
|
|
|
|
expected_uncomputed: 'skewY(22.5deg) rotate(90deg)' },
|
|
|
|
{ start: 'skewY(45deg) rotate(90deg) translate(0)',
|
|
|
|
end: 'skewY(-45deg) rotate(90deg)',
|
|
|
|
expected: 'matrix(0, 1, -1, -0.5, 0, 0)',
|
|
|
|
round_error_ok: true },
|
|
|
|
{ start: 'skewX(45deg) rotate(90deg)',
|
|
|
|
end: 'skewX(-45deg) rotate(90deg)',
|
|
|
|
expected_uncomputed: 'skewX(22.5deg) rotate(90deg)' },
|
|
|
|
{ start: 'skewX(-60deg) rotate(90deg) translate(0)',
|
|
|
|
end: 'skewX(60deg) rotate(90deg)',
|
|
|
|
expected: computeMatrix('rotate(120deg) skewX(' + Math.atan(Math.tan(Math.PI * 60/180) / 2) + 'rad) scale(2, 0.5)'),
|
|
|
|
round_error_ok: true },
|
|
|
|
];
|
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
var prop;
|
|
|
|
for (prop in supported_properties) {
|
|
|
|
// Test that prop is in the property database.
|
|
|
|
ok(prop in gCSSProperties, "property " + prop + " in gCSSProperties");
|
|
|
|
|
|
|
|
// Test that the entry has at least one test function.
|
|
|
|
ok(supported_properties[prop].length > 0,
|
|
|
|
"property " + prop + " must have at least one test function");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test that transitions don't do anything (i.e., aren't supported) on
|
|
|
|
// the properties not in our test list above (and not transition
|
|
|
|
// properties themselves).
|
|
|
|
for (prop in gCSSProperties) {
|
|
|
|
var info = gCSSProperties[prop];
|
|
|
|
if (!(prop in supported_properties) &&
|
|
|
|
info.type != CSS_TYPE_TRUE_SHORTHAND &&
|
2012-09-18 11:37:14 -07:00
|
|
|
!("alias_for" in info) &&
|
2012-07-08 18:25:10 -07:00
|
|
|
!prop.match(/^transition-/) &&
|
2009-10-13 19:38:20 -07:00
|
|
|
// FIXME (Bug 119078): THIS SHOULD REALLY NOT BE NEEDED!
|
2009-10-07 20:22:42 -07:00
|
|
|
prop != "-moz-binding") {
|
|
|
|
|
|
|
|
if ("prerequisites" in info) {
|
|
|
|
var prereqs = info.prerequisites;
|
|
|
|
for (var prereq in prereqs) {
|
|
|
|
div.style.setProperty(prereq, prereqs[prereq], "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var all_values = info.initial_values.concat(info.other_values);
|
|
|
|
var all_computed = [];
|
|
|
|
for (var idx in all_values) {
|
|
|
|
var val = all_values[idx];
|
|
|
|
div.style.setProperty(prop, val, "");
|
|
|
|
all_computed.push(cs.getPropertyValue(prop));
|
|
|
|
}
|
|
|
|
div.style.removeProperty(prop);
|
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition", prop + " 20s linear", "");
|
2009-10-07 20:22:42 -07:00
|
|
|
for (var i = 0; i < all_values.length; ++i) {
|
|
|
|
for (var j = i + 1; j < all_values.length; ++j) {
|
|
|
|
div.style.setProperty(prop, all_values[i], "");
|
|
|
|
is(cs.getPropertyValue(prop), all_computed[i],
|
|
|
|
"transitions not supported for property " + prop +
|
|
|
|
" value " + all_values[i]);
|
|
|
|
div.style.setProperty(prop, all_values[j], "");
|
|
|
|
is(cs.getPropertyValue(prop), all_computed[j],
|
|
|
|
"transitions not supported for property " + prop +
|
|
|
|
" value " + all_values[j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.removeProperty("transition");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.removeProperty(prop);
|
2009-10-07 20:22:42 -07:00
|
|
|
if ("prerequisites" in info) {
|
|
|
|
var prereqs = info.prerequisites;
|
|
|
|
for (var prereq in prereqs) {
|
|
|
|
div.style.removeProperty(prereq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-26 11:58:06 -07:00
|
|
|
// Do 4-second linear transitions with -1 second transition delay and
|
2009-10-07 20:22:42 -07:00
|
|
|
// linear timing function so that we can expect the transition to be
|
2010-06-26 11:58:06 -07:00
|
|
|
// one quarter of the way through the value space right after changing
|
|
|
|
// the property.
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-duration", "4s", "");
|
|
|
|
div.style.setProperty("transition-delay", "-1s", "");
|
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2009-10-07 20:22:42 -07:00
|
|
|
for (prop in supported_properties) {
|
|
|
|
var tinfo = supported_properties[prop];
|
|
|
|
var info = gCSSProperties[prop];
|
|
|
|
|
|
|
|
isnot(info.type, CSS_TYPE_TRUE_SHORTHAND,
|
|
|
|
prop + " must not be a shorthand");
|
|
|
|
if ("prerequisites" in info) {
|
|
|
|
var prereqs = info.prerequisites;
|
|
|
|
for (var prereq in prereqs) {
|
2010-06-26 11:58:06 -07:00
|
|
|
// We don't want the 19px font-size prereq of line-height, since we
|
|
|
|
// want to leave it 20px.
|
|
|
|
if (prop != "line-height" || prereq != "font-size") {
|
|
|
|
div.style.setProperty(prereq, prereqs[prereq], "");
|
|
|
|
}
|
2009-10-07 20:22:42 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var idx in tinfo) {
|
|
|
|
tinfo[idx](prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure to unset the property and stop transitions on it.
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-07 20:22:42 -07:00
|
|
|
div.style.removeProperty(prop);
|
|
|
|
cs.getPropertyValue(prop);
|
|
|
|
|
|
|
|
if ("prerequisites" in info) {
|
|
|
|
var prereqs = info.prerequisites;
|
|
|
|
for (var prereq in prereqs) {
|
|
|
|
div.style.removeProperty(prereq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.removeProperty("transition");
|
2009-10-07 20:22:42 -07:00
|
|
|
|
2010-10-23 16:31:55 -07:00
|
|
|
function get_distance(prop, v1, v2)
|
|
|
|
{
|
2011-04-30 15:16:19 -07:00
|
|
|
return SpecialPowers.DOMWindowUtils
|
|
|
|
.computeAnimationDistance(div, prop, v1, v2);
|
2010-10-23 16:31:55 -07:00
|
|
|
}
|
|
|
|
|
2011-08-30 19:03:47 -07:00
|
|
|
function transform3D_enabled()
|
|
|
|
{
|
|
|
|
return SpecialPowers.getBoolPref("layout.3d-transforms.enabled");
|
|
|
|
}
|
|
|
|
|
2010-10-23 16:31:55 -07:00
|
|
|
function check_distance(prop, start, quarter, end)
|
|
|
|
{
|
|
|
|
var sq = get_distance(prop, start, quarter);
|
|
|
|
var se = get_distance(prop, start, end);
|
|
|
|
var qe = get_distance(prop, quarter, end);
|
|
|
|
|
|
|
|
ok(Math.abs((sq * 4 - se) / se) < 0.0001, "property '" + prop + "': distance " + sq + " from start '" + start + "' to quarter '" + quarter + "' should be quarter distance " + se + " from start '" + start + "' to end '" + end + "'");
|
|
|
|
ok(Math.abs((qe * 4 - se * 3) / se) < 0.0001, "property '" + prop + "': distance " + qe + " from quarter '" + quarter + "' to end '" + end + "' should be three quarters distance " + se + " from start '" + start + "' to end '" + end + "'");
|
|
|
|
}
|
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
function test_length_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-07 20:22:42 -07:00
|
|
|
div.style.setProperty(prop, "4px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "4px",
|
|
|
|
"length-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-10-07 20:22:42 -07:00
|
|
|
div.style.setProperty(prop, "12px", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "6px",
|
2009-10-07 20:22:42 -07:00
|
|
|
"length-valued property " + prop + ": interpolation of lengths");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "4px", "6px", "12px");
|
2009-10-07 20:22:42 -07:00
|
|
|
}
|
|
|
|
|
2011-05-09 12:02:35 -07:00
|
|
|
function test_length_clamped(prop) {
|
|
|
|
test_length_clamped_or_unclamped(prop, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_length_unclamped(prop) {
|
|
|
|
test_length_clamped_or_unclamped(prop, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_length_clamped_or_unclamped(prop, is_clamped) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0px",
|
|
|
|
"length-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "100px", "");
|
|
|
|
(is_clamped ? is : isnot)(cs.getPropertyValue(prop), "0px",
|
|
|
|
"length-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
}
|
|
|
|
|
2009-10-08 18:30:49 -07:00
|
|
|
// Test using float values in the range [0, 1] (e.g. opacity)
|
|
|
|
function test_float_zeroToOne_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-08 18:30:49 -07:00
|
|
|
div.style.setProperty(prop, "0.3", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0.3",
|
|
|
|
"float-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-10-08 18:30:49 -07:00
|
|
|
div.style.setProperty(prop, "0.8", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "0.425",
|
2009-10-08 18:30:49 -07:00
|
|
|
"float-valued property " + prop + ": interpolation of floats");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "0.3", "0.425", "0.8");
|
2009-10-08 18:30:49 -07:00
|
|
|
}
|
|
|
|
|
2011-05-09 12:02:35 -07:00
|
|
|
function test_float_zeroToOne_clamped(prop) {
|
|
|
|
test_float_zeroToOne_clamped_or_unclamped(prop, true);
|
|
|
|
}
|
|
|
|
function test_float_zeroToOne_unclamped(prop) {
|
|
|
|
test_float_zeroToOne_clamped_or_unclamped(prop, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_float_zeroToOne_clamped_or_unclamped(prop, is_clamped) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0",
|
|
|
|
"float-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "1", "");
|
|
|
|
(is_clamped ? is : isnot)(cs.getPropertyValue(prop), "0",
|
|
|
|
"float-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
}
|
|
|
|
|
2009-10-08 18:30:49 -07:00
|
|
|
// Test using float values in the range [1, infinity) (e.g. stroke-miterlimit)
|
|
|
|
function test_float_aboveOne_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-08 18:30:49 -07:00
|
|
|
div.style.setProperty(prop, "1", "");
|
|
|
|
is(cs.getPropertyValue(prop), "1",
|
|
|
|
"float-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-10-08 18:30:49 -07:00
|
|
|
div.style.setProperty(prop, "2.1", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "1.275",
|
2009-10-08 18:30:49 -07:00
|
|
|
"float-valued property " + prop + ": interpolation of floats");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "1", "1.275", "2.1");
|
2009-10-08 18:30:49 -07:00
|
|
|
}
|
|
|
|
|
2011-05-09 12:02:35 -07:00
|
|
|
function test_float_aboveOne_clamped(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "1", "");
|
|
|
|
is(cs.getPropertyValue(prop), "1",
|
|
|
|
"float-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "5", "");
|
|
|
|
is(cs.getPropertyValue(prop), "1",
|
|
|
|
"float-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
}
|
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
function test_percent_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-07 20:22:42 -07:00
|
|
|
div.style.setProperty(prop, "25%", "");
|
|
|
|
var av = cs.getPropertyValue(prop);
|
|
|
|
var a = any_unit_to_num(av);
|
|
|
|
div.style.setProperty(prop, "75%", "");
|
|
|
|
var bv = cs.getPropertyValue(prop);
|
|
|
|
var b = any_unit_to_num(bv);
|
|
|
|
isnot(b, a, "different percentages (" + av + " and " + bv +
|
|
|
|
") should be different for " + prop);
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-10-07 20:22:42 -07:00
|
|
|
div.style.setProperty(prop, "25%", "");
|
|
|
|
var res = cs.getPropertyValue(prop);
|
2010-06-26 11:58:06 -07:00
|
|
|
is(any_unit_to_num(res) * 4, 3 * b + a,
|
2009-10-07 20:22:42 -07:00
|
|
|
"percent-valued property " + prop + ": interpolation of percents: " +
|
2010-06-26 11:58:06 -07:00
|
|
|
res + " should be a quarter of the way between " + bv + " and " + av);
|
2009-10-07 20:22:42 -07:00
|
|
|
ok(has_num(res),
|
|
|
|
"percent-valued property " + prop + ": percent computes to number");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "25%", "37.5%", "75%");
|
2009-10-07 20:22:42 -07:00
|
|
|
}
|
|
|
|
|
2011-05-09 12:02:35 -07:00
|
|
|
function test_percent_clamped(prop) {
|
|
|
|
test_percent_clamped_or_unclamped(prop, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_percent_unclamped(prop) {
|
|
|
|
test_percent_clamped_or_unclamped(prop, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_percent_clamped_or_unclamped(prop, is_clamped) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0%", "");
|
|
|
|
var zero_val = cs.getPropertyValue(prop); // flushes too
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "150%", "");
|
|
|
|
(is_clamped ? is : isnot)(cs.getPropertyValue(prop), zero_val,
|
|
|
|
"percent-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
}
|
|
|
|
|
2010-09-15 08:11:26 -07:00
|
|
|
function test_length_percent_calc_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2010-09-15 08:11:26 -07:00
|
|
|
div.style.setProperty(prop, "0%", "");
|
|
|
|
var av = cs.getPropertyValue(prop);
|
|
|
|
var a = any_unit_to_num(av);
|
|
|
|
div.style.setProperty(prop, "100%", "");
|
|
|
|
var bv = cs.getPropertyValue(prop);
|
|
|
|
var b = any_unit_to_num(bv);
|
|
|
|
div.style.setProperty(prop, "100px", "");
|
|
|
|
var cv = cs.getPropertyValue(prop);
|
|
|
|
var c = any_unit_to_num(cv);
|
|
|
|
isnot(b, a, "different percentages (" + av + " and " + bv +
|
|
|
|
") should be different for " + prop);
|
|
|
|
|
|
|
|
div.style.setProperty(prop, "50%", "");
|
|
|
|
var v1v = cs.getPropertyValue(prop);
|
|
|
|
is(any_unit_to_num(v1v) * 2, a + b,
|
|
|
|
"computed value before transition for " + prop + ": '" +
|
|
|
|
v1v + "' should be halfway " +
|
|
|
|
"between '" + av + "' + and '" + bv + "'.");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-09-15 08:11:26 -07:00
|
|
|
div.style.setProperty(prop, "200px", "");
|
|
|
|
var v2v = cs.getPropertyValue(prop);
|
|
|
|
is(any_unit_to_num(v2v) * 8, 5*a + 3*b + 4*c,
|
|
|
|
"interpolation between length and percent for " + prop + ": '"
|
|
|
|
+ v2v + "'");
|
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2012-07-13 15:06:50 -07:00
|
|
|
div.style.setProperty(prop, "calc(25% + 100px)", "");
|
2010-09-15 08:11:26 -07:00
|
|
|
v1v = cs.getPropertyValue(prop);
|
2010-10-06 21:25:47 -07:00
|
|
|
is(any_unit_to_num(v1v) * 4, b + 4*c,
|
2010-09-15 08:11:26 -07:00
|
|
|
"computed value before transition for " + prop + ": '" + v1v + "'");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-10-06 21:25:47 -07:00
|
|
|
div.style.setProperty(prop, "75%", "");
|
2010-09-15 08:11:26 -07:00
|
|
|
v2v = cs.getPropertyValue(prop);
|
2010-10-06 21:25:47 -07:00
|
|
|
is(any_unit_to_num(v2v) * 8, 5*a + 3*b + 6*c,
|
2010-09-15 08:11:26 -07:00
|
|
|
"interpolation between calc() and percent for " + prop + ": '" +
|
|
|
|
v2v + "'");
|
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2010-10-06 21:25:47 -07:00
|
|
|
div.style.setProperty(prop, "150px", "");
|
2010-09-15 08:11:26 -07:00
|
|
|
v1v = cs.getPropertyValue(prop);
|
2010-10-06 21:25:47 -07:00
|
|
|
is(any_unit_to_num(v1v) * 2, c * 3,
|
2010-09-15 08:11:26 -07:00
|
|
|
"computed value before transition for " + prop + ": '" + v1v + "'");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2012-07-13 15:06:50 -07:00
|
|
|
div.style.setProperty(prop, "calc(50% + 50px)", "");
|
2010-09-15 08:11:26 -07:00
|
|
|
v2v = cs.getPropertyValue(prop);
|
2010-10-06 21:25:47 -07:00
|
|
|
is(any_unit_to_num(v2v) * 8, 7 * a + b + 10*c,
|
2010-09-15 08:11:26 -07:00
|
|
|
"interpolation between length and calc() for " + prop + ": '" +
|
|
|
|
v2v + "'");
|
2010-10-23 16:31:55 -07:00
|
|
|
|
2012-07-13 15:06:50 -07:00
|
|
|
check_distance(prop, "50%", "calc(37.5% + 50px)", "200px");
|
|
|
|
check_distance(prop, "calc(25% + 100px)", "calc(37.5% + 75px)",
|
2010-10-23 16:31:55 -07:00
|
|
|
"75%");
|
2012-07-13 15:06:50 -07:00
|
|
|
check_distance(prop, "150px", "calc(125px + 12.5%)",
|
|
|
|
"calc(50% + 50px)");
|
2010-09-15 08:11:26 -07:00
|
|
|
}
|
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
function test_color_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-07 20:22:42 -07:00
|
|
|
div.style.setProperty(prop, "rgb(255, 28, 0)", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rgb(255, 28, 0)",
|
2009-10-08 18:30:49 -07:00
|
|
|
"color-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "rgb(75, 84, 128)", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rgb(210, 42, 32)",
|
2009-10-08 18:30:49 -07:00
|
|
|
"color-valued property " + prop + ": interpolation of colors");
|
2010-04-06 19:03:12 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2010-04-06 19:03:12 -07:00
|
|
|
div.style.setProperty(prop, "rgb(128, 64, 0)", "");
|
|
|
|
(prop == "color" ? div.parentNode : div).style.
|
|
|
|
setProperty("color", "rgb(0, 0, 128)", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rgb(128, 64, 0)",
|
|
|
|
"color-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-04-06 19:03:12 -07:00
|
|
|
div.style.setProperty(prop, "currentColor", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "rgb(96, 48, 32)",
|
2010-04-06 19:03:12 -07:00
|
|
|
"color-valued property " + prop + ": interpolation of currentColor");
|
2010-10-23 16:31:55 -07:00
|
|
|
|
|
|
|
check_distance(prop, "rgb(255, 28, 0)", "rgb(210, 42, 32)",
|
|
|
|
"rgb(75, 84, 128)");
|
|
|
|
check_distance(prop, "rgb(128, 64, 0)", "rgb(96, 48, 32)", "currentColor");
|
|
|
|
|
2010-04-06 19:03:12 -07:00
|
|
|
(prop == "color" ? div.parentNode : div).style.removeProperty("color");
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "rgb(0, 255, 0)", "");
|
|
|
|
var vals = cs.getPropertyValue(prop).match(/rgb\(([^, ]*), ([^, ]*), ([^, ]*)\)/);
|
|
|
|
is(vals.length, 4,
|
|
|
|
"color-valued property " + prop + ": flush before clamping test (length)");
|
|
|
|
is(vals[1], "0",
|
|
|
|
"color-valued property " + prop + ": flush before clamping test (red)");
|
|
|
|
is(vals[2], "255",
|
|
|
|
"color-valued property " + prop + ": flush before clamping test (green)");
|
|
|
|
is(vals[3], "0",
|
|
|
|
"color-valued property " + prop + ": flush before clamping test (blue)");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "rgb(255, 0, 128)", "");
|
|
|
|
// FIXME: Once we support non-sRGB colors, these tests will need fixing.
|
|
|
|
vals = cs.getPropertyValue(prop).match(/rgb\(([^, ]*), ([^, ]*), ([^, ]*)\)/);
|
|
|
|
is(vals.length, 4,
|
|
|
|
"color-valued property " + prop + ": clamping of negatives (length)");
|
|
|
|
is(vals[1], "0",
|
|
|
|
"color-valued property " + prop + ": clamping of negatives (red)");
|
|
|
|
is(vals[2], "255",
|
|
|
|
"color-valued property " + prop + ": clamping of above-range (green)");
|
|
|
|
is(vals[3], "0",
|
|
|
|
"color-valued property " + prop + ": clamping of negatives (blue)");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2010-04-06 19:03:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function test_border_color_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2010-04-06 19:03:12 -07:00
|
|
|
div.style.setProperty(prop, "rgb(128, 64, 0)", "");
|
|
|
|
div.style.setProperty("color", "rgb(0, 0, 128)", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rgb(128, 64, 0)",
|
|
|
|
"color-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-04-06 19:03:12 -07:00
|
|
|
div.style.removeProperty(prop);
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "rgb(96, 48, 32)",
|
2010-04-06 19:03:12 -07:00
|
|
|
"color-valued property " + prop + ": interpolation of initial value");
|
2010-10-23 16:31:55 -07:00
|
|
|
|
2012-10-30 08:57:36 -07:00
|
|
|
check_distance(prop, "rgb(128, 64, 0)", "rgb(96, 48, 32)", "initial");
|
2010-10-23 16:31:55 -07:00
|
|
|
|
2010-04-06 19:03:12 -07:00
|
|
|
div.style.removeProperty("color");
|
2009-10-07 20:22:42 -07:00
|
|
|
}
|
|
|
|
|
2009-10-21 03:53:46 -07:00
|
|
|
function test_shadow_transition(prop) {
|
2010-09-11 09:27:12 -07:00
|
|
|
var spreadStr = (prop == "box-shadow") ? " 0px" : "";
|
2009-10-21 03:53:46 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-21 03:53:46 -07:00
|
|
|
div.style.setProperty(prop, "none", "");
|
|
|
|
is(cs.getPropertyValue(prop), "none",
|
|
|
|
"shadow-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-10-21 03:53:46 -07:00
|
|
|
div.style.setProperty(prop, "4px 8px 3px red", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "rgba(255, 0, 0, 0.25) 1px 2px 0.75px" + spreadStr,
|
2009-10-21 03:53:46 -07:00
|
|
|
"shadow-valued property " + prop + ": interpolation of shadows");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "none", "rgba(255, 0, 0, 0.25) 1px 2px 0.75px",
|
|
|
|
"4px 8px 3px red");
|
2009-10-21 03:53:46 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "#038000 4px 4px, 2px 2px blue", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rgb(3, 128, 0) 4px 4px 0px" + spreadStr + ", rgb(0, 0, 255) 2px 2px 0px" + spreadStr,
|
2009-10-21 03:53:46 -07:00
|
|
|
"shadow-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-10-21 03:53:46 -07:00
|
|
|
div.style.setProperty(prop, "8px 8px 8px red", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "rgb(66, 96, 0) 5px 5px 2px" + spreadStr + ", rgba(0, 0, 255, 0.75) 1.5px 1.5px 0px" + spreadStr,
|
2009-10-21 03:53:46 -07:00
|
|
|
"shadow-valued property " + prop + ": interpolation of shadows");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "#038000 4px 4px, 2px 2px blue",
|
|
|
|
"rgb(66, 96, 0) 5px 5px 2px, rgba(0, 0, 255, 0.75) 1.5px 1.5px 0px",
|
|
|
|
"8px 8px 8px red");
|
2009-10-21 03:53:46 -07:00
|
|
|
|
2010-09-11 09:27:12 -07:00
|
|
|
if (prop == "box-shadow") {
|
2009-10-21 03:53:46 -07:00
|
|
|
div.style.setProperty(prop, "8px 8px 8px red inset", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rgb(255, 0, 0) 8px 8px 8px 0px inset",
|
|
|
|
"shadow-valued property " + prop + ": non-interpolable cases");
|
|
|
|
div.style.setProperty(prop, "8px 8px 8px 8px red inset", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "rgb(255, 0, 0) 8px 8px 8px 2px inset",
|
2009-10-21 03:53:46 -07:00
|
|
|
"shadow-valued property " + prop + ": interpolation of spread");
|
|
|
|
// Leave in same state whether in the |if| or not.
|
|
|
|
div.style.setProperty(prop, "8px 8px 8px red", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rgb(255, 0, 0) 8px 8px 8px 0px",
|
|
|
|
"shadow-valued property " + prop + ": non-interpolable cases");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "8px 8px 8px red inset",
|
|
|
|
"rgb(255, 0, 0) 8px 8px 8px 2px inset",
|
|
|
|
"8px 8px 8px 8px red inset");
|
2009-10-21 03:53:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
var defaultColor = cs.getPropertyValue("color") + " ";
|
|
|
|
div.style.setProperty(prop, "2px 2px 2px", "");
|
|
|
|
is(cs.getPropertyValue(prop), defaultColor + "2px 2px 2px" + spreadStr,
|
|
|
|
"shadow-valued property " + prop + ": non-interpolable cases");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "6px 14px 10px", "");
|
2009-10-21 03:53:46 -07:00
|
|
|
is(cs.getPropertyValue(prop), defaultColor + "3px 5px 4px" + spreadStr,
|
|
|
|
"shadow-valued property " + prop + ": interpolation without color");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "2px 2px 2px", "3px 5px 4px", "6px 14px 10px");
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0px 0px 0px black", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rgb(0, 0, 0) 0px 0px 0px" + spreadStr,
|
|
|
|
"shadow-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "10px 10px 10px black", "");
|
|
|
|
var vals = cs.getPropertyValue(prop).split(" ");
|
|
|
|
is(vals.length, 6 + (prop == "box-shadow"), "unexpected number of values");
|
|
|
|
is(vals.slice(0, 3).join(" "), "rgb(0, 0, 0)",
|
|
|
|
"shadow-valued property " + prop + " (color): clamping of negatives");
|
|
|
|
isnot(vals[3], "0px",
|
|
|
|
"shadow-valued property " + prop + " (x): clamping of negatives");
|
|
|
|
isnot(vals[4], "0px",
|
|
|
|
"shadow-valued property " + prop + " (y): clamping of negatives");
|
|
|
|
is(vals[5], "0px",
|
|
|
|
"shadow-valued property " + prop + " (radius): clamping of negatives");
|
|
|
|
if (prop == "box-shadow") {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0px 0px 0px 0px black", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rgb(0, 0, 0) 0px 0px 0px 0px",
|
|
|
|
"shadow-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "10px 10px 10px 10px black", "");
|
|
|
|
var vals = cs.getPropertyValue(prop).split(" ");
|
|
|
|
is(vals.length, 7, "unexpected number of values");
|
|
|
|
is(vals.slice(0, 3).join(" "), "rgb(0, 0, 0)",
|
|
|
|
"shadow-valued property " + prop + " (color): clamping of negatives");
|
|
|
|
isnot(vals[3], "0px",
|
|
|
|
"shadow-valued property " + prop + " (x): clamping of negatives");
|
|
|
|
isnot(vals[4], "0px",
|
|
|
|
"shadow-valued property " + prop + " (y): clamping of negatives");
|
|
|
|
is(vals[5], "0px",
|
|
|
|
"shadow-valued property " + prop + " (radius): clamping of negatives");
|
|
|
|
isnot(vals[6], "0px",
|
|
|
|
"shadow-valued property " + prop + " (spread): clamping of negatives");
|
|
|
|
}
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2009-10-21 03:53:46 -07:00
|
|
|
}
|
|
|
|
|
2009-10-21 07:17:40 -07:00
|
|
|
function test_dasharray_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-21 07:17:40 -07:00
|
|
|
div.style.setProperty(prop, "3", "");
|
|
|
|
is(cs.getPropertyValue(prop), "3",
|
|
|
|
"dasharray-valued property " + prop +
|
|
|
|
": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "15px", "");
|
2009-10-21 07:17:40 -07:00
|
|
|
is(cs.getPropertyValue(prop), "6",
|
|
|
|
"dasharray-valued property " + prop + ": interpolation of dasharray");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "3", "6", "15px");
|
2009-10-21 07:17:40 -07:00
|
|
|
div.style.setProperty(prop, "none", "");
|
|
|
|
is(cs.getPropertyValue(prop), "none",
|
|
|
|
"dasharray-valued property " + prop + ": non-interpolability of none");
|
|
|
|
div.style.setProperty(prop, "6,8px,4,4", "");
|
|
|
|
is(cs.getPropertyValue(prop), "6, 8px, 4, 4",
|
|
|
|
"dasharray-valued property " + prop +
|
|
|
|
": computed value before transition");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "14, 12,16,16px", "");
|
2009-10-21 07:17:40 -07:00
|
|
|
is(cs.getPropertyValue(prop), "8, 9, 7, 7",
|
|
|
|
"dasharray-valued property " + prop + ": interpolation of dasharray");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "6,8px,4,4", "8,9,7,7", "14, 12,16,16px");
|
2009-10-21 07:17:40 -07:00
|
|
|
div.style.setProperty(prop, "none", "");
|
|
|
|
is(cs.getPropertyValue(prop), "none",
|
|
|
|
"dasharray-valued property " + prop + ": non-interpolability of none");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "8,16,4", "");
|
|
|
|
is(cs.getPropertyValue(prop), "8, 16, 4",
|
2009-10-21 07:17:40 -07:00
|
|
|
"dasharray-valued property " + prop +
|
|
|
|
": computed value before transition");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "4,8,12,16", "");
|
|
|
|
is(cs.getPropertyValue(prop), "7, 14, 6, 10, 13, 5, 9, 16, 4, 8, 15, 7",
|
2009-10-21 07:17:40 -07:00
|
|
|
"dasharray-valued property " + prop + ": interpolation of dasharray");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "8,16,4", "7, 14, 6, 10, 13, 5, 9, 16, 4, 8, 15, 7",
|
|
|
|
"4,8,12,16");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "2,50%,6,10", "");
|
|
|
|
is(cs.getPropertyValue(prop), "2, 50%, 6, 10",
|
2009-10-21 07:17:40 -07:00
|
|
|
"dasharray-valued property " + prop + ": non-interpolability of mixed units");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "6,30%,2,2", "");
|
|
|
|
is(cs.getPropertyValue(prop), "3, 45%, 5, 8",
|
2009-10-21 07:17:40 -07:00
|
|
|
"dasharray-valued property " + prop + ": interpolation of dasharray");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "2,50%,6,10", "3, 45%, 5, 8", "6,30%,2,2");
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0,0%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0, 0%",
|
|
|
|
"dasharray-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "5, 25%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0, 0%",
|
|
|
|
"dasharray-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2009-10-21 07:17:40 -07:00
|
|
|
}
|
|
|
|
|
2009-10-28 20:22:27 -07:00
|
|
|
function test_radius_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-28 20:22:27 -07:00
|
|
|
|
|
|
|
// FIXME: Test a square for now, since we haven't updated to the spec
|
|
|
|
// for vertical components being relative to the height.
|
2011-04-28 06:48:59 -07:00
|
|
|
// Note: We use powers of two here so the floating-point math comes out
|
|
|
|
// nicely.
|
|
|
|
div.style.setProperty("width", "256px", "");
|
|
|
|
div.style.setProperty("height", "256px", "");
|
2009-10-28 20:22:27 -07:00
|
|
|
div.style.setProperty("border", "none", "");
|
|
|
|
div.style.setProperty("padding", "0", "");
|
|
|
|
|
|
|
|
div.style.setProperty(prop, "3px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "3px",
|
|
|
|
"radius-valued property " + prop +
|
|
|
|
": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "15px", "");
|
2009-10-28 20:22:27 -07:00
|
|
|
is(cs.getPropertyValue(prop), "6px",
|
|
|
|
"radius-valued property " + prop + ": interpolation of radius");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "3px", "6px", "15px");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-04-28 06:48:59 -07:00
|
|
|
div.style.setProperty(prop, "12.5%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "32px",
|
2010-09-15 08:11:26 -07:00
|
|
|
"radius-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-10-28 20:22:27 -07:00
|
|
|
div.style.setProperty(prop, "25%", "");
|
2011-04-28 06:48:59 -07:00
|
|
|
is(cs.getPropertyValue(prop), "40px",
|
2009-10-28 20:22:27 -07:00
|
|
|
"radius-valued property " + prop + ": interpolation of radius");
|
2011-04-28 06:48:59 -07:00
|
|
|
check_distance(prop, "12.5%", "15.625%", "25%");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-10-28 20:22:27 -07:00
|
|
|
div.style.setProperty(prop, "3px 8px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "3px 8px",
|
2010-09-15 08:11:26 -07:00
|
|
|
"radius-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "15px 12px", "");
|
2009-10-28 20:22:27 -07:00
|
|
|
is(cs.getPropertyValue(prop), "6px 9px",
|
|
|
|
"radius-valued property " + prop + ": interpolation of radius");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "3px 8px", "6px 9px", "15px 12px");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-04-28 06:48:59 -07:00
|
|
|
div.style.setProperty(prop, "12.5% 6.25%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "32px 16px",
|
2010-09-15 08:11:26 -07:00
|
|
|
"radius-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-10-28 20:22:27 -07:00
|
|
|
div.style.setProperty(prop, "25%", "");
|
2011-04-28 06:48:59 -07:00
|
|
|
is(cs.getPropertyValue(prop), "40px 28px",
|
2009-10-28 20:22:27 -07:00
|
|
|
"radius-valued property " + prop + ": interpolation of radius");
|
2011-04-28 06:48:59 -07:00
|
|
|
check_distance(prop, "12.5% 6.25%", "15.625% 10.9375%", "25%");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-04-28 06:48:59 -07:00
|
|
|
div.style.setProperty(prop, "6.25% 12.5%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "16px 32px",
|
2010-09-15 08:11:26 -07:00
|
|
|
"radius-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-04-28 06:48:59 -07:00
|
|
|
div.style.setProperty(prop, "64px 16px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "28px",
|
2010-09-15 08:11:26 -07:00
|
|
|
"radius-valued property " + prop + ": interpolation of radius with mixed units");
|
2011-04-28 06:48:59 -07:00
|
|
|
check_distance(prop, "6.25% 12.5%",
|
2012-07-13 15:06:50 -07:00
|
|
|
"calc(4.6875% + 16px) calc(9.375% + 4px)",
|
2011-04-28 06:48:59 -07:00
|
|
|
"64px 16px");
|
2010-09-15 08:11:26 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0px 0px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0px",
|
|
|
|
"radius-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "10px 20px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0px",
|
|
|
|
"radius-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2010-09-15 08:11:26 -07:00
|
|
|
test_length_percent_calc_transition(prop);
|
2009-10-28 20:22:27 -07:00
|
|
|
|
|
|
|
div.style.removeProperty("width");
|
|
|
|
div.style.removeProperty("height");
|
|
|
|
div.style.removeProperty("border");
|
|
|
|
div.style.removeProperty("padding");
|
|
|
|
}
|
|
|
|
|
2012-07-06 17:06:19 -07:00
|
|
|
function test_integer_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-11-12 17:40:05 -08:00
|
|
|
div.style.setProperty(prop, "4", "");
|
|
|
|
is(cs.getPropertyValue(prop), "4",
|
|
|
|
"integer-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "-14", "");
|
2009-11-12 17:40:05 -08:00
|
|
|
is(cs.getPropertyValue(prop), "-1",
|
2011-12-06 18:49:15 -08:00
|
|
|
"integer-valued property " + prop + ": interpolation of integers");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "6", "1", "-14");
|
2012-07-06 17:06:19 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-11-12 17:40:05 -08:00
|
|
|
div.style.setProperty(prop, "-4", "");
|
|
|
|
is(cs.getPropertyValue(prop), "-4",
|
|
|
|
"integer-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-11-12 17:40:05 -08:00
|
|
|
div.style.setProperty(prop, "8", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "-1",
|
2011-12-06 18:49:15 -08:00
|
|
|
"integer-valued property " + prop + ": interpolation of integers");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "-4", "-1", "8");
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0",
|
|
|
|
"integer-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "100", "");
|
|
|
|
isnot(cs.getPropertyValue(prop), "0",
|
|
|
|
"integer-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2009-11-12 17:40:05 -08:00
|
|
|
}
|
|
|
|
|
2009-11-14 19:16:59 -08:00
|
|
|
function test_font_stretch(prop) {
|
|
|
|
is(prop, "font-stretch", "only designed for one property");
|
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-11-14 19:16:59 -08:00
|
|
|
div.style.setProperty(prop, "normal", "");
|
|
|
|
is(cs.getPropertyValue(prop), "normal",
|
|
|
|
"font-stretch property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-11-14 19:16:59 -08:00
|
|
|
div.style.setProperty(prop, "ultra-expanded", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "semi-expanded",
|
2009-11-14 19:16:59 -08:00
|
|
|
"font-stretch property " + prop + ": interpolation of font-stretches");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "normal", "semi-expanded", "ultra-expanded");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-11-14 19:16:59 -08:00
|
|
|
div.style.setProperty(prop, "expanded", "");
|
|
|
|
is(cs.getPropertyValue(prop), "expanded",
|
|
|
|
"font-stretch property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-11-14 19:16:59 -08:00
|
|
|
div.style.setProperty(prop, "extra-condensed", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "normal",
|
2009-11-14 19:16:59 -08:00
|
|
|
"font-stretch property " + prop + ": interpolation of font-stretches");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "expanded", "semi-expanded", "condensed");
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "ultra-condensed", "");
|
|
|
|
is(cs.getPropertyValue(prop), "ultra-condensed",
|
|
|
|
"font-stretch property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "ultra-expanded", "");
|
|
|
|
is(cs.getPropertyValue(prop), "ultra-condensed",
|
|
|
|
"font-stretch property " + prop + ": clamping of values");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "ultra-expanded", "");
|
|
|
|
is(cs.getPropertyValue(prop), "ultra-expanded",
|
|
|
|
"font-stretch property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "ultra-condensed", "");
|
|
|
|
is(cs.getPropertyValue(prop), "ultra-expanded",
|
|
|
|
"font-stretch property " + prop + ": clamping of values");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2009-11-14 19:16:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function test_font_weight(prop) {
|
|
|
|
is(prop, "font-weight", "only designed for one property");
|
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-11-14 19:16:59 -08:00
|
|
|
div.style.setProperty(prop, "normal", "");
|
2009-11-14 19:16:59 -08:00
|
|
|
is(cs.getPropertyValue(prop), "400",
|
2009-11-14 19:16:59 -08:00
|
|
|
"font-weight property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-11-14 19:16:59 -08:00
|
|
|
div.style.setProperty(prop, "900", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "500",
|
2009-11-14 19:16:59 -08:00
|
|
|
"font-weight property " + prop + ": interpolation of font-weights");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "400", "500", "800");
|
2010-11-10 07:49:52 -08:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "900", "");
|
|
|
|
is(cs.getPropertyValue(prop), "900",
|
2009-11-14 19:16:59 -08:00
|
|
|
"font-weight property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-11-14 19:16:59 -08:00
|
|
|
div.style.setProperty(prop, "100", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "700",
|
2009-11-14 19:16:59 -08:00
|
|
|
"font-weight property " + prop + ": interpolation of font-weights");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "900", "700", "100");
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "100", "");
|
|
|
|
is(cs.getPropertyValue(prop), "100",
|
|
|
|
"font-weight property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "900", "");
|
|
|
|
is(cs.getPropertyValue(prop), "100",
|
|
|
|
"font-weight property " + prop + ": clamping of values");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "900", "");
|
|
|
|
is(cs.getPropertyValue(prop), "900",
|
|
|
|
"font-weight property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "100", "");
|
|
|
|
is(cs.getPropertyValue(prop), "900",
|
|
|
|
"font-weight property " + prop + ": clamping of values");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2009-11-14 19:16:59 -08:00
|
|
|
}
|
|
|
|
|
2009-12-11 08:13:19 -08:00
|
|
|
function test_pos_integer_or_auto_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-12-11 08:13:19 -08:00
|
|
|
div.style.setProperty(prop, "4", "");
|
|
|
|
is(cs.getPropertyValue(prop), "4",
|
|
|
|
"integer-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "11", "");
|
2009-12-11 08:13:19 -08:00
|
|
|
is(cs.getPropertyValue(prop), "5",
|
2011-12-06 18:49:15 -08:00
|
|
|
"integer-valued property " + prop + ": interpolation of integers");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "4", "6", "12");
|
2009-12-11 08:13:19 -08:00
|
|
|
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", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "7",
|
2011-12-06 18:49:15 -08:00
|
|
|
"integer-valued property " + prop + ": interpolation of integers");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "8", "7", "4");
|
2009-12-11 08:13:19 -08:00
|
|
|
}
|
|
|
|
|
2011-05-09 12:02:35 -07:00
|
|
|
function test_integer_at_least_one_clamping(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "1", "");
|
|
|
|
is(cs.getPropertyValue(prop), "1",
|
|
|
|
"integer-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "5", "");
|
|
|
|
is(cs.getPropertyValue(prop), "1",
|
|
|
|
"integer-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
}
|
|
|
|
|
2009-12-11 08:13:19 -08:00
|
|
|
function test_length_pair_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "4px 6px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "4px 6px",
|
2009-12-11 08:13:19 -08:00
|
|
|
"length-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-12-11 08:13:19 -08:00
|
|
|
div.style.setProperty(prop, "12px 10px", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "6px 7px",
|
2009-12-11 08:13:19 -08:00
|
|
|
"length-valued property " + prop + ": interpolation of lengths");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "4px 6px", "6px 7px", "12px 10px");
|
2009-12-11 08:13:19 -08:00
|
|
|
}
|
|
|
|
|
2011-05-09 12:02:35 -07:00
|
|
|
function test_length_pair_transition_clamped(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0px 0px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0px 0px",
|
|
|
|
"length-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "30px 50px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0px 0px",
|
|
|
|
"length-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
}
|
|
|
|
|
2009-12-11 08:13:19 -08:00
|
|
|
function test_length_percent_pair_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-12-11 08:13:19 -08:00
|
|
|
div.style.setProperty(prop, "4px 50%", "");
|
2012-02-07 12:40:02 -08:00
|
|
|
is(cs.getPropertyValue(prop), "4px 5px",
|
2009-12-11 08:13:19 -08:00
|
|
|
"length-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-12-11 08:13:19 -08:00
|
|
|
div.style.setProperty(prop, "12px 70%", "");
|
2012-02-07 12:40:02 -08:00
|
|
|
is(cs.getPropertyValue(prop), "6px 5.5px",
|
2009-12-11 08:13:19 -08:00
|
|
|
"length-valued property " + prop + ": interpolation of lengths");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "4px 50%", "6px 55%", "12px 70%");
|
2009-12-11 08:13:19 -08:00
|
|
|
}
|
|
|
|
|
2011-05-09 12:02:35 -07:00
|
|
|
function test_length_percent_pair_clamped(prop) {
|
|
|
|
test_length_percent_pair_clamped_or_unclamped(prop, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_length_percent_pair_unclamped(prop) {
|
|
|
|
test_length_percent_pair_clamped_or_unclamped(prop, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_length_percent_pair_clamped_or_unclamped(prop, is_clamped) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "0px 0%", "");
|
2012-02-07 12:40:02 -08:00
|
|
|
is(cs.getPropertyValue(prop), "0px 0px",
|
2011-05-09 12:02:35 -07:00
|
|
|
"length+percent-valued property " + prop + ": flush before clamping test");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "30px 25%", "");
|
2012-02-07 12:40:02 -08:00
|
|
|
(is_clamped ? is : isnot)(cs.getPropertyValue(prop), "0px 0px",
|
2011-05-09 12:02:35 -07:00
|
|
|
"length+percent-valued property " + prop + ": clamping of negatives");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
}
|
|
|
|
|
2009-12-21 13:46:25 -08:00
|
|
|
function test_rect_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "rect(4px, 16px, 12px, 6px)", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rect(4px, 16px, 12px, 6px)",
|
2009-12-21 13:46:25 -08:00
|
|
|
"rect-valued property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-06-26 11:58:06 -07:00
|
|
|
div.style.setProperty(prop, "rect(0px, 4px, 4px, 2px)", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rect(3px, 13px, 10px, 5px)",
|
2009-12-21 13:46:25 -08:00
|
|
|
"rect-valued property " + prop + ": interpolation of rects");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "rect(4px, 16px, 12px, 6px)",
|
|
|
|
"rect(3px, 13px, 10px, 5px)",
|
|
|
|
"rect(0px, 4px, 4px, 2px)");
|
2009-12-21 13:46:25 -08:00
|
|
|
if (prop == "clip") {
|
|
|
|
div.style.setProperty(prop, "rect(0px, 6px, 4px, auto)", "");
|
|
|
|
is(cs.getPropertyValue(prop), "rect(0px, 6px, 4px, auto)",
|
|
|
|
"rect-valued property " + prop + ": can't interpolate auto components");
|
|
|
|
div.style.setProperty(prop, "rect(0px, 6px, 4px, 2px)", "");
|
|
|
|
}
|
|
|
|
div.style.setProperty(prop, "auto", "");
|
|
|
|
is(cs.getPropertyValue(prop), "auto",
|
|
|
|
"rect-valued property " + prop + ": can't interpolate auto components");
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "rect(-10px, 30px, 0px, 0px)", "");
|
|
|
|
var vals = cs.getPropertyValue(prop).match(/rect\(([^, ]*), ([^, ]*), ([^, ]*), ([^, ]*)\)/);
|
|
|
|
is(vals.length, 5,
|
|
|
|
"rect-valued property " + prop + ": flush before clamping test (length)");
|
|
|
|
is(vals[1], "-10px",
|
|
|
|
"rect-valued property " + prop + ": flush before clamping test (top)");
|
|
|
|
is(vals[2], "30px",
|
|
|
|
"rect-valued property " + prop + ": flush before clamping test (right)");
|
|
|
|
is(vals[3], "0px",
|
|
|
|
"rect-valued property " + prop + ": flush before clamping test (bottom)");
|
|
|
|
is(vals[4], "0px",
|
|
|
|
"rect-valued property " + prop + ": flush before clamping test (left)");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-09 12:02:35 -07:00
|
|
|
div.style.setProperty(prop, "rect(0px, 40px, 10px, 10px)", "");
|
|
|
|
vals = cs.getPropertyValue(prop).match(/rect\(([^, ]*), ([^, ]*), ([^, ]*), ([^, ]*)\)/);
|
|
|
|
is(vals.length, 5,
|
|
|
|
"rect-valued property " + prop + ": clamping of negatives (length)");
|
|
|
|
isnot(vals[1], "-10px",
|
|
|
|
"rect-valued property " + prop + ": clamping of negatives (top)");
|
|
|
|
isnot(vals[2], "30px",
|
|
|
|
"rect-valued property " + prop + ": clamping of negatives (right)");
|
|
|
|
isnot(vals[3], "0px",
|
|
|
|
"rect-valued property " + prop + ": clamping of negatives (bottom)");
|
|
|
|
isnot(vals[4], "0px",
|
|
|
|
"rect-valued property " + prop + ": clamping of negatives (left)");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2009-12-21 13:46:25 -08:00
|
|
|
}
|
|
|
|
|
2009-12-21 13:46:25 -08:00
|
|
|
function test_visibility_transition(prop) {
|
2013-01-08 20:37:29 -08:00
|
|
|
function do_test(from_value, to_value, interp_value) {
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
|
|
|
div.style.setProperty(prop, from_value, "");
|
|
|
|
is(cs.getPropertyValue(prop), from_value,
|
|
|
|
"visibility property " + prop + ": computed value before transition");
|
|
|
|
div.style.setProperty("transition-property", prop, "");
|
|
|
|
div.style.setProperty(prop, to_value, "");
|
|
|
|
is(cs.getPropertyValue(prop), interp_value,
|
|
|
|
"visibility property " + prop + ": interpolation of visibility");
|
|
|
|
}
|
|
|
|
|
|
|
|
do_test("visible", "hidden", "visible");
|
|
|
|
do_test("hidden", "visible", "visible");
|
|
|
|
do_test("hidden", "collapse", "collapse"); /* not interpolable */
|
|
|
|
do_test("collapse", "hidden", "hidden"); /* not interpolable */
|
|
|
|
do_test("visible", "collapse", "visible");
|
|
|
|
do_test("collapse", "visible", "visible");
|
|
|
|
|
2010-10-23 16:31:55 -07:00
|
|
|
isnot(get_distance(prop, "visible", "hidden"), 0,
|
|
|
|
"distance between visible and hidden should not be zero");
|
2013-01-08 20:37:29 -08:00
|
|
|
isnot(get_distance(prop, "visible", "collapse"), 0,
|
|
|
|
"distance between visible and collapse should not be zero");
|
2010-10-23 16:31:55 -07:00
|
|
|
is(get_distance(prop, "visible", "visible"), 0,
|
|
|
|
"distance between visible and visible should not be zero");
|
|
|
|
is(get_distance(prop, "hidden", "hidden"), 0,
|
|
|
|
"distance between hidden and hidden should not be zero");
|
2013-01-08 20:37:29 -08:00
|
|
|
is(get_distance(prop, "collapse", "collapse"), 0,
|
|
|
|
"distance between collapse and collapse should not be zero");
|
2011-05-09 12:02:35 -07:00
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
|
2013-01-08 20:37:29 -08:00
|
|
|
function do_negative_test(from_value, to_value, interpolable) {
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
|
|
|
div.style.setProperty(prop, from_value, "");
|
|
|
|
is(cs.getPropertyValue(prop), from_value,
|
|
|
|
"visibility property " + prop + ": flush before clamping test");
|
|
|
|
div.style.setProperty("transition-property", prop, "");
|
|
|
|
div.style.setProperty(prop, to_value, "");
|
|
|
|
is(cs.getPropertyValue(prop), interpolable ? from_value : to_value,
|
|
|
|
"visibility property " + prop + ": clamping of negatives");
|
|
|
|
}
|
|
|
|
do_negative_test("visible", "hidden", true);
|
|
|
|
do_negative_test("hidden", "visible", true);
|
|
|
|
do_negative_test("hidden", "collapse", false);
|
|
|
|
do_negative_test("collapse", "hidden", false);
|
|
|
|
do_negative_test("visible", "collapse", true);
|
|
|
|
do_negative_test("collapse", "visible", true);
|
|
|
|
|
|
|
|
div.style.setProperty("transition-delay", "-3s", "");
|
|
|
|
div.style.setProperty("transition-timing-function", FUNC_OVERONE, "");
|
|
|
|
|
|
|
|
function do_overone_test(from_value, to_value) {
|
|
|
|
div.style.setProperty("transition-property", "none", "");
|
|
|
|
div.style.setProperty(prop, from_value, "");
|
|
|
|
is(cs.getPropertyValue(prop), from_value,
|
|
|
|
"visibility property " + prop + ": flush before clamping test");
|
|
|
|
div.style.setProperty("transition-property", prop, "");
|
|
|
|
div.style.setProperty(prop, to_value, "");
|
|
|
|
is(cs.getPropertyValue(prop), to_value,
|
|
|
|
"visibility property " + prop + ": clamping of over-ones");
|
|
|
|
}
|
|
|
|
do_overone_test("visible", "hidden");
|
|
|
|
do_overone_test("hidden", "visible");
|
|
|
|
do_overone_test("hidden", "collapse");
|
|
|
|
do_overone_test("collapse", "hidden");
|
|
|
|
do_overone_test("visible", "collapse");
|
|
|
|
do_overone_test("collapse", "visible");
|
|
|
|
|
|
|
|
div.style.setProperty("transition-delay", "-1s", "");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-timing-function", "linear", "");
|
2009-12-21 13:46:25 -08:00
|
|
|
}
|
|
|
|
|
2009-12-21 13:46:25 -08:00
|
|
|
function test_background_size_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-12-21 13:46:25 -08:00
|
|
|
div.style.setProperty(prop, "50% 80%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "50% 80%",
|
|
|
|
"property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-12-21 13:46:25 -08:00
|
|
|
div.style.setProperty(prop, "100% 100%", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "62.5% 85%",
|
2009-12-21 13:46:25 -08:00
|
|
|
"property " + prop + ": interpolation of percents");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "50% 80%", "62.5% 85%", "100% 100%");
|
2009-12-21 13:46:25 -08:00
|
|
|
div.style.setProperty(prop, "contain", "");
|
|
|
|
is(cs.getPropertyValue(prop), "contain",
|
|
|
|
"property " + prop + ": can't interpolate 'contain'");
|
|
|
|
test_background_position_size_common(prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_background_position_transition(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-12-21 13:46:25 -08:00
|
|
|
div.style.setProperty(prop, "center 80%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "50% 80%",
|
|
|
|
"property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-12-21 13:46:25 -08:00
|
|
|
div.style.setProperty(prop, "bottom right", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "62.5% 85%",
|
2009-12-21 13:46:25 -08:00
|
|
|
"property " + prop + ": interpolation of percents");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "center 80%", "62.5% 85%", "bottom right");
|
2009-12-21 13:46:25 -08:00
|
|
|
test_background_position_size_common(prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_background_position_size_common(prop) {
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-23 13:36:18 -07:00
|
|
|
div.style.setProperty(prop, "40% 0%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "40% 0%",
|
|
|
|
"property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-23 13:36:18 -07:00
|
|
|
div.style.setProperty(prop, "0% 0%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "30% 0%",
|
|
|
|
"property " + prop + ": interpolation of percentages");
|
|
|
|
check_distance(prop, "40% 0%", "30% 0%", "0% 0%");
|
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2011-05-23 13:36:18 -07:00
|
|
|
div.style.setProperty(prop, "0% 40%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0% 40%",
|
|
|
|
"property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2011-05-23 13:36:18 -07:00
|
|
|
div.style.setProperty(prop, "0% 0%", "");
|
|
|
|
is(cs.getPropertyValue(prop), "0% 30%",
|
|
|
|
"property " + prop + ": interpolation of percentages");
|
|
|
|
check_distance(prop, "0% 40%", "0% 30%", "0% 0%");
|
|
|
|
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2009-12-21 13:46:25 -08:00
|
|
|
div.style.setProperty(prop, "10px 40px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "10px 40px",
|
|
|
|
"property " + prop + ": computed value before transition");
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2009-12-21 13:46:25 -08:00
|
|
|
div.style.setProperty(prop, "50px 0", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "20px 30px",
|
2009-12-21 13:46:25 -08:00
|
|
|
"property " + prop + ": interpolation of lengths");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "10px 40px", "20px 30px", "50px 0");
|
2009-12-21 13:46:25 -08:00
|
|
|
div.style.setProperty(prop, "10px 40px, 50px 50px, 30px 20px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "10px 40px, 50px 50px, 30px 20px",
|
|
|
|
"property " + prop + ": computed value before transition");
|
|
|
|
div.style.setProperty(prop, "50px 20px, 70px 50px, 30px 40px", "");
|
2010-06-26 11:58:06 -07:00
|
|
|
is(cs.getPropertyValue(prop), "20px 35px, 55px 50px, 30px 25px",
|
2009-12-21 13:46:25 -08:00
|
|
|
"property " + prop + ": interpolation of lists of lengths");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "10px 40px, 50px 50px, 30px 20px",
|
|
|
|
"20px 35px, 55px 50px, 30px 25px",
|
|
|
|
"50px 20px, 70px 50px, 30px 40px");
|
2010-09-15 08:11:26 -07:00
|
|
|
div.style.setProperty(prop, "10px 40%, 50% 50px, 30% 20%, 5px 10px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "10px 40%, 50% 50px, 30% 20%, 5px 10px",
|
2009-12-21 13:46:25 -08:00
|
|
|
"property " + prop + ": computed value before transition");
|
2010-09-15 08:11:26 -07:00
|
|
|
div.style.setProperty(prop, "50px 20%, 70% 50px, 30% 40%, 25px 50px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "20px 35%, 55% 50px, 30% 25%, 10px 20px",
|
2009-12-21 13:46:25 -08:00
|
|
|
"property " + prop + ": interpolation of lists of lengths and percents");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "10px 40%, 50% 50px, 30% 20%, 5px 10px",
|
|
|
|
"20px 35%, 55% 50px, 30% 25%, 10px 20px",
|
|
|
|
"50px 20%, 70% 50px, 30% 40%, 25px 50px");
|
2010-09-15 08:11:26 -07:00
|
|
|
div.style.setProperty(prop, "20% 40%, 8px 12px", "");
|
|
|
|
is(cs.getPropertyValue(prop), "20% 40%, 8px 12px",
|
|
|
|
"property " + prop + ": computed value before transition");
|
|
|
|
div.style.setProperty(prop, "12px 20px, 40% 16%", "");
|
2012-07-13 15:06:50 -07:00
|
|
|
is(cs.getPropertyValue(prop), "calc(3px + 15%) calc(5px + 30%), calc(6px + 10%) calc(9px + 4%)",
|
2010-09-15 08:11:26 -07:00
|
|
|
"property " + prop + ": interpolation that computes to calc()");
|
2010-10-23 16:31:55 -07:00
|
|
|
check_distance(prop, "20% 40%, 8px 12px",
|
2012-07-13 15:06:50 -07:00
|
|
|
"calc(3px + 15%) calc(5px + 30%), calc(6px + 10%) calc(9px + 4%)",
|
2010-10-23 16:31:55 -07:00
|
|
|
"12px 20px, 40% 16%");
|
2012-07-13 15:06:50 -07:00
|
|
|
div.style.setProperty(prop, "calc(20% + 40px) calc(40px + 40%), 8px 12%, calc(20px + 12%) calc(24px + 8%)", "");
|
|
|
|
is(cs.getPropertyValue(prop), "calc(40px + 20%) calc(40px + 40%), 8px 12%, calc(20px + 12%) calc(24px + 8%)",
|
2010-09-15 08:11:27 -07:00
|
|
|
"property " + prop + ": computed value before transition");
|
2012-07-13 15:06:50 -07:00
|
|
|
div.style.setProperty(prop, "12px 20%, calc(20%) calc(16px + 60%), calc(8px + 20%) calc(40px + 16%)", "");
|
|
|
|
is(cs.getPropertyValue(prop), "calc(33px + 15%) calc(30px + 35%), calc(6px + 5%) calc(4px + 24%), calc(17px + 14%) calc(28px + 10%)",
|
2010-09-15 08:11:27 -07:00
|
|
|
"property " + prop + ": interpolation that computes to calc()");
|
2012-07-13 15:06:50 -07:00
|
|
|
check_distance(prop, "calc(20% + 40px) calc(40px + 40%), 8px 12%, calc(20px + 12%) calc(24px + 8%)",
|
|
|
|
"calc(33px + 15%) calc(30px + 35%), calc(6px + 5%) calc(4px + 24%), calc(17px + 14%) calc(28px + 10%)",
|
|
|
|
"12px 20%, calc(20%) calc(16px + 60%), calc(8px + 20%) calc(40px + 16%)");
|
2009-12-21 13:46:25 -08:00
|
|
|
}
|
|
|
|
|
2010-07-02 21:18:56 -07:00
|
|
|
function test_transform_transition(prop) {
|
2013-06-04 20:11:56 -07:00
|
|
|
is(prop, "transform", "Unexpected transform property! Test needs to be fixed");
|
2012-02-10 13:04:59 -08:00
|
|
|
var matrix_re = /^matrix\(([^,]*), ([^,]*), ([^,]*), ([^,]*), ([^,]*), ([^,]*)\)$/;
|
2013-06-04 20:11:56 -07:00
|
|
|
for (var i in transformTests) {
|
|
|
|
var test = transformTests[i];
|
2010-10-23 16:31:55 -07:00
|
|
|
if (!("expected" in test)) {
|
|
|
|
var v = test.expected_uncomputed;
|
2010-11-16 09:56:03 -08:00
|
|
|
if (v.match(matrix_re) && !test.force_compute) {
|
2010-10-23 16:31:55 -07:00
|
|
|
test.expected = v;
|
|
|
|
} else {
|
2013-06-04 20:11:56 -07:00
|
|
|
test.expected = computeMatrix(v);
|
2010-10-23 16:31:55 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-04 20:11:56 -07:00
|
|
|
for (var i in transformTests) {
|
|
|
|
var test = transformTests[i];
|
2011-08-30 19:03:47 -07:00
|
|
|
if (test.requires_3d && !transform3D_enabled()) {
|
|
|
|
continue;
|
|
|
|
}
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", "none", "");
|
2010-07-02 21:18:56 -07:00
|
|
|
div.style.setProperty(prop, test.start, "");
|
|
|
|
cs.getPropertyValue(prop);
|
2012-07-08 18:25:10 -07:00
|
|
|
div.style.setProperty("transition-property", prop, "");
|
2010-07-02 21:18:56 -07:00
|
|
|
div.style.setProperty(prop, test.end, "");
|
|
|
|
var actual = cs.getPropertyValue(prop);
|
|
|
|
if (!test.round_error_ok || actual == test.expected) {
|
|
|
|
// In most cases, we'll get an exact match, but in some cases
|
|
|
|
// there can be a small amount of rounding error.
|
|
|
|
is(actual, test.expected,
|
|
|
|
"interpolation of transitions: " + test.start + " to " + test.end);
|
|
|
|
} else {
|
|
|
|
function s(mat) {
|
2010-10-23 16:31:55 -07:00
|
|
|
return mat.match(matrix_re).slice(1,7);
|
2010-07-02 21:18:56 -07:00
|
|
|
}
|
|
|
|
var pass = true;
|
|
|
|
var actual_split = s(actual);
|
|
|
|
var expected_split = s(test.expected);
|
|
|
|
for (var i = 0; i < 6; ++i) {
|
|
|
|
// Allow differences of 1 at the sixth decimal place, and allow
|
|
|
|
// a drop extra for floating point error from the subtraction.
|
|
|
|
if (Math.abs(Number(actual_split[i]) - Number(expected_split[i])) >
|
|
|
|
0.0000011) {
|
|
|
|
pass = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ok(pass,
|
|
|
|
"interpolation of transitions: " + test.start + " to " + test.end +
|
|
|
|
": " + actual + " should approximately equal " + test.expected);
|
|
|
|
}
|
|
|
|
}
|
2011-05-09 12:02:35 -07:00
|
|
|
|
|
|
|
// FIXME: should perhaps test that no clamping occurs
|
2013-06-04 20:11:56 -07:00
|
|
|
|
|
|
|
// These tests check the computed value 2/3 of the way through the transition
|
|
|
|
transformDiv.style.setProperty("transition-duration", "300s", "");
|
|
|
|
transformDiv.style.setProperty("transition-timing-function", "linear", "");
|
|
|
|
window.requestAnimationFrame(nextAsyncTransformTest);
|
|
|
|
}
|
|
|
|
|
|
|
|
function nextAsyncTransformTest()
|
|
|
|
{
|
|
|
|
var test = transformTests[transformTestIndex];
|
|
|
|
|
|
|
|
if (transformTestIndex >= transformTests.length) {
|
|
|
|
transformDiv.style.removeProperty("transition");
|
|
|
|
SimpleTest.finish();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test.requires_3d && !transform3D_enabled()) {
|
|
|
|
transformTestIndex++;
|
|
|
|
window.requestAnimationFrame(nextAsyncTransformTest);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
transformDiv.style.setProperty("transition-property", "none", "");
|
|
|
|
transformDiv.style.setProperty("transform", test.start, "");
|
|
|
|
transformCs.getPropertyValue("transform");
|
|
|
|
transformDiv.style.setProperty("transition-property", "transform", "");
|
|
|
|
transformDiv.style.setProperty("transform", test.end, "");
|
|
|
|
transformCs.getPropertyValue("transform");
|
|
|
|
|
|
|
|
window.requestAnimationFrame(checkAsyncTransformTest);
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkAsyncTransformTest() {
|
|
|
|
function s(matrix) {
|
|
|
|
return matrix.replace(/^\w*\(/, '').replace(')','').split(/\s*,\s*/);
|
|
|
|
}
|
|
|
|
winUtils.advanceTimeAndRefresh(200000);
|
|
|
|
var test = transformTests[transformTestIndex];
|
|
|
|
var async_transform = winUtils.getOMTAOrComputedStyle(transformDiv, "transform");
|
|
|
|
var computed_transform = transformCs.getPropertyValue("transform");
|
|
|
|
var async_split = s(async_transform);
|
|
|
|
var cs_split = s(computed_transform);
|
|
|
|
var pass = true;
|
|
|
|
for (var j = 0; j < 16; ++j) {
|
|
|
|
var epsilon = test.big_omta_round_error ? 0.1 : 0.0001;
|
|
|
|
if (Math.abs(Number(async_split[j]) - Number(cs_split[j])) > epsilon) {
|
|
|
|
pass = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ok(pass,
|
|
|
|
"interpolation of transitions: " + test.start + " to " + test.end +
|
|
|
|
": OMTA - " + async_transform + ", computed style - " + computed_transform);
|
|
|
|
transformTestIndex++;
|
|
|
|
winUtils.restoreNormalRefresh();
|
|
|
|
window.requestAnimationFrame(nextAsyncTransformTest);
|
2010-07-02 21:18:56 -07:00
|
|
|
}
|
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|