diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 08:35:55 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-27 08:35:55 +0000 |
commit | 40fbffa6a1d8cc0aa6adb8e71725fea954d0eb17 (patch) | |
tree | 5e37fa314f54e15dd72c9a28cb1bad463800a00e /ppapi/cpp | |
parent | a5bd413ae6ca86fce6922fcd19c111eaeb7232f4 (diff) | |
download | chromium_src-40fbffa6a1d8cc0aa6adb8e71725fea954d0eb17.zip chromium_src-40fbffa6a1d8cc0aa6adb8e71725fea954d0eb17.tar.gz chromium_src-40fbffa6a1d8cc0aa6adb8e71725fea954d0eb17.tar.bz2 |
Revert 102897 - Additional update on Pepper IME API and boilerplate thunk/proxy implementation.
BUG=59425
TEST=Check that ppapi_tests compile.
This CL is the second (out of three) part for adding IME support for PPAPI.
It reflects comments from James Su to the previous CL:
http://codereview.chromium.org/7882004.
- Renamed ..._COMPOSTION_START to _IME_COMPOSITON_START.
- Changed to assure GetSegment to return a strictly increasing sequence of
segmentation points from 0 to the length.
and,
- Added the mostly boilerplate code for interfacing with
in-process & out-of-process plugins.
The actual implementation of the IME support will come as
the next and the last part of this series of patches.
Review URL: http://codereview.chromium.org/7978019
TBR=kinaba@chromium.org
Review URL: http://codereview.chromium.org/8060005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102900 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r-- | ppapi/cpp/dev/ime_input_event_dev.cc | 13 | ||||
-rw-r--r-- | ppapi/cpp/dev/ime_input_event_dev.h | 22 | ||||
-rw-r--r-- | ppapi/cpp/dev/text_input_dev.cc | 7 | ||||
-rw-r--r-- | ppapi/cpp/dev/text_input_dev.h | 1 |
4 files changed, 25 insertions, 18 deletions
diff --git a/ppapi/cpp/dev/ime_input_event_dev.cc b/ppapi/cpp/dev/ime_input_event_dev.cc index bc1f387..21fe879 100644 --- a/ppapi/cpp/dev/ime_input_event_dev.cc +++ b/ppapi/cpp/dev/ime_input_event_dev.cc @@ -49,11 +49,16 @@ uint32_t IMEInputEvent_Dev::GetSegmentNumber() const { pp_resource()); } -uint32_t IMEInputEvent_Dev::GetSegmentOffset(uint32_t index) const { +std::pair<uint32_t, uint32_t> +IMEInputEvent_Dev::GetSegmentAt(uint32_t index) const { + std::pair<uint32_t, uint32_t> range(0, 0); if (!has_interface<PPB_IMEInputEvent_Dev>()) - return 0; - return get_interface<PPB_IMEInputEvent_Dev>()->GetSegmentOffset(pp_resource(), - index); + return range; + get_interface<PPB_IMEInputEvent_Dev>()->GetSegmentAt(pp_resource(), + index, + &range.first, + &range.second); + return range; } int32_t IMEInputEvent_Dev::GetTargetSegment() const { diff --git a/ppapi/cpp/dev/ime_input_event_dev.h b/ppapi/cpp/dev/ime_input_event_dev.h index 17216a8..3c9b4a3 100644 --- a/ppapi/cpp/dev/ime_input_event_dev.h +++ b/ppapi/cpp/dev/ime_input_event_dev.h @@ -41,23 +41,17 @@ class IMEInputEvent_Dev : public InputEvent { /// returns 0. uint32_t GetSegmentNumber() const; - /// 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. + /// Returns the start and the end position of the index-th segment in the + /// composition text. The positions are given by byte-indices of the string + /// GetText(). They always satisfy 0 <= .first < .second <= (Length of + /// GetText()) and GetSegmentAt(index).first < GetSegmentAt(index+1).first. + /// When the event is not COMPOSITION_UPDATE or index >= GetSegmentNumber(), + /// returns (0, 0). /// /// @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(uint32_t index) const; + /// @return A pair of integers representing the index-th segment. + std::pair<uint32_t, uint32_t> GetSegmentAt(uint32_t index) const; /// Returns the index of the current target segment of composition. /// diff --git a/ppapi/cpp/dev/text_input_dev.cc b/ppapi/cpp/dev/text_input_dev.cc index 6388836..3ead040 100644 --- a/ppapi/cpp/dev/text_input_dev.cc +++ b/ppapi/cpp/dev/text_input_dev.cc @@ -40,6 +40,13 @@ void TextInput_Dev::UpdateCaretPosition(const Rect& caret, instance_->pp_instance(), &caret.pp_rect(), &bounding_box.pp_rect()); } +void TextInput_Dev::ConfirmCompositionText() { + if (!has_interface<PPB_TextInput_Dev>()) + return; + get_interface<PPB_TextInput_Dev>()->ConfirmCompositionText( + instance_->pp_instance()); +} + void TextInput_Dev::CancelCompositionText() { if (!has_interface<PPB_TextInput_Dev>()) return; diff --git a/ppapi/cpp/dev/text_input_dev.h b/ppapi/cpp/dev/text_input_dev.h index 79fadd6..2283bf7 100644 --- a/ppapi/cpp/dev/text_input_dev.h +++ b/ppapi/cpp/dev/text_input_dev.h @@ -21,6 +21,7 @@ class TextInput_Dev { void SetTextInputType(PP_TextInput_Type type); void UpdateCaretPosition(const Rect& caret, const Rect& bounding_box); + void ConfirmCompositionText(); void CancelCompositionText(); private: |