selection range incorrect after undoing a cut operation in a contenteditable

Bug #1524288 reported by Olivier Tilloy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Oxide
New
Undecided
Unassigned

Bug Description

I’m working on adding unit tests for a new WebView::editingCapabilities API, and I stumbled across this issue:

 - if I select all the text in a contenteditable with e.g. webView.executeEditingCommand(WebView.EditingCommandSelectAll), the RWHV’s selection range is correctly updated

 - if I cut that text with e.g. webView.executeEditingCommand(WebView.EditingCommandCut), the range is again correctly updated (it becomes empty)

 - if I undo the last command with e.g. webView.executeEditingCommand(WebView.EditingCommandUndo), the selection is visually restored, but the RWHV’s selection range is *not* updated, it remains empty

I’m not really sure where the issue lies yet. I dug into chromium’s code, and saw that in RenderFrameImpl::didChangeSelection(), if handling_select_range_ is false the method may return early, thus not calling SyncSelectionIfRequired(). I also saw that RenderFrameImpl::OnUndo() and RenderFrameImpl::OnRedo() do not temporarily set handling_select_range_ to true, unlike RenderFrameImpl::OnCut() and other editing command handlers. I wonder whether this is intentional, or a bug in chromium.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.