naiveproxy/ui/platform_window/mojo/text_input_state.mojom
2018-02-02 05:49:39 -05:00

73 lines
1.7 KiB
Plaintext

// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ui.mojom;
// Text input type which is based on blink::WebTextInputType.
enum TextInputType {
NONE,
TEXT,
PASSWORD,
SEARCH,
EMAIL,
NUMBER,
TELEPHONE,
URL,
DATE,
DATE_TIME,
DATE_TIME_LOCAL,
MONTH,
TIME,
WEEK,
TEXT_AREA,
CONTENT_EDITABLE,
DATE_TIME_FIELD,
MAX = DATE_TIME_FIELD,
};
// Text input flag which is based on blink::WebTextInputFlags.
enum TextInputFlag {
NONE,
AUTOCOMPLETE_ON = 0x001,
AUTOCOMPLETE_OFF = 0x002,
AUTOCORRECT_ON = 0x004,
AUTOCORRECT_OFF = 0x008,
SPELLCHECK_ON = 0x010,
SPELLCHECK_OFF = 0x020,
AUTOCAPITALIZE_NONE = 0x040,
AUTOCAPITALIZE_CHARACTERS = 0x080,
AUTOCAPITALIZE_WORDS = 0x100,
AUTOCAPITALIZE_SENTENCES = 0x200,
ALL = 0x3FF,
};
// Text input info which is based on blink::WebTextInputInfo.
struct TextInputState {
// The type of input field.
TextInputType type;
// The flags of the input field (autocorrect, autocomplete, etc.).
int32 flags;
// The value of the input field.
string? text;
// The cursor position of the current selection start, or the caret position
// if nothing is selected.
int32 selection_start;
// The cursor position of the current selection end, or the caret position
// if nothing is selected.
int32 selection_end;
// The start position of the current composition, or -1 if there is none.
int32 composition_start;
// The end position of the current composition, or -1 if there is none.
int32 composition_end;
// Whether or not inline composition can be performed for the current input.
bool can_compose_inline;
};