MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / ui / platform_window / text_input_state.h
blob14d016bcede790835eb8df9a43d19c28909b15fb
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_PLATFORM_WINDOW_TEXT_INPUT_STATE_H_
6 #define UI_PLATFORM_WINDOW_TEXT_INPUT_STATE_H_
8 #include <string>
10 #include "ui/base/ime/text_input_flags.h"
11 #include "ui/base/ime/text_input_type.h"
13 namespace ui {
15 // Text input info which is based on blink::WebTextInputInfo.
16 struct TextInputState {
17 TextInputState();
18 TextInputState(TextInputType type,
19 int flags,
20 const std::string& text,
21 int selection_start,
22 int selection_end,
23 int composition_start,
24 int composition_end,
25 bool can_compose_inline);
26 bool operator==(const TextInputState& other) const;
28 // The type of input field.
29 TextInputType type;
31 // The flags of the input field (autocorrect, autocomplete, etc.).
32 int flags;
34 // The value of the input field.
35 std::string text;
37 // The cursor position of the current selection start, or the caret position
38 // if nothing is selected.
39 int selection_start;
41 // The cursor position of the current selection end, or the caret position
42 // if nothing is selected.
43 int selection_end;
45 // The start position of the current composition, or -1 if there is none.
46 int composition_start;
48 // The end position of the current composition, or -1 if there is none.
49 int composition_end;
51 // Whether or not inline composition can be performed for the current input.
52 bool can_compose_inline;
55 } // namespace ui
57 #endif // UI_PLATFORM_WINDOW_TEXT_INPUT_STATE_H_