Closed
Bug 825499
Opened 13 years ago
Closed 13 years ago
Add caretPositionFromPoint to Document.webidl
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: Ms2ger, Assigned: jwir3)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file, 1 obsolete file)
6.18 KB,
patch
|
Ms2ger
:
review+
|
Details | Diff | Splinter Review |
No description provided.
![]() |
||
Comment 1•13 years ago
|
||
Ms2ger, thanks for catching this!
Scott, are you planning to patch, or should I do it?
Assignee | ||
Comment 3•13 years ago
|
||
Attachment #697502 -
Flags: review?(Ms2ger)
![]() |
||
Comment 4•13 years ago
|
||
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?
Assignee | ||
Comment 5•13 years ago
|
||
(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.
Reporter | ||
Comment 6•13 years ago
|
||
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.
Assignee | ||
Comment 7•13 years ago
|
||
Second revision of the patch.
Attachment #697502 -
Attachment is obsolete: true
Attachment #697502 -
Flags: review?(Ms2ger)
Attachment #697594 -
Flags: review?(Ms2ger)
Reporter | ||
Comment 8•13 years ago
|
||
Comment on attachment 697594 [details] [diff] [review]
b825499 (v2)
Review of attachment 697594 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
Attachment #697594 -
Flags: review?(Ms2ger) → review+
Assignee | ||
Comment 9•13 years ago
|
||
Pushed to try:
https://tbpl.mozilla.org/?tree=Try&rev=3788c55300e2
Assignee | ||
Comment 10•13 years ago
|
||
Assignee | ||
Updated•13 years ago
|
Target Milestone: --- → mozilla20
Comment 12•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•