mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1201214 - Deal with AppendElement failing if it's called in a fallible way r=jwatt
Fortunately bug 1631371 has marked the methods and SVGPathData::GetSegmentLengths is dead code Differential Revision: https://phabricator.services.mozilla.com/D84092
This commit is contained in:
parent
5d84e2b8f0
commit
58d8d9dc4a
@ -161,10 +161,8 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromBasicAttrs(
|
||||
if (HasAttr(nsGkAtoms::from)) {
|
||||
const nsAString& fromStr = GetAttr(nsGkAtoms::from)->GetStringValue();
|
||||
success = pathGenerator.MoveToAbsolute(fromStr);
|
||||
// XXX(Bug 1631371) Check if this should use a fallible operation as it
|
||||
// pretended earlier.
|
||||
if (!mPathVertices.AppendElement(0.0, fallible)) {
|
||||
mozalloc_handle_oom(0);
|
||||
success = false;
|
||||
}
|
||||
} else {
|
||||
// Create dummy 'from' value at 0,0, if we're doing by-animation.
|
||||
@ -172,14 +170,12 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromBasicAttrs(
|
||||
// because the SMILAnimationFunction logic for to-animation doesn't
|
||||
// expect a dummy value. It only expects one value: the final 'to' value.)
|
||||
pathGenerator.MoveToOrigin();
|
||||
success = true;
|
||||
if (!HasAttr(nsGkAtoms::to)) {
|
||||
// XXX(Bug 1631371) Check if this should use a fallible operation as it
|
||||
// pretended earlier.
|
||||
if (!mPathVertices.AppendElement(0.0, fallible)) {
|
||||
mozalloc_handle_oom(0);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
success = true;
|
||||
}
|
||||
|
||||
// Apply 'to' or 'by' value
|
||||
@ -195,10 +191,8 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromBasicAttrs(
|
||||
success = pathGenerator.LineToRelative(byStr, dist);
|
||||
}
|
||||
if (success) {
|
||||
// XXX(Bug 1631371) Check if this should use a fallible operation as it
|
||||
// pretended earlier.
|
||||
if (!mPathVertices.AppendElement(dist, fallible)) {
|
||||
mozalloc_handle_oom(0);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -135,25 +135,6 @@ uint32_t SVGPathData::CountItems() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool SVGPathData::GetSegmentLengths(nsTArray<double>* aLengths) const {
|
||||
aLengths->Clear();
|
||||
SVGPathTraversalState state;
|
||||
|
||||
uint32_t i = 0;
|
||||
while (i < mData.Length()) {
|
||||
state.length = 0.0;
|
||||
SVGPathSegUtils::TraversePathSegment(&mData[i], state);
|
||||
// XXX(Bug 1631371) Check if this should use a fallible operation as it
|
||||
// pretended earlier.
|
||||
aLengths->AppendElement(state.length);
|
||||
i += 1 + SVGPathSegUtils::ArgCountForType(mData[i]);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SVGPathData::GetDistancesFromOriginToEndsOfVisibleSegments(
|
||||
FallibleTArray<double>* aOutput) const {
|
||||
SVGPathTraversalState state;
|
||||
|
@ -145,11 +145,6 @@ class SVGPathData {
|
||||
|
||||
void GetMarkerPositioningData(nsTArray<SVGMark>* aMarks) const;
|
||||
|
||||
/**
|
||||
* Returns true, except on OOM, in which case returns false.
|
||||
*/
|
||||
bool GetSegmentLengths(nsTArray<double>* aLengths) const;
|
||||
|
||||
/**
|
||||
* Returns true, except on OOM, in which case returns false.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user