зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1717312 - clear mapped values if we're not animating any more r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D188712
This commit is contained in:
Родитель
4c5476f29b
Коммит
905dbcc069
|
@ -101,9 +101,7 @@ nsresult SMILCSSProperty::SetAnimValue(const SMILValue& aValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMILCSSProperty::ClearAnimValue() {
|
void SMILCSSProperty::ClearAnimValue() {
|
||||||
// Put empty string in override style for our property
|
mElement->SMILOverrideStyle()->ClearSMILValue(mPropID);
|
||||||
mElement->SMILOverrideStyle()->SetPropertyValue(mPropID, ""_ns, nullptr,
|
|
||||||
IgnoreErrors());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Based on http://www.w3.org/TR/SVG/propidx.html
|
// Based on http://www.w3.org/TR/SVG/propidx.html
|
||||||
|
|
|
@ -1507,8 +1507,13 @@ void SVGElement::DidAnimateLength(uint8_t aAttrEnum) {
|
||||||
// We don't map use element width/height currently. We can remove this
|
// We don't map use element width/height currently. We can remove this
|
||||||
// test when we do.
|
// test when we do.
|
||||||
if (propId != eCSSProperty_UNKNOWN) {
|
if (propId != eCSSProperty_UNKNOWN) {
|
||||||
|
auto lengthInfo = GetLengthInfo();
|
||||||
|
if (lengthInfo.mValues[aAttrEnum].IsAnimated()) {
|
||||||
SMILOverrideStyle()->SetSMILValue(propId,
|
SMILOverrideStyle()->SetSMILValue(propId,
|
||||||
GetLengthInfo().mValues[aAttrEnum]);
|
lengthInfo.mValues[aAttrEnum]);
|
||||||
|
} else {
|
||||||
|
SMILOverrideStyle()->ClearSMILValue(propId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1711,8 +1716,13 @@ void SVGElement::DidAnimatePathSegList() {
|
||||||
|
|
||||||
// Notify style we have to update the d property because of SMIL animation.
|
// Notify style we have to update the d property because of SMIL animation.
|
||||||
if (name == nsGkAtoms::d) {
|
if (name == nsGkAtoms::d) {
|
||||||
|
auto* animPathSegList = GetAnimPathSegList();
|
||||||
|
if (animPathSegList->IsAnimating()) {
|
||||||
SMILOverrideStyle()->SetSMILValue(nsCSSPropertyID::eCSSProperty_d,
|
SMILOverrideStyle()->SetSMILValue(nsCSSPropertyID::eCSSProperty_d,
|
||||||
*GetAnimPathSegList());
|
*animPathSegList);
|
||||||
|
} else {
|
||||||
|
SMILOverrideStyle()->ClearSMILValue(nsCSSPropertyID::eCSSProperty_d);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DidAnimateAttribute(kNameSpaceID_None, name);
|
DidAnimateAttribute(kNameSpaceID_None, name);
|
||||||
|
|
|
@ -55,6 +55,10 @@ class nsDOMCSSAttributeDeclaration final : public nsDOMCSSDeclaration {
|
||||||
const SVGAnimatedLength& aLength);
|
const SVGAnimatedLength& aLength);
|
||||||
nsresult SetSMILValue(const nsCSSPropertyID,
|
nsresult SetSMILValue(const nsCSSPropertyID,
|
||||||
const mozilla::SVGAnimatedPathSegList& aPath);
|
const mozilla::SVGAnimatedPathSegList& aPath);
|
||||||
|
void ClearSMILValue(const nsCSSPropertyID aPropID) {
|
||||||
|
// Put empty string in override style for our property
|
||||||
|
SetPropertyValue(aPropID, ""_ns, nullptr, mozilla::IgnoreErrors());
|
||||||
|
}
|
||||||
|
|
||||||
void SetPropertyValue(const nsCSSPropertyID aPropID, const nsACString& aValue,
|
void SetPropertyValue(const nsCSSPropertyID aPropID, const nsACString& aValue,
|
||||||
nsIPrincipal* aSubjectPrincipal,
|
nsIPrincipal* aSubjectPrincipal,
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<svg class="reftest-wait" onload="load()" xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||||
|
<html:link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1717312"/>
|
||||||
|
<html:script src="/common/reftest-wait.js"/>
|
||||||
|
<html:script src="/common/rendering-utils.js"/>
|
||||||
|
<html:link rel="match" href="../../embedded/reference/green-rect-100x100.svg"/>
|
||||||
|
<rect id="r" width="100" height="50" fill="green">
|
||||||
|
<animate attributeName="height" values="0" dur="20ms"/>
|
||||||
|
</rect>
|
||||||
|
<script>
|
||||||
|
function load() {
|
||||||
|
document.documentElement.setCurrentTime(1);
|
||||||
|
document.getElementById("r").setAttribute("height", 100);
|
||||||
|
waitForAtLeastOneFrame().then(takeScreenshot);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</svg>
|
После Ширина: | Высота: | Размер: 735 B |
Загрузка…
Ссылка в новой задаче