|
|
(One intermediate revision by the same user not shown) |
Line 1: |
Line 1: |
| = Introduction =
| | #REDIRECT [[Mobile/IME]] |
| Here we will be collecting information about keyboard/IME handling and issues in Fennec.
| |
| | |
| = IME architecture =
| |
| | |
| == Components ==
| |
| Android IME-handling code consists of 4 parts: Java, widget, content, and IPC.
| |
| | |
| Java part is mostly in GeckoInputConnection.java, which deals with Android API, and translates Java interface calls made by Android system to the corresponding Gecko events.
| |
| | |
| The IME events are the objects of GeckoEvent class with one of the IME_XXX types. They get sent using GeckoAppShell.sendEventToGecko() across JNI to nsWindow.cpp in widget, wrapped in AndroidGeckoEvent C++ class.
| |
| | |
| nsWindow does minimum packaging and dispatches the events further to content, where they go all over the place.
| |
| Many of those events are handled in [http://mxr.mozilla.org/mozilla-central/source/content/events/src/nsContentEventHandler.cpp content/events/src/nsContentEventHandler.cpp], for example NS_QUERY_SELECTED_TEXT is dispatched to nsContentEventHandler::OnQuerySelectedText.
| |
| | |
| The IME events go only in one direction: from front-end to back-end, the reverse communication is done using notifications going from back-end to front-end. They pass through nsWindow::OnIMExxx in widget, across JNI to GeckoAppShell.NotifyIMEChange, and handled in GeckoInputConnection.notifyXXXChange.
| |
| | |
| == Ranges ==
| |
| | |
| Some IMEs are marking a part of the text that you're working on. For example, here a part of the text being entered is underlined:
| |
| | |
| [[Image:Fennec-IME-ranges.png|IME Ranges]]
| |
| | |
| Information about those parts is passed to Gecko as an array of ranges. Each range has several properties, including a type, which defines the nature of the range, styles like underlining, and text colors. The most noticeable and important range types are the composing text, and the text selection.
| |
| | |
| == Composition ==
| |
| | |
| A composing text is a range of text that you are currently working on. While it is in the composition state, it can be freely changed, these changes are considered as a batch operation, and are submitted as one update at the end of the composition, so the whole text modification is stored as one action in the edit history.
| |
| | |
| GeckoInputConnection tracks the composing state using mComposing flag. When it receives a text modification request from Android it sets this flag and sends IME_COMPOSITION_BEGIN event to Gecko. While in that state the mComposingText variable contains the current composing text, and mCompositionStart points to a start index of the composition within the text body. mCompositionSelStart/mCompositionSelLen track the text selection during the composition, as Gecko selection is not supposed to change while in the composing state.
| |
| | |
| = Bugs =
| |
| [https://bugzilla.mozilla.org/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=Fennec%20IME%20bugs&sharer_id=350513 Bugzilla query to get all Fennec IME-related bugs] | |
| | |
| [https://docs.google.com/spreadsheet/ccc?key=0AtcKMbhw1sNJdElhN2RXRGllbjVZemgyWUdNU0d5Q2c&hl=en_US Android-specific bugs reviewed]
| |