Closed Bug 1386342 Opened 7 years ago Closed 7 years ago

Add a special case to Selection::Collapse() to detect the no-op case where a selection is being collapsed onto itself and do nothing in that case

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

No description provided.
Assignee: nobody → ehsan
Blocks: 1365874
Comment on attachment 8892545 [details] [diff] [review] Add a special case to Selection::Collapse() to detect the no-op case where a selection is being collapsed onto itself and do nothing in that case r=me
Attachment #8892545 - Flags: review?(bzbarsky) → review+
Why is the patch right when there are several ranges in selection? And isn't collapse suppose to replace the range object from JS point of view. See "// we should reuse it for reducing the recreation cost."
Flags: needinfo?(ehsan)
(In reply to Olli Pettay [:smaug] from comment #3) > Why is the patch right when there are several ranges in selection? Oh yeah, that's a bug. We don't have a test to catch it unfortunately. :-/ > And isn't collapse suppose to replace the range object from JS point of view. > See "// we should reuse it for reducing the recreation cost." Does this matter for nsFrameSelection objects we create for nsTextEditorState? The selection objects inside those aren't exposed to content JS.
Flags: needinfo?(ehsan) → needinfo?(bugs)
It probably doesn't matter for internal frame selection objects. But then, I'd expect refcnt to be 1 usually in that case.
Flags: needinfo?(bugs)
I don't think the patch here is much useful after all, I'm going to close this bug.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: