Bug 130748 - When a node is removed and that changes selection, we don't notify editor client, and don't fire selectionchange event
Summary: When a node is removed and that changes selection, we don't notify editor cli...
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks: 130727
  Show dependency treegraph
 
Reported: 2014-03-25 15:26 PDT by Alexey Proskuryakov
Modified: 2014-03-26 11:50 PDT (History)
3 users (show)

See Also:


Attachments
WIP patch (6.41 KB, patch)
2014-03-26 09:56 PDT, Alexey Proskuryakov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2014-03-25 15:26:37 PDT
When a node is removed and that changes selection, we don't notify editor client, and don't fire selectionchange event.
Comment 1 Alexey Proskuryakov 2014-03-26 09:56:45 PDT
Created attachment 227855 [details]
WIP patch

Attaching a WIP patch. There are still many big issues that may make this impractical for now:

- The patch causes multiple crashes in editing code.
- It only fixes notifications when a removed node contains one of the endpoints, not when a node is removed in the middle of selection.
- It doesn't fix anything when a node is added in the middle of selection.
- It almost certainly doesn't fix anything when text content of nodes is manipulated.
- I haven't even tested what IE does in any of these cases. Maybe it only fires selectionchange event when selecting manually?

One way or another, it's certainly a problem that we don't cleanly track selection and composition changes in WebCore.
Comment 2 Alexey Proskuryakov 2014-03-26 11:50:27 PDT
Tested, and IE 11 is pretty bad about dispatching selectionchange for programmatic changes. I got the event when removing a contenteditable div with a range selection inside, but not when removing nodes from a selection.

But we need to track DOM changes somehow to stay in sync with input methods.