-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EditContext: Do IME see the plaintext in EditContext
?
#9
Comments
Oh, I find |
yes IME do see the plaintext in EditContext, so the suggestion in software keyboard or candidate window in CJK will still work with EditContext. As for character bounds, it does sound like a missing API, we'll evaluate and add it to the spec, thanks! |
One difficult thing of storing character bounds is, which rects of characters should be stored. As you know, the main process of a browser interacts with native IME, but layout information (in this case, E.g., Gecko caches the following character rects in the main process:
Once those requirements from browser is defined in the spec, web apps may be able to compute the character rects with simpler code (or they can put the layout information actively). And if the text position is changed by scroll in the view, those information need to be updated. So this issue may cause performance issue if web apps computes the rects too much or too strictly. |
Blink is also caching layout infomation in the main process, but with little difference:
same
Blink only caches rect of current selection, (or rect of the caret if no selection). What is the use of the first char rect for IME if the char is not in active composition?
do you mean if the string is "A|BCD|EF" and selection is (1,4), Gecko caches rect for 'A''B' and 'D''E'? in this case Blink caches rect for 'BCD', is that not enough for IME?
could you elaborate more? we already cache all chars in composition in 1) right? do you mean after comosition ends, we don't reset? and what is Kakutei-undo feature? how do we apply it? |
According to the log, it was required for supporting Japanese IME on macOS Yosemite.
It was supporting for query rect of previous character when caret is put at end of line. I don't remember the detail though.
Kakutei-Undo is that restore last composition string which is committed immediately before (i.e., if you move selection or typing other things, it may become not available). At this time, IME queries character rects of the last commit string before or immediately after starting new composition. I.e., this is required when there is no active composition, but Kakutei-Undo is available. |
@masayuki-nakano we have added a new event CharacterBoudnsUpdateEvent and new API updateCharacterBounds, where CharacterBoundsUpdateEvent describes what character bounds are needed by the Text Input Service. After receiving CharacterBoundsUpdateEvent, the author is responsible to compute the requested character bounds and call updateCharacterBounds to update the character bounds cached in the EditContext. (please see the example 3 in the spec for more details) Do you think this API is sufficient to cover your 4 scenarios? or do you think we'll need an event/API that support an array of ranges? note we have updateSelectionBound API that can let the author set the caret bound, so it should cover your 2nd scenario when there is no text. also do you know how to trigger Kakutei-Undo on Windows? |
I think the questions in this issue were resolved in Alex's response here; see CharacterBoundsUpdateEvent and https://w3c.github.io/edit-context/#editcontext-events in the spec. Feel free to reopen if there are still unresolved issues with this. |
I don't find this information. As you konw, modern IME on desktop retrieve text and selection for improving suggestions and candidate list. So, returning same text to IME is important for compatibility between browsers.
And also it's important information for IME on desktop where is the caret or the selected clause of composition string to show their own window. However,
EditContext
does not have this information.The text was updated successfully, but these errors were encountered: