Changes

Jump to: navigation, search

WebAPI/KeboardIME

712 bytes removed, 12:37, 23 August 2013
change Promise<boolean> to Promise<void> and add textBeforeCursor, textAfterCursor properties.
// Ask the OS to show a list of available IMEs for users to switch from.
// OS should ignore this request if the app is currently not the active one.
void <strike>showInputMethodPicker</strike> showAll();
// Ask the OS to switch away from the current active Keyboard app.
// OS should ignore this request if the app is currently not the active one.
void <strike>switchToNextInputMethod</strike> next();
// To know if the OS supports IME switching or not.
// This method belong to |mgmt| because we would like to allow Keyboard to access to
// this method w/o a input context.
void <strike>removeFocus</strike> hide();
};
// But I agree that also enabling the keyboard to declare in the manifest which types it supports
// is a good idea.
interface <strike>InputMethodConnection</strike> InputContext: EventTarget {
// The tag name of input field, which is enum of "input", "textarea", or "contenteditable"
<strike>// [JS] I think "type" would be better here.</strike> <strike>// [JS] This should also be 'readonly', right?</strike> readonly DOMString <strike>name</strike> type;
// The type of the input field, which is enum of text, number, password, url, search, email, and so on.
// See http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#states-of-the-type-attribute
<strike>// [JS] and "inputtype" here.</strike> <strike>// [JS] This should also be 'readonly', right?</strike> readonly DOMString <strike>type</strike> inputType;
/*
* See http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#input-modalities:-the-inputmode-attribute
*/
<strike>// [JS] This should be 'readonly', right?</strike>
readonly DOMString inputMode;
* See http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#htmlelement
*/
<strike>// [JS] This should be 'readonly', right?</strike>
readonly DOMString lang;
readonly attribute long selectionEnd;
// The text before and after the begining of the selected text.
readonly attribute DOMString textBeforeCursor;
readonly attribute DOMString textAfterCursor;
 
/*
* Set the selection range of the the editable text.
* selectionStart and selectionEnd.
*/
<strike>Promise<boolean> setSelectionRange(long start, long length);</strike> Promise<void> setSelectionRange(long start, long length);
/* User moves the cursor, or changes the selection with other means. If the text around
* cursor has changed, but the cursor has not been moved, the IME won't get notification.
*
* [JJ] I would merge this with onsurroundingtextchange to have 1 state event.
* in the end, every onselectionchange event will also generate a surrounding
* text change event.
*/
attribute EventHandler onselectionchange;
* @param length The length of text to replace. Defaults to 0.
*/
<strike>Promise<boolean> replaceSurroundingText(DOMString text, [optional] long offset, [optional] long length);</strike>commitText Promise</strikevoid> replaceSurroundingText(DOMString text, [optional] long offset, [optional] long length);
/*
* @param offset The offset from the cursor position where deletion starts.
* @param length The length of text to delete.
* TODO: maybe updateSurroundingText(DOMString beforeText, DOMString afterText); ?
* [JJ] Rather do a replaceSurroundingText(long offset, long length, optional DOMString text)
* If text is null or empty, it behaves the same
*/
<strike>Promise<boolean> deleteSurroundingText(long offset, long length);</strike> Promise<void> deleteSurroundingText(long offset, long length);
/*
* editing or cursor movement. If the cursor has been moved, but the text around has not
* changed, the IME won't get notification.
*
* The event handler function is specified as:
* @param beforeString Text before and including cursor position.
* @param afterString Text after and excluing cursor position.
* function(DOMString beforeText, DOMString afterText) {
* ...
* }
*/
// [JS] Can you describe how the cursor can be moved without the surrounding text
// also changing? Is that really something that can happen?
// [yxl] For example, if the text field is filled with 'a', wherever the cusor movies the surrounding text is always 'aa...'. Another exmaple, the selection range is changed, but the cursor isn't and the surrouding text won't be changed. attribute SurroundingTextChangeEventHandler EventHandler onsurroundingtextchange;
/*
* Alternative: sendKey(KeyboardEvent event), but we will likely waste memory for creating the KeyboardEvent object.
*/
<strike>Promise<boolean> sendKey(long keyCode, long charCode, [optional] long modifiers);</strike> Promise<void> sendKey(long keyCode, long charCode, [optional] long modifiers);
/*
* To finish composition and commit text to current input field, an IME should call |endComposition|.
*/
<strike>// Promise<boolean> setComposition(DOMString text, [JSoptional] A more detailed description of how to use these two functions would be great. // It's not really obvious to me what either of these two arguments do.long cursor);</strike> Promise<booleanvoid> setComposition(DOMString text, [optional] long cursor);
/*
* |replaceSurroundingText|, |deleteSurroundingText|, user moving the cursor, changing the focus, etc.
*/
<strike>Promise<boolean> endComposition(DOMString text);</strike> Promise<void> endComposition(DOMString text);
};
Confirm
58
edits

Navigation menu