Page MenuHomePhabricator

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


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 ) 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.

Event Timeline

dchan claimed this task.
dchan raised the priority of this task from to Medium.
dchan updated the task description. (Show Details)
dchan added a subscriber: Esanders.
Jdforrester-WMF raised the priority of this task from Medium 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

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