зеркало из https://github.com/mozilla/pjs.git
Bug 533291 Patch E: Add another outparam to nsISMILAttr::ValueFromString, to let us know whether we can re-use the parsed result in the future. r=roc
This commit is contained in:
Родитель
1cd94792dd
Коммит
f62ad5a1f6
|
@ -67,12 +67,17 @@ public:
|
||||||
* provided additional context data such as for
|
* provided additional context data such as for
|
||||||
* animateTransform where the 'type' attribute is needed to
|
* animateTransform where the 'type' attribute is needed to
|
||||||
* parse the value.
|
* parse the value.
|
||||||
* @param aValue Outparam for storing the parsed value.
|
* @param[out] aValue Outparam for storing the parsed value.
|
||||||
|
* @param[out] aCanCache Outparam for indicating whether the parsed value
|
||||||
|
* can be reused in future samples -- i.e. whether the
|
||||||
|
* given string is always guaranteed to compute
|
||||||
|
* to the same nsSMILValue.
|
||||||
* @return NS_OK on success or an error code if creation failed.
|
* @return NS_OK on success or an error code if creation failed.
|
||||||
*/
|
*/
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const = 0;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the underlying value of this attribute.
|
* Gets the underlying value of this attribute.
|
||||||
|
|
|
@ -104,6 +104,7 @@ nsSMILAnimationFunction::nsSMILAnimationFunction()
|
||||||
mRepeatIteration(0),
|
mRepeatIteration(0),
|
||||||
mLastValue(PR_FALSE),
|
mLastValue(PR_FALSE),
|
||||||
mHasChanged(PR_TRUE),
|
mHasChanged(PR_TRUE),
|
||||||
|
mValueNeedsReparsingEverySample(PR_FALSE),
|
||||||
mBeginTime(LL_MININT),
|
mBeginTime(LL_MININT),
|
||||||
mAnimationElement(nsnull),
|
mAnimationElement(nsnull),
|
||||||
mErrorFlags(0)
|
mErrorFlags(0)
|
||||||
|
@ -358,7 +359,7 @@ nsSMILAnimationFunction::WillReplace() const
|
||||||
PRBool
|
PRBool
|
||||||
nsSMILAnimationFunction::HasChanged() const
|
nsSMILAnimationFunction::HasChanged() const
|
||||||
{
|
{
|
||||||
return mHasChanged;
|
return mHasChanged || mValueNeedsReparsingEverySample;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
|
@ -684,23 +685,33 @@ nsSMILAnimationFunction::GetAttr(nsIAtom* aAttName, nsAString& aResult) const
|
||||||
* A utility function to make querying an attribute that corresponds to an
|
* A utility function to make querying an attribute that corresponds to an
|
||||||
* nsSMILValue a little neater.
|
* nsSMILValue a little neater.
|
||||||
*
|
*
|
||||||
* @param aAttName The attribute name (in the global namespace)
|
* @param aAttName The attribute name (in the global namespace).
|
||||||
* @param aSMILAttr The SMIL attribute to perform the parsing
|
* @param aSMILAttr The SMIL attribute to perform the parsing.
|
||||||
* @param aResult The resulting nsSMILValue
|
* @param[out] aResult The resulting nsSMILValue.
|
||||||
|
* @param[out] aCanCacheSoFar If |aResult| cannot be cached (as reported by
|
||||||
|
* nsISMILAttr::ValueFromString), then this outparam
|
||||||
|
* will be set to PR_FALSE. Otherwise, this outparam
|
||||||
|
* won't be modified.
|
||||||
*
|
*
|
||||||
* Returns PR_FALSE if a parse error occurred, otherwise returns PR_TRUE.
|
* Returns PR_FALSE if a parse error occurred, otherwise returns PR_TRUE.
|
||||||
*/
|
*/
|
||||||
PRBool
|
PRBool
|
||||||
nsSMILAnimationFunction::ParseAttr(nsIAtom* aAttName,
|
nsSMILAnimationFunction::ParseAttr(nsIAtom* aAttName,
|
||||||
const nsISMILAttr& aSMILAttr,
|
const nsISMILAttr& aSMILAttr,
|
||||||
nsSMILValue& aResult) const
|
nsSMILValue& aResult,
|
||||||
|
PRBool& aCanCacheSoFar) const
|
||||||
{
|
{
|
||||||
nsAutoString attValue;
|
nsAutoString attValue;
|
||||||
if (GetAttr(aAttName, attValue)) {
|
if (GetAttr(aAttName, attValue)) {
|
||||||
nsresult rv =
|
PRBool canCache;
|
||||||
aSMILAttr.ValueFromString(attValue, mAnimationElement, aResult);
|
nsresult rv = aSMILAttr.ValueFromString(attValue, mAnimationElement,
|
||||||
|
aResult, canCache);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
|
if (!canCache) {
|
||||||
|
aCanCacheSoFar = PR_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -726,25 +737,34 @@ nsSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
|
||||||
if (!mAnimationElement)
|
if (!mAnimationElement)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
mValueNeedsReparsingEverySample = PR_FALSE;
|
||||||
nsSMILValueArray result;
|
nsSMILValueArray result;
|
||||||
|
|
||||||
// If "values" is set, use it
|
// If "values" is set, use it
|
||||||
if (HasAttr(nsGkAtoms::values)) {
|
if (HasAttr(nsGkAtoms::values)) {
|
||||||
nsAutoString attValue;
|
nsAutoString attValue;
|
||||||
GetAttr(nsGkAtoms::values, attValue);
|
GetAttr(nsGkAtoms::values, attValue);
|
||||||
|
PRBool canCache;
|
||||||
nsresult rv = nsSMILParserUtils::ParseValues(attValue, mAnimationElement,
|
nsresult rv = nsSMILParserUtils::ParseValues(attValue, mAnimationElement,
|
||||||
aSMILAttr, result);
|
aSMILAttr, result, canCache);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
if (!canCache) {
|
||||||
|
mValueNeedsReparsingEverySample = PR_TRUE;
|
||||||
|
}
|
||||||
// Else try to/from/by
|
// Else try to/from/by
|
||||||
} else {
|
} else {
|
||||||
|
PRBool canCacheSoFar = PR_TRUE;
|
||||||
PRBool parseOk = PR_TRUE;
|
PRBool parseOk = PR_TRUE;
|
||||||
nsSMILValue to, from, by;
|
nsSMILValue to, from, by;
|
||||||
parseOk &= ParseAttr(nsGkAtoms::to, aSMILAttr, to);
|
parseOk &= ParseAttr(nsGkAtoms::to, aSMILAttr, to, canCacheSoFar);
|
||||||
parseOk &= ParseAttr(nsGkAtoms::from, aSMILAttr, from);
|
parseOk &= ParseAttr(nsGkAtoms::from, aSMILAttr, from, canCacheSoFar);
|
||||||
parseOk &= ParseAttr(nsGkAtoms::by, aSMILAttr, by);
|
parseOk &= ParseAttr(nsGkAtoms::by, aSMILAttr, by, canCacheSoFar);
|
||||||
|
|
||||||
|
if (!canCacheSoFar) {
|
||||||
|
mValueNeedsReparsingEverySample = PR_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!parseOk)
|
if (!parseOk)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
|
@ -321,7 +321,7 @@ protected:
|
||||||
nsAString& aResult) const;
|
nsAString& aResult) const;
|
||||||
|
|
||||||
PRBool ParseAttr(nsIAtom* aAttName, const nsISMILAttr& aSMILAttr,
|
PRBool ParseAttr(nsIAtom* aAttName, const nsISMILAttr& aSMILAttr,
|
||||||
nsSMILValue& aResult) const;
|
nsSMILValue& aResult, PRBool& aCanCacheSoFar) const;
|
||||||
nsresult GetValues(const nsISMILAttr& aSMILAttr,
|
nsresult GetValues(const nsISMILAttr& aSMILAttr,
|
||||||
nsSMILValueArray& aResult);
|
nsSMILValueArray& aResult);
|
||||||
void UpdateValuesArray();
|
void UpdateValuesArray();
|
||||||
|
@ -372,6 +372,7 @@ protected:
|
||||||
PRUint32 mRepeatIteration;
|
PRUint32 mRepeatIteration;
|
||||||
PRPackedBool mLastValue;
|
PRPackedBool mLastValue;
|
||||||
PRPackedBool mHasChanged;
|
PRPackedBool mHasChanged;
|
||||||
|
PRPackedBool mValueNeedsReparsingEverySample;
|
||||||
|
|
||||||
nsSMILTime mBeginTime; // document time
|
nsSMILTime mBeginTime; // document time
|
||||||
|
|
||||||
|
|
|
@ -146,12 +146,26 @@ nsSMILCSSProperty::GetBaseValue() const
|
||||||
nsresult
|
nsresult
|
||||||
nsSMILCSSProperty::ValueFromString(const nsAString& aStr,
|
nsSMILCSSProperty::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr, aValue);
|
nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr, aValue);
|
||||||
return aValue.IsNull() ? NS_ERROR_FAILURE : NS_OK;
|
if (aValue.IsNull()) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXXdholbert: For simplicity, just assume that all CSS values have to
|
||||||
|
// reparsed every sample. This prevents us from doing the "nothing's changed
|
||||||
|
// so don't recompose" optimization (bug 533291) for CSS properties & mapped
|
||||||
|
// attributes. If it ends up being expensive to always recompose those, we
|
||||||
|
// can be a little smarter here. We really only need to disable aCanCache
|
||||||
|
// for "inherit" & "currentColor" (whose values could change at any time), as
|
||||||
|
// well as for length-valued types (particularly those with em/ex/percent
|
||||||
|
// units, since their conversion ratios can change at any time).
|
||||||
|
aCanCache = PR_FALSE;
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -66,7 +66,8 @@ public:
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
|
|
|
@ -542,7 +542,8 @@ nsresult
|
||||||
nsSMILParserUtils::ParseValues(const nsAString& aSpec,
|
nsSMILParserUtils::ParseValues(const nsAString& aSpec,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
const nsISMILAttr& aAttribute,
|
const nsISMILAttr& aAttribute,
|
||||||
nsTArray<nsSMILValue>& aValuesArray)
|
nsTArray<nsSMILValue>& aValuesArray,
|
||||||
|
PRBool& aCanCache)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
@ -551,6 +552,9 @@ nsSMILParserUtils::ParseValues(const nsAString& aSpec,
|
||||||
const PRUnichar* substrEnd = nsnull;
|
const PRUnichar* substrEnd = nsnull;
|
||||||
const PRUnichar* next = nsnull;
|
const PRUnichar* next = nsnull;
|
||||||
|
|
||||||
|
// Assume all results can be cached, until we find one that can't.
|
||||||
|
aCanCache = PR_TRUE;
|
||||||
|
|
||||||
while (start != end) {
|
while (start != end) {
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
@ -576,8 +580,9 @@ nsSMILParserUtils::ParseValues(const nsAString& aSpec,
|
||||||
--substrEnd;
|
--substrEnd;
|
||||||
|
|
||||||
nsSMILValue newValue;
|
nsSMILValue newValue;
|
||||||
|
PRBool tmpCanCache;
|
||||||
rv = aAttribute.ValueFromString(Substring(start, substrEnd),
|
rv = aAttribute.ValueFromString(Substring(start, substrEnd),
|
||||||
aSrcElement, newValue);
|
aSrcElement, newValue, tmpCanCache);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -585,8 +590,10 @@ nsSMILParserUtils::ParseValues(const nsAString& aSpec,
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!tmpCanCache) {
|
||||||
|
aCanCache = PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
rv = NS_OK;
|
|
||||||
start = next;
|
start = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,8 @@ public:
|
||||||
static nsresult ParseValues(const nsAString& aSpec,
|
static nsresult ParseValues(const nsAString& aSpec,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
const nsISMILAttr& aAttribute,
|
const nsISMILAttr& aAttribute,
|
||||||
nsTArray<nsSMILValue>& aValuesArray);
|
nsTArray<nsSMILValue>& aValuesArray,
|
||||||
|
PRBool& aCanCache);
|
||||||
|
|
||||||
static nsresult ParseRepeatCount(const nsAString& aSpec,
|
static nsresult ParseRepeatCount(const nsAString& aSpec,
|
||||||
nsSMILRepeatCount& aResult);
|
nsSMILRepeatCount& aResult);
|
||||||
|
|
|
@ -436,7 +436,8 @@ nsSVGAngle::ToSMILAttr(nsSVGElement *aSVGElement)
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGAngle::SMILOrient::ValueFromString(const nsAString& aStr,
|
nsSVGAngle::SMILOrient::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* /*aSrcElement*/,
|
const nsISMILAnimationElement* /*aSrcElement*/,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
nsSMILValue val(&SVGOrientSMILType::sSingleton);
|
nsSMILValue val(&SVGOrientSMILType::sSingleton);
|
||||||
if (aStr.EqualsLiteral("auto")) {
|
if (aStr.EqualsLiteral("auto")) {
|
||||||
|
@ -453,6 +454,7 @@ nsSVGAngle::SMILOrient::ValueFromString(const nsAString& aStr,
|
||||||
val.mU.mOrient.mOrientType = nsIDOMSVGMarkerElement::SVG_MARKER_ORIENT_ANGLE;
|
val.mU.mOrient.mOrientType = nsIDOMSVGMarkerElement::SVG_MARKER_ORIENT_ANGLE;
|
||||||
}
|
}
|
||||||
aValue = val;
|
aValue = val;
|
||||||
|
aCanCache = PR_TRUE;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,8 @@ private:
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
|
|
|
@ -143,7 +143,8 @@ nsSVGBoolean::ToSMILAttr(nsSVGElement *aSVGElement)
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGBoolean::SMILBool::ValueFromString(const nsAString& aStr,
|
nsSVGBoolean::SMILBool::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* /*aSrcElement*/,
|
const nsISMILAnimationElement* /*aSrcElement*/,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
nsSMILValue val(&SMILBoolType::sSingleton);
|
nsSMILValue val(&SMILBoolType::sSingleton);
|
||||||
|
|
||||||
|
@ -155,6 +156,7 @@ nsSVGBoolean::SMILBool::ValueFromString(const nsAString& aStr,
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
aValue = val;
|
aValue = val;
|
||||||
|
aCanCache = PR_TRUE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,8 @@ private:
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
|
|
|
@ -174,7 +174,8 @@ nsSVGEnum::ToSMILAttr(nsSVGElement *aSVGElement)
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGEnum::SMILEnum::ValueFromString(const nsAString& aStr,
|
nsSVGEnum::SMILEnum::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* /*aSrcElement*/,
|
const nsISMILAnimationElement* /*aSrcElement*/,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> valAtom = do_GetAtom(aStr);
|
nsCOMPtr<nsIAtom> valAtom = do_GetAtom(aStr);
|
||||||
nsSVGEnumMapping *mapping = mVal->GetMapping(mSVGElement);
|
nsSVGEnumMapping *mapping = mVal->GetMapping(mSVGElement);
|
||||||
|
@ -184,6 +185,7 @@ nsSVGEnum::SMILEnum::ValueFromString(const nsAString& aStr,
|
||||||
nsSMILValue val(&SMILEnumType::sSingleton);
|
nsSMILValue val(&SMILEnumType::sSingleton);
|
||||||
val.mU.mUint = mapping->mVal;
|
val.mU.mUint = mapping->mVal;
|
||||||
aValue = val;
|
aValue = val;
|
||||||
|
aCanCache = PR_TRUE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
mapping++;
|
mapping++;
|
||||||
|
|
|
@ -128,7 +128,8 @@ private:
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
|
|
|
@ -137,7 +137,8 @@ nsSVGInteger::ToSMILAttr(nsSVGElement *aSVGElement)
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGInteger::SMILInteger::ValueFromString(const nsAString& aStr,
|
nsSVGInteger::SMILInteger::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* /*aSrcElement*/,
|
const nsISMILAnimationElement* /*aSrcElement*/,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
NS_ConvertUTF16toUTF8 value(aStr);
|
NS_ConvertUTF16toUTF8 value(aStr);
|
||||||
const char *str = value.get();
|
const char *str = value.get();
|
||||||
|
@ -154,6 +155,7 @@ nsSVGInteger::SMILInteger::ValueFromString(const nsAString& aStr,
|
||||||
nsSMILValue smilVal(&SMILIntegerType::sSingleton);
|
nsSMILValue smilVal(&SMILIntegerType::sSingleton);
|
||||||
smilVal.mU.mInt = val;
|
smilVal.mU.mInt = val;
|
||||||
aValue = smilVal;
|
aValue = smilVal;
|
||||||
|
aCanCache = PR_TRUE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,8 @@ private:
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
|
|
|
@ -519,7 +519,8 @@ nsSVGLength2::ToSMILAttr(nsSVGElement *aSVGElement)
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGLength2::SMILLength::ValueFromString(const nsAString& aStr,
|
nsSVGLength2::SMILLength::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* /*aSrcElement*/,
|
const nsISMILAnimationElement* /*aSrcElement*/,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
float value;
|
float value;
|
||||||
PRUint16 unitType;
|
PRUint16 unitType;
|
||||||
|
@ -532,7 +533,10 @@ nsSVGLength2::SMILLength::ValueFromString(const nsAString& aStr,
|
||||||
nsSMILValue val(&nsSMILFloatType::sSingleton);
|
nsSMILValue val(&nsSMILFloatType::sSingleton);
|
||||||
val.mU.mDouble = value / mVal->GetUnitScaleFactor(mSVGElement, unitType);
|
val.mU.mDouble = value / mVal->GetUnitScaleFactor(mSVGElement, unitType);
|
||||||
aValue = val;
|
aValue = val;
|
||||||
|
aCanCache = (unitType != nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE &&
|
||||||
|
unitType != nsIDOMSVGLength::SVG_LENGTHTYPE_EMS &&
|
||||||
|
unitType != nsIDOMSVGLength::SVG_LENGTHTYPE_EXS);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,8 @@ private:
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue &aValue) const;
|
nsSMILValue &aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
|
|
|
@ -172,7 +172,8 @@ nsSVGNumber2::ToSMILAttr(nsSVGElement *aSVGElement)
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGNumber2::SMILNumber::ValueFromString(const nsAString& aStr,
|
nsSVGNumber2::SMILNumber::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* /*aSrcElement*/,
|
const nsISMILAnimationElement* /*aSrcElement*/,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
float value;
|
float value;
|
||||||
|
|
||||||
|
@ -184,6 +185,7 @@ nsSVGNumber2::SMILNumber::ValueFromString(const nsAString& aStr,
|
||||||
nsSMILValue val(&nsSMILFloatType::sSingleton);
|
nsSMILValue val(&nsSMILFloatType::sSingleton);
|
||||||
val.mU.mDouble = value;
|
val.mU.mDouble = value;
|
||||||
aValue = val;
|
aValue = val;
|
||||||
|
aCanCache = PR_TRUE;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,8 @@ private:
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
|
|
|
@ -345,7 +345,8 @@ nsresult
|
||||||
nsSVGPreserveAspectRatio::SMILPreserveAspectRatio
|
nsSVGPreserveAspectRatio::SMILPreserveAspectRatio
|
||||||
::ValueFromString(const nsAString& aStr,
|
::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* /*aSrcElement*/,
|
const nsISMILAnimationElement* /*aSrcElement*/,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
PreserveAspectRatio par;
|
PreserveAspectRatio par;
|
||||||
nsresult res = ToPreserveAspectRatio(aStr, &par);
|
nsresult res = ToPreserveAspectRatio(aStr, &par);
|
||||||
|
@ -354,6 +355,7 @@ nsSVGPreserveAspectRatio::SMILPreserveAspectRatio
|
||||||
nsSMILValue val(&SMILEnumType::sSingleton);
|
nsSMILValue val(&SMILEnumType::sSingleton);
|
||||||
val.mU.mUint = PackPreserveAspectRatio(par);
|
val.mU.mUint = PackPreserveAspectRatio(par);
|
||||||
aValue = val;
|
aValue = val;
|
||||||
|
aCanCache = PR_TRUE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,8 @@ private:
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGTransformSMILAttr::ValueFromString(const nsAString& aStr,
|
nsSVGTransformSMILAttr::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(aSrcElement, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(aSrcElement, NS_ERROR_FAILURE);
|
||||||
NS_ASSERTION(aValue.IsNull(),
|
NS_ASSERTION(aValue.IsNull(),
|
||||||
|
@ -66,6 +67,7 @@ nsSVGTransformSMILAttr::ValueFromString(const nsAString& aStr,
|
||||||
: nsGkAtoms::translate;
|
: nsGkAtoms::translate;
|
||||||
|
|
||||||
ParseValue(aStr, transformType, aValue);
|
ParseValue(aStr, transformType, aValue);
|
||||||
|
aCanCache = PR_TRUE;
|
||||||
return aValue.IsNull() ? NS_ERROR_FAILURE : NS_OK;
|
return aValue.IsNull() ? NS_ERROR_FAILURE : NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,9 +57,10 @@ public:
|
||||||
: mVal(aTransform) {}
|
: mVal(aTransform) {}
|
||||||
|
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
|
|
|
@ -284,7 +284,8 @@ nsresult
|
||||||
nsSVGViewBox::SMILViewBox
|
nsSVGViewBox::SMILViewBox
|
||||||
::ValueFromString(const nsAString& aStr,
|
::ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* /*aSrcElement*/,
|
const nsISMILAnimationElement* /*aSrcElement*/,
|
||||||
nsSMILValue& aValue) const
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const
|
||||||
{
|
{
|
||||||
nsSVGViewBoxRect viewBox;
|
nsSVGViewBoxRect viewBox;
|
||||||
nsresult res = ToSVGViewBoxRect(aStr, &viewBox);
|
nsresult res = ToSVGViewBoxRect(aStr, &viewBox);
|
||||||
|
@ -298,6 +299,7 @@ nsSVGViewBox::SMILViewBox
|
||||||
}
|
}
|
||||||
*static_cast<nsSVGViewBoxRect*>(val.mU.mPtr) = viewBox;
|
*static_cast<nsSVGViewBoxRect*>(val.mU.mPtr) = viewBox;
|
||||||
aValue = val;
|
aValue = val;
|
||||||
|
aCanCache = PR_TRUE;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,8 @@ private:
|
||||||
// nsISMILAttr methods
|
// nsISMILAttr methods
|
||||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||||
const nsISMILAnimationElement* aSrcElement,
|
const nsISMILAnimationElement* aSrcElement,
|
||||||
nsSMILValue& aValue) const;
|
nsSMILValue& aValue,
|
||||||
|
PRBool& aCanCache) const;
|
||||||
virtual nsSMILValue GetBaseValue() const;
|
virtual nsSMILValue GetBaseValue() const;
|
||||||
virtual void ClearAnimValue();
|
virtual void ClearAnimValue();
|
||||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче