Maintain selection and composition during updateText()#115
Draft
dandclark wants to merge 3 commits intow3c:gh-pagesfrom
Draft
Maintain selection and composition during updateText()#115dandclark wants to merge 3 commits intow3c:gh-pagesfrom
dandclark wants to merge 3 commits intow3c:gh-pagesfrom
Conversation
|
Thanks. These changes would solve the issues I've been running into. |
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
May 20, 2025
This CL adds use counters to analyze the impact of implementing the change proposed in [1]. Following counters are added: 1. kEditContextUpdateTextRangePrecedesOrOverlapsSelection: Tracks when updateText is called and the update range precedes or overlaps the selection. 2. kEditContextUpdateTextRangePrecedesCompositionRange: Tracks when updateText is called and the update range precedes the composition range during an active composition. 3. kEditContextUpdateTextRangeOverlapsCompositionRange: Tracks when updateText is called and the update range overlaps with the composition range during an active composition. 4. kEditContextUpdateSelectionDuringActiveComposition: Tracks when updateSelection is called during an active composition. [1] w3c/edit-context#115 These counters will help us understand how frequently these behaviors occur before making changes to the spec implementation. Bug: 379170477 Change-Id: I8043fdb6161137f79d8eaa3336b90d93ca25042c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6549358 Reviewed-by: Dan Clark <daniec@microsoft.com> Commit-Queue: Ashish Kumar <ashishkum@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1462602}
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
Oct 15, 2025
…ction This CL implements the changes proposed in [1] to maintain consistent selection and composition state during `EditContext::updateText` and `Editcontext::updateSelection` calls. [1]: w3c/edit-context#115 Bug: 379170477 Change-Id: I4a7911311d7ca4988d8cd5ae012e119cdc50b6d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6845496 Reviewed-by: Kent Tamura <tkent@chromium.org> Reviewed-by: Rohan Raja <roraja@microsoft.com> Commit-Queue: Ashish Kumar <ashishkum@microsoft.com> Reviewed-by: Alex Keng <shihken@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1530027}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make the following changes to keep the selection and composition in a consistent state after
updateText()/updateSelection()calls.updateText()sets the boundary point toboundaryPoint + text.length - (rangeEnd - rangeStart)whenboundaryPoint >= rangeEnd, or torangeStart + text.lengthwhenboundaryPoint > rangeStart && boundaryPoint < rangeEnd.updateText()call,updateSelection()is called with a selection that differs from the current selection, abort the composition.Resolves #111.
For normative changes, the following tasks have been completed:
Editing WG resolution on the proposed changes, with at least two implementers participating and not objecting:
For browsers that are shipping the feature, implementation bugs are filed for the proposed changes (link to bug, or write "Not Implementing"):