Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 1 | // 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 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> |
| 9 | |
Dominic Mazzoni | f918279 | 2020-04-01 22:52:31 | [diff] [blame] | 10 | #include "ui/accessibility/ax_base_export.h" |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 11 | |
| 12 | namespace ui { |
| 13 | |
Nektarios Paisios | c78cd72 | 2021-08-03 14:35:52 | [diff] [blame^] | 14 | // 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. |
| 18 | struct 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-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 22 | |
Nektarios Paisios | c78cd72 | 2021-08-03 14:35:52 | [diff] [blame^] | 23 | AXTextAttributes(); |
| 24 | ~AXTextAttributes(); |
| 25 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 26 | AXTextAttributes(const AXTextAttributes& other) = delete; |
| 27 | AXTextAttributes& operator=(const AXTextAttributes&) = delete; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 28 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 29 | AXTextAttributes(AXTextAttributes&& other); |
| 30 | AXTextAttributes& operator=(AXTextAttributes&& other); |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 31 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 32 | bool operator==(const AXTextAttributes& other) const; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 33 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 34 | bool operator!=(const AXTextAttributes& other) const; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 35 | |
| 36 | bool IsUnset() const; |
| 37 | |
Nektarios Paisios | c78cd72 | 2021-08-03 14:35:52 | [diff] [blame^] | 38 | 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-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 49 | std::string font_family; |
| 50 | }; |
| 51 | |
| 52 | } // namespace ui |
| 53 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 54 | #endif // UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_ |