File: ax_action_data_mojom_traits.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (89 lines) | stat: -rw-r--r-- 3,061 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_ACCESSIBILITY_MOJOM_AX_ACTION_DATA_MOJOM_TRAITS_H_
#define UI_ACCESSIBILITY_MOJOM_AX_ACTION_DATA_MOJOM_TRAITS_H_

#include <stdint.h>

#include <optional>
#include <string>

#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_tree_id.h"
#include "ui/accessibility/mojom/ax_action_data.mojom-shared.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"

namespace mojo {

template <>
struct StructTraits<ax::mojom::AXActionDataDataView, ui::AXActionData> {
  static ax::mojom::Action action(const ui::AXActionData& a) {
    return a.action;
  }
  static const ui::AXTreeID& target_tree_id(const ui::AXActionData& a) {
    return a.target_tree_id;
  }
  static const std::string& source_extension_id(const ui::AXActionData& a) {
    return a.source_extension_id;
  }
  static int32_t target_node_id(const ui::AXActionData& a) {
    return a.target_node_id;
  }
  static ax::mojom::Role target_role(const ui::AXActionData& a) {
    return a.target_role;
  }
  static int32_t request_id(const ui::AXActionData& a) { return a.request_id; }
  static int32_t flags(const ui::AXActionData& a) { return a.flags; }
  static int32_t anchor_node_id(const ui::AXActionData& a) {
    return a.anchor_node_id;
  }
  static int32_t anchor_offset(const ui::AXActionData& a) {
    return a.anchor_offset;
  }
  static int32_t focus_node_id(const ui::AXActionData& a) {
    return a.focus_node_id;
  }
  static int32_t focus_offset(const ui::AXActionData& a) {
    return a.focus_offset;
  }
  static int32_t custom_action_id(const ui::AXActionData& a) {
    return a.custom_action_id;
  }
  static const gfx::Rect& target_rect(const ui::AXActionData& a) {
    return a.target_rect;
  }
  static const gfx::Point& target_point(const ui::AXActionData& a) {
    return a.target_point;
  }
  static const std::string& value(const ui::AXActionData& a) { return a.value; }
  static ax::mojom::Event hit_test_event_to_fire(const ui::AXActionData& a) {
    return a.hit_test_event_to_fire;
  }
  static ax::mojom::ScrollAlignment horizontal_scroll_alignment(
      const ui::AXActionData& a) {
    return a.horizontal_scroll_alignment;
  }
  static ax::mojom::ScrollAlignment vertical_scroll_alignment(
      const ui::AXActionData& a) {
    return a.vertical_scroll_alignment;
  }
  static ax::mojom::ScrollBehavior scroll_behavior(const ui::AXActionData& a) {
    return a.scroll_behavior;
  }
  static const std::optional<ui::AXTreeID> child_tree_id(
      const ui::AXActionData& a) {
    return a.child_tree_id;
  }

  // Returns false if `data` could not be read into `out`, which may occur if
  // `data` was created using newer versions of enums than `out` supports,
  // or if some other value cannot be read.
  static bool Read(ax::mojom::AXActionDataDataView data, ui::AXActionData* out);
};

}  // namespace mojo

#endif  // UI_ACCESSIBILITY_MOJOM_AX_ACTION_DATA_MOJOM_TRAITS_H_