Closed Bug 935858 Opened 11 years ago Closed 7 years ago

[Keyboard] The "sendString" method will be removed from "keyboard.js"

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: lchang, Unassigned)

References

Details

After Bug 906617 is landed, we have passed the new APIs (setComposition / endComposition) to the "init" function of layout engine. We suppose layout engines use these two APIs to replace the old ones (sendPendingSymbols / sendString).

The "sendString" method will be removed from "keyboard.js" after Korean, Japanese and Pinyin engine change to new APIs.
Depends on: 935859
Depends on: 935860
Depends on: 935863
Depends on: 933252
Why not remove sendString?
|sendString| is used to send string without composition. It is the case of auto-correction and suggestion for the latin IME. Also the word prediction feature (showing a list of related words after user input a word) requires sendString without composition as well.
|the word prediction feature| is part of Pinyin IME and the related code is:

https://github.com/mozilla-b2g/gaia/blob/690275d455d210ed781cbbbbfc789ad3ca7a54c8/apps/keyboard/js/imes/jspinyin/jspinyin.js#L658
To my knowledge, the compositionstart/compositionupdate/compositionend events will still be triggered in desktop browsers when we try to send word predictions through input methods without composition. According to W3C composition events, I suppose all the characters sent from input methods, that means not from native keyboard directly, should be sent by composition APIs (with composition events). Another reason is that I think it's more reasonable for web to send a string together at one time without triggering multiple key events.
We should use "replaceSurroundingText" to implement "sentString" without triggering multiple key events. "replaceSurroundingText" is much efficient than "setComposition".
I think the meaning of "replaceSurroundingText" still not suit the use case of "sendString" because it doesn't need to trigger any composition event in general.

In most of mobile devices, web pages won't receive any composition and key events when using auto-correcting function but will receive composition events when using word-predicting function without key events. I guess we need to distinguish each use case with its events.

In this bug, however, we have already passed the "replaceSurroundingText" API to every layout engines so I think we can still remove the "sendString" method here to let the layout developers know that they need to use either "replaceSurroundingText" or "setComposition" to send a string instead of "sendString".
That's fine.
Assignee: lchang → nobody
Firefox OS is not being worked on
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.