Bug 520485, patch 2 of 5: add support for float values in SVG/SMIL. r=roc

This commit is contained in:
Daniel Holbert 2009-10-08 18:30:50 -07:00
parent c78ecfe798
commit 5e589fe66b
7 changed files with 32 additions and 30 deletions

View File

@ -243,11 +243,11 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
// case eCSSProperty_color_interpolation_filters:
// case eCSSProperty_display:
// case eCSSProperty_dominant_baseline:
// case eCSSProperty_fill_opacity:
case eCSSProperty_fill_opacity:
// case eCSSProperty_fill_rule:
// case eCSSProperty_filter:
case eCSSProperty_flood_color:
// case eCSSProperty_flood_opacity:
case eCSSProperty_flood_opacity:
// case eCSSProperty_font_family:
case eCSSProperty_font_size:
// case eCSSProperty_font_size_adjust:
@ -262,16 +262,16 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
// case eCSSProperty_marker_mid:
// case eCSSProperty_marker_start:
// case eCSSProperty_mask:
// case eCSSProperty_opacity:
case eCSSProperty_opacity:
// case eCSSProperty_pointer_events:
// case eCSSProperty_shape_rendering:
case eCSSProperty_stop_color:
// case eCSSProperty_stop_opacity:
case eCSSProperty_stop_opacity:
case eCSSProperty_stroke_dashoffset:
// case eCSSProperty_stroke_linecap:
// case eCSSProperty_stroke_linejoin:
// case eCSSProperty_stroke_miterlimit:
// case eCSSProperty_stroke_opacity:
case eCSSProperty_stroke_miterlimit:
case eCSSProperty_stroke_opacity:
case eCSSProperty_stroke_width:
// case eCSSProperty_text_anchor:
// case eCSSProperty_text_decoration:

View File

@ -65,6 +65,7 @@ struct ValueWrapper {
// -------------------------------------
static const nsStyleCoord sZeroCoord(0);
static const nsStyleCoord sZeroPercent(0.0f, eStyleUnit_Percent);
static const nsStyleCoord sZeroFactor(0.0f, eStyleUnit_Factor);
static const nsStyleCoord sZeroColor(NS_RGB(0,0,0));
// Helper Methods
@ -79,6 +80,8 @@ GetZeroValueForUnit(nsStyleUnit aUnit)
return &sZeroCoord;
case eStyleUnit_Percent:
return &sZeroPercent;
case eStyleUnit_Factor:
return &sZeroFactor;
case eStyleUnit_Color:
return &sZeroColor;
default:
@ -97,6 +100,9 @@ InvertStyleCoordSign(nsStyleCoord& aStyleCoord)
case eStyleUnit_Percent:
aStyleCoord.SetPercentValue(-aStyleCoord.GetPercentValue());
break;
case eStyleUnit_Factor:
aStyleCoord.SetFactorValue(-aStyleCoord.GetFactorValue());
break;
default:
NS_NOTREACHED("Calling InvertStyleCoordSign with an unsupported unit");
break;

View File

@ -71,7 +71,10 @@ var gFromByBundles =
new TestcaseBundle(gPropList.fill, _fromByTestLists.color),
new TestcaseBundle(gPropList.font_size, _fromByTestLists.lengthPx),
new TestcaseBundle(gPropList.lighting_color, _fromByTestLists.color),
new TestcaseBundle(gPropList.opacity, _fromByTestLists.opacity,
"need support for float values"),
new TestcaseBundle(gPropList.opacity, _fromByTestLists.opacity),
new TestcaseBundle(gPropList.stroke_miterlimit, [
new AnimTestcaseFromBy("1", "1", { midComp: "1.5", toComp: "2" }),
new AnimTestcaseFromBy("20.1", "-10", { midComp: "15.1", toComp: "10.1" }),
]),
new TestcaseBundle(gPropList.stroke_width, _fromByTestLists.lengthPx),
];

View File

@ -215,8 +215,7 @@ var gFromToBundles = [
[].concat(_fromToTestLists.color,
_fromToTestLists.paintServer,
_fromToTestLists.colorFromInheritBlack)),
new TestcaseBundle(gPropList.fill_opacity, _fromToTestLists.opacity,
"need support for float values"),
new TestcaseBundle(gPropList.fill_opacity, _fromToTestLists.opacity),
new TestcaseBundle(gPropList.fill_rule, [
new AnimTestcaseFromTo("nonzero", "evenodd"),
new AnimTestcaseFromTo("evenodd", "inherit", { toComp: "nonzero" }),
@ -225,8 +224,7 @@ var gFromToBundles = [
new TestcaseBundle(gPropList.flood_color,
[].concat(_fromToTestLists.color,
_fromToTestLists.colorFromInheritBlack)),
new TestcaseBundle(gPropList.flood_opacity, _fromToTestLists.opacity,
"need support for float values"),
new TestcaseBundle(gPropList.flood_opacity, _fromToTestLists.opacity),
new TestcaseBundle(gPropList.font, [
// NOTE: 'line-height' is hard-wired at 10px in test_smilCSSFromTo.xhtml
// because if it's not explicitly set, its value varies across platforms.
@ -322,8 +320,7 @@ var gFromToBundles = [
new TestcaseBundle(gPropList.marker_mid, _fromToTestLists.URIsAndNone),
new TestcaseBundle(gPropList.marker_start, _fromToTestLists.URIsAndNone),
new TestcaseBundle(gPropList.mask, _fromToTestLists.URIsAndNone),
new TestcaseBundle(gPropList.opacity, _fromToTestLists.opacity,
"need support for float values"),
new TestcaseBundle(gPropList.opacity, _fromToTestLists.opacity),
new TestcaseBundle(gPropList.overflow, [
new AnimTestcaseFromTo("auto", "visible"),
new AnimTestcaseFromTo("scroll", "auto"),
@ -344,8 +341,7 @@ var gFromToBundles = [
new TestcaseBundle(gPropList.stop_color,
[].concat(_fromToTestLists.color,
_fromToTestLists.colorFromInheritBlack)),
new TestcaseBundle(gPropList.stop_opacity, _fromToTestLists.opacity,
"need support for float values"),
new TestcaseBundle(gPropList.stop_opacity, _fromToTestLists.opacity),
new TestcaseBundle(gPropList.stroke,
[].concat(_fromToTestLists.color,
_fromToTestLists.paintServer, [
@ -376,9 +372,8 @@ var gFromToBundles = [
new TestcaseBundle(gPropList.stroke_miterlimit, [
new AnimTestcaseFromTo("1", "2", { midComp: "1.5" }),
new AnimTestcaseFromTo("20.1", "10.1", { midComp: "15.1" }),
], "need support for float values"),
new TestcaseBundle(gPropList.stroke_opacity, _fromToTestLists.opacity,
"need support for float values"),
]),
new TestcaseBundle(gPropList.stroke_opacity, _fromToTestLists.opacity),
new TestcaseBundle(gPropList.stroke_width,
[].concat(_fromToTestLists.lengthPx,
_fromToTestLists.lengthPxPctSVG,

View File

@ -210,8 +210,7 @@ var gPacedBundles =
},
"need support for more font properties"),
]),
new TestcaseBundle(gPropList.opacity, _pacedTestLists.opacity,
"need support for float values"),
new TestcaseBundle(gPropList.opacity, _pacedTestLists.opacity),
new TestcaseBundle(gPropList.stroke_dashoffset,
[].concat(_pacedTestLists.lengthPx,
_pacedTestLists.lengthPctSVG,

View File

@ -54,8 +54,8 @@ include pause/reftest.list
== anim-discrete-to-4.svg anim-standard-ref.svg
fails == anim-fillcolor-1.svg anim-standard-ref.svg # bug 436296
fails == anim-fillopacity-1none.svg anim-standard-ref.svg # XXXdholbert float support in nsStyleAnimation (bug 504652 or a followup)
fails == anim-fillopacity-1css.svg anim-standard-ref.svg # XXXdholbert float support in nsStyleAnimation (bug 504652 or a followup)
== anim-fillopacity-1none.svg anim-standard-ref.svg
== anim-fillopacity-1css.svg anim-standard-ref.svg
fails == anim-fillopacity-1xml.svg anim-standard-ref.svg # bug 436276
== anim-height-done-1a.svg anim-standard-ref.svg

View File

@ -57,14 +57,13 @@
fails == anim-css-fill-overflow-1-from-by.svg anim-css-fill-overflow-1-ref.svg
# 'fill-opacity' property
# XXXdholbert These tests require float support in nsStyleAnimation (bug 504652 or a followup)
fails == anim-css-fillopacity-1-by.svg anim-css-fillopacity-1-ref.svg
fails == anim-css-fillopacity-1-from-by.svg anim-css-fillopacity-1-ref.svg
fails == anim-css-fillopacity-1-from-to.svg anim-css-fillopacity-1-ref.svg
fails == anim-css-fillopacity-1-to.svg anim-css-fillopacity-1-ref.svg
fails == anim-css-fillopacity-2-paced.svg anim-css-fillopacity-2-ref.svg
== anim-css-fillopacity-1-by.svg anim-css-fillopacity-1-ref.svg
== anim-css-fillopacity-1-from-by.svg anim-css-fillopacity-1-ref.svg
== anim-css-fillopacity-1-from-to.svg anim-css-fillopacity-1-ref.svg
== anim-css-fillopacity-1-to.svg anim-css-fillopacity-1-ref.svg
== anim-css-fillopacity-2-paced.svg anim-css-fillopacity-2-ref.svg
fails == anim-css-fillopacity-3-clamp-big.svg anim-css-fillopacity-3-ref.svg # bug 501188
fails == anim-css-fillopacity-3-clamp-small.svg anim-css-fillopacity-3-ref.svg
== anim-css-fillopacity-3-clamp-small.svg anim-css-fillopacity-3-ref.svg
# 'font' shorthand property
# XXXdholbert We don't yet support animating shorthand properties (bug 520239)