Observed changes: widen heuristic criteria for guessing a change is simple
Closed, ResolvedPublic40 Story Points

Description

In VisualEditor's handling of observed DOM changes, a "simple change" is one guaranteed not to require the DOM to be re-rendered from the DM; in contrast a "complex" change is one that may require a re-render.

The existing heuristic (copied into https://gerrit.wikimedia.org/r/#/c/241144/10/src/ce/ve.ce.js ) has been to guess that an insertion is simple if both the prior selection and the new selection are collapsed cursors *and* the inserted text lies immediately before the new cursor. This is quite conservative; it doesn't include:

  1. Inserted text after, around, or away from the new cursor
  2. Inserted text that gets selected (as IME candidates often are)
  3. Any change that is a replacement (with some characters removed and some characters inserted).

In all these cases, the change handler will re-render the DOM from the DM if that would cause it to change, which could cause the IME to be closed in error.

It would be preferable to detect more changes as simple where that won't lead to rendering discrepancies. To decide when it would be safe to do so, research with multiple IME/platform combinations is needed to determine whether text input can "escape" the annotation context at the cursor and modify text that has different annotations.

dchan created this task.Sep 30 2015, 4:23 PM
dchan updated the task description. (Show Details)
dchan raised the priority of this task from to Normal.
dchan claimed this task.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 30 2015, 4:23 PM
dchan set Security to None.Sep 30 2015, 5:14 PM
dchan added a subscriber: Esanders.
Jdforrester-WMF raised the priority of this task from Normal to High.Oct 6 2015, 7:22 PM
Jdforrester-WMF edited a custom field.
Jdforrester-WMF moved this task from To Triage to TR3: Language support on the VisualEditor board.

Change 247800 had a related patch set uploaded (by Divec):
Diff richtext to build model changes

https://gerrit.wikimedia.org/r/247800

dchan added a comment.Nov 30 2015, 8:07 AM

With change 247800, every observed DOM change should be simple (i.e. the DOM should never require re-rendering from the DM in response to observed DOM changes).

Change 247800 merged by jenkins-bot:
Diff richtext to build model changes

https://gerrit.wikimedia.org/r/247800