Closed
Bug 541882
Opened 14 years ago
Closed 14 years ago
Add support for SMIL animation of the preserveAspectRatio attribute in SVG
Categories
(Core :: SVG, defect)
Core
SVG
Tracking
()
RESOLVED
FIXED
People
(Reporter: jwatt, Assigned: jwatt)
References
Details
Attachments
(1 file)
28.24 KB,
patch
|
dholbert
:
review+
|
Details | Diff | Splinter Review |
We should add support for SMIL animation of the preserveAspectRatio attribute in SVG.
Assignee | ||
Comment 1•14 years ago
|
||
I'm just reusing SMILEnumType here (stuffing the multiple values into it), since the logic is the same.
Comment 2•14 years ago
|
||
Comment on attachment 423281 [details] [diff] [review] patch >+nsresult >+nsSVGPreserveAspectRatio::SetBaseValueString(const nsAString &aValueAsString, >+#ifdef MOZ_SMIL >+ if (mIsAnimated) { >+ aSVGElement->AnimationNeedsResample(); >+ } >+#endif return NS_OK; Put "return NS_OK;" on its own line there. >+nsresult >+nsSVGPreserveAspectRatio::SMILPreserveAspectRatio >+ ::ValueFromString(const nsAString& aStr, >+ const nsISMILAnimationElement* /*aSrcElement*/, >+ nsSMILValue& aValue) const [SNIP] >+ PRUint64 compound = 0; >+ compound |= PRUint64(par.GetDefer() ? 1 : 0) << 16; >+ compound |= PRUint64(par.GetAlign()) << 8; >+ compound |= PRUint64(par.GetMeetOrSlice()); The SMILPreserveAspectRatio implementation has three copies of the above four lines, in various methods. Can we refactor that out into a helper function that these methods can call? Maybe something like: static PRUint64 GetCompoundRepresentation(nsSVGPreserveAspectRatio* par) { [the four lines quoted above] return compound; } >+++ b/content/svg/content/src/nsSVGPreserveAspectRatio.h >+ const PreserveAspectRatio &GetAnimValue(nsSVGElement *aSVGElement) const >+ { >+ #ifdef MOZ_SMIL >+ aSVGElement->FlushAnimations(); >+ #endif >+ return mAnimVal; >+ } Remove the indentation on the #ifdef & #endif there. >+++ b/layout/svg/base/src/nsSVGPatternFrame.cpp > const nsSVGPreserveAspectRatio & > nsSVGPatternFrame::GetPreserveAspectRatio() > { >+ // XXX this should also check for animated values > nsSVGPatternElement *patternElement = > GetPatternWithAttr(nsGkAtoms::preserveAspectRatio, mContent); > > return patternElement->mPreserveAspectRatio; > } RE that XXX comment -- do animated values actually present a problem there? If we're animated, wouldn't they have updated |patternElement| via SetAnimValue already? Maybe we'd need to call mContent->FlushAnimations() to make sure we're returning a value with up-to-date animation effects... but aside from that, is there anything else problematic there? r=dholbert with the above addressed
Attachment #423281 -
Flags: review?(dholbert) → review+
Assignee | ||
Comment 3•14 years ago
|
||
(In reply to comment #2) > RE that XXX comment -- do animated values actually present a problem there? If > we're animated, wouldn't they have updated |patternElement| via SetAnimValue > already? My comment was clearly lacking. I've moved it and expanded it to clarify, and I've filed bug 544809 for the issue.
Assignee | ||
Comment 4•14 years ago
|
||
Pushed http://hg.mozilla.org/mozilla-central/rev/8dc04dca2a59
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•