Bug 1865470 - support by animation on viewBox r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D193985
This commit is contained in:
Robert Longson 2023-11-21 03:36:21 +00:00
parent 3a88f319e5
commit c00bca6409
3 changed files with 13 additions and 14 deletions

View file

@ -19,7 +19,7 @@ SVGViewBoxSMILType SVGViewBoxSMILType::sSingleton;
void SVGViewBoxSMILType::Init(SMILValue& aValue) const {
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mPtr = new SVGViewBox();
aValue.mU.mPtr = new SVGViewBox(0.0f, 0.0f, 0.0f, 0.0f);
aValue.mType = this;
}
@ -56,11 +56,19 @@ nsresult SVGViewBoxSMILType::Add(SMILValue& aDest, const SMILValue& aValueToAdd,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType, "Trying to add invalid types");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
// See https://bugzilla.mozilla.org/show_bug.cgi?id=541884#c3 and the two
// comments that follow that one for arguments for and against allowing
// viewBox to be additive.
auto* dest = static_cast<SVGViewBox*>(aDest.mU.mPtr);
const auto* valueToAdd = static_cast<const SVGViewBox*>(aValueToAdd.mU.mPtr);
return NS_ERROR_FAILURE;
if (dest->none || valueToAdd->none) {
return NS_ERROR_FAILURE;
}
dest->x += valueToAdd->x * aCount;
dest->y += valueToAdd->y * aCount;
dest->width += valueToAdd->width * aCount;
dest->height += valueToAdd->height * aCount;
return NS_OK;
}
nsresult SVGViewBoxSMILType::ComputeDistance(const SMILValue& aFrom,

View file

@ -1,4 +0,0 @@
[additive-type-by-animation.html]
[This by animation for all XML property types]
expected: FAIL

View file

@ -1,5 +0,0 @@
[svgrect-animation-2.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Tests from-by SVGRect animation.]
expected: FAIL