ax_text_attributes.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #ifndef UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_
  5. #define UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_
  6. #include <string>
  7. #include <vector>
  8. #include "ui/accessibility/ax_base_export.h"
  9. namespace ui {
  10. // A compact representation of text attributes, such as spelling markers and
  11. // style information, on an `AXNode`. This data represents a snapshot at a given
  12. // time and is not intended to be held for periods of time. For this reason, it
  13. // is a move-only class, to encourage deliberate short-term usage.
  14. struct AX_BASE_EXPORT AXTextAttributes final {
  15. // For numeric attributes, the value to be used when a particular attribute is
  16. // not set on the `AXNode`, or its value is otherwise unknown.
  17. static constexpr int kUnsetValue = -1;
  18. AXTextAttributes();
  19. ~AXTextAttributes();
  20. AXTextAttributes(const AXTextAttributes& other) = delete;
  21. AXTextAttributes& operator=(const AXTextAttributes&) = delete;
  22. AXTextAttributes(AXTextAttributes&& other);
  23. AXTextAttributes& operator=(AXTextAttributes&& other);
  24. bool operator==(const AXTextAttributes& other) const;
  25. bool operator!=(const AXTextAttributes& other) const;
  26. bool IsUnset() const;
  27. int32_t background_color = kUnsetValue;
  28. int32_t color = kUnsetValue;
  29. int32_t invalid_state = kUnsetValue;
  30. int32_t overline_style = kUnsetValue;
  31. int32_t strikethrough_style = kUnsetValue;
  32. int32_t text_direction = kUnsetValue;
  33. int32_t text_position = kUnsetValue;
  34. int32_t text_style = kUnsetValue;
  35. int32_t underline_style = kUnsetValue;
  36. float font_size = kUnsetValue;
  37. float font_weight = kUnsetValue;
  38. std::string font_family;
  39. std::vector<int32_t> marker_types;
  40. std::vector<int32_t> highlight_types;
  41. };
  42. } // namespace ui
  43. #endif // UI_ACCESSIBILITY_AX_TEXT_ATTRIBUTES_H_