Closed Bug 459921 Opened 17 years ago Closed 17 years ago

Double-click-and-drag selects previous word when dragging to left half of first letter of a word

Categories

(Core :: DOM: Selection, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9.1b2

People

(Reporter: uriber, Assigned: uriber)

References

(Depends on 1 open bug)

Details

(Keywords: testcase)

Attachments

(3 files, 2 obsolete files)

When dragging after double-click (selecting in word-by-word mode), if you drag to the first (left) half of the first letter of a word, the previous word gets selected as well. This is similar to bug 200098, and should be fixable in a similar manner.
Attached file testcase
Note: Keep the mouse down after you double-click on "Web" in the testcase.
OS: Mac OS X → All
Hardware: PC → All
Attached patch patchSplinter Review
Similar to bug 200098.
Assignee: nobody → uriber
Status: NEW → ASSIGNED
Attachment #343828 - Flags: review?(roc)
Comment on attachment 343828 [details] [diff] [review] patch we really need tests for this stuff
Attachment #343828 - Flags: superreview+
Attachment #343828 - Flags: review?(roc)
Attachment #343828 - Flags: review+
Attached patch mochitest (obsolete) — Splinter Review
I'll wait until someone verifies that my test for bug 415707 works on Windows/Linux before checking this in (unless someone wants to verify this test, which would be nice).
Attachment #343983 - Flags: review?(roc)
Comment on attachment 343983 [details] [diff] [review] mochitest Actually, Roc, would you like to have a look at the test first?
Using synthesizeMouse would take care of the accelerator-key selection and getBoundingClientRect for you. Otherwise looks good.
Attached patch better mochitest (obsolete) — Splinter Review
Using EventUtils.js, much nicer.
Attachment #343983 - Attachment is obsolete: true
Attachment #343983 - Flags: review?(roc)
Attached patch better mochitestSplinter Review
The real test, this time.
Attachment #344046 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b2
I backed out the mochitest since it triggered bug 426195, and the workaround we used last time (do another click at the end) only fixed Mac, and broke a different test on Linux (that wasn't affected initially).
Depends on: 426195
Flags: in-testsuite+ → in-testsuite?
> nsIFrame* frame = GetFrameForNodeOffset(offsets.content, offsets.offset, HINTRIGHT, &offset); >+ >+ if (amount == eSelectWord && direction == eDirPrevious) { >+ // To avoid selecting the previous word when at start of word, >+ // first move one character forward. >+ nsPeekOffsetStruct charPos; >+ charPos.SetData(eSelectCharacter, eDirNext, offset, 0, >+ PR_FALSE, mLimiter != nsnull, PR_FALSE, PR_FALSE); >+ if (NS_SUCCEEDED(frame->PeekOffset(&charPos))) { ^ frame should be null checked here (or perhaps in the if() block above), like it is when it's used below. >+ frame = charPos.mResultFrame; >+ offset = charPos.mContentOffset; >+ } >+ } I think this is causing my crash at http://crash-stats.mozilla.com/report/index/a795e040-a45f-11dd-b7a9-001cc4e2bf68?p=1 -- caused by selecting and deselecting some stuff on a bugzilla bug list page.
verified FIXED on builds: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090413 Minefield/3.6a1pre ID:20090413031052 and Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090413 Minefield/3.6a1pre ID:20090413031052
Status: RESOLVED → VERIFIED
ack, here's the build ID for Shiretoko Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b4pre) Gecko/20090413 Shiretoko/3.5b4pre ID:20090413031313
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: