Chromium Code Reviews| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 virtual base::i18n::TextDirection GetTextDirection() const = 0; | 74 virtual base::i18n::TextDirection GetTextDirection() const = 0; |
| 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 the scale factor of the screen in which the view of this | |
| 85 // TextInputClient has been located. | |
| 86 // This is used in the platform-dependent InputMethod implementations, on | |
| 87 // which the native IME requires the non-dip coordinates from | |
| 88 // GetCaretBounds, etc. | |
| 89 virtual float GetScaleFactor() const = 0; | |
|
sadrul
2016/12/22 01:30:22
Unfortunately, there are several types of scale fa
Shu Chen
2016/12/22 03:02:27
Done.
I've removed the GetScaleFactor method.
| |
| 90 | |
| 84 // Returns current caret (insertion point) bounds in the universal screen | 91 // Returns current caret (insertion point) bounds in the universal screen |
| 85 // coordinates. If there is selection, then the selection bounds will be | 92 // coordinates in DIP (Density Independent Pixel). |
| 86 // returned. | 93 // 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; | 94 virtual gfx::Rect GetCaretBounds() const = 0; |
| 92 | 95 |
| 93 // Retrieves the composition character boundary rectangle in the universal | 96 // Retrieves the composition character boundary rectangle in the universal |
| 94 // screen coordinates. The |index| is zero-based index of character position | 97 // screen coordinates in DIP (Density Independent Pixel). |
| 95 // in composition text. | 98 // 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. | 99 // 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. | 100 // 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, | 101 virtual bool GetCompositionCharacterBounds(uint32_t index, |
| 103 gfx::Rect* rect) const = 0; | 102 gfx::Rect* rect) const = 0; |
| 104 | 103 |
| 105 // Returns true if there is composition text. | 104 // Returns true if there is composition text. |
| 106 virtual bool HasCompositionText() const = 0; | 105 virtual bool HasCompositionText() const = 0; |
| 107 | 106 |
| 108 // Document content operations ---------------------------------------------- | 107 // Document content operations ---------------------------------------------- |
| 109 | 108 |
| 110 // Retrieves the UTF-16 based character range containing accessible text in | 109 // Retrieves the UTF-16 based character range containing accessible text in |
| 111 // the View. It must cover the composition and selection range. | 110 // 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( | 154 virtual bool ChangeTextDirectionAndLayoutAlignment( |
| 156 base::i18n::TextDirection direction) = 0; | 155 base::i18n::TextDirection direction) = 0; |
| 157 | 156 |
| 158 // Deletes the current selection plus the specified number of characters | 157 // Deletes the current selection plus the specified number of characters |
| 159 // before and after the selection or caret. This function should be used | 158 // before and after the selection or caret. This function should be used |
| 160 // instead of calling DeleteRange with GetSelectionRange, because | 159 // instead of calling DeleteRange with GetSelectionRange, because |
| 161 // GetSelectionRange may not be the latest value due to asynchronous of IPC | 160 // GetSelectionRange may not be the latest value due to asynchronous of IPC |
| 162 // between browser and renderer. | 161 // between browser and renderer. |
| 163 virtual void ExtendSelectionAndDelete(size_t before, size_t after) = 0; | 162 virtual void ExtendSelectionAndDelete(size_t before, size_t after) = 0; |
| 164 | 163 |
| 165 // Ensure the caret is not in |rect|. |rect| is in screen coordinates and | 164 // Ensure the caret is not in |rect|. |rect| is the screen coordinates in |
| 166 // may extend beyond the bounds of this TextInputClient. | 165 // 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 | 166 // 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; | 167 virtual void EnsureCaretNotInRect(const gfx::Rect& rect) = 0; |
| 172 | 168 |
| 173 // Returns true if |command| is currently allowed to be executed. | 169 // Returns true if |command| is currently allowed to be executed. |
| 174 virtual bool IsTextEditCommandEnabled(TextEditCommand command) const = 0; | 170 virtual bool IsTextEditCommandEnabled(TextEditCommand command) const = 0; |
| 175 | 171 |
| 176 // Execute |command| on the next key event. This allows a TextInputClient to | 172 // 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 | 173 // 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 | 174 // 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, | 175 // TextInputClient). The edit command will take into account any OS-specific, |
| 180 // or user-specified, keybindings that may be set up. | 176 // or user-specified, keybindings that may be set up. |
| 181 virtual void SetTextEditCommandForNextKeyEvent(TextEditCommand command) = 0; | 177 virtual void SetTextEditCommandForNextKeyEvent(TextEditCommand command) = 0; |
| 182 }; | 178 }; |
| 183 | 179 |
| 184 } // namespace ui | 180 } // namespace ui |
| 185 | 181 |
| 186 #endif // UI_BASE_IME_TEXT_INPUT_CLIENT_H_ | 182 #endif // UI_BASE_IME_TEXT_INPUT_CLIENT_H_ |
| OLD | NEW |