- From: James Su <suzhe@google.com>
- Date: Tue, 23 Apr 2013 16:35:05 +0800
- To: public-webapps@w3.org
- Message-ID: <CAFah6LmqQYuAyvxYGXErpCWDwKEfE5txsu0vpo+OqY0abupYcg@mail.gmail.com>
Hi all, Please see below my initial feedback about * http://www.w3.org/TR/2013/WD-ime-api-20130404/.* * 5. The getInputContext() method partial interface HTMLElement { InputMethodContext<http://www.w3.org/TR/ime-api/#idl-def-InputMethodContext> getInputContext<http://www.w3.org/TR/ime-api/#widl-HTMLElement-getInputContext-InputMethodContext>(); }; Feedback: 1. The name of the method and its return value type doesn’t match. Suggest to rename the method to getInputMethodContext(). 6. The Composition Dictionary dictionary Composition { readonly attribute Node text<http://www.w3.org/TR/2013/WD-ime-api-20130404/#widl-Composition-text> ; readonly attribute Range caret<http://www.w3.org/TR/2013/WD-ime-api-20130404/#widl-Composition-caret> ; }; Question: I’m wondering how should a web app render the styled text on a canvas? Can you provide an example code? Feedback: how about rename caret to selectedRange? 7. The InputMethodContext Interface interface InputMethodContext { readonly attribute Composition<http://www.w3.org/TR/ime-api/#idl-def-Composition> composition<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-composition> ; attribute boolean enabled<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-enabled> ; readonly attribute DOMString locale<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-locale> ; void confirmComposition<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-confirmComposition-void>(); void setCaretRectangle<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-setCaretRectangle-void-Node-anchor-long-x-long-y-long-w-long-h>( Node anchor, long x, long y, long w, long h); void setExclusionRectangle<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-setExclusionRectangle-void-Node-anchor-long-x-long-y-long-w-long-h>( Node anchor, long x, long y, long w, long h); boolean open<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-open-boolean>(); }; Feedback: 1. attribute boolean enabled<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-enabled> ; Instead of using a boolean value to tell the system whether or not the IME should be enabled, I suggest to add a mechanism to tell the IME the supported input type of the current focused node, it may either be a DOMString attribute or a method like setInputType(DOMString type). The acceptable values of the input type can be a subset of the types defined for HTML Input element<http://www.w3.org/TR/html-markup/input.html#input>. So that the browser can enable/disable the IME or maybe switch to a specific IME according to the input type. For example, if the web app wants to implement a password input box by itself, it can specify the input type to ‘password’, then the browser will switch the current IME to a special one suitable for inputting password. Setting the input type to ‘none’ or an empty value to disable the input method. 2. readonly attribute DOMString locale<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-locale> ; Having this attribute is good, but may not enough. We probably need a mechanism to notify the web app whenever the IME’s locale gets changed. For example, when the locale is changed from a LTR to a RTL one, the web app may want to adjust its text alignment and cursor position automatically. 3. void confirmComposition<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-confirmComposition-void>(); I suggest to change this method to cancelComposition(), which asks the IME to cancel the current composition session by resetting its internal state without committing anything. The web app is responsible for converting the latest composition text into the final text. The reason is that, confirmComposition() may require a round-trip call between IME and the web app, which may be an asynchronous call. So if the IME wants to commit anything when this method gets called, the result may be sent to the web app asynchronously any time after calling confirmComposition() method. This will cause unexpected behavior if the web app wants to manipulate the text content immediately after calling confirmComposition(). For example: assuming the current composition text is “Hello world|”, and the caret is at the end. If the web app decides to finish the composition and move the caret when the user clicks the composition text or any other place, the web app needs to call confirmComposition() method to ask the IME to finish the current composition session, but as the result may be sent back asynchronously after confirmComposition() method returns, the result may be inserted into a wrong place if the web app moves the caret immediately after calling confirmComposition(). 4. boolean open<http://www.w3.org/TR/ime-api/#widl-InputMethodContext-open-boolean>(); This method may not be necessary, as the User Agent should take care of opening/closing the IME according to the current input type when necessary. * -- James Su | Software Engineer | suzhe@google.com | +8610 62504149
Received on Tuesday, 23 April 2013 08:35:58 UTC