OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef UI_BASE_IME_TEXT_INPUT_CLIENT_H_ | 5 #ifndef UI_BASE_IME_TEXT_INPUT_CLIENT_H_ |
6 #define UI_BASE_IME_TEXT_INPUT_CLIENT_H_ | 6 #define UI_BASE_IME_TEXT_INPUT_CLIENT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // Returns the current text input flags, which is a bit map of | 76 // Returns the current text input flags, which is a bit map of |
77 // WebTextInputType defined in blink. This is valid only for web input fileds; | 77 // WebTextInputType defined in blink. This is valid only for web input fileds; |
78 // it will return TEXT_INPUT_FLAG_NONE for native input fields. | 78 // it will return TEXT_INPUT_FLAG_NONE for native input fields. |
79 virtual int GetTextInputFlags() const = 0; | 79 virtual int GetTextInputFlags() const = 0; |
80 | 80 |
81 // Returns if the client supports inline composition currently. | 81 // Returns if the client supports inline composition currently. |
82 virtual bool CanComposeInline() const = 0; | 82 virtual bool CanComposeInline() const = 0; |
83 | 83 |
84 // Returns current caret (insertion point) bounds in the universal screen | 84 // Returns current caret (insertion point) bounds in the universal screen |
85 // coordinates. If there is selection, then the selection bounds will be | 85 // coordinates in DIP (Density Independent Pixel). |
86 // returned. | 86 // If there is selection, then the selection bounds will be returned. |
87 // Note: On Windows, the returned value is supposed to be DIP (Density | |
88 // Independent Pixel). | |
89 // TODO(ime): Have a clear spec whether the returned value is DIP or not. | |
90 // http://crbug.com/360334 | |
91 virtual gfx::Rect GetCaretBounds() const = 0; | 87 virtual gfx::Rect GetCaretBounds() const = 0; |
92 | 88 |
93 // Retrieves the composition character boundary rectangle in the universal | 89 // Retrieves the composition character boundary rectangle in the universal |
94 // screen coordinates. The |index| is zero-based index of character position | 90 // screen coordinates in DIP (Density Independent Pixel). |
95 // in composition text. | 91 // The |index| is zero-based index of character position in composition text. |
96 // Returns false if there is no composition text or |index| is out of range. | 92 // Returns false if there is no composition text or |index| is out of range. |
97 // The |rect| is not touched in the case of failure. | 93 // The |rect| is not touched in the case of failure. |
98 // Note: On Windows, the returned value is supposed to be DIP | |
99 // (Density Independent Pixel). | |
100 // TODO(ime): Have a clear spec whether the returned value is DIP or not. | |
101 // http://crbug.com/360334 | |
102 virtual bool GetCompositionCharacterBounds(uint32_t index, | 94 virtual bool GetCompositionCharacterBounds(uint32_t index, |
103 gfx::Rect* rect) const = 0; | 95 gfx::Rect* rect) const = 0; |
104 | 96 |
105 // Returns true if there is composition text. | 97 // Returns true if there is composition text. |
106 virtual bool HasCompositionText() const = 0; | 98 virtual bool HasCompositionText() const = 0; |
107 | 99 |
108 // Document content operations ---------------------------------------------- | 100 // Document content operations ---------------------------------------------- |
109 | 101 |
110 // Retrieves the UTF-16 based character range containing accessible text in | 102 // Retrieves the UTF-16 based character range containing accessible text in |
111 // the View. It must cover the composition and selection range. | 103 // the View. It must cover the composition and selection range. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 virtual bool ChangeTextDirectionAndLayoutAlignment( | 147 virtual bool ChangeTextDirectionAndLayoutAlignment( |
156 base::i18n::TextDirection direction) = 0; | 148 base::i18n::TextDirection direction) = 0; |
157 | 149 |
158 // Deletes the current selection plus the specified number of characters | 150 // Deletes the current selection plus the specified number of characters |
159 // before and after the selection or caret. This function should be used | 151 // before and after the selection or caret. This function should be used |
160 // instead of calling DeleteRange with GetSelectionRange, because | 152 // instead of calling DeleteRange with GetSelectionRange, because |
161 // GetSelectionRange may not be the latest value due to asynchronous of IPC | 153 // GetSelectionRange may not be the latest value due to asynchronous of IPC |
162 // between browser and renderer. | 154 // between browser and renderer. |
163 virtual void ExtendSelectionAndDelete(size_t before, size_t after) = 0; | 155 virtual void ExtendSelectionAndDelete(size_t before, size_t after) = 0; |
164 | 156 |
165 // Ensure the caret is not in |rect|. |rect| is in screen coordinates and | 157 // Ensure the caret is not in |rect|. |rect| is in screen coordinates in |
166 // may extend beyond the bounds of this TextInputClient. | 158 // DIP (Density Independent Pixel) and may extend beyond the bounds of this |
167 // Note: On Windows, the returned value is supposed to be DIP (Density | 159 // TextInputClient. |
168 // Independent Pixel). | |
169 // TODO(ime): Have a clear spec whether the returned value is DIP or not. | |
170 // http://crbug.com/360334 | |
171 virtual void EnsureCaretNotInRect(const gfx::Rect& rect) = 0; | 160 virtual void EnsureCaretNotInRect(const gfx::Rect& rect) = 0; |
172 | 161 |
173 // Returns true if |command| is currently allowed to be executed. | 162 // Returns true if |command| is currently allowed to be executed. |
174 virtual bool IsTextEditCommandEnabled(TextEditCommand command) const = 0; | 163 virtual bool IsTextEditCommandEnabled(TextEditCommand command) const = 0; |
175 | 164 |
176 // Execute |command| on the next key event. This allows a TextInputClient to | 165 // Execute |command| on the next key event. This allows a TextInputClient to |
177 // be informed of a platform-independent edit command that has been derived | 166 // be informed of a platform-independent edit command that has been derived |
178 // from the key event currently being dispatched (but not yet sent to the | 167 // from the key event currently being dispatched (but not yet sent to the |
179 // TextInputClient). The edit command will take into account any OS-specific, | 168 // TextInputClient). The edit command will take into account any OS-specific, |
180 // or user-specified, keybindings that may be set up. | 169 // or user-specified, keybindings that may be set up. |
181 virtual void SetTextEditCommandForNextKeyEvent(TextEditCommand command) = 0; | 170 virtual void SetTextEditCommandForNextKeyEvent(TextEditCommand command) = 0; |
182 }; | 171 }; |
183 | 172 |
184 } // namespace ui | 173 } // namespace ui |
185 | 174 |
186 #endif // UI_BASE_IME_TEXT_INPUT_CLIENT_H_ | 175 #endif // UI_BASE_IME_TEXT_INPUT_CLIENT_H_ |
OLD | NEW |