Open Bug 278044 Opened 20 years ago Updated 4 years ago

Selection.deleteFromDocument() should remove selection

Categories

(Core :: DOM: Selection, defect, P5)

x86
Windows 2000
defect

Tracking

()

People

(Reporter: surkov, Unassigned)

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a5) Gecko/20041122
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a5) Gecko/20041122

When I call deleteFromDocument() method then selected nodes are removed but
selection remains.

Reproducible: Always

Steps to Reproduce:
Attached file test case
Note. Sometimes deleting of selected nodes may come to crach (see
https://bugzilla.mozilla.org/show_bug.cgi?id=278042). Better to see the test
case in previous mozilla builds (in instance firefox 1.7.3).
ccing some people who know something about selection, hopefully...
You can see a problem when you call nsIRange::deleteContents()
(nsISelection::deleteFromDocument() called nsIRange::deleteContents()). Actually
selection is removed when range content is removed because
window.selection.rangeCounts is equal 1 and selection.getRangeAt(0) is
collapsed. But selection track is displayed.
Attached file testcase2
It seems the bug is lying in nsRange::CollapseRangeAfterDelete() method.



Such behaviour you can get by using methods nsIRange::setStart() and
nsIRange::setEnd(), in instance, if you set selection after removing charackter
of textnode (see a testcase2). I'm not sure it is the same bug or not. ogub  fi
I'm not sure what component ('selection' or 'DOM: Traversal-Range') is right
component for this bug. Please move bug to more appropriate component. ro 
This seems to work for me in current trunk build.
I builded one day old seamonkey (SeaMonkey 1.5a
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20060405 SeaMonkey/1.5a). Testcases show a problem as before.
Yes, now I can see the bug too.
It seems more like a painting problem to me.
I think the selection is removed all right, but somehow there is still a selection painted. When I move with the caret through the still painted selection (which shouldn't be possible, because when you see a caret, you shouldn't see a selection too), the part where the caret was becomes unpainted.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
Assignee: selection → nobody
QA Contact: selection

Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority.

If you have reason to believe this is wrong (especially for the severity), please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: