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

Side by Side Diff: third_party/WebKit/Source/core/editing/InputMethodController.h

Issue 2650113004: [WIP] Add support for Android SuggestionSpans when editing text (Closed)
Patch Set: Remove logging statements, fix copyright years in new files Created 3 years, 10 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 /* 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 18 matching lines...) Expand all
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/dom/Range.h" 30 #include "core/dom/Range.h"
31 #include "core/dom/SynchronousMutationObserver.h" 31 #include "core/dom/SynchronousMutationObserver.h"
32 #include "core/editing/CompositionUnderline.h" 32 #include "core/editing/CompositionUnderline.h"
33 #include "core/editing/EphemeralRange.h" 33 #include "core/editing/EphemeralRange.h"
34 #include "core/editing/FrameSelection.h" 34 #include "core/editing/FrameSelection.h"
35 #include "core/editing/PlainTextRange.h" 35 #include "core/editing/PlainTextRange.h"
36 #include "platform/heap/Handle.h" 36 #include "platform/heap/Handle.h"
37 #include "public/platform/WebTextInputInfo.h" 37 #include "public/platform/WebTextInputInfo.h"
38 #include "public/platform/WebTextInputType.h" 38 #include "public/platform/WebTextInputType.h"
39 #include "public/web/WebTextSuggestionInfo.h"
39 #include "wtf/Vector.h" 40 #include "wtf/Vector.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 class Editor; 44 class Editor;
44 class LocalFrame; 45 class LocalFrame;
45 class Range; 46 class Range;
46 47
47 class CORE_EXPORT InputMethodController final 48 class CORE_EXPORT InputMethodController final
48 : public GarbageCollectedFinalized<InputMethodController>, 49 : public GarbageCollectedFinalized<InputMethodController>,
(...skipping 26 matching lines...) Expand all
75 // relative to the end of the inserting text. 76 // relative to the end of the inserting text.
76 bool commitText(const String& text, 77 bool commitText(const String& text,
77 const Vector<CompositionUnderline>& underlines, 78 const Vector<CompositionUnderline>& underlines,
78 int relativeCaretPosition); 79 int relativeCaretPosition);
79 80
80 // Inserts ongoing composing text; changes the selection to the end of 81 // Inserts ongoing composing text; changes the selection to the end of
81 // the inserting text if DoNotKeepSelection, or holds the selection if 82 // the inserting text if DoNotKeepSelection, or holds the selection if
82 // KeepSelection. 83 // KeepSelection.
83 bool finishComposingText(ConfirmCompositionBehavior); 84 bool finishComposingText(ConfirmCompositionBehavior);
84 85
86 void applySuggestionReplacement(int documentMarkerID, int suggestionIndex);
87 void deleteSuggestionHighlight();
88 void suggestionMenuClosed();
89
85 // Deletes the existing composition text. 90 // Deletes the existing composition text.
86 void cancelComposition(); 91 void cancelComposition();
87 92
88 EphemeralRange compositionEphemeralRange() const; 93 EphemeralRange compositionEphemeralRange() const;
89 Range* compositionRange() const; 94 Range* compositionRange() const;
90 95
91 void clear(); 96 void clear();
92 void documentAttached(Document*); 97 void documentAttached(Document*);
93 98
94 PlainTextRange getSelectionOffsets() const; 99 PlainTextRange getSelectionOffsets() const;
95 // Returns true if setting selection to specified offsets, otherwise false. 100 // Returns true if setting selection to specified offsets, otherwise false.
96 bool setEditableSelectionOffsets( 101 bool setEditableSelectionOffsets(
97 const PlainTextRange&, 102 const PlainTextRange&,
98 FrameSelection::SetSelectionOptions = FrameSelection::CloseTyping); 103 FrameSelection::SetSelectionOptions = FrameSelection::CloseTyping);
99 void extendSelectionAndDelete(int before, int after); 104 void extendSelectionAndDelete(int before, int after);
100 PlainTextRange createRangeForSelection(int start, 105 PlainTextRange createRangeForSelection(int start,
101 int end, 106 int end,
102 size_t textLength) const; 107 size_t textLength) const;
103 void deleteSurroundingText(int before, int after); 108 void deleteSurroundingText(int before, int after);
104 WebTextInputInfo textInputInfo() const; 109 WebTextInputInfo textInputInfo() const;
105 WebTextInputType textInputType() const; 110 WebTextInputType textInputType() const;
111 WebVector<blink::WebTextSuggestionInfo> getTextSuggestionInfosUnderCaret()
112 const;
113 void prepareForTextSuggestionMenuToBeShown();
106 114
107 // Call this when we will change focus. 115 // Call this when we will change focus.
108 void willChangeFocus(); 116 void willChangeFocus();
109 117
110 private: 118 private:
111 Document& document() const; 119 Document& document() const;
112 bool isAvailable() const; 120 bool isAvailable() const;
113 121
114 Member<LocalFrame> m_frame; 122 Member<LocalFrame> m_frame;
115 Member<Range> m_compositionRange; 123 Member<Range> m_compositionRange;
116 bool m_hasComposition; 124 bool m_hasComposition;
117 125
118 explicit InputMethodController(LocalFrame&); 126 explicit InputMethodController(LocalFrame&);
119 127
120 Editor& editor() const; 128 Editor& editor() const;
121 LocalFrame& frame() const { 129 LocalFrame& frame() const {
122 DCHECK(m_frame); 130 DCHECK(m_frame);
123 return *m_frame; 131 return *m_frame;
124 } 132 }
125 133
126 String composingText() const; 134 String composingText() const;
127 void selectComposition() const; 135 void selectComposition() const;
128 bool setSelectionOffsets( 136 bool setSelectionOffsets(
129 const PlainTextRange&, 137 const PlainTextRange&,
130 FrameSelection::SetSelectionOptions = FrameSelection::CloseTyping); 138 FrameSelection::SetSelectionOptions = FrameSelection::CloseTyping);
131 139
132 void addCompositionUnderlines(const Vector<CompositionUnderline>& underlines, 140 void addCompositionUnderlines(const Vector<CompositionUnderline>& underlines,
133 ContainerNode* rootEditableElement, 141 ContainerNode* rootEditableElement,
134 unsigned offset); 142 unsigned offset);
143 void clearSuggestionMarkersTouchingSelection();
135 144
136 bool insertText(const String&); 145 bool insertText(const String&);
137 bool insertTextAndMoveCaret(const String&, 146 bool insertTextAndMoveCaret(const String&,
138 int relativeCaretPosition, 147 int relativeCaretPosition,
139 const Vector<CompositionUnderline>& underlines); 148 const Vector<CompositionUnderline>& underlines);
140 149
141 // Inserts the given text string in the place of the existing composition. 150 // Inserts the given text string in the place of the existing composition.
142 // Returns true if did replace. 151 // Returns true if did replace.
143 bool replaceComposition(const String& text); 152 bool replaceComposition(const String& text);
144 // Inserts the given text string in the place of the existing composition 153 // Inserts the given text string in the place of the existing composition
(...skipping 12 matching lines...) Expand all
157 int textInputFlags() const; 166 int textInputFlags() const;
158 WebTextInputMode inputModeOfFocusedElement() const; 167 WebTextInputMode inputModeOfFocusedElement() const;
159 168
160 // Implements |SynchronousMutationObserver|. 169 // Implements |SynchronousMutationObserver|.
161 void contextDestroyed(Document*) final; 170 void contextDestroyed(Document*) final;
162 }; 171 };
163 172
164 } // namespace blink 173 } // namespace blink
165 174
166 #endif // InputMethodController_h 175 #endif // InputMethodController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698