blob: 5cdb6bb7190224e51755965ef8aa9e5c1c8bb287 [file] [log] [blame]
Kurt Catti-Schmidtf738bce2019-05-08 01:06:561// Copyright 2019 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.
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>
9
Dominic Mazzonif9182792020-04-01 22:52:3110#include "ui/accessibility/ax_base_export.h"
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5611
12namespace ui {
13
Nektarios Paisiosc78cd722021-08-03 14:35:5214// A compact representation of text attributes, such as spelling markers and
15// style information, on an `AXNode`. This data represents a snapshot at a given
16// time and is not intended to be held for periods of time. For this reason, it
17// is a move-only class, to encourage deliberate short-term usage.
18struct AX_BASE_EXPORT AXTextAttributes final {
19 // For numeric attributes, the value to be used when a particular attribute is
20 // not set on the `AXNode`, or its value is otherwise unknown.
21 static constexpr int kUnsetValue = -1;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5622
Nektarios Paisiosc78cd722021-08-03 14:35:5223 AXTextAttributes();
24 ~AXTextAttributes();
25
Nektarios Paisios70b6a5e52021-08-03 05:32:3626 AXTextAttributes(const AXTextAttributes& other) = delete;
27 AXTextAttributes& operator=(const AXTextAttributes&) = delete;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5628
Nektarios Paisios70b6a5e52021-08-03 05:32:3629 AXTextAttributes(AXTextAttributes&& other);
30 AXTextAttributes& operator=(AXTextAttributes&& other);
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5631
Nektarios Paisios70b6a5e52021-08-03 05:32:3632 bool operator==(const AXTextAttributes& other) const;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5633
Nektarios Paisios70b6a5e52021-08-03 05:32:3634 bool operator!=(const AXTextAttributes& other) const;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5635
36 bool IsUnset() const;
37
Nektarios Paisiosc78cd722021-08-03 14:35:5238 int32_t background_color = kUnsetValue;
39 int32_t color = kUnsetValue;
40 int32_t invalid_state = kUnsetValue;
41 int32_t overline_style = kUnsetValue;
42 int32_t strikethrough_style = kUnsetValue;
43 int32_t text_direction = kUnsetValue;
44 int32_t text_position = kUnsetValue;
45 int32_t text_style = kUnsetValue;
46 int32_t underline_style = kUnsetValue;
47 float font_size = kUnsetValue;
48 float font_weight = kUnsetValue;
Kurt Catti-Schmidtf738bce2019-05-08 01:06:5649 std::string font_family;
50};
51
52} // namespace ui
53
Nektarios Paisios70b6a5e52021-08-03 05:32:3654#endif // UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_