ax_action_data.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Copyright 2016 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_ACTION_DATA_H_
  5. #define UI_ACCESSIBILITY_AX_ACTION_DATA_H_
  6. #include <string>
  7. #include "ui/accessibility/ax_base_export.h"
  8. #include "ui/accessibility/ax_enums.mojom-forward.h"
  9. #include "ui/accessibility/ax_node_data.h"
  10. #include "ui/accessibility/ax_tree_id.h"
  11. #include "ui/gfx/geometry/rect.h"
  12. namespace ui {
  13. // A compact representation of an accessibility action and the arguments
  14. // associated with that action.
  15. struct AX_BASE_EXPORT AXActionData {
  16. AXActionData();
  17. AXActionData(const AXActionData& other);
  18. ~AXActionData();
  19. // This is a simple serializable struct. All member variables should be
  20. // public and copyable.
  21. // See the ax::mojom::Action enums in ax_enums.mojom for explanations of which
  22. // parameters apply.
  23. // The action to take.
  24. ax::mojom::Action action;
  25. // The ID of the tree that this action should be performed on.
  26. ui::AXTreeID target_tree_id = ui::AXTreeIDUnknown();
  27. // The source extension id (if any) of this action.
  28. std::string source_extension_id;
  29. // The ID of the node that this action should be performed on.
  30. int target_node_id = -1;
  31. // The request id of this action tracked by the client.
  32. int request_id = -1;
  33. // Use enums from ax::mojom::ActionFlags
  34. int flags = 0;
  35. // For an action that creates a selection, the selection anchor and focus
  36. // (see ax_tree_data.h for definitions).
  37. int anchor_node_id = -1;
  38. int anchor_offset = -1;
  39. int focus_node_id = -1;
  40. int focus_offset = -1;
  41. // Start index of the text which should be queried for.
  42. int32_t start_index = -1;
  43. // End index of the text which should be queried for.
  44. int32_t end_index = -1;
  45. // For custom action.
  46. AXNodeID custom_action_id = kInvalidAXNodeID;
  47. // The target rect for the action.
  48. gfx::Rect target_rect;
  49. // The target point for the action in screen coordinates.
  50. gfx::Point target_point;
  51. // The new value for a node, for the SET_VALUE action. UTF-8 encoded.
  52. std::string value;
  53. // The event to fire in response to a HIT_TEST action.
  54. ax::mojom::Event hit_test_event_to_fire;
  55. // The scroll alignment to use for a SCROLL_TO_MAKE_VISIBLE action. The
  56. // scroll alignment controls where a node is scrolled within the viewport.
  57. ax::mojom::ScrollAlignment horizontal_scroll_alignment;
  58. ax::mojom::ScrollAlignment vertical_scroll_alignment;
  59. // The behavior to use for a SCROLL_TO_MAKE_VISIBLE. This controls whether or
  60. // not the viewport is scrolled when the node is already visible.
  61. ax::mojom::ScrollBehavior scroll_behavior;
  62. };
  63. } // namespace ui
  64. #endif // UI_ACCESSIBILITY_AX_ACTION_DATA_H_