Talk:WebAPI/KeboardIME

From MozillaWiki
Revision as of 08:15, 17 July 2013 by Timdream (talk | contribs) (+ proposed API)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Proposed API (July 17 WIP)

mozInputMethod API to Keyboard Apps

partial interface Navigator {
    readonly attribute nsIDOMInputMethod mozInputMethod;
};
interface nsIDOMInputMethod: nsIDOMEventTarget {
    // IMManager contain a few global methods expose to apps
    readonly attribute nsIDOMInputMethodManager mgmt;

    // An "input context" is mapped to a text field that the app is allow to mutate.
    // this attribute should be null when there is no text field currently focused.
    attribute nsIDOMInputContext|null inputcontext;

    // Fired when the inputcontext changes, include changes from and to null.
    attribute nsIDOMEventListener oninputcontextchange;
};
interface nsIDOMInputMethodManager {
   // Switch away from the current IME
   void next();

   // Show the list of IMEs available
   void: showList();
};
interface nsIDOMInputContext {
   // an "input context" gets void when the app is no longer allowed to interact with the text field,
   // e.g., the text field is no longer exists, the app is being switched to background, etc.

   // All the properties and methods necessary to work with a specific text field should be here.
   ....
}

mozChromeEvents to System apps

Here are some signals necessary to Keyboard Manager in System app in order for it to do minimal interaction with keyboard app and text field.

  • inputcontextchange: should also expose the nsIDOMInputContext object here
  • inputmethodnext
  • inputmethodshowlist

mozbrowser API extension

  • setInputMethodActive(boolean): Depend on what we want, we might not want to re-use setVisible() to block/unblock a background/foreground keyboard app to interact with the text fields.