Closed Bug 1024848 Opened 8 years ago Closed 8 years ago

[Text Selection] Enable selection carets sanity test on Windows browser

Categories

(Core :: DOM: Selection, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(2 files)

Long press to select a word has different behavior on Windows. For example, if we have a <input> containing "abc def ghi", long press on the character 'e' selects "def" on Linux. However, on Windows, it selects "def ", i.e. the word "def" with all the spaces afterward.
On Windows, when selecting a word by long pressing, extra spaces after
the word will also be selected. To solve this problem, I redesign the
test cases by comparing the target content with the selected content
directly while ignoring spaces at certain test cases. I believe it's
easier to understand and less error-prone than the old
replace-selected-content-and-compare way.

I added a new method SelectionManager.selected_content() to make it
easier to get the current selected text.
Attachment #8439800 - Flags: review?(mdas)
Attachment #8439800 - Flags: review?(mdas) → review+
Comment on attachment 8439801 [details] [diff] [review]
part 2 - Enable selection carets sanity tests on Windows browser (v1)

Review of attachment 8439801 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks so much for these great patches!
Attachment #8439801 - Flags: review?(mdas) → review+
(In reply to Ting-Yu Lin [:TYLin] (UTC+8) from comment #1)
> On Windows, when selecting a word by long pressing, extra spaces after
> the word will also be selected.

I also see double clicks doing this. This behavior seems suboptimal to me (selecting words is pretty useful); is it something we can control?
(In reply to Emanuel Hoogeveen [:ehoogeveen] from comment #4)
> (In reply to Ting-Yu Lin [:TYLin] (UTC+8) from comment #1)
> > On Windows, when selecting a word by long pressing, extra spaces after
> > the word will also be selected.
> 
> I also see double clicks doing this. This behavior seems suboptimal to me
> (selecting words is pretty useful); is it something we can control?

I double click on a word in Notepad, Word, and IE. They all select a word and all the subsequent spaces. I think this is the default behavior on Windows. The only exception I found is Google Chrome (version 35) on Windows. It does not select those spaces after the word.
https://hg.mozilla.org/mozilla-central/rev/b26ccba8deb8
https://hg.mozilla.org/mozilla-central/rev/589789cf7bf8
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
As Morris Tseng points out, we have a preference "layout.word_select.eat_space_to_next_word" defaults to false but it's overrided to true on Windows in all.js. That's why the word selection behavior is different on Windows.
http://dxr.mozilla.org/mozilla-central/source/modules/libpref/src/init/all.js
You need to log in before you can comment on or make changes to this bug.