Skip to content

Commit

Permalink
PPAPI: Move IMEInputEvent and TextInput to stable.
Browse files Browse the repository at this point in the history
To be able to work with current ppapi Flash, this CL keeps ABI of "PPB_IMEInputEvent_Dev_0_2", "PPB_TextInput_Dev_0_2" and "PPP_TextInput_Dev_0_2".

BUG=None
TEST=Manually checked that ppapi_example_ime works and also works with current Flash.
NOTRY=True

Review URL: https://chromiumcodereview.appspot.com/18671004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214878 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
nona@chromium.org committed Aug 1, 2013
1 parent 934e3c9 commit 79cad34
Show file tree
Hide file tree
Showing 24 changed files with 946 additions and 50 deletions.
1 change: 1 addition & 0 deletions content/renderer/pepper/plugin_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
#include "ppapi/c/ppb_network_proxy.h"
#include "ppapi/c/ppb_opengles2.h"
#include "ppapi/c/ppb_tcp_socket.h"
#include "ppapi/c/ppb_text_input_controller.h"
#include "ppapi/c/ppb_udp_socket.h"
#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/c/ppb_url_request_info.h"
Expand Down
1 change: 1 addition & 0 deletions native_client_sdk/src/libraries/ppapi/library.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'pp_bool.h',
'ppb_opengles2.h',
'ppb_tcp_socket.h',
'ppb_text_input_controller.h',
'ppb_udp_socket.h',
'ppb_url_loader.h',
'ppb_url_request_info.h',
Expand Down
2 changes: 2 additions & 0 deletions native_client_sdk/src/libraries/ppapi_cpp/library.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'rect.cc',
'resource.cc',
'tcp_socket.cc',
'text_input_controller.cc',
'udp_socket.cc',
'url_loader.cc',
'url_request_info.cc',
Expand Down Expand Up @@ -142,6 +143,7 @@
'resource.h',
'size.h',
'tcp_socket.h',
'text_input_controller.h',
'touch_point.h',
'udp_socket.h',
'url_loader.h',
Expand Down
129 changes: 129 additions & 0 deletions ppapi/api/ppb_input_event.idl
Original file line number Diff line number Diff line change
Expand Up @@ -905,3 +905,132 @@ interface PPB_TouchInputEvent {
[in] PP_TouchListType list,
[in] uint32_t touch_id);
};

[macro="PPB_IME_INPUT_EVENT_INTERFACE"]
interface PPB_IMEInputEvent {
/**
* Create() creates an IME input event with the given parameters. Normally
* you will get an IME event passed through the <code>HandleInputEvent</code>
* and will not need to create them, but some applications may want to create
* their own for internal use.
*
* @param[in] instance The instance for which this event occurred.
*
* @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of
* input event. The type must be one of the IME event types.
*
* @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time
* when the event occurred.
*
* @param[in] text The string returned by <code>GetText</code>.
*
* @param[in] segment_number The number returned by
* <code>GetSegmentNumber</code>.
*
* @param[in] segment_offsets The array of numbers returned by
* <code>GetSegmentOffset</code>. If <code>segment_number</code> is zero,
* the number of elements of the array should be zero. If
* <code>segment_number</code> is non-zero, the length of the array must be
* <code>segment_number</code> + 1.
*
* @param[in] target_segment The number returned by
* <code>GetTargetSegment</code>.
*
* @param[in] selection_start The start index returned by
* <code>GetSelection</code>.
*
* @param[in] selection_end The end index returned by
* <code>GetSelection</code>.
*
* @return A <code>PP_Resource</code> containing the new IME input event.
*/
PP_Resource Create([in] PP_Instance instance,
[in] PP_InputEvent_Type type,
[in] PP_TimeTicks time_stamp,
[in] PP_Var text,
[in] uint32_t segment_number,
[in] uint32_t[] segment_offsets,
[in] int32_t target_segment,
[in] uint32_t selection_start,
[in] uint32_t selection_end);

/**
* IsIMEInputEvent() determines if a resource is an IME event.
*
* @param[in] resource A <code>PP_Resource</code> corresponding to an event.
*
* @return <code>PP_TRUE</code> if the given resource is a valid input event.
*/
PP_Bool IsIMEInputEvent([in] PP_Resource resource);

/**
* GetText() returns the composition text as a UTF-8 string for the given IME
* event.
*
* @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
* event.
*
* @return A string var representing the composition text. For non-IME input
* events the return value will be an undefined var.
*/
PP_Var GetText([in] PP_Resource ime_event);

/**
* GetSegmentNumber() returns the number of segments in the composition text.
*
* @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
* event.
*
* @return The number of segments. For events other than COMPOSITION_UPDATE,
* returns 0.
*/
uint32_t GetSegmentNumber([in] PP_Resource ime_event);

/**
* GetSegmentOffset() returns the position of the index-th segmentation point
* in the composition text. The position is given by a byte-offset (not a
* character-offset) of the string returned by GetText(). It always satisfies
* 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1)
* < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()).
* Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range
* of the i-th segment, and hence GetSegmentNumber() can be a valid argument
* to this function instead of an off-by-1 error.
*
* @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
* event.
*
* @param[in] index An integer indicating a segment.
*
* @return The byte-offset of the segmentation point. If the event is not
* COMPOSITION_UPDATE or index is out of range, returns 0.
*/
uint32_t GetSegmentOffset([in] PP_Resource ime_event,
[in] uint32_t index);

/**
* GetTargetSegment() returns the index of the current target segment of
* composition.
*
* @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
* event.
*
* @return An integer indicating the index of the target segment. When there
* is no active target segment, or the event is not COMPOSITION_UPDATE,
* returns -1.
*/
int32_t GetTargetSegment([in] PP_Resource ime_event);

/**
* GetSelection() returns the range selected by caret in the composition text.
*
* @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME
* event.
*
* @param[out] start The start position of the current selection.
*
* @param[out] end The end position of the current selection.
*/
void GetSelection([in] PP_Resource ime_event,
[out] uint32_t start,
[out] uint32_t end);
};
95 changes: 95 additions & 0 deletions ppapi/api/ppb_text_input_controller.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/* Copyright 2013 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

/**
* This file defines the <code>PPB_TextInputController</code> interface.
*/

label Chrome {
M30 = 1.0
};

/**
* PP_TextInput_Type is used to indicate the status of a plugin in regard to
* text input.
*/
[assert_size(4)]
enum PP_TextInput_Type {
/**
* Input caret is not in an editable mode, no input method shall be used.
*/
PP_TEXTINPUT_TYPE_NONE = 0,
/**
* Input caret is in a normal editable mode, any input method can be used.
*/
PP_TEXTINPUT_TYPE_TEXT = 1,
/**
* Input caret is in a password box, an input method may be used only if
* it's suitable for password input.
*/
PP_TEXTINPUT_TYPE_PASSWORD = 2,
PP_TEXTINPUT_TYPE_SEARCH = 3,
PP_TEXTINPUT_TYPE_EMAIL = 4,
PP_TEXTINPUT_TYPE_NUMBER = 5,
PP_TEXTINPUT_TYPE_TELEPHONE = 6,
PP_TEXTINPUT_TYPE_URL = 7
};

/**
* <code>PPB_TextInputController</code> provides a set of functions for giving
* hints to the browser about the text input status of plugins, and functions
* for controlling input method editors (IMEs).
*/
interface PPB_TextInputController {
/**
* Informs the browser about the current text input mode of the plugin.
* Typical use of this information in the browser is to properly
* display/suppress tools for supporting text inputs (such as virtual
* keyboards in touch screen based devices, or input method editors often
* used for composing East Asian characters).
*/
void SetTextInputType([in] PP_Instance instance,
[in] PP_TextInput_Type type);

/**
* Informs the browser about the coordinates of the text input caret area.
* Typical use of this information in the browser is to layout IME windows
* etc.
*/
void UpdateCaretPosition([in] PP_Instance instance,
[in] PP_Rect caret);

/**
* Cancels the current composition in IME.
*/
void CancelCompositionText([in] PP_Instance instance);

/**
* Informs the browser about the current text selection and surrounding
* text. <code>text</code> is a UTF-8 string that contains the current range
* of text selection in the plugin. <code>caret</code> is the byte-index of
* the caret position within <code>text</code>. <code>anchor</code> is the
* byte-index of the anchor position (i.e., if a range of text is selected,
* it is the other edge of selection different from <code>caret</code>. If
* there are no selection, <code>anchor</code> is equal to <code>caret</code>.
*
* Typical use of this information in the browser is to enable "reconversion"
* features of IME that puts back the already committed text into the
* pre-commit composition state. Another use is to improve the precision
* of suggestion of IME by taking the context into account (e.g., if the caret
* looks to be on the beginning of a sentence, suggest capital letters in a
* virtual keyboard).
*
* When the focus is not on text, call this function setting <code>text</code>
* to an empty string and <code>caret</code> and <code>anchor</code> to zero.
* Also, the plugin should send the empty text when it does not want to reveal
* the selection to IME (e.g., when the surrounding text is containing
* password text).
*/
void UpdateSurroundingText([in] PP_Instance instance,
[in] PP_Var text,
[in] uint32_t caret,
[in] uint32_t anchor);
};
4 changes: 2 additions & 2 deletions ppapi/c/pp_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* found in the LICENSE file.
*/

/* From pp_macros.idl modified Thu Mar 14 13:24:42 2013. */
/* From pp_macros.idl modified Tue Jul 2 14:15:05 2013. */

#ifndef PPAPI_C_PP_MACROS_H_
#define PPAPI_C_PP_MACROS_H_


#define PPAPI_RELEASE 29
#define PPAPI_RELEASE 30

/**
* @file
Expand Down
Loading

0 comments on commit 79cad34

Please sign in to comment.