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 | #include "ui/accessibility/ax_text_attributes.h" |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 6 | |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 7 | namespace ui { |
Nektarios Paisios | c78cd72 | 2021-08-03 14:35:52 | [diff] [blame] | 8 | |
| 9 | AXTextAttributes::AXTextAttributes() = default; |
| 10 | |
| 11 | AXTextAttributes::~AXTextAttributes() = default; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 12 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 13 | AXTextAttributes::AXTextAttributes(AXTextAttributes&& other) |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 14 | : background_color(other.background_color), |
| 15 | color(other.color), |
| 16 | invalid_state(other.invalid_state), |
| 17 | overline_style(other.overline_style), |
| 18 | strikethrough_style(other.strikethrough_style), |
| 19 | text_direction(other.text_direction), |
| 20 | text_position(other.text_position), |
| 21 | text_style(other.text_style), |
| 22 | underline_style(other.underline_style), |
| 23 | font_size(other.font_size), |
| 24 | font_weight(other.font_weight), |
Benjamin Beaudry | 6d656d36 | 2022-02-24 21:21:55 | [diff] [blame] | 25 | font_family(std::move(other.font_family)), |
| 26 | marker_types(std::move(other.marker_types)), |
| 27 | highlight_types(std::move(other.highlight_types)) {} |
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::operator=(AXTextAttributes&& other) { |
Nektarios Paisios | c78cd72 | 2021-08-03 14:35:52 | [diff] [blame] | 30 | if (this == &other) |
| 31 | return *this; |
| 32 | |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 33 | background_color = other.background_color; |
| 34 | color = other.color; |
| 35 | invalid_state = other.invalid_state; |
| 36 | overline_style = other.overline_style; |
| 37 | strikethrough_style = other.strikethrough_style; |
| 38 | text_direction = other.text_direction; |
| 39 | text_position = other.text_position; |
| 40 | text_style = other.text_style; |
| 41 | underline_style = other.underline_style; |
| 42 | font_size = other.font_size; |
| 43 | font_weight = other.font_weight; |
| 44 | font_family = other.font_family; |
Benjamin Beaudry | 6d656d36 | 2022-02-24 21:21:55 | [diff] [blame] | 45 | marker_types = other.marker_types; |
| 46 | highlight_types = other.highlight_types; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 47 | |
| 48 | return *this; |
| 49 | } |
| 50 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 51 | bool AXTextAttributes::operator==(const AXTextAttributes& other) const { |
Benjamin Beaudry | 6d656d36 | 2022-02-24 21:21:55 | [diff] [blame] | 52 | return background_color == other.background_color && color == other.color && |
| 53 | invalid_state == other.invalid_state && |
| 54 | overline_style == other.overline_style && |
| 55 | strikethrough_style == other.strikethrough_style && |
| 56 | text_direction == other.text_direction && |
| 57 | text_position == other.text_position && font_size == other.font_size && |
| 58 | font_weight == other.font_weight && text_style == other.text_style && |
| 59 | underline_style == other.underline_style && |
| 60 | font_family == other.font_family && |
| 61 | marker_types == other.marker_types && |
| 62 | highlight_types == other.highlight_types; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 63 | } |
| 64 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 65 | bool AXTextAttributes::operator!=(const AXTextAttributes& other) const { |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 66 | return !operator==(other); |
| 67 | } |
| 68 | |
Nektarios Paisios | 70b6a5e5 | 2021-08-03 05:32:36 | [diff] [blame] | 69 | bool AXTextAttributes::IsUnset() const { |
Benjamin Beaudry | 6d656d36 | 2022-02-24 21:21:55 | [diff] [blame] | 70 | return background_color == kUnsetValue && invalid_state == kUnsetValue && |
| 71 | overline_style == kUnsetValue && strikethrough_style == kUnsetValue && |
| 72 | text_position == kUnsetValue && font_size == kUnsetValue && |
| 73 | font_weight == kUnsetValue && text_style == kUnsetValue && |
| 74 | underline_style == kUnsetValue && font_family.length() == 0 && |
| 75 | marker_types.size() == 0 && highlight_types.size() == 0; |
Kurt Catti-Schmidt | f738bce | 2019-05-08 01:06:56 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | } // namespace ui |