Closed Bug 759726 Opened 13 years ago Closed 13 years ago

Make nsICanvasRenderingContextInternal::SetCanvasElement return void

Categories

(Core :: Graphics: Canvas2D, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: Ms2ger, Assigned: Ms2ger)

Details

Attachments

(1 file)

No description provided.
Attached patch Patch v1Splinter Review
I ended up doing a bit more.
Attachment #629787 - Flags: review?(bjacob)
Attachment #629787 - Flags: feedback?(bzbarsky)
Comment on attachment 629787 [details] [diff] [review] Patch v1 Looks good to me.
Attachment #629787 - Flags: feedback?(bzbarsky) → feedback+
Comment on attachment 629787 [details] [diff] [review] Patch v1 Review of attachment 629787 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/canvas/public/nsICanvasRenderingContextInternal.h @@ +47,5 @@ > }; > > + void SetCanvasElement(nsHTMLCanvasElement* aParentCanvas) > + { > + mCanvasElement = aParentCanvas; This is making me nervous: there was this comment saying exactly to NOT do this, but not explaining why that would be a bad thing; now you're doing this; I need an explanation.
Comment on attachment 629787 [details] [diff] [review] Patch v1 Review of attachment 629787 [details] [diff] [review]: ----------------------------------------------------------------- r=me modulo a nontrivial question about the removed do_QueryInterface. Also some style nits, not duplicated everywhere where they apply. Note that comments/questions on the xxx2d file apply as well to the xxx2dAzure file. ::: content/canvas/src/nsCanvasRenderingContext2D.cpp @@ +839,5 @@ > nsresult rv; > nscolor color; > > if (!aStr.IsVoid()) { > + nsIDocument* document = mCanvasElement ? mCanvasElement->OwnerDoc() : nsnull; Suggest MFBT style: x = a ? b : c; @@ +2434,5 @@ > * string is equal to the old one. > */ > > + if (!mCanvasElement && !mDocShell) { > + NS_WARNING("Canvas element must be non-null or a docshell must be provided"); If this case is a plain c++ coding mistake (which I don't know) then this should be a fatal-in-debug assert. @@ +2812,5 @@ > // arg, and there is no way to tell if the default was used > if (aMaxWidth < 0) > return NS_ERROR_INVALID_ARG; > > + if (!mCanvasElement && !mDocShell) { Was the do_QueryInterface useless?
Attachment #629787 - Flags: review?(bjacob) → review+
<Ms2ger> sorta, mCanvasElement was an nsIDOMHTMLCanvasElement <Ms2ger> It could have used HTMLCanvasElement()
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: