Closed
Bug 262306
Opened 20 years ago
Closed 3 years ago
Selection follows mouse movement in textarea when drag-selecting in border to outside border.
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
WORKSFORME
mozilla1.9.1a2
People
(Reporter: martijn.martijn, Unassigned)
References
Details
(Keywords: testcase)
Attachments
(4 files, 2 obsolete files)
634 bytes,
text/html
|
Details | |
1.23 KB,
text/html
|
Details | |
1.18 KB,
patch
|
roc
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
1.05 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a4) Gecko/20040918 Firefox/0.9.1+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a4) Gecko/20040918 Firefox/0.9.1+
See upcoming testcase. That testcase has an exaggerated border, in order to
easily reproduce the bug.
1- Mousedown on the border of this textarea.
2- Drag the mouse outside the border and outside the textarea.
3- Release the mouse-button.
Result: when returning with the mouse inside the textarea, you'll notice that
the selection follows your mouse-movement.
In IE, you can't select text with mouse-dragging on the border of the textarea,
so there it is not an issue.
Reproducible: Always
Steps to Reproduce:
Actual Results:
Selection is 'sticky', it follows mouse-movement.
Expected Results:
The selection should not follow mouse-movement.
Reporter | ||
Comment 1•20 years ago
|
||
Reporter | ||
Comment 2•20 years ago
|
||
This bug is also happening when beginning the selection in the padding area of
an textarea and releasing the mouse-button outside the textarea.
Also, when beginning the selection in the padding area of an textare, you can't
drag-select-scroll the textarea. (that's also the case when beginning selection
in the border).
I've noticed this on http://gmail.com , where they've set a 5px padding on
their reply-textarea fields.
lla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a4) Gecko/20040918
Firefox/0.9.1+ See upcoming testcase. That testcase has an exaggerated border,
in order to easily reproduce the bug.(In reply to comment #1)
> Created an attachment (id=160648) [edit]
> Testcase
>
Testcase 3
Comment 4•19 years ago
|
||
*** Bug 332823 has been marked as a duplicate of this bug. ***
Reporter | ||
Updated•19 years ago
|
OS: Windows 2000 → All
Reporter | ||
Comment 5•17 years ago
|
||
Still happening in current trunk build.
Comment 6•17 years ago
|
||
Notes to self (or others) for later:
In nsFrame::CaptureMouse(), for any frame inside the textarea, the textarea's view is sent to GrabMouseEvent. But when the frame is nsTextControlFrame itself (which happens when clicking on the border), a containing view is used, and the mouse events are therefore grabbed for it (which is bad).
So the problem could be stated as following:
While a point on the border of a textarea maps (via GetContentOffsetsFromPoint()) to content inside the textarea, its containing view is not the view defined by the textarea, bur instead the containing view.
Unfortunately, my understanding of views is quite poor.
Comment 7•17 years ago
|
||
Actually, not "its containing view" but "its nearest capturing view", as returned by GetNearestCapturingView().
Comment 8•17 years ago
|
||
We do still use views for scrollable things, right roc?
Removing those views could perhaps fix this one.
Comment 9•17 years ago
|
||
Make a nsTextFrame's mouse capturer be its scrollable view, rather than its containing view.
Note the ugly const_cast. Is there a reason why GetScrollableView() can't be const?
Attachment #333282 -
Flags: review?(roc)
I'm a bit confused. In the first testcase, the nearest capturing view for the nsTextControlFrame should be the outermost scrolled view (the view for the CanvasFrame). Yet apparently it isn't, can you explain why?
Comment 11•17 years ago
|
||
(In reply to comment #10)
> I'm a bit confused. In the first testcase, the nearest capturing view for the
> nsTextControlFrame should be the outermost scrolled view (the view for the
> CanvasFrame). Yet apparently it isn't, can you explain why?
>
I believe it indeed is the outermost view - which is exactly what causes the problem.
Why do you think it isn't?
Then why is dragging behaving differently when you click in the border than when you click completely outside the nsTextControlFrame?
Comment 13•16 years ago
|
||
Because GetContentOffsetsFromPoint (and GetSelectionClosestFrame) don't care about capturing views (or views at all for that matter), and return a textframe inside the control as the target for a point on the control's border.
But when I'm dragging and I move the mouse out of the nsTextControlFrame border, GetContentOffsetsFromPoint and GetSelectionClosestFrame should start returning something outside the nsTextControlFrame, right? Yet it seems they don't.
Comment 15•16 years ago
|
||
This took me a while to figure out, but I did:
The reason GetContentOffsetsFromPoint doesn't return something outside the nsTextControlFrame, is that the event target in this case (and therefore the frame on which GetContentOffsetsFromPoint is called) is the inner nsHTMLScrollFrame.
So somehow (I didn't research this part), we remember that this is a drag operation that started within the text control's nsHTMLScrollFrame, and all mouse events, up to and including the release, are targeted to this frame (or its descendants).
So it seems the analogous solution for mouse capturing would be that nsFrame::HandlePress will call CaptureMouse() on the frame associated with the content/offset returned by GetContentOffsetsFromPoint (i.e., where the selection really starts), rather than on |this|. Would you prefer such a solution?
Yes, that sounds much better!
Comment 17•16 years ago
|
||
Like this. I tried to affect the current logic as little as possible.
Assignee: events → uriber
Attachment #333282 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #333781 -
Flags: review?(roc)
Attachment #333282 -
Flags: review?(roc)
Comment 18•16 years ago
|
||
Removed a change that shouldn't have been there.
Attachment #333781 -
Attachment is obsolete: true
Attachment #333782 -
Flags: review?(roc)
Attachment #333781 -
Flags: review?(roc)
Updated•16 years ago
|
Attachment #333782 -
Attachment is patch: true
Attachment #333782 -
Attachment mime type: application/octet-stream → text/plain
Comment on attachment 333782 [details] [diff] [review]
patch v2 (corrected)
I like this approach. Maybe it's a bit scary --- it might do something unexpected --- but it feels like the right thing to do.
Attachment #333782 -
Flags: superreview+
Attachment #333782 -
Flags: review?(roc)
Attachment #333782 -
Flags: review+
Comment 20•16 years ago
|
||
Submitted. Let's hope this doesn't break anything.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1a2
Reporter | ||
Comment 21•16 years ago
|
||
Works perfect now!
Using:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a2pre) Gecko/20080815064214 Minefield/3.1a2pre
Thank you so much for fixing this one, Uri!
Status: RESOLVED → VERIFIED
Comment 22•16 years ago
|
||
Backed out in bug 484238. Reopening.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Comment 23•16 years ago
|
||
This is not perfect. In practice this prevents selection when done on the border.
Updated•15 years ago
|
QA Contact: ian → events
Mass-removing myself from cc; search for 12b9dfe4-ece3-40dc-8d23-60e179f64ac1 or any reasonable part thereof, to mass-delete these notifications (and sorry!)
Comment 25•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:hsinyi, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee: uriber → nobody
Flags: needinfo?(htsai)
Comment 26•3 years ago
|
||
This may have been fixed somewhere. It seems to work well for me.
Status: REOPENED → RESOLVED
Closed: 16 years ago → 3 years ago
Flags: needinfo?(htsai)
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•