Skip to content

Commit 2632c28

Browse files
authored
Fix image references and update control & selection bounds methods (#112)
This PR updates the image references and replaces the `updateLayout` method with `updateControlBounds` & `updateSelectionBounds` methods in the explainer.
1 parent c043369 commit 2632c28

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

dev-design.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Developer Design
22

3-
![shared text](shared_text_basic.png)
3+
![shared text](images/shared_text_basic.png)
44

55
1. The typical flow of text input comes from the user pressing keys on the keyboard.
66
2. These are delivered to the browser, which opted-in to using the system's text services framework in order to integrate with the IMEs installed on the system. This will cause input to be forwarded to the active IME.
@@ -33,7 +33,7 @@ Note that the composition events are also not fired on the focused element as th
3333

3434
Changes to the editable contents can also come from external events, such as collaboration scenarios. In this case, the web editing framework may get some XHR completion that notifies it of some pending collaboartive change that another user has committed. The framework is then responsible for writing to the shared buffer, via the ```updateText()``` method.
3535

36-
![external input](external_input.png)
36+
![external input](images/external_input.png)
3737

3838
## API Details
3939

@@ -74,7 +74,7 @@ enum EditContextInputPolicy { "auto", "manual" }
7474
```
7575

7676
### Renderer process IME components:
77-
![Renderer process communication](renderer_process_comm.png)
77+
![Renderer process communication](images/renderer_process_comm.png)
7878

7979
1. WidgetInputHandlerImpl: Receives the IME messages in the IO thread and posts it to the main thread of the renderer process.
8080
2. It is then received by the RenderWidget that sends it to the WebInputMethodControllerImpl to decide which component should handle the IME event and fire the corresponding JS event.
@@ -83,12 +83,12 @@ enum EditContextInputPolicy { "auto", "manual" }
8383
5. If EditContext is in focus, then it updates the internal states and fires the corresponding events to JS.
8484

8585
### EditContext:
86-
![Class diagram](edit_context_class_design.png)
86+
![Class diagram](images/edit_context_class_design.png)
8787

8888
This class implements the WebInputMethodController interface and is also the event target for various JS events that get fired based on the IME and English typing events. The lifetime of the EditContext is managed by the Document. There can be multiple EditContext for an active document but only one can be focused at a time. The EditContext JS events are fired whenever there is an active composition. EditContext also maintains internal states that get updated during these input events. These internal states are used to communicate changes to the text input services that might affect their text view of the edit control.
8989

9090
### Synchronization mechanism
91-
![Synchronization mechanism](edit_context_state_sync.png)
91+
![Synchronization mechanism](images/edit_context_state_sync.png)
9292

9393
1. EditContext's state can be manipulated by either text input services or JS authors. This state is kept in sync with the text input services via TextInputState data object. This TextInputState object contains the data that is required by the text input services to synchronize their text view and provide meaningful suggestions and other text input intelligence operation.
9494
2. The TextInputState object is updated on every lifecycle update(BeginMainFrame) which gets invoked right before the paint happens. This TextInputState object is updated from EditContext if it has focus, else, it is updated from InputMethodController and then sent by RenderWidget to the browser process through the IPC mechanism.

explainer.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ interface EditContext : EventTarget {
156156
```
157157
## Difference between Contenteditable element and the EditContext element.
158158

159-
![contenteditable_vs_editcontext](contentEditable_vs_editContext.png)
159+
![contenteditable_vs_editcontext](images/contentEditable_vs_editContext.png)
160160

161161
One can think of a div with Contenteditable (on the left in the above figure) as a div with a built-in EditContext which maintains a plain text buffer that serves as a plain text view (or IME-facing view) to communicate with various text input services (ex. IME, handwriting recognition, speech detection, etc.) When users initiate text inputs, the text input services will update the plain text buffer through the plain text view. The built-in EditContext then sends internal events to the div which takes the plain text buffer as part of its own model and updates the DOM, which serves as a user-facing view, based on some default editing behaviors defined by the brower.
162162

@@ -247,7 +247,8 @@ The following table summarizes the difference between div with contentEditable a
247247
let controlBound = editView.getBoundingClientRect();
248248
let s = document.getSelection();
249249
let selectionBound = s.getRangeAt(0).getBoundingClientRect();
250-
editContext.updateLayout(controlBound, selectionBound);
250+
editContext.updateControlBounds(controlBound);
251+
editContext.updateSelectionBounds(selectionBound);
251252
```
252253

253254
## Example Application
@@ -329,18 +330,18 @@ Multiple approaches have been discussed during F2F editing meetings and through
329330
# Appendix
330331
## Example Text Input Methods
331332
### Virtual Keyboard Shape-writing
332-
![VK shape-writing](Shape-writing.gif)
333+
![VK shape-writing](images/Shape-writing.gif)
333334

334335
### Handwriting Recognition
335-
![Handwriting Recognition](Handwriting-recognition.gif)
336+
![Handwriting Recognition](images/Handwriting-recognition.gif)
336337

337338
### Emoji Picker
338-
![Emoji Picker](Emoji-picker.gif)
339+
![Emoji Picker](images/Emoji-picker.gif)
339340

340341
### IME Composition
341-
![IME Compositions](Composition.gif)
342+
![IME Compositions](images/Composition.gif)
342343

343344
### Dictation
344-
![Dictation](dictation.png)
345+
![Dictation](images/dictation.png)
345346
---
346347
[Related issues](https://github.com/MicrosoftEdge/MSEdgeExplainers/labels/EditContext) | [Open a new issue](https://github.com/MicrosoftEdge/MSEdgeExplainers/issues/new?title=%5BEditContext%5D)

0 commit comments

Comments
 (0)