Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 * Use of this source code is governed by a BSD-style license that can be | |
| 3 * found in the LICENSE file. | |
| 4 */ | |
| 5 | |
| 6 /** | |
| 7 * This file defines the <code>PPB_IMEInputEvent_Dev</code> interface. | |
| 8 */ | |
| 9 | |
| 10 label Chrome { | |
| 11 M16 = 0.1 | |
| 12 }; | |
| 13 | |
| 14 [version=0.1, macro="PPB_IME_INPUT_EVENT_INTERFACE"] | |
| 15 interface PPB_IMEInputEvent_Dev { | |
| 16 /** | |
| 17 * IsIMEInputEvent() determines if a resource is an IME event. | |
| 18 * | |
| 19 * @param[in] resource A <code>PP_Resource</code> corresponding to an event. | |
| 20 * | |
| 21 * @return <code>PP_TRUE</code> if the given resource is a valid input event. | |
| 22 */ | |
| 23 PP_Bool IsIMEInputEvent([in] PP_Resource resource); | |
| 24 | |
| 25 /** | |
| 26 * GetText() returns the composition text as a UTF-8 string for the given IME | |
| 27 * event. | |
| 28 * | |
| 29 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME | |
| 30 * event. | |
| 31 * | |
| 32 * @return A string var representing the composition text. For non-IME input | |
| 33 * events the return value will be an undefined var. | |
| 34 */ | |
| 35 PP_Var GetText([in] PP_Resource ime_event); | |
| 36 | |
| 37 /** | |
| 38 * GetSegmentNumber() returns the number of segments in the composition text. | |
| 39 * | |
| 40 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME | |
| 41 * event. | |
| 42 * | |
| 43 * @return The number of segments. For events other than COMPOSITION_UPDATE, | |
| 44 * returns 0. | |
| 45 */ | |
| 46 uint32_t GetSegmentNumber([in] PP_Resource ime_event); | |
| 47 | |
| 48 /** | |
| 49 * GetSegmentAt() returns the start and the end position of the index-th | |
| 50 * segment in the composition text. The positions are given by byte-indices of | |
|
yzshen1
2011/09/14 17:32:56
byte -> char?
brettw
2011/09/14 23:00:06
We should be careful how this is defined. Is it Un
kinaba
2011/09/15 08:53:50
It is bytes, not Unicode characters. Improved the
| |
| 51 * the string GetText(). They always satisfy 0 <= start < end <= (Length of | |
|
yzshen1
2011/09/14 17:32:56
Just to double check: according to "end <= (Length
kochi
2011/09/15 07:27:19
I just discussed this with Kazuhiro and removed th
kinaba
2011/09/15 08:53:50
Added a comment saying that [start, end) is the on
| |
| 52 * GetText()) and start[index] < start[index+1]. When the event is not | |
| 53 * COMPOSITION_UPDATE or index >= GetSegmentNumber(), nothing happens. | |
|
yzshen1
2011/09/14 17:32:56
Is it better to return a PP_Bool?
kinaba
2011/09/15 08:53:50
Done.
| |
| 54 * | |
| 55 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME | |
| 56 * event. | |
| 57 * | |
| 58 * @param[in] index An integer indicating a segment. | |
| 59 * | |
| 60 * @param[out] start The start position of the index-th segment. | |
| 61 * | |
| 62 * @param[out] end The end position of the index-th segment. | |
| 63 */ | |
| 64 void GetSegmentAt([in] PP_Resource ime_event, | |
| 65 [in] uint32_t index, | |
| 66 [out] uint32_t start, | |
| 67 [out] uint32_t end); | |
| 68 | |
| 69 /** | |
| 70 * GetTargetSegment() returns the index of the current target segment of | |
| 71 * composition. | |
| 72 * | |
| 73 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME | |
| 74 * event. | |
| 75 * | |
| 76 * @return An integer indicating the index of the target segment. When there | |
| 77 * is no active target segment, or the event is not COMPOSITION_UPDATE, | |
| 78 * returns -1. | |
| 79 */ | |
| 80 int32_t GetTargetSegment([in] PP_Resource ime_event); | |
| 81 | |
| 82 /** | |
| 83 * GetSelection() returns the range selected by caret in the composition text. | |
| 84 * | |
| 85 * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME | |
| 86 * event. | |
| 87 * | |
| 88 * @param[out] start The start position of the current selection. | |
| 89 * | |
| 90 * @param[out] end The end position of the current selection. | |
| 91 */ | |
| 92 void GetSelection([in] PP_Resource ime_event, | |
| 93 [out] uint32_t start, | |
| 94 [out] uint32_t end); | |
| 95 }; | |
| OLD | NEW |