Bug 570555 - CSS animation on font-size should not require units. r=dholbert,sr=roc

This commit is contained in:
Robert Longson 2010-06-09 20:51:31 +01:00
parent 2baddc5c9a
commit 77d4c995db
8 changed files with 64 additions and 15 deletions

View File

@ -145,8 +145,8 @@ nsSMILCSSProperty::GetBaseValue() const
// (4) Populate our nsSMILValue from the computed style
if (didGetComputedVal) {
nsSMILCSSValueType::ValueFromString(mPropID, mElement, computedStyleVal,
PR_FALSE, baseValue);
nsSMILCSSValueType::ValueFromString(mPropID, mElement,
computedStyleVal, baseValue);
}
return baseValue;
}
@ -159,8 +159,7 @@ nsSMILCSSProperty::ValueFromString(const nsAString& aStr,
{
NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr,
PR_FALSE, aValue);
nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr, aValue);
if (aValue.IsNull()) {
return NS_ERROR_FAILURE;
}

View File

@ -337,7 +337,6 @@ ValueFromStringHelper(nsCSSProperty aPropID,
nsIContent* aTargetElement,
nsPresContext* aPresContext,
const nsAString& aString,
PRBool aUseSVGMode,
nsStyleAnimation::Value& aStyleAnimValue)
{
// If value is negative, we'll strip off the "-" so the CSS parser won't
@ -353,7 +352,7 @@ ValueFromStringHelper(nsCSSProperty aPropID,
}
nsDependentSubstring subString(aString, subStringBegin);
if (!nsStyleAnimation::ComputeValue(aPropID, aTargetElement, subString,
aUseSVGMode, aStyleAnimValue)) {
PR_TRUE, aStyleAnimValue)) {
return PR_FALSE;
}
if (isNegative) {
@ -376,7 +375,6 @@ void
nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID,
nsIContent* aTargetElement,
const nsAString& aString,
PRBool aUseSVGMode,
nsSMILValue& aValue)
{
// XXXbz aTargetElement should be an Element
@ -389,7 +387,7 @@ nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID,
nsStyleAnimation::Value parsedValue;
if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
aString, aUseSVGMode, parsedValue)) {
aString, parsedValue)) {
sSingleton.Init(aValue);
aValue.mU.mPtr = new ValueWrapper(aPropID, parsedValue, presContext);
if (!aValue.mU.mPtr) {

View File

@ -91,8 +91,6 @@ public:
* @param aTargetElement The target element to whom the property/value
* setting applies.
* @param aString The string to be parsed as a CSS value.
* @param aUseSVGMode A flag to indicate whether we should parse
* |aString| in SVG mode.
* @param [out] aValue The nsSMILValue to be populated. Should
* initially be null-typed.
* @pre aValue.IsNull()
@ -101,7 +99,6 @@ public:
static void ValueFromString(nsCSSProperty aPropID,
nsIContent* aTargetElement,
const nsAString& aString,
PRBool aUseSVGMode,
nsSMILValue& aValue);
/**

View File

@ -66,8 +66,7 @@ nsSMILMappedAttribute::ValueFromString(const nsAString& aStr,
{
NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr,
PR_TRUE, aValue);
nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr, aValue);
if (aValue.IsNull()) {
return NS_ERROR_FAILURE;
}
@ -87,8 +86,8 @@ nsSMILMappedAttribute::GetBaseValue() const
baseStringValue);
nsSMILValue baseValue;
if (success) {
nsSMILCSSValueType::ValueFromString(mPropID, mElement, baseStringValue,
PR_TRUE, baseValue);
nsSMILCSSValueType::ValueFromString(mPropID, mElement,
baseStringValue, baseValue);
} else {
// Attribute is unset -- use computed value.
// FIRST: Temporarily clear animated value, to make sure it doesn't pollute

View File

@ -0,0 +1,17 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
style="font-size: 2px"
class="reftest-wait"
onload="go()">
<script xlink:href="../smil-grid.js" type="text/javascript"/>
<script xlink:href="../smil-util.js" type="text/javascript"/>
<script>
function go() {
var animAttrHash = { "attributeName" : "font-size",
"attributeType" : "CSS",
"from" : "10",
"to" : "30" };
testAnimatedTextGrid("animate", [animAttrHash]);
}
</script>
</svg>

After

Width:  |  Height:  |  Size: 615 B

View File

@ -0,0 +1,17 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
style="font-size: 2px"
class="reftest-wait"
onload="go()">
<script xlink:href="../smil-grid.js" type="text/javascript"/>
<script xlink:href="../smil-util.js" type="text/javascript"/>
<script>
function go() {
var animAttrHash = { "attributeName" : "font-size",
"attributeType" : "CSS",
"from" : "10",
"to" : "30px" };
testAnimatedTextGrid("animate", [animAttrHash]);
}
</script>
</svg>

After

Width:  |  Height:  |  Size: 617 B

View File

@ -0,0 +1,17 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
style="font-size: 2px"
class="reftest-wait"
onload="go()">
<script xlink:href="../smil-grid.js" type="text/javascript"/>
<script xlink:href="../smil-util.js" type="text/javascript"/>
<script>
function go() {
var animAttrHash = { "attributeName" : "font-size",
"attributeType" : "CSS",
"from" : "10px",
"to" : "30" };
testAnimatedTextGrid("animate", [animAttrHash]);
}
</script>
</svg>

After

Width:  |  Height:  |  Size: 617 B

View File

@ -72,6 +72,11 @@ fails == anim-css-fillopacity-3-clamp-big.svg anim-css-fillopacity-3-ref.svg
== anim-css-fontsize-1-from-by-px-px.svg anim-css-fontsize-1-ref.svg
== anim-css-fontsize-1-from-to-px-px.svg anim-css-fontsize-1-ref.svg
# 'font-size' property (accepts unitless values)
== anim-css-fontsize-1-from-to-no-no.svg anim-css-fontsize-1-ref.svg
== anim-css-fontsize-1-from-to-no-px.svg anim-css-fontsize-1-ref.svg
== anim-css-fontsize-1-from-to-px-no.svg anim-css-fontsize-1-ref.svg
# 'font-size' mapped attribute (accepts unitless values)
== anim-mapped-fontsize-1-from-to-no-no.svg anim-css-fontsize-1-ref.svg
== anim-mapped-fontsize-1-from-to-no-px.svg anim-css-fontsize-1-ref.svg