Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: components/arc/common/ime.mojom

Issue 2876693004: Implement GetTextFromRange(), GetTextRange() and GetSelectionRange() for ArcImeService. (Closed)
Patch Set: save surrounding text even if cursor rect is not changed Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Next MinVersion: 5 5 // Next MinVersion: 6
6 6
7 module arc.mojom; 7 module arc.mojom;
8 8
9 import "screen_rect.mojom"; 9 import "screen_rect.mojom";
10 10
11 // Represents the type of text input field currently focused. 11 // Represents the type of text input field currently focused.
12 [Extensible] 12 [Extensible]
13 enum TextInputType { 13 enum TextInputType {
14 NONE, 14 NONE,
15 TEXT, 15 TEXT,
16 PASSWORD, 16 PASSWORD,
17 SEARCH, 17 SEARCH,
18 EMAIL, 18 EMAIL,
19 NUMBER, 19 NUMBER,
20 TELEPHONE, 20 TELEPHONE,
21 URL, 21 URL,
22 DATE, 22 DATE,
23 TIME, 23 TIME,
24 DATETIME, 24 DATETIME,
25 }; 25 };
26 26
27 // Represents the text insertion points in the container screen coordinates. 27 // Represents the text insertion points in the container screen coordinates.
28 struct CursorRect { 28 struct CursorRect {
29 int32 left; 29 int32 left;
30 int32 top; 30 int32 top;
31 int32 right; 31 int32 right;
32 int32 bottom; 32 int32 bottom;
33 }; 33 };
34 34
35 // Represents the range in the text. It is an open interval [start, end).
Luis Héctor Chávez 2017/05/15 15:44:26 nit: can you document what these offsets represent
yhanada 2017/05/16 10:02:12 Done.
36 [MinVersion=5]
37 struct TextRange {
38 uint32 start;
39 uint32 end;
40 };
41
35 // Represents a single segment of text currently composed by IME. 42 // Represents a single segment of text currently composed by IME.
36 struct CompositionSegment { 43 struct CompositionSegment {
37 // Start offset of the segment in UTF-16 index. 44 // Start offset of the segment in UTF-16 index.
38 uint32 start_offset; 45 uint32 start_offset;
39 // End offset of the segment in UTF-16 index. 46 // End offset of the segment in UTF-16 index.
40 uint32 end_offset; 47 uint32 end_offset;
41 // Indicates that this segment should be emphasized. 48 // Indicates that this segment should be emphasized.
42 bool emphasized; 49 bool emphasized;
43 }; 50 };
44 51
45 // Next method ID: 4 52 // Next method ID: 4
46 interface ImeHost { 53 interface ImeHost {
47 // Notifies Chrome that the text input focus is changed. 54 // Notifies Chrome that the text input focus is changed.
48 OnTextInputTypeChanged@0(TextInputType type); 55 OnTextInputTypeChanged@0(TextInputType type);
49 56
50 // Notifies Chrome that the cursor poisition has changed. 57 // Notifies Chrome that the cursor poisition has changed.
51 OnCursorRectChanged@1(CursorRect rect); 58 OnCursorRectChanged@1(CursorRect rect);
52 59
53 // Notifies Chrome that the current composition is canceled. 60 // Notifies Chrome that the current composition is canceled.
54 [MinVersion=1] OnCancelComposition@2(); 61 [MinVersion=1] OnCancelComposition@2();
55 62
56 // Show virtual keyboard of Chrome OS if needed. 63 // Show virtual keyboard of Chrome OS if needed.
57 [MinVersion=2] ShowImeIfNeeded@3(); 64 [MinVersion=2] ShowImeIfNeeded@3();
65
66 // Notifies Chrome that the cursor position has changed and
67 // also sends surrounding text.
68 //
69 // |text_range|, |text_in_range| and |selection_range| are piggy-backed
70 // into this method because Chrome OS IME tries to retrieve these information
71 // synchronously, so we need to update them all at once to keep consistency.
72 [MinVersion=5] OnCursorRectChangedWithSurroundingText@4(
73 CursorRect rect, // The cursor position.
74 TextRange text_range, // The range of |text_in_range| in the current text
75 // in the editor.
76 string text_in_range, // The text around the cursor.
77 TextRange selection_range // The range of the selected text
78 // in the current text in the editor.
79 );
Luis Héctor Chávez 2017/05/15 15:44:27 nit: Clang-format does not work here, but can you
yhanada 2017/05/16 10:02:12 Done.
58 }; 80 };
59 81
60 // Next method ID: 6 82 // Next method ID: 6
61 interface ImeInstance { 83 interface ImeInstance {
62 Init@0(ImeHost host_ptr); 84 Init@0(ImeHost host_ptr);
63 85
64 // Sets composition text and attributes requested by the host IME. 86 // Sets composition text and attributes requested by the host IME.
65 SetCompositionText@1(string text, array<CompositionSegment> segments); 87 SetCompositionText@1(string text, array<CompositionSegment> segments);
66 88
67 // Commits the last set composition text and clears the composition. 89 // Commits the last set composition text and clears the composition.
68 ConfirmCompositionText@2(); 90 ConfirmCompositionText@2();
69 91
70 // Commits the specified text and clears the composition. 92 // Commits the specified text and clears the composition.
71 InsertText@3(string text); 93 InsertText@3(string text);
72 94
73 // Informs the virtual keyboard bounds on screen is changing. 95 // Informs the virtual keyboard bounds on screen is changing.
74 // |new_bounds| Represents a ChromeOS virtual keyboard bounds in ChromeOS 96 // |new_bounds| Represents a ChromeOS virtual keyboard bounds in ChromeOS
75 // screen coordinate, physical pixel as a unit. 97 // screen coordinate, physical pixel as a unit.
76 // When all members are zero value, virtual keyboard is being hidden. 98 // When all members are zero value, virtual keyboard is being hidden.
77 [MinVersion=3] OnKeyboardBoundsChanging@4(ScreenRect new_bounds); 99 [MinVersion=3] OnKeyboardBoundsChanging@4(ScreenRect new_bounds);
78 100
79 // Deletes current selection plus the specified number of char16 values 101 // Deletes current selection plus the specified number of char16 values
80 // before and after selection or caret. 102 // before and after selection or caret.
81 [MinVersion=4] ExtendSelectionAndDelete@5(uint64 before, uint64 after); 103 [MinVersion=4] ExtendSelectionAndDelete@5(uint64 before, uint64 after);
82 }; 104 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698