| Index: ppapi/thunk/ppb_input_event_thunk.cc
|
| diff --git a/ppapi/thunk/ppb_input_event_thunk.cc b/ppapi/thunk/ppb_input_event_thunk.cc
|
| index bd28495a90ac3926605c3a600cc4e04fe464558e..be646f7ccfb39d65e90e326dac92922fe65ac96e 100644
|
| --- a/ppapi/thunk/ppb_input_event_thunk.cc
|
| +++ b/ppapi/thunk/ppb_input_event_thunk.cc
|
| @@ -271,6 +271,64 @@ const PPB_KeyboardInputEvent g_ppb_keyboard_input_event_thunk = {
|
| &GetCharacterText
|
| };
|
|
|
| +// Keyboard --------------------------------------------------------------------
|
| +
|
| +PP_Bool IsCompositionInputEvent(PP_Resource resource) {
|
| + if (!IsInputEvent(resource))
|
| + return PP_FALSE; // Prevent warning log in GetType.
|
| + PP_InputEvent_Type type = GetType(resource);
|
| + return PP_FromBool(type == PP_INPUTEVENT_TYPE_COMPOSITION_START ||
|
| + type == PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE ||
|
| + type == PP_INPUTEVENT_TYPE_COMPOSITION_END ||
|
| + type == PP_INPUTEVENT_TYPE_IME_TEXT);
|
| +}
|
| +
|
| +PP_Var GetCompositionText(PP_Resource composition_event) {
|
| + return GetCharacterText(composition_event);
|
| +}
|
| +
|
| +void GetCompositionSegments(PP_Resource composition_event,
|
| + void* segments,
|
| + uint32_t* size) {
|
| + EnterInputEvent enter(composition_event, true);
|
| + if (enter.failed()) {
|
| + if (size)
|
| + *size = 0;
|
| + return;
|
| + }
|
| + enter.object()->GetCompositionSegments(static_cast<uint32_t**>(segments),
|
| + size);
|
| +}
|
| +
|
| +int32_t GetCompositionTargetSegment(PP_Resource composition_event) {
|
| + EnterInputEvent enter(composition_event, true);
|
| + if (enter.failed())
|
| + return -1;
|
| + return enter.object()->GetCompositionTargetSegment();
|
| +}
|
| +
|
| +void GetCompositionSelection(PP_Resource composition_event,
|
| + uint32_t* start,
|
| + uint32_t* end) {
|
| + EnterInputEvent enter(composition_event, true);
|
| + if (enter.failed()) {
|
| + if (start)
|
| + *start = 0;
|
| + if (end)
|
| + *end = 0;
|
| + return;
|
| + }
|
| + enter.object()->GetCompositionSelection(start, end);
|
| +}
|
| +
|
| +const PPB_CompositionInputEvent g_ppb_composition_input_event_thunk = {
|
| + &IsCompositionInputEvent,
|
| + &GetCompositionText,
|
| + &GetCompositionSegments,
|
| + &GetCompositionTargetSegment,
|
| + &GetCompositionSelection
|
| +};
|
| +
|
| } // namespace
|
|
|
| const PPB_InputEvent* GetPPB_InputEvent_Thunk() {
|
| @@ -293,5 +351,9 @@ const PPB_WheelInputEvent* GetPPB_WheelInputEvent_Thunk() {
|
| return &g_ppb_wheel_input_event_thunk;
|
| }
|
|
|
| +const PPB_CompositionInputEvent* GetPPB_CompositionInputEvent_Thunk() {
|
| + return &g_ppb_composition_input_event_thunk;
|
| +}
|
| +
|
| } // namespace thunk
|
| } // namespace ppapi
|
|
|