| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef WebTextInputInfo_h | 26 #ifndef WebTextInputInfo_h |
| 27 #define WebTextInputInfo_h | 27 #define WebTextInputInfo_h |
| 28 | 28 |
| 29 #include "WebCommon.h" | 29 #include "WebCommon.h" |
| 30 #include "WebString.h" | 30 #include "WebString.h" |
| 31 #include "WebTextInputMode.h" |
| 31 #include "WebTextInputType.h" | 32 #include "WebTextInputType.h" |
| 32 | 33 |
| 33 namespace blink { | 34 namespace blink { |
| 34 | 35 |
| 35 struct WebTextInputInfo { | 36 struct WebTextInputInfo { |
| 36 WebTextInputType type; | 37 WebTextInputType type; |
| 37 int flags; | 38 int flags; |
| 38 | 39 |
| 39 // The value of the currently focused input field. | 40 // The value of the currently focused input field. |
| 40 WebString value; | 41 WebString value; |
| 41 | 42 |
| 42 // The cursor position of the current selection start, or the caret position | 43 // The cursor position of the current selection start, or the caret position |
| 43 // if nothing is selected. | 44 // if nothing is selected. |
| 44 int selectionStart; | 45 int selectionStart; |
| 45 | 46 |
| 46 // The cursor position of the current selection end, or the caret position | 47 // The cursor position of the current selection end, or the caret position |
| 47 // if nothing is selected. | 48 // if nothing is selected. |
| 48 int selectionEnd; | 49 int selectionEnd; |
| 49 | 50 |
| 50 // The start position of the current composition, or -1 if there is none. | 51 // The start position of the current composition, or -1 if there is none. |
| 51 int compositionStart; | 52 int compositionStart; |
| 52 | 53 |
| 53 // The end position of the current composition, or -1 if there is none. | 54 // The end position of the current composition, or -1 if there is none. |
| 54 int compositionEnd; | 55 int compositionEnd; |
| 55 | 56 |
| 56 // The inputmode attribute value of the currently focused input field. | 57 // The inputmode attribute value of the currently focused input field. |
| 57 // This string is lower-case. | 58 WebTextInputMode inputMode; |
| 58 WebString inputMode; | |
| 59 | 59 |
| 60 BLINK_PLATFORM_EXPORT bool equals(const WebTextInputInfo&) const; | 60 BLINK_PLATFORM_EXPORT bool equals(const WebTextInputInfo&) const; |
| 61 | 61 |
| 62 WebTextInputInfo() | 62 WebTextInputInfo() |
| 63 : type(WebTextInputTypeNone), | 63 : type(WebTextInputTypeNone), |
| 64 flags(WebTextInputFlagNone), | 64 flags(WebTextInputFlagNone), |
| 65 selectionStart(0), | 65 selectionStart(0), |
| 66 selectionEnd(0), | 66 selectionEnd(0), |
| 67 compositionStart(-1), | 67 compositionStart(-1), |
| 68 compositionEnd(-1) {} | 68 compositionEnd(-1), |
| 69 inputMode(kWebTextInputModeDefault) {} |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 inline bool operator==(const WebTextInputInfo& a, const WebTextInputInfo& b) { | 72 inline bool operator==(const WebTextInputInfo& a, const WebTextInputInfo& b) { |
| 72 return a.equals(b); | 73 return a.equals(b); |
| 73 } | 74 } |
| 74 | 75 |
| 75 inline bool operator!=(const WebTextInputInfo& a, const WebTextInputInfo& b) { | 76 inline bool operator!=(const WebTextInputInfo& a, const WebTextInputInfo& b) { |
| 76 return !(a == b); | 77 return !(a == b); |
| 77 } | 78 } |
| 78 | 79 |
| 79 } // namespace blink | 80 } // namespace blink |
| 80 | 81 |
| 81 #endif | 82 #endif |
| OLD | NEW |