| Index: ppapi/cpp/input_event.h
|
| diff --git a/ppapi/cpp/input_event.h b/ppapi/cpp/input_event.h
|
| index da92742c3b026bcfe934a2fcdb572520c40c536a..788aa046d8f9afb4d39614242d58ec0a98731d65 100644
|
| --- a/ppapi/cpp/input_event.h
|
| +++ b/ppapi/cpp/input_event.h
|
| @@ -6,6 +6,7 @@
|
| #define PPAPI_CPP_INPUT_EVENT_H_
|
|
|
| #include <string>
|
| +#include <vector>
|
|
|
| #include "ppapi/c/ppb_input_event.h"
|
| #include "ppapi/cpp/resource.h"
|
| @@ -302,6 +303,46 @@ class KeyboardInputEvent : public InputEvent {
|
| Var GetCharacterText() const;
|
| };
|
|
|
| +class CompositionInputEvent : public InputEvent {
|
| + public:
|
| + /// Constructs an is_null() keyboard input event object.
|
| + CompositionInputEvent();
|
| +
|
| + /// Constructs a composition input event object from the provided generic
|
| + /// input event. If the given event is itself is_null() or is not a
|
| + /// composition input event, the composition object will be is_null().
|
| + ///
|
| + /// @param[in] event A generic input event.
|
| + explicit CompositionInputEvent(const InputEvent& event);
|
| +
|
| + /// Returns the composition text as a UTF-8 string for the given composition
|
| + /// event.
|
| + ///
|
| + /// @return A string var representing the composition text. For non-
|
| + /// composition input events the return value will be an undefined var.
|
| + Var GetText() const;
|
| +
|
| + /// Returns the segmentation information by a list of indices of
|
| + /// a UTF-8 string returned by GetText.
|
| + ///
|
| + /// @return A vector representing segmentation information. For events other
|
| + /// than COMPOSITION_UPDATE, it returns an empty vector.
|
| + std::vector< std::pair<uint32_t, uint32_t> > GetSegments() const;
|
| +
|
| + /// Returns the index in the array retrieved by GetSegments indicating the
|
| + /// segment currently under composition.
|
| + ///
|
| + /// @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() const;
|
| +
|
| + /// Returns the selection (caret) position in the current composition text.
|
| + ///
|
| + /// @return A pair of integers indicating the selection range.
|
| + std::pair<uint32_t, uint32_t> GetSelection() const;
|
| +};
|
| +
|
| } // namespace pp
|
|
|
| #endif // PPAPI_CPP_INPUT_EVENT_H_
|
|
|