Closed Bug 272899 Opened 20 years ago Closed 20 years ago

cleanup svg base type creation

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tor, Assigned: tor)

References

Details

Attachments

(1 file)

 
Attached patch cleanupSplinter Review
Attachment #167723 - Flags: review?(jonathan.watt)
Comment on attachment 167723 [details] [diff] [review]
cleanup

Is it okay to initialise mRefCnt to 1? I seem to recall objections being raised
to that somewhere.

I would rather that 'result' be the last parameter in NS_NewSVGXxx to be
consistent, but I didn't really look to see if we need the default values for
the other parameters. Not a big deal I guess.

In nsSVGMatrix::Translate return the error code returned by NS_NewSVGMatrix.

While you're changing that part of nsSVGPointList.cpp, I'd rather we have:

    rv = NS_NewSVGPoint(getter_AddRefs(point), (float)x, (float)y);
    if (!point)
      break;

In nsSVGSVGElement.cpp you could use the fact that NS_NewSVGPoint has default
values for the parameters instead of assigning them 0.0f anyway.

In nsSVGForeignObjectFrame.cpp can you put an:

  if (!point)
    return;

after the NS_NewSVGPoint call please.

In nsSVGOuterSVGFrame.cpp perhaps you should check if an error occured during
the NS_NewSVGRect call. Not sure what you would do if it did.

In nsSVGTSpanFrame.cpp please return the rv from NS_NewSVGRect.

In nsSVGTextFrame.cpp please return the rv from NS_NewSVGRect.
Attachment #167723 - Flags: review?(jonathan.watt) → review+
(In reply to comment #2)
> While you're changing that part of nsSVGPointList.cpp, I'd rather we have:
> 
>     rv = NS_NewSVGPoint(getter_AddRefs(point), (float)x, (float)y);
>     if (!point)
>       break;

That would allow a partial list to be returned if we ran out of memory.
I'd rather return a failure.

> In nsSVGOuterSVGFrame.cpp perhaps you should check if an error occured during
> the NS_NewSVGRect call. Not sure what you would do if it did.

SetCoordCtxRect handles a null parameter; just using that behavior probably
isn't any better/worse than returning at that point.

Checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: