OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 DoNotKeepSelection, | 55 DoNotKeepSelection, |
56 KeepSelection, | 56 KeepSelection, |
57 }; | 57 }; |
58 | 58 |
59 static InputMethodController* create(LocalFrame&); | 59 static InputMethodController* create(LocalFrame&); |
60 virtual ~InputMethodController(); | 60 virtual ~InputMethodController(); |
61 DECLARE_TRACE(); | 61 DECLARE_TRACE(); |
62 | 62 |
63 // international text input composition | 63 // international text input composition |
64 bool hasComposition() const; | 64 bool hasComposition() const; |
65 void setComposition(const String&, | 65 void setComposition(const String& text, |
66 const Vector<CompositionUnderline>&, | 66 const Vector<CompositionUnderline>& underlines, |
67 int selectionStart, | 67 int selectionStart, |
68 int selectionEnd); | 68 int selectionEnd); |
69 void setCompositionFromExistingText(const Vector<CompositionUnderline>&, | 69 void setCompositionFromExistingText(const Vector<CompositionUnderline>& text, |
70 unsigned compositionStart, | 70 unsigned compositionStart, |
71 unsigned compositionEnd); | 71 unsigned compositionEnd); |
72 | 72 |
73 // Deletes ongoing composing text if any, inserts specified text, and | 73 // Deletes ongoing composing text if any, inserts specified text, and |
74 // changes the selection according to relativeCaretPosition, which is | 74 // changes the selection according to relativeCaretPosition, which is |
75 // relative to the end of the inserting text. | 75 // relative to the end of the inserting text. |
76 bool commitText(const String& text, int relativeCaretPosition); | 76 bool commitText(const String& text, |
| 77 const Vector<CompositionUnderline>& underlines, |
| 78 int relativeCaretPosition); |
77 | 79 |
78 // Inserts ongoing composing text; changes the selection to the end of | 80 // Inserts ongoing composing text; changes the selection to the end of |
79 // the inserting text if DoNotKeepSelection, or holds the selection if | 81 // the inserting text if DoNotKeepSelection, or holds the selection if |
80 // KeepSelection. | 82 // KeepSelection. |
81 bool finishComposingText(ConfirmCompositionBehavior); | 83 bool finishComposingText(ConfirmCompositionBehavior); |
82 | 84 |
83 // Deletes the existing composition text. | 85 // Deletes the existing composition text. |
84 void cancelComposition(); | 86 void cancelComposition(); |
85 | 87 |
86 void cancelCompositionIfSelectionIsInvalid(); | 88 void cancelCompositionIfSelectionIsInvalid(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 DCHECK(m_frame); | 123 DCHECK(m_frame); |
122 return *m_frame; | 124 return *m_frame; |
123 } | 125 } |
124 | 126 |
125 String composingText() const; | 127 String composingText() const; |
126 void selectComposition() const; | 128 void selectComposition() const; |
127 bool setSelectionOffsets( | 129 bool setSelectionOffsets( |
128 const PlainTextRange&, | 130 const PlainTextRange&, |
129 FrameSelection::SetSelectionOptions = FrameSelection::CloseTyping); | 131 FrameSelection::SetSelectionOptions = FrameSelection::CloseTyping); |
130 | 132 |
| 133 void addCompositionUnderlines(const Vector<CompositionUnderline>& underlines, |
| 134 Node* baseNode, |
| 135 unsigned baseOffset); |
| 136 |
131 bool insertText(const String&); | 137 bool insertText(const String&); |
132 bool insertTextAndMoveCaret(const String&, int relativeCaretPosition); | 138 bool insertTextAndMoveCaret(const String&, |
| 139 int relativeCaretPosition, |
| 140 const Vector<CompositionUnderline>& underlines); |
133 | 141 |
134 // Inserts the given text string in the place of the existing composition. | 142 // Inserts the given text string in the place of the existing composition. |
135 // Returns true if did replace. | 143 // Returns true if did replace. |
136 bool replaceComposition(const String& text); | 144 bool replaceComposition(const String& text); |
137 // Inserts the given text string in the place of the existing composition | 145 // Inserts the given text string in the place of the existing composition |
138 // and moves caret. Returns true if did replace and moved caret successfully. | 146 // and moves caret. Returns true if did replace and moved caret successfully. |
139 bool replaceCompositionAndMoveCaret(const String&, int relativeCaretPosition); | 147 bool replaceCompositionAndMoveCaret( |
| 148 const String&, |
| 149 int relativeCaretPosition, |
| 150 const Vector<CompositionUnderline>& underlines); |
140 | 151 |
141 // Returns true if moved caret successfully. | 152 // Returns true if moved caret successfully. |
142 bool moveCaret(int newCaretPosition); | 153 bool moveCaret(int newCaretPosition); |
143 | 154 |
144 PlainTextRange createSelectionRangeForSetComposition(int selectionStart, | 155 PlainTextRange createSelectionRangeForSetComposition(int selectionStart, |
145 int selectionEnd, | 156 int selectionEnd, |
146 size_t textLength) const; | 157 size_t textLength) const; |
147 int textInputFlags() const; | 158 int textInputFlags() const; |
148 WebTextInputMode inputModeOfFocusedElement() const; | 159 WebTextInputMode inputModeOfFocusedElement() const; |
149 | 160 |
150 // Implements |SynchronousMutationObserver|. | 161 // Implements |SynchronousMutationObserver|. |
151 void contextDestroyed() final; | 162 void contextDestroyed() final; |
152 }; | 163 }; |
153 | 164 |
154 } // namespace blink | 165 } // namespace blink |
155 | 166 |
156 #endif // InputMethodController_h | 167 #endif // InputMethodController_h |
OLD | NEW |