Closed Bug 263099 Opened 20 years ago Closed 20 years ago

Double-clicking a "margin" often selects a strange bit of text elsewhere on the page

Categories

(Core :: DOM: Selection, defect)

x86
All
defect
Not set
minor

Tracking

()

VERIFIED FIXED

People

(Reporter: tempshill, Assigned: roc)

References

()

Details

(Keywords: qawanted)

Attachments

(3 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20040913 Firefox/0.10 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20040913 Firefox/0.10 Go to http://en.wikipedia.org/wiki/United_States_Constitution#Preamble which is a Wikipedia article. (I am assuming you don't use any Wikipedia skins.) Try doubleclicking in the 'margin' on the left. Depending on where you click horizontally, different words Reproducible: Always Steps to Reproduce: 1. Go to http://en.wikipedia.org/wiki/United_States_Constitution#Preamble 2. Move the mouse so it's to the left of the 2nd line of the paragraph about the Preamble. Double-click. 3. Note that a word in the 4th line in the paragraph about the Preamble will be highlighted. (strange behavior) 4. Try moving the mouse to the right or left in the 'margin' (such that the mouse is still to the left of the 2nd line in the Preamble paragraph). Repeat step #3. Note that a different word is highlighted. Actual Results: Various words get highlighted that I wouldn't expect to get highlighted by this action. Expected Results: Probably highlight nothing, since I was not doubleclicking on any text.
Assignee: firefox → selection
Component: General → Selection
Product: Firefox → Browser
QA Contact: firefox.general
Version: unspecified → Trunk
Minimal testcase needed...
Keywords: qawanted
The patch for bug 180015 seems to fix this mostly. The horizontal selection offset is gone with that patch. But the small vertical selection offset (selection 2 lines lower than where you've activated it with the mouse)is still there with the patch.
Depends on: 180015
I also see the 2-line vertical offset problem on Linux with bug 180015 fixed.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: qawanted
OS: Windows 2000 → All
Martijn, could you minimize that testcase, by any chance?
Keywords: qawanted
Attached file Minimised testcase
Sure. The position:relative is needed and the extra nested <div> is needed for the bug to happen.
I'm betting that we're messing up the coordinate transformation (because the nearest view to the click point is not the view of the rel pos element or something like that).
Attached patch fixSplinter Review
nsBlockFrame::HandleEvent drills down to find a block where selection should be happening. As predicted, it's assuming that the view for the child block is the same as the view for the current block (to which aEvent->point is relative) --- obviously incorrect. So this code uses frame->GetOffsetTo to get the delta between the child block and the current block and adds that to the offset from the current block to its containing view.
Assignee: selection → roc
Status: NEW → ASSIGNED
Attachment #173209 - Flags: superreview?(bzbarsky)
Attachment #173209 - Flags: review?(bzbarsky)
Comment on attachment 173209 [details] [diff] [review] fix So... could you fix the comment on GetClosestLine() to make sense? Its documentation for aOrigin tells me nothing. I can't even tell whether this patch is correct, because I can't tell what this code is really doing. :(
Attached patch fix #2Splinter Review
OK, I removed the stupid aOrigin parameter and I'm just forcing aPoint to be relative to the line iterator's block's coordinate system.
Attachment #173572 - Flags: superreview?(bzbarsky)
Attachment #173572 - Flags: review?(bzbarsky)
Attachment #173209 - Flags: superreview?(bzbarsky)
Attachment #173209 - Flags: review?(bzbarsky)
Comment on attachment 173572 [details] [diff] [review] fix #2 Much better, thank you! r+sr=bzbarsky
Attachment #173572 - Flags: superreview?(bzbarsky)
Attachment #173572 - Flags: superreview+
Attachment #173572 - Flags: review?(bzbarsky)
Attachment #173572 - Flags: review+
checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: