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
5 #include "ui/accessibility/ax_node_text_styles.h"
6
7 constexpr int kUnsetValue = -1;
8
9 namespace ui {
AXNodeTextStyles()10 AXNodeTextStyles::AXNodeTextStyles()
11 : background_color(kUnsetValue),
12 color(kUnsetValue),
13 invalid_state(kUnsetValue),
14 overline_style(kUnsetValue),
15 strikethrough_style(kUnsetValue),
16 text_direction(kUnsetValue),
17 text_position(kUnsetValue),
18 text_style(kUnsetValue),
19 underline_style(kUnsetValue),
20 font_size(kUnsetValue),
21 font_weight(kUnsetValue) {}
22
AXNodeTextStyles(AXNodeTextStyles && other)23 AXNodeTextStyles::AXNodeTextStyles(AXNodeTextStyles&& other)
24 : background_color(other.background_color),
25 color(other.color),
26 invalid_state(other.invalid_state),
27 overline_style(other.overline_style),
28 strikethrough_style(other.strikethrough_style),
29 text_direction(other.text_direction),
30 text_position(other.text_position),
31 text_style(other.text_style),
32 underline_style(other.underline_style),
33 font_size(other.font_size),
34 font_weight(other.font_weight),
35 font_family(std::move(other.font_family)) {}
36
operator =(AXNodeTextStyles && other)37 AXNodeTextStyles& AXNodeTextStyles::operator=(AXNodeTextStyles&& other) {
38 background_color = other.background_color;
39 color = other.color;
40 invalid_state = other.invalid_state;
41 overline_style = other.overline_style;
42 strikethrough_style = other.strikethrough_style;
43 text_direction = other.text_direction;
44 text_position = other.text_position;
45 text_style = other.text_style;
46 underline_style = other.underline_style;
47 font_size = other.font_size;
48 font_weight = other.font_weight;
49 font_family = other.font_family;
50
51 return *this;
52 }
53
operator ==(const AXNodeTextStyles & other) const54 bool AXNodeTextStyles::operator==(const AXNodeTextStyles& other) const {
55 return (background_color == other.background_color && color == other.color &&
56 invalid_state == other.invalid_state &&
57 overline_style == other.overline_style &&
58 strikethrough_style == other.strikethrough_style &&
59 text_direction == other.text_direction &&
60 text_position == other.text_position &&
61 font_size == other.font_size && font_weight == other.font_weight &&
62 text_style == other.text_style &&
63 underline_style == other.underline_style &&
64 font_family == other.font_family);
65 }
66
operator !=(const AXNodeTextStyles & other) const67 bool AXNodeTextStyles::operator!=(const AXNodeTextStyles& other) const {
68 return !operator==(other);
69 }
70
IsUnset() const71 bool AXNodeTextStyles::IsUnset() const {
72 return (background_color == kUnsetValue && invalid_state == kUnsetValue &&
73 overline_style == kUnsetValue && strikethrough_style == kUnsetValue &&
74 text_position == kUnsetValue && font_size == kUnsetValue &&
75 font_weight == kUnsetValue && text_style == kUnsetValue &&
76 underline_style == kUnsetValue && font_family.length() == 0);
77 }
78
79 } // namespace ui
80