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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2016 Google Inc. All rights reserved. 2 * Copyright (C) 2016 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef DOMVisualViewport_h 31 #ifndef WebInputMethodController_h
32 #define DOMVisualViewport_h 32 #define WebInputMethodController_h
33 33
34 #include "bindings/core/v8/ScriptWrappable.h" 34 #include "WebCompositionUnderline.h"
35 #include "core/dom/ExecutionContext.h" 35 #include "WebWidget.h"
36 #include "core/events/EventTarget.h"
37 #include "platform/heap/Handle.h"
38 36
39 namespace blink { 37 namespace blink {
40 38
41 class LocalDOMWindow; 39 class WebString;
42 class ExecutionContext; 40 template <typename T>
41 class WebVector;
43 42
44 class DOMVisualViewport final : public EventTargetWithInlineData { 43 class WebInputMethodController {
45 DEFINE_WRAPPERTYPEINFO(); 44
46 public: 45 public:
47 static DOMVisualViewport* create(LocalDOMWindow* window) 46 enum ConfirmCompositionBehavior {
48 { 47 DoNotKeepSelection,
49 return new DOMVisualViewport(window); 48 KeepSelection,
50 } 49 };
51 50
52 ~DOMVisualViewport() override; 51 virtual ~WebInputMethodController() {};
52 // Called to inform the WebInputMethodController of a new composition text.
53 // If selectionStart and selectionEnd has the same value, then it indicates
54 // the input caret position. If the text is empty, then the existing
55 // composition text will be canceled.
56 // Returns true if the composition text was set successfully.
57 virtual bool setComposition(
58 const WebString& text,
59 const WebVector<WebCompositionUnderline>& underlines,
60 int selectionStart,
61 int selectionEnd)
62 = 0;
53 63
54 DECLARE_VIRTUAL_TRACE(); 64 // Called to inform the WebWidget that deleting the ongoing composition if
65 // any, inserting the specified text, and moving the caret according to
66 // relativeCaretPosition.
67 virtual bool commitText(const WebString& text, int relativeCaretPosition) = 0;
55 68
56 // EventTarget overrides: 69 // Called to inform the WebWidget to confirm an ongoing composition.
57 const AtomicString& interfaceName() const override; 70 virtual bool finishComposingText(ConfirmCompositionBehavior selectionBehavio r) = 0;
58 ExecutionContext* getExecutionContext() const override;
59
60 double scrollLeft();
61 double scrollTop();
62 double pageX();
63 double pageY();
64 double clientWidth();
65 double clientHeight();
66 double scale();
67
68 private:
69 explicit DOMVisualViewport(LocalDOMWindow*);
70
71 Member<LocalDOMWindow> m_window;
72 }; 71 };
73 72
74 } // namespace blink 73 } // namespace blink
75 74 #endif
76 #endif // DOMVisualViewport_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698