// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ui.mojom;
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/text_direction.mojom";
import "ui/base/ime/mojom/ime_types.mojom";
import "ui/base/ime/mojom/virtual_keyboard_types.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/range/mojom/range.mojom";
// This structure contains ime text span and its bounds.
struct ImeTextSpanInfo {
ui.mojom.ImeTextSpan span;
gfx.mojom.Rect bounds;
};
// This structure represents the current editing state.
struct TextInputState {
// Identifier for the currently focused input field, or 0 if there is no
// focus. This identifier is unique for nodes within the same document.
int32 node_id = 0;
// Type of the input field.
ui.mojom.TextInputType type = ui.mojom.TextInputType.NONE;
// The mode of input field.
ui.mojom.TextInputMode mode = ui.mojom.TextInputMode.kDefault;
// The action of the input field.
ui.mojom.TextInputAction action = ui.mojom.TextInputAction.kDefault;
// The flags of input field (autocorrect, autocomplete, etc.)
// See ui/base/ime/text_input_flags.h for definitions.
uint32 flags;
// The value of input field.
mojo_base.mojom.BigString16? value;
// The current selection range, or the caret position if nothing is selected.
gfx.mojom.Range selection;
// The current composition range if there is one.
gfx.mojom.Range? composition;
// Whether or not inline composition can be performed for the current input.
bool can_compose_inline = true;
// Whether or not the IME should be shown as a result of this update. Even if
// true, the IME will only be shown if the input is appropriate (e.g. not
// TEXT_INPUT_TYPE_NONE).
bool show_ime_if_needed;
// Whether or not the IME should always be hidden as a result of this update.
bool always_hide_ime;
// Whether or not this is a reply to a request from IME.
bool reply_to_request;
// Store control and selection bounds of EditContext.
// These optionals will be nullopts if there isn't any active EditContext.
// For non EditContext scenarios, the bounds are returned via
// |GetCompositionCharacterBounds|
gfx.mojom.Rect? edit_context_control_bounds;
gfx.mojom.Rect? edit_context_selection_bounds;
// The virtualkeyboardpolicy of the input field.
ui.mojom.VirtualKeyboardPolicy vk_policy =
ui.mojom.VirtualKeyboardPolicy.AUTO;
// Whether or not show()/hide() API is called from VirtualKeyboard by web
// authors when the virtualkeyboardpolicy is manual.
ui.mojom.VirtualKeyboardVisibilityRequest last_vk_visibility_request =
ui.mojom.VirtualKeyboardVisibilityRequest.NONE;
// Information of ime text spans at the cursor position.
array<ImeTextSpanInfo> ime_text_spans_info;
};