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

Unified Diff: third_party/WebKit/public/web/WebInputMethodController.h

Issue 2333813002: Introduce WebInputMethodController to blink (Closed)
Patch Set: Moved ConfirmCompositionBehavior to WebInputMethodController Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/public/web/WebInputMethodController.h
diff --git a/third_party/WebKit/Source/core/frame/DOMVisualViewport.h b/third_party/WebKit/public/web/WebInputMethodController.h
similarity index 55%
copy from third_party/WebKit/Source/core/frame/DOMVisualViewport.h
copy to third_party/WebKit/public/web/WebInputMethodController.h
index 2d3a1b508ecf51394124ee6055b36913d5eb5e52..e7675c9087780cf0837415bbb60b181ce4cebf33 100644
--- a/third_party/WebKit/Source/core/frame/DOMVisualViewport.h
+++ b/third_party/WebKit/public/web/WebInputMethodController.h
@@ -28,49 +28,47 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DOMVisualViewport_h
-#define DOMVisualViewport_h
+#ifndef WebInputMethodController_h
+#define WebInputMethodController_h
-#include "bindings/core/v8/ScriptWrappable.h"
-#include "core/dom/ExecutionContext.h"
-#include "core/events/EventTarget.h"
-#include "platform/heap/Handle.h"
+#include "WebCompositionUnderline.h"
+#include "WebWidget.h"
namespace blink {
-class LocalDOMWindow;
-class ExecutionContext;
+class WebString;
+template <typename T>
+class WebVector;
-class DOMVisualViewport final : public EventTargetWithInlineData {
- DEFINE_WRAPPERTYPEINFO();
-public:
- static DOMVisualViewport* create(LocalDOMWindow* window)
- {
- return new DOMVisualViewport(window);
- }
-
- ~DOMVisualViewport() override;
-
- DECLARE_VIRTUAL_TRACE();
+class WebInputMethodController {
- // EventTarget overrides:
- const AtomicString& interfaceName() const override;
- ExecutionContext* getExecutionContext() const override;
+public:
+ enum ConfirmCompositionBehavior {
+ DoNotKeepSelection,
+ KeepSelection,
+ };
- double scrollLeft();
- double scrollTop();
- double pageX();
- double pageY();
- double clientWidth();
- double clientHeight();
- double scale();
+ virtual ~WebInputMethodController() {};
+ // Called to inform the WebInputMethodController of a new composition text.
+ // If selectionStart and selectionEnd has the same value, then it indicates
+ // the input caret position. If the text is empty, then the existing
+ // composition text will be canceled.
+ // Returns true if the composition text was set successfully.
+ virtual bool setComposition(
+ const WebString& text,
+ const WebVector<WebCompositionUnderline>& underlines,
+ int selectionStart,
+ int selectionEnd)
+ = 0;
-private:
- explicit DOMVisualViewport(LocalDOMWindow*);
+ // Called to inform the WebWidget that deleting the ongoing composition if
+ // any, inserting the specified text, and moving the caret according to
+ // relativeCaretPosition.
+ virtual bool commitText(const WebString& text, int relativeCaretPosition) = 0;
- Member<LocalDOMWindow> m_window;
+ // Called to inform the WebWidget to confirm an ongoing composition.
+ virtual bool finishComposingText(ConfirmCompositionBehavior selectionBehavior) = 0;
};
} // namespace blink
-
-#endif // DOMVisualViewport_h
+#endif

Powered by Google App Engine
This is Rietveld 408576698