Bug 530983, patch 2: Enable SMIL animation for 'clip' property. r=roc

This commit is contained in:
Daniel Holbert 2010-01-04 16:32:11 -08:00
parent 426093642e
commit 96cd4fb14d
4 changed files with 84 additions and 16 deletions

View File

@ -199,17 +199,7 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
// writing-mode
switch (aPropID) {
// SHORTHAND PROPERTIES
case eCSSProperty_font:
case eCSSProperty_marker:
case eCSSProperty_overflow:
return PR_TRUE;
// PROPERTIES OF TYPE eCSSType_Rect
case eCSSProperty_clip:
// XXXdholbert Rect type not yet supported by nsStyleAnimation
return PR_FALSE;
case eCSSProperty_clip_rule:
case eCSSProperty_clip_path:
case eCSSProperty_color:
@ -224,6 +214,7 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
case eCSSProperty_filter:
case eCSSProperty_flood_color:
case eCSSProperty_flood_opacity:
case eCSSProperty_font:
case eCSSProperty_font_family:
case eCSSProperty_font_size:
case eCSSProperty_font_size_adjust:
@ -234,11 +225,13 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
case eCSSProperty_image_rendering:
case eCSSProperty_letter_spacing:
case eCSSProperty_lighting_color:
case eCSSProperty_marker:
case eCSSProperty_marker_end:
case eCSSProperty_marker_mid:
case eCSSProperty_marker_start:
case eCSSProperty_mask:
case eCSSProperty_opacity:
case eCSSProperty_overflow:
case eCSSProperty_pointer_events:
case eCSSProperty_shape_rendering:
case eCSSProperty_stop_color:

View File

@ -87,6 +87,27 @@ var _fromByTestLists =
// List of attribute/testcase-list bundles to be tested
var gFromByBundles =
[
new TestcaseBundle(gPropList.clip, [
new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)",
"rect(10px, 20px, 30px, 40px)",
{ midComp: "rect(6px, 12px, 18px, 24px)",
toComp: "rect(11px, 22px, 33px, 44px)"}),
// Adding "auto" (either as a standalone value or a subcomponent value)
// should cause animation to fail.
new AnimTestcaseFromBy("auto", "auto", { noEffect: 1 }),
new AnimTestcaseFromBy("auto",
"rect(auto, auto, auto, auto)", { noEffect: 1 }),
new AnimTestcaseFromBy("rect(auto, auto, auto, auto)",
"rect(auto, auto, auto, auto)", { noEffect: 1 }),
new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)", "auto", { noEffect: 1 }),
new AnimTestcaseFromBy("auto", "rect(1px, 2px, 3px, 4px)", { noEffect: 1 }),
new AnimTestcaseFromBy("rect(1px, 2px, 3px, auto)",
"rect(10px, 20px, 30px, 40px)", { noEffect: 1 }),
new AnimTestcaseFromBy("rect(1px, auto, 3px, 4px)",
"rect(10px, auto, 30px, 40px)", { noEffect: 1 }),
new AnimTestcaseFromBy("rect(1px, 2px, 3px, 4px)",
"rect(10px, auto, 30px, 40px)", { noEffect: 1 }),
]),
// Check that 'by' animations for 'cursor' has no effect
new TestcaseBundle(gPropList.cursor, [
new AnimTestcaseFromBy("crosshair", "move"),

View File

@ -151,11 +151,23 @@ var _fromToTestLists = {
// List of attribute/testcase-list bundles to be tested
var gFromToBundles = [
new TestcaseBundle(gPropList.clip, [
// XXXdholbert Add more rect-valued testcases once we support rect values
new AnimTestcaseFromTo("rect(1px, 2px, 3px, 4px)",
"rect(11px, 22px, 33px, 44px)",
{ midComp: "rect(6px, 12px, 18px, 24px)" }),
], "need support for rect() values"),
new AnimTestcaseFromTo("rect(1px, auto, 3px, 4px)",
"rect(11px, auto, 33px, 44px)",
{ midComp: "rect(6px, auto, 18px, 24px)" }),
new AnimTestcaseFromTo("auto", "auto"),
new AnimTestcaseFromTo("rect(auto, auto, auto, auto)",
"rect(auto, auto, auto, auto)"),
// Interpolation not supported in these next cases (with auto --> px-value)
new AnimTestcaseFromTo("rect(1px, auto, 3px, auto)",
"rect(11px, auto, 33px, 44px)"),
new AnimTestcaseFromTo("rect(1px, 2px, 3px, 4px)",
"rect(11px, auto, 33px, 44px)"),
new AnimTestcaseFromTo("rect(1px, 2px, 3px, 4px)", "auto"),
new AnimTestcaseFromTo("auto", "rect(1px, 2px, 3px, 4px)"),
]),
new TestcaseBundle(gPropList.clip_path, _fromToTestLists.URIsAndNone),
new TestcaseBundle(gPropList.clip_rule, [
new AnimTestcaseFromTo("nonzero", "evenodd"),

View File

@ -163,16 +163,58 @@ var _pacedTestLists =
comp2_3: "rect(20px, 20px, 90px, 6px)",
comp1: "rect(20px, 30px, 130px, 4px)"
}),
// XXXdholbert Test "inherit" & "auto" as rect values, & test "auto" as
// a component value
new AnimTestcasePaced("rect(10px, auto, 10px, 10px); " +
"rect(20px, auto, 50px, 8px); " +
"rect(40px, auto, 130px, 4px)",
{ comp0: "rect(10px, auto, 10px, 10px)",
comp1_6: "rect(15px, auto, 30px, 9px)",
comp1_3: "rect(20px, auto, 50px, 8px)",
comp2_3: "rect(30px, auto, 90px, 6px)",
comp1: "rect(40px, auto, 130px, 4px)"
}),
// Paced-mode animation is not supported in these next few cases
// (Can't compute subcomponent distance between 'auto' & px-values)
new AnimTestcasePaced("rect(10px, 10px, 10px, auto); " +
"rect(20px, 10px, 50px, 8px); " +
"rect(20px, 30px, 130px, 4px)",
{ comp0: "rect(10px, 10px, 10px, auto)",
comp1_6: "rect(10px, 10px, 10px, auto)",
comp1_3: "rect(20px, 10px, 50px, 8px)",
comp2_3: "rect(20px, 30px, 130px, 4px)",
comp1: "rect(20px, 30px, 130px, 4px)"
}),
new AnimTestcasePaced("rect(10px, 10px, 10px, 10px); " +
"rect(20px, 10px, 50px, 8px); " +
"auto",
{ comp0: "rect(10px, 10px, 10px, 10px)",
comp1_6: "rect(10px, 10px, 10px, 10px)",
comp1_3: "rect(20px, 10px, 50px, 8px)",
comp2_3: "auto",
comp1: "auto"
}),
new AnimTestcasePaced("auto; " +
"auto; " +
"rect(20px, 30px, 130px, 4px)",
{ comp0: "auto",
comp1_6: "auto",
comp1_3: "auto",
comp2_3: "rect(20px, 30px, 130px, 4px)",
comp1: "rect(20px, 30px, 130px, 4px)"
}),
new AnimTestcasePaced("auto; auto; auto",
{ comp0: "auto",
comp1_6: "auto",
comp1_3: "auto",
comp2_3: "auto",
comp1: "auto"
}),
],
};
// TODO: test more properties here.
var gPacedBundles =
[
new TestcaseBundle(gPropList.clip, _pacedTestLists.rect,
"need support for animating rect-valued properties"),
new TestcaseBundle(gPropList.clip, _pacedTestLists.rect),
new TestcaseBundle(gPropList.color, _pacedTestLists.color),
new TestcaseBundle(gPropList.direction, [
new AnimTestcasePaced("rtl; ltr; rtl")