Closed Bug 804991 Opened 7 years ago Closed 7 years ago

Make FromContent expect a non-null pointer and add FromContentOrNull

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: peterv, Assigned: peterv)

References

Details

Attachments

(1 file)

Attached patch v1Splinter Review
We have a couple of FromContent methods, and they're inconsistent about whether they accept a null pointer. I think we should make FromContent always expect a non-null pointer and add a FromContentOrNull for those cases where we expect null pointers too. I have a patch that implements this, I went through all the existing callers, where the existing FromContent implementation didn't deal with null I left the calls as is, where the existing FromContent implementation did deal with null I've either changed for FromContentOrNull or to FromContent if it was clear from the context that we never passed in null. We could make FromContent take a reference, to make it really obvious that it expects a non-null pointer, but I'm not sure it's that important.
Attachment #674638 - Flags: review?(bzbarsky)
Comment on attachment 674638 [details] [diff] [review]
v1

aElement is never null in SurfaceFromElement.  So you can use FromContent there.

r=me with that
Attachment #674638 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/ee3ee9e659bd(In reply to 

> aElement is never null in SurfaceFromElement.  So you can use FromContent
> there.

This was actually not true, so also checked in a bustage fix:

https://hg.mozilla.org/integration/mozilla-inbound/rev/0e0750c14c49
https://hg.mozilla.org/mozilla-central/rev/ee3ee9e659bd
https://hg.mozilla.org/mozilla-central/rev/0e0750c14c49
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
> This was actually not true

Hrm.  I wonder why not.  Maybe one of the canvas callers is being silly?  :(
Depends on: 810597
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.