diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 430beb551160..b2bec0c61e57 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2760,8 +2760,8 @@ CSS_PROP_SVG( mFill, eCSSType_ValuePair, nsnull, - CSS_PROP_NO_OFFSET, - eStyleAnimType_None) + offsetof(nsStyleSVG, mFill), + eStyleAnimType_PaintServer) CSS_PROP_SVG( fill-opacity, fill_opacity, @@ -2930,8 +2930,8 @@ CSS_PROP_SVG( mStroke, eCSSType_ValuePair, nsnull, - CSS_PROP_NO_OFFSET, - eStyleAnimType_None) + offsetof(nsStyleSVG, mStroke), + eStyleAnimType_PaintServer) CSS_PROP_SVG( stroke-dasharray, stroke_dasharray, diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index a4db7b5b6af4..9bcdc7a8b2fe 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -85,6 +85,9 @@ enum nsStyleAnimType { // nscolor values eStyleAnimType_Color, + // nsStyleSVGPaint values + eStyleAnimType_PaintServer, + // property not animatable eStyleAnimType_None }; diff --git a/layout/style/nsStyleAnimation.cpp b/layout/style/nsStyleAnimation.cpp index 6dad7ddd02ac..e92d34a32a79 100644 --- a/layout/style/nsStyleAnimation.cpp +++ b/layout/style/nsStyleAnimation.cpp @@ -458,6 +458,20 @@ nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty, aComputedValue.SetColorValue(*static_cast( StyleDataAtOffset(styleStruct, ssOffset))); return PR_TRUE; + case eStyleAnimType_PaintServer: { + const nsStyleSVGPaint &paint = *static_cast( + StyleDataAtOffset(styleStruct, ssOffset)); + // We *could* animate 'none' by treating it as rgba(0, 0, 0, 0), + // but since SVG doesn't have (or really get along with) rgba() + // colors, I think we're not supposed to. + // FIXME: However, at some point in the future, we should animate + // gradients. + if (paint.mType == eStyleSVGPaintType_Color) { + aComputedValue.SetColorValue(paint.mPaint.mColor); + return PR_TRUE; + } + return PR_FALSE; + } case eStyleAnimType_None: NS_NOTREACHED("shouldn't use on non-animatable properties"); } @@ -521,6 +535,13 @@ nsStyleAnimation::StoreComputedValue(nsCSSProperty aProperty, *static_cast(StyleDataAtOffset(aStyleStruct, ssOffset)) = aComputedValue.GetColorValue(); return PR_TRUE; + case eStyleAnimType_PaintServer: { + nsStyleSVGPaint &paint = *static_cast( + StyleDataAtOffset(aStyleStruct, ssOffset)); + paint.mType = eStyleSVGPaintType_Color; + paint.mPaint.mColor = aComputedValue.GetColorValue(); + return PR_TRUE; + } case eStyleAnimType_None: NS_NOTREACHED("shouldn't use on non-animatable properties"); }