ax_text_attributes.cc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #include "ui/accessibility/ax_text_attributes.h"
  5. namespace ui {
  6. AXTextAttributes::AXTextAttributes() = default;
  7. AXTextAttributes::~AXTextAttributes() = default;
  8. AXTextAttributes::AXTextAttributes(AXTextAttributes&& other)
  9. : background_color(other.background_color),
  10. color(other.color),
  11. invalid_state(other.invalid_state),
  12. overline_style(other.overline_style),
  13. strikethrough_style(other.strikethrough_style),
  14. text_direction(other.text_direction),
  15. text_position(other.text_position),
  16. text_style(other.text_style),
  17. underline_style(other.underline_style),
  18. font_size(other.font_size),
  19. font_weight(other.font_weight),
  20. font_family(std::move(other.font_family)),
  21. marker_types(std::move(other.marker_types)),
  22. highlight_types(std::move(other.highlight_types)) {}
  23. AXTextAttributes& AXTextAttributes::operator=(AXTextAttributes&& other) {
  24. if (this == &other)
  25. return *this;
  26. background_color = other.background_color;
  27. color = other.color;
  28. invalid_state = other.invalid_state;
  29. overline_style = other.overline_style;
  30. strikethrough_style = other.strikethrough_style;
  31. text_direction = other.text_direction;
  32. text_position = other.text_position;
  33. text_style = other.text_style;
  34. underline_style = other.underline_style;
  35. font_size = other.font_size;
  36. font_weight = other.font_weight;
  37. font_family = other.font_family;
  38. marker_types = other.marker_types;
  39. highlight_types = other.highlight_types;
  40. return *this;
  41. }
  42. bool AXTextAttributes::operator==(const AXTextAttributes& other) const {
  43. return background_color == other.background_color && color == other.color &&
  44. invalid_state == other.invalid_state &&
  45. overline_style == other.overline_style &&
  46. strikethrough_style == other.strikethrough_style &&
  47. text_direction == other.text_direction &&
  48. text_position == other.text_position && font_size == other.font_size &&
  49. font_weight == other.font_weight && text_style == other.text_style &&
  50. underline_style == other.underline_style &&
  51. font_family == other.font_family &&
  52. marker_types == other.marker_types &&
  53. highlight_types == other.highlight_types;
  54. }
  55. bool AXTextAttributes::operator!=(const AXTextAttributes& other) const {
  56. return !operator==(other);
  57. }
  58. bool AXTextAttributes::IsUnset() const {
  59. return background_color == kUnsetValue && invalid_state == kUnsetValue &&
  60. overline_style == kUnsetValue && strikethrough_style == kUnsetValue &&
  61. text_position == kUnsetValue && font_size == kUnsetValue &&
  62. font_weight == kUnsetValue && text_style == kUnsetValue &&
  63. underline_style == kUnsetValue && font_family.length() == 0 &&
  64. marker_types.size() == 0 && highlight_types.size() == 0;
  65. }
  66. } // namespace ui