blob: b72a7c3a5059de09aec2686a8b8aa00cbc85d003 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.accessibility.semantics;
using fuchsia.ui.gfx;
/// Represents actions that can be applied to Nodes.
enum Action {
/// The default action associated with the role of an element.
DEFAULT = 1;
};
/// Represents a role of an element on a UI.
enum Role {
/// Role used to represent elements which role is not currently supported.
UNKNOWN = 1;
};
/// An attribute is an essential property to describe an element. Unlike states, attributes do not
/// change over the life of an element.
/// Example: A button with a label attribute 'ok' should never change to 'cancel', as this is not
/// the same element.
table Attributes {
/// The label for an element. If longer than MAX_LABEL_SIZE the client is responsible for
/// truncating the label.
1: string:MAX_LABEL_SIZE label;
};
/// A state is a dynamic property of an element that may change in response to
/// user action or automated processes. Thus, they are different from attributes
/// in an important point, which is frequency of change.
/// Example: a checkbox can be checked / unchecked, and this state can be
/// altered via user input.
table States {
/// Whether the element is checked.
1: bool checked;
};
/// Node: data structure to represent semantic information about a UI element.
///
/// The Node represents a semantic element on an interface. This may
/// be a button, a text field, a checkbox or any element that has a relevant
/// semantic meaning so that assistive technology can understand the current UI.
table Node {
/// Unique ID that represents a node in a particular UI.
/// Zero is assumed to be the root node and the only entry point to the tree.
/// No forest is allowed.
1: uint32 node_id;
/// Role of this element, e.g. button, checkbox, etc.
2: Role role;
/// A table of states of this object, e.g. checked, editable, etc.
3: States states;
/// A table of attributes of this node.
4: Attributes attributes;
/// A list of actions that can be performed on this node.
5: vector<Action>:100 actions;
/// The list of child IDs of this node, in traversal order. Runtimes supplying semantic tree
/// information are responsible for ensuring the tree does not contain cycles. Each node may
/// have only one parent.
6: vector<uint32>:MAX_FAN_OUT child_ids;
/// Local bounding box of this element.
7: fuchsia.ui.gfx.BoundingBox location;
/// Transform from parent coordinate space to local space.
8: fuchsia.ui.gfx.mat4 transform;
};