| OLD | NEW |
| 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 Loading... |
| 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 // Called to inform the WebInputMethodController of a new composition text. |
| 52 // If selectionStart and selectionEnd has the same value, then it indicates |
| 53 // the input caret position. If the text is empty, then the existing |
| 54 // composition text will be canceled. |
| 55 // Returns true if the composition text was set successfully. |
| 56 virtual bool setComposition( |
| 57 const WebString& text, |
| 58 const WebVector<WebCompositionUnderline>& underlines, |
| 59 int selectionStart, |
| 60 int selectionEnd) { return false; } |
| 53 | 61 |
| 54 DECLARE_VIRTUAL_TRACE(); | 62 // Called to inform the WebWidget that deleting the ongoing composition if |
| 63 // any, inserting the specified text, and moving the caret according to |
| 64 // relativeCaretPosition. |
| 65 virtual bool commitText(const WebString& text, int relativeCaretPosition) {
return false; } |
| 55 | 66 |
| 56 // EventTarget overrides: | 67 // Called to inform the WebWidget to confirm an ongoing composition. |
| 57 const AtomicString& interfaceName() const override; | 68 virtual bool finishComposingText(WebWidget::ConfirmCompositionBehavior selec
tionBehavior) { return false; } |
| 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 }; | 69 }; |
| 73 | 70 |
| 74 } // namespace blink | 71 } // namespace blink |
| 75 | 72 #endif |
| 76 #endif // DOMVisualViewport_h | |
| OLD | NEW |