Contact emails:
[email protected], [email protected]

Explainer:
https://github.com/w3c/edit-context/issues/156

Specification:
https://w3c.github.io/edit-context/

Summary:
Adds a pull-on-demand context update mechanism (`editContext.invalidate()`
and the `contextrequest` event via `ContextRequestEvent`) to `EditContext`.
Large-document canvas/custom editors (such as Google Docs and Slides) have
non-trivial serialization costs when computing multi-paragraph plain-text
buffers and selection offsets on every keystroke or cursor movement.
`editContext.invalidate()` allows web editors to notify the user agent in
O(1) time that the document text or selection has changed (and cleanly
cancel any active IME composition), while deferring actual `updateText()` /
`updateSelection()` serialization until an IME, OS text service, or browser
AI/voice dictation feature dispatches a `ContextRequestEvent` (`scope:
"local" | "extended"`, with optional `waitUntil(promise)` support for
asynchronous document models).

Blink component:
Blink>Editing>IME

Motivation:
Currently, `EditContext` requires authors to eagerly call `updateText()`
and `updateSelection()` on every document mutation or selection change so
the browser cache stays warm—even when no IME or OS text consumer is
reading it. Furthermore, resetting an active IME composition on external
selection changes currently requires a synthetic DOM `blur()`/`focus()`
workaround (which causes virtual keyboard flicker on mobile).
`invalidate()` + `contextrequest` brings the same pull-on-demand ergonomics
to text and selection that `characterboundsupdate` already provides for
geometry.

Initial public proposal:
https://github.com/w3c/edit-context/issues/156

Prototype CL:
https://chromium-review.googlesource.com/c/chromium/src/+/8608668

TAG review:
N/A (incremental addition to the existing EditContext API; will file if
requested by API owners)

Risks:
- Interoperability and Compatibility: Low. Additive method (`invalidate()`)
and event (`contextrequest`) on `EditContext`, guarded behind the
`EditContextOnDemand` runtime feature. Existing eager `updateText()` /
`updateSelection()` callers are completely unaffected.
- Gecko: No signal
- WebKit: No signal
- Web developers: some positive signal from Google Workspace Editors.

Debuggability:
Standard DevTools Event Listener breakpoints and DOM/Event inspection apply
to `contextrequest`.

Is this feature fully tested by web-platform-tests?
Will add WPT coverage under `editing/edit-context/` alongside the prototype.

Flag name on about://flags:
--enable-blink-features=EditContextOnDemand (or experimental web platform
features)

Requires code in //chrome?
No (Blink renderer `core/editing/ime` and `modules/content_extraction`).

Tracking bug:
https://crbug.com/574145399

-- 
Gary

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAO5k46DYiJFng_TSfqTajsu80LMGk1rib-vA8CrxqFTJ0JnYgw%40mail.gmail.com.

Reply via email to