From b279901825cb8cbdaa151dbd36f0ae80897a43e6 Mon Sep 17 00:00:00 2001
From: Dan Clark The EditContext Model
When changes are made to the [=Text Edit Context=] by the [=Text Input Service=], those changes are reflected to the author asynchronously in the form of events which are dispatched against the [=active EditContext=].
When the author makes changes to the [=active EditContext=], those changes will be reflected in the [=Text Edit Context=] during the next lifecycle update.
- To reflect changes made by the author to the [=active EditContext=] since the last lifecycle update, run the steps to [=update the Text Edit Context=] - with the [=active EditContext=]'s [=text state=]'s [=text=], [=selection start=], [=selection end=], [=control bounds=], [=selection bounds=], and [=codepoint locations=]. -
-- When the [=Text Input Service=] updates the state of the [=Text Edit Context=], run the steps to [=update the EditContext=] - with the [=Text Edit Context=]'s [=text state=]'s [=text=], [=text formats=], [=selection start=], [=selection end=], [=is composing=], [=composition start=], and [=composition end=]. -
Both the [=Text Edit Context=] and {{EditContext}} have a [=text state=] which holds the information exchanged in the aforementioned updates. The text state consists of: @@ -138,11 +130,6 @@
In addition to [=text state=], an {{EditContext}} also has: -
An {{EditContext}} has an associated element, an {{HTMLElement}}. @@ -182,18 +169,16 @@
- A [=top-level traversable=] should have at most one active EditContext, which is determined - by running the steps to [=determine the active EditContext=] for that [=top-level traversable=]. + A {{Document}} has an active EditContext, which may be null.
- When an {{EditContext}} that was previously the [=active EditContext=] stops being - the [=active EditContext=], run the steps to [=deactivate an EditContext=] - on that {{EditContext}}. + When a {{Document}} receives text input from the [=Text Input Service=] and that + {{Document}} has a non-null [=active EditContext=] |editContext|, the user agent + must run [=Update the EditContext=] given |editContext| and the + [=Text Edit Context=]'s [=text state=]'s [=text=], [=text formats=], + [=selection start=], [=selection end=], [=is composing=], [=composition start=], + and [=composition end=].
-- When, exactly? Do we need a step for this in the Event Loop? -
-When there is an [=active EditContext=] and there is a text input from the [=Text Input Service=], the user agent must run [=Update the EditContext=].
@@ -218,12 +203,12 @@
+ A new step will be introduced as a substep within the [=Update the rendering=] step + in the HTML Event Loops Processing Model, immediately following step 15 (which runs + the focusing steps for {{Document}}s whose + focused areas + become non-focusable). The step is: For each + fully active + {{Document}} |doc|, [=queue a global task=] on the [=DOM manipulation task source=] + given |doc|'s [=relevant global object=] to run + the [=Update the Text Edit Context=] steps given |doc|. +
Using an {{EditContext}}, an author can mark a region of the document editable by associating an {{EditContext}} object with an element as shown in the example below:
@@ -653,7 +650,8 @@- This processing step must occur as a substep within the [=Update the rendering=] step in the HTML Event Loops Processing Model. - The step is: Run the [=Update the Text Edit Context=] steps. - It must occur just after substep 13: run the animation frame callbacks steps. -
Note that the steps to update the [=Text Edit Context=]'s [=text state=] are dependent on the nature of the abstraction created over a platform-specific [=Text Input Service=]. @@ -747,18 +740,19 @@
If |focused| is null or if the [=shadow-including root=] of |focused| is not |document|, return null.
++ The purpose of getting |focusable| through the [=top-level traversable=] is that + we want there to be only one [=active EditContext=] at a time per + [=top-level traversable=]. So if system focus is in some other document, this + document can't have an [=active EditContext=]. +
+