Closed Bug 1259949 Opened 9 years ago Closed 9 years ago

<textarea> displays caret on wrong line after selecting \n if it's the last symbol

Categories

(Core :: DOM: Selection, defect)

defect
Not set
minor

Tracking

()

VERIFIED FIXED
mozilla48
Tracking Status
firefox48 --- verified

People

(Reporter: arni2033, Assigned: MatsPalmgren_bugz)

References

(Blocks 1 open bug)

Details

(Keywords: testcase)

Attachments

(3 files)

>>> My Info: Win7_64, Nightly 48, 32bit, ID 20160324030447 STR: 1. Open attached "testcase 1" (text in <textarea> is "asdf\n") 2. Select any text including the last "\n" in testcase, for example: Click between "s" and "d", press Shift+Down to select "df\n" 3. Press Right key to move cursor to the end of text selection 4. Type "x" Result: After Step 3 cursor is displayed at the end of the 1st line After Step 4 the typed letter ("x") appears in the beginning of the 2nd line Expectations: After Step 3 cursor should be displayed at the start of the 2nd line
In this case we have a DOM like so: <anonymous-div> "asdf\n" <br> and we Collapse() at <anonymous-div> : 1 So that makes do_QueryFrame(aParentNode.AsContent()->GetPrimaryFrame()) null since the frame we get there isn't a text frame - it's a scroll frame for the <anonymous-div>. To my surprise though, nsCaret::GetFrameAndOffset seems to deal with this and does return the text frame (if I remove the initial null-check on 'f'). We would need to tweak the aOffset check on line 4948 though since it isn't a text offset in this case. http://hg.mozilla.org/mozilla-central/annotate/63be002b4a80/layout/generic/nsSelection.cpp#l4940
Assignee: nobody → mats
Severity: normal → minor
Keywords: testcase
Attached patch fixSplinter Review
(see explanation of the problem in comment 2)
Attachment #8735256 - Flags: review?(ehsan)
Attachment #8735256 - Flags: superreview+
Attachment #8735256 - Flags: superreview+
Attachment #8735256 - Flags: review?(ehsan)
Attachment #8735256 - Flags: review+
Attachment #8735257 - Flags: review+
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Flags: in-testsuite+
Fixed on: Win7_64, Nightly 48, 32bit, ID 20160401030216 Bug 1237286 is still reproducible
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: