Avi Drissman | 3e1a26c | 2022-09-15 20:26:03 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 5 | #ifndef UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_ |
| 6 | #define UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_ |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 7 | |
| 8 | #include <string> |
Benjamin Beaudry | 6d656d36 | 2022-02-24 21:21:55 | [diff] [blame] | 9 | #include <vector> |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 10 | |
Dominic Mazzoni | f918279 | 2020-04-01 22:52:31 | [diff] [blame] | 11 | #include "ui/accessibility/ax_base_export.h" |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 12 | |
| 13 | namespace ui { |
| 14 | |
Nektarios Paisios | c78cd72 | 2021-08-03 14:35:52 | [diff] [blame] | 15 | // 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. |
| 19 | struct 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-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 23 | |
Nektarios Paisios | c78cd72 | 2021-08-03 14:35:52 | [diff] [blame] | 24 | AXTextAttributes(); |
| 25 | ~AXTextAttributes(); |
| 26 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 27 | AXTextAttributes(const AXTextAttributes& other) = delete; |
| 28 | AXTextAttributes& operator=(const AXTextAttributes&) = delete; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 29 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 30 | AXTextAttributes(AXTextAttributes&& other); |
| 31 | AXTextAttributes& operator=(AXTextAttributes&& other); |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 32 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 33 | bool operator==(const AXTextAttributes& other) const; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 34 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 35 | bool operator!=(const AXTextAttributes& other) const; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 36 | |
| 37 | bool IsUnset() const; |
| 38 | |
Nektarios Paisios | c78cd72 | 2021-08-03 14:35:52 | [diff] [blame] | 39 | 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-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 50 | std::string font_family; |
Benjamin Beaudry | 6d656d36 | 2022-02-24 21:21:55 | [diff] [blame] | 51 | std::vector<int32_t> marker_types; |
| 52 | std::vector<int32_t> highlight_types; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | } // namespace ui |
| 56 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 57 | #endif // UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_ |