Closed
Bug 1180240
Opened 9 years ago
Closed 9 years ago
ContentEventHandler::OnQuerySelectedText() should use mFirstSelectedRange if mSelection doesn't have selection range
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Core
DOM: UI Events & Focus Handling
Tracking
()
RESOLVED
FIXED
mozilla42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
3.93 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
By the fix of bug 1179090, ContentEventHandler assumes that there is a selection range [0-0] when there is not selection range actually.
On the other hand, in ContentEventHanldler::OnQuerySelectedText(), it uses mSelection->Get(Anchor|Focus)Node() for retrieving selection range. So, we should use mFirstSelectionRange if it doesn't return proper node.
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8629882 -
Flags: review?(bugs)
Comment 2•9 years ago
|
||
Comment on attachment 8629882 [details] [diff] [review]
Patch
>+ NS_ASSERTION(mFirstSelectedRange->Collapsed(),
>+ "When mSelection doesn't have selection, mFirstSelectedRange must be "
>+ "collapsed");
nit, 2 spaces for indentation
>+ anchorNode = focusNode = mFirstSelectedRange->GetStartParent();
It is guaranteed that mFirstSelectedRange is always non-null when this method is run, right?
Attachment #8629882 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 3•9 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #2)
> >+ anchorNode = focusNode = mFirstSelectedRange->GetStartParent();
> It is guaranteed that mFirstSelectedRange is always non-null when this
> method is run, right?
Yes. It's guaranteed at initializing the members:
http://mxr.mozilla.org/mozilla-central/source/dom/events/ContentEventHandler.cpp?rev=20245e58fd57&mark=108-111#85
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•