Closed Bug 981652 Opened 6 years ago Closed 6 years ago

Dispatch "select" events from HTMLInputElement/HTMLTextAreaElement.setSelectionRange() and selection setters

Categories

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

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: ehsan, Assigned: ehsan)

References

(Depends on 1 open bug)

Details

(Keywords: dev-doc-needed)

Attachments

(1 file, 2 obsolete files)

This is basically reverting the fix to bug 924069 with bug 931904 fixed.
Attachment #8388555 - Flags: review?(bugs)
Comment on attachment 8388555 [details] [diff] [review]
Dispatch "select" events from HTMLInputElement/HTMLTextAreaElement.setSelectionRange() and selection setters; r=smaug

Doesn't this mean that we won't dispatch select for display: none case, like
we currently do.
Attachment #8388555 - Flags: review?(bugs) → review-
Ah, that's a very good point.  I'll fix up the patch.
Attachment #8388889 - Flags: review?(bugs)
Comment on attachment 8388889 [details] [diff] [review]
Dispatch "select" events from HTMLInputElement/HTMLTextAreaElement.setSelectionRange() and selection setters; r=smaug

You didn't fix HTMLTextAreaElement::SetSelectionRange, only 
HTMLInputElement::SetSelectionRange
Attachment #8388889 - Flags: review?(bugs) → review-
Comment on attachment 8388889 [details] [diff] [review]
Dispatch "select" events from HTMLInputElement/HTMLTextAreaElement.setSelectionRange() and selection setters; r=smaug

My bad!
Attachment #8388889 - Attachment is obsolete: true
Attachment #8388992 - Flags: review?(bugs)
Comment on attachment 8388992 [details] [diff] [review]
Dispatch "select" events from HTMLInputElement/HTMLTextAreaElement.setSelectionRange() and selection setters; r=smaug

Oh, crap, this code is just broken. SetSelectionRange really
doesn't handle the case when we don't have a frame.
Currently SetRangeText on textarea doesn't end up dispatching "select" since
SetSelectionRange throws NS_ERROR_FAILURE, but input does dispatch, since its
SetSelectionRange doesn't throw.

At least we need to make input and textarea work consistently, even better
would be to fix both to work per the spec.
Attachment #8388992 - Flags: review?(bugs)
As discussed on IRC, nsTextEditorState has the concept of a selection cache which is used to save the selection offsets and the selection direction when we reframe a text control, but we currently have nothing to store the selection information when we start off without a frame.  I have filed bug 982145 to get that more general problem fixed.
Depends on: 982145
Attachment #8388555 - Flags: review- → review?(bugs)
Attachment #8388992 - Attachment is obsolete: true
Attachment #8388555 - Flags: review?(bugs) → review+
Keywords: dev-doc-needed
https://hg.mozilla.org/mozilla-central/rev/c866f4f5ec95
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.