blob: c29802381e2a71ae2320881a8df55067f213e122 [file] [log] [blame]
Avi Drissman3e1a26c2022-09-15 20:26:031// Copyright 2019 The Chromium Authors
Kurt Catti-Schmidtf738bce2019-05-08 01:06:562// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Nektarios Paisios70b6a5e52021-08-03 05:32:365#ifndef UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_
6#define UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_
Kurt Catti-Schmidtf738bce2019-05-08 01:06:567
8#include <string>
Benjamin Beaudry6d656d362022-02-24 21:21:559#include <vector>
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5610
Dominic Mazzonif9182792020-04-01 22:52:3111#include "ui/accessibility/ax_base_export.h"
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5612
13namespace ui {
14
Nektarios Paisiosc78cd722021-08-03 14:35:5215// A compact representation of text attributes, such as spelling markers and
16// style information, on an `AXNode`. This data represents a snapshot at a given
17// time and is not intended to be held for periods of time. For this reason, it
18// is a move-only class, to encourage deliberate short-term usage.
19struct AX_BASE_EXPORT AXTextAttributes final {
20 // For numeric attributes, the value to be used when a particular attribute is
21 // not set on the `AXNode`, or its value is otherwise unknown.
22 static constexpr int kUnsetValue = -1;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5623
Nektarios Paisiosc78cd722021-08-03 14:35:5224 AXTextAttributes();
25 ~AXTextAttributes();
26
Nektarios Paisios70b6a5e52021-08-03 05:32:3627 AXTextAttributes(const AXTextAttributes& other) = delete;
28 AXTextAttributes& operator=(const AXTextAttributes&) = delete;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5629
Nektarios Paisios70b6a5e52021-08-03 05:32:3630 AXTextAttributes(AXTextAttributes&& other);
31 AXTextAttributes& operator=(AXTextAttributes&& other);
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5632
Nektarios Paisios70b6a5e52021-08-03 05:32:3633 bool operator==(const AXTextAttributes& other) const;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5634
Nektarios Paisios70b6a5e52021-08-03 05:32:3635 bool operator!=(const AXTextAttributes& other) const;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5636
37 bool IsUnset() const;
38
Nektarios Paisiosc78cd722021-08-03 14:35:5239 int32_t background_color = kUnsetValue;
40 int32_t color = kUnsetValue;
41 int32_t invalid_state = kUnsetValue;
42 int32_t overline_style = kUnsetValue;
43 int32_t strikethrough_style = kUnsetValue;
44 int32_t text_direction = kUnsetValue;
45 int32_t text_position = kUnsetValue;
46 int32_t text_style = kUnsetValue;
47 int32_t underline_style = kUnsetValue;
48 float font_size = kUnsetValue;
49 float font_weight = kUnsetValue;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5650 std::string font_family;
Benjamin Beaudry6d656d362022-02-24 21:21:5551 std::vector<int32_t> marker_types;
52 std::vector<int32_t> highlight_types;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5653};
54
55} // namespace ui
56
Nektarios Paisios70b6a5e52021-08-03 05:32:3657#endif // UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_