summaryrefslogtreecommitdiff
path: root/chromium/ui/accessibility/ax_action_target.h
blob: c4de1f2081e1ca0e31eed74f4e58caa3873d9e9c (plain)
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
// Copyright 2019 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_AX_ACTION_TARGET_H_
#define UI_ACCESSIBILITY_AX_ACTION_TARGET_H_

#include "ui/accessibility/ax_enums.mojom-forward.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"

namespace ui {

struct AXActionData;

// AXActionTarget is an abstract interface that can be used to carry out
// accessibility actions on nodes from an AXTreeSource without knowing the
// concrete class of that AXTreeSource.
class AXActionTarget {
 public:
  virtual ~AXActionTarget() = default;

  enum class Type { kNull, kBlink, kPdf };
  virtual Type GetType() const = 0;

  virtual bool PerformAction(const AXActionData& action_data) const = 0;

  virtual gfx::Rect GetRelativeBounds() const = 0;
  virtual gfx::Point GetScrollOffset() const = 0;
  virtual gfx::Point MinimumScrollOffset() const = 0;
  virtual gfx::Point MaximumScrollOffset() const = 0;
  virtual void SetScrollOffset(const gfx::Point& point) const = 0;
  virtual bool SetSelected(bool selected) const = 0;
  virtual bool SetSelection(const AXActionTarget* anchor_object,
                            int anchor_offset,
                            const AXActionTarget* focus_object,
                            int focus_offset) const = 0;
  // Make this object visible by scrolling as many nested scrollable views as
  // needed.
  virtual bool ScrollToMakeVisible() const = 0;
  // Same, but if the whole object can't be made visible, try for this subrect,
  // in local coordinates.
  virtual bool ScrollToMakeVisibleWithSubFocus(
      const gfx::Rect& rect,
      ax::mojom::ScrollAlignment horizontal_scroll_alignment,
      ax::mojom::ScrollAlignment vertical_scroll_alignment,
      ax::mojom::ScrollBehavior scroll_behavior) const = 0;

 protected:
  AXActionTarget() = default;
};

}  // namespace ui

#endif  // UI_ACCESSIBILITY_AX_ACTION_TARGET_H_