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

Side by Side Diff: services/ui/public/interfaces/ime/ime.mojom

Issue 2539453002: IME for Mus: Add ui.mojom.CompositionText and its struct traits. (Closed)
Patch Set: Addressed feedback. Created 4 years 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
« no previous file with comments | « services/ui/public/interfaces/ime/OWNERS ('k') | services/ui/public/interfaces/ime/ime.typemap » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 module ui.mojom; 5 module ui.mojom;
6 6
7 import "ui/events/mojo/event.mojom"; 7 import "ui/events/mojo/event.mojom";
8 import "ui/gfx/geometry/mojo/geometry.mojom"; 8 import "ui/gfx/geometry/mojo/geometry.mojom";
9 import "ui/gfx/range/mojo/range.mojom";
9 10
10 struct CompositionEvent { 11 // Represents an underlined segment of text currently composed by IME.
11 CompositionEventType type; 12 // Corresponds to ui::CompositionUnderline.
12 13 struct CompositionUnderline {
13 // Used when |type| is INSERT_CHAR. See the comments for 14 uint32 start_offset;
14 // ui::TextInputClient::InsertChar() for more information. 15 uint32 end_offset;
15 Event? key_event; 16 bool thick;
16 17 uint32 color;
17 // TODO(moshayedi): crbug.com/631524. Add fields required for other types of 18 uint32 background_color;
18 // composition event.
19 }; 19 };
20 20
21 enum CompositionEventType { 21 // Represents a text currently being composed by IME. Corresponds to
22 UPDATE, 22 // ui::CompositionText.
23 CONFIRM, 23 struct CompositionText {
24 CLEAR, 24 string text;
25 INSERT_CHAR, 25 array<CompositionUnderline> underlines;
26 INSERT_TEXT 26 gfx.mojom.Range selection;
27 }; 27 };
28 28
29 // See comments for ui::TextInputType for more details. 29 // See comments for ui::TextInputType for more details.
30 enum TextInputType { 30 enum TextInputType {
31 NONE, 31 NONE,
32 TEXT, 32 TEXT,
33 PASSWORD, 33 PASSWORD,
34 SEARCH, 34 SEARCH,
35 EMAIL, 35 EMAIL,
36 NUMBER, 36 NUMBER,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 OnTextInputModeChanged(TextInputMode text_input_mode); 89 OnTextInputModeChanged(TextInputMode text_input_mode);
90 OnTextInputTypeChanged(TextInputType text_input_type); 90 OnTextInputTypeChanged(TextInputType text_input_type);
91 91
92 // Client sends |caret_bounds| in focused window coordinates, 92 // Client sends |caret_bounds| in focused window coordinates,
93 // Mus translates it to global coordinates and sends it to IME app. 93 // Mus translates it to global coordinates and sends it to IME app.
94 OnCaretBoundsChanged(gfx.mojom.Rect caret_bounds); 94 OnCaretBoundsChanged(gfx.mojom.Rect caret_bounds);
95 95
96 // Called to process a key event. The callback function will be called to 96 // Called to process a key event. The callback function will be called to
97 // notify the client if the event was handled or not. A handled event may 97 // notify the client if the event was handled or not. A handled event may
98 // generate zero or more composition events which will be sent to the client 98 // generate zero or more composition events which will be sent to the client
99 // by calling TextInputClient::OnCompositionEvent(). 99 // using the "input method result" functions of TextInputClient interface.
100 ProcessKeyEvent(ui.mojom.Event key_event) => (bool handled); 100 ProcessKeyEvent(ui.mojom.Event key_event) => (bool handled);
101 101
102 CancelComposition(); 102 CancelComposition();
103 }; 103 };
104 104
105 // IME drivers send updates to clients using the TextInputClient interface. 105 // IME drivers send updates to clients using the TextInputClient interface.
106 interface TextInputClient { 106 interface TextInputClient {
107 // Corresponds to "input method result" functions of ui::TextInputClient. 107 // Functions corresponding to "input method result" functions of
108 // See comments for InputMethod::ProcessKeyEvent() for when this is called. 108 // ui::TextInputClient. See comments for InputMethod::ProcessKeyEvent() for
109 OnCompositionEvent(CompositionEvent event); 109 // when these are called.
110
111 // Sets composition text and attributes. See comments for
112 // ui::TextInputClient::SetCompositionText() for more details.
113 SetCompositionText(CompositionText composition);
114
115 // Converts current composition text into final content.
116 ConfirmCompositionText();
117
118 // Removes current composition text.
119 ClearCompositionText();
120
121 // Inserts a given text at the insertion point. Current composition text or
122 // selection will be removed. This method should never be called when the
123 // current text input type is TEXT_INPUT_TYPE_NONE.
124 InsertText(string text);
125
126 // Inserts a single character at the insertion point. Unlike InsertText(),
127 // the character is not processed. See ui::TextInputClient::InsertChar()
128 // for more details.
129 InsertChar(ui.mojom.Event event);
110 130
111 // TODO(moshayedi): Add functions corresponding to ui::TextInputClient for: 131 // TODO(moshayedi): Add functions corresponding to ui::TextInputClient for:
112 // - Input text confirmation 132 // - Input context information
113 // - Document content operations 133 // - Document content operations
114 // - Miscellaneous functions 134 // - Miscellaneous functions
115 // crbug.com/631527. 135 // crbug.com/631527.
116 }; 136 };
OLDNEW
« no previous file with comments | « services/ui/public/interfaces/ime/OWNERS ('k') | services/ui/public/interfaces/ime/ime.typemap » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698