Closed Bug 825499 Opened 13 years ago Closed 13 years ago

Add caretPositionFromPoint to Document.webidl

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: Ms2ger, Assigned: jwir3)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file, 1 obsolete file)

No description provided.
Ms2ger, thanks for catching this! Scott, are you planning to patch, or should I do it?
Sure, I can do it.
Assignee: nobody → sjohnson
Attached patch b825499 (obsolete) — Splinter Review
Attachment #697502 - Flags: review?(Ms2ger)
Comment on attachment 697502 [details] [diff] [review] b825499 >+ *aCaretPos = nullptr; >+ nsRefPtr<nsDOMCaretPosition> cp = nsIDocument::CaretPositionFromPoint(aX, aY, rv); >+ *aCaretPos = cp.get(); *aCaretPos = nsIDocument::CaretPositionFromPoint(aX, aY, rv).get(); (note that this is not equivalent to what you had; the refcounting is different). Is the change to throw if !ps or !ptFrame (instead of returning null) purposeful?
(In reply to Boris Zbarsky (:bz) from comment #4) > Comment on attachment 697502 [details] [diff] [review] > b825499 > > >+ *aCaretPos = nullptr; > >+ nsRefPtr<nsDOMCaretPosition> cp = nsIDocument::CaretPositionFromPoint(aX, aY, rv); > >+ *aCaretPos = cp.get(); > > *aCaretPos = nsIDocument::CaretPositionFromPoint(aX, aY, rv).get(); > > (note that this is not equivalent to what you had; the refcounting is > different). Ok, I'll fix that. > Is the change to throw if !ps or !ptFrame (instead of returning null) > purposeful? It was intentional. But, after thinking about it some more, I think perhaps the way I had it originally was a bit better. I think I'm going to change this back, since it's perfectly reasonable to simply return null if we're in a strange state like this... it doesn't seem to be an exception IMO.
Comment on attachment 697502 [details] [diff] [review] b825499 Review of attachment 697502 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/base/src/nsDocument.cpp @@ +8846,5 @@ > nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, true, > false); > if (!ptFrame) { > + rv.Throw(NS_ERROR_UNEXPECTED); > + return nullptr; Isn't this what you'd hit for """If either argument is negative, x is greater than the viewport width excluding the size of a rendered scroll bar (if any), y is greather than the viewport height excluding the size of a rendered scroll bar (if any) return null."""? @@ +8885,5 @@ > + NS_ENSURE_ARG_POINTER(aCaretPos); > + ErrorResult rv; > + *aCaretPos = nullptr; > + nsRefPtr<nsDOMCaretPosition> cp = nsIDocument::CaretPositionFromPoint(aX, aY, rv); > + *aCaretPos = cp.get(); What bz said. ::: dom/webidl/Document.webidl @@ +15,5 @@ > * http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/core/nsIDOMDocument.idl > */ > > interface Attr; > +interface CaretPosition; I would expect this to break. Anyway, remove it.
Attached patch b825499 (v2)Splinter Review
Second revision of the patch.
Attachment #697502 - Attachment is obsolete: true
Attachment #697502 - Flags: review?(Ms2ger)
Attachment #697594 - Flags: review?(Ms2ger)
Comment on attachment 697594 [details] [diff] [review] b825499 (v2) Review of attachment 697594 [details] [diff] [review]: ----------------------------------------------------------------- r=me
Attachment #697594 - Flags: review?(Ms2ger) → review+
Target Milestone: --- → mozilla20
(Missed the merge)
Target Milestone: mozilla20 → mozilla21
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Blocks: 857703
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: