Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
ax_fragment_root_win.h
Go to the documentation of this file.
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
5#ifndef UI_ACCESSIBILITY_PLATFORM_AX_FRAGMENT_ROOT_WIN_H_
6#define UI_ACCESSIBILITY_PLATFORM_AX_FRAGMENT_ROOT_WIN_H_
7
9
10#include <wrl/client.h>
11
12namespace ui {
13
14class AXFragmentRootDelegateWin;
15class AXFragmentRootPlatformNodeWin;
16class AXPlatformNodeWin;
17
18// UI Automation on Windows requires the root of a multi-element provider to
19// implement IRawElementProviderFragmentRoot. Our internal accessibility trees
20// may not know their roots for right away; for example, web content may
21// deserialize the document for an iframe before the host document. Because of
22// this, and because COM rules require that the list of interfaces returned by
23// QueryInterface remain static over the lifetime of an object instance, we
24// implement IRawElementProviderFragmentRoot on its own node for each HWND, with
25// the root of our internal accessibility tree for that HWND as its sole child.
26//
27// Since UIA derives some information from the underlying HWND hierarchy, we
28// expose one fragment root per HWND. The class that owns the HWND is expected
29// to own the corresponding AXFragmentRootWin.
31 public:
32 AXFragmentRootWin(gfx::AcceleratedWidget widget,
34 ~AXFragmentRootWin() override;
35
36 // Fragment roots register themselves in a map upon creation and unregister
37 // upon destruction. This method provides a lookup, which allows the internal
38 // accessibility root to navigate back to the corresponding fragment root.
39 static AXFragmentRootWin* GetForAcceleratedWidget(
40 gfx::AcceleratedWidget widget);
41
42 // If the given NativeViewAccessible is the direct descendant of a fragment
43 // root, return the corresponding fragment root.
44 static AXFragmentRootWin* GetFragmentRootParentOf(
45 gfx::NativeViewAccessible accessible);
46
47 // Returns the NativeViewAccessible for this fragment root.
48 gfx::NativeViewAccessible GetNativeViewAccessible() override;
49
50 // Assistive technologies will typically use UI Automation's control or
51 // content view rather than the raw view.
52 // Returns true if the fragment root should be included in the control and
53 // content views or false if it should be excluded.
54 bool IsControlElement();
55
56 // If a child node is available, return its delegate.
57 AXPlatformNodeDelegate* GetChildNodeDelegate() const;
58
59 // |AXPlatformNodeDelegate|
60 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
61
62 // alert_node is an AXPlatformNodeWin whose text value can be set by the
63 // application for the purposes of announcing messages to a screen reader.
64 // AXFragmentRootWin does not own its alert_node_; it is owned by the object
65 // with the responsibility of setting its text. In the case of flutter
66 // windows, this is the Window.
67 void SetAlertNode(AXPlatformNodeWin* alert_node);
68
69 private:
70 // AXPlatformNodeDelegate overrides.
71 gfx::NativeViewAccessible GetParent() override;
72 int GetChildCount() const override;
73 gfx::NativeViewAccessible ChildAtIndex(int index) override;
74 gfx::NativeViewAccessible GetNextSibling() override;
75 gfx::NativeViewAccessible GetPreviousSibling() override;
76 gfx::NativeViewAccessible HitTestSync(int x, int y) const override;
77 gfx::NativeViewAccessible GetFocus() override;
78 const ui::AXUniqueId& GetUniqueId() const override;
79 AXPlatformNode* GetFromTreeIDAndNodeID(const ui::AXTreeID& ax_tree_id,
80 int32_t id) override;
81 gfx::Rect GetBoundsRect(const AXCoordinateSystem acs,
82 const AXClippingBehavior acb,
83 AXOffscreenResult* result) const override;
84
85 // A fragment root does not correspond to any node in the platform neutral
86 // accessibility tree. Rather, the fragment root's child is a child of the
87 // fragment root's parent. This helper computes the child's index in the
88 // parent's array of children.
89 int GetIndexInParentOfChild() const;
90
91 // If a parent node is available, return its delegate.
92 AXPlatformNodeDelegate* GetParentNodeDelegate() const;
93
94 gfx::AcceleratedWidget widget_;
96 Microsoft::WRL::ComPtr<ui::AXFragmentRootPlatformNodeWin> platform_node_;
97 ui::AXUniqueId unique_id_;
98
99 // Node that presents the alert, if any.
100 AXPlatformNodeWin* alert_node_;
101};
102
103} // namespace ui
104
105#endif // UI_ACCESSIBILITY_PLATFORM_AX_FRAGMENT_ROOT_WIN_H_
#define AX_EXPORT
Definition ax_export.h:29
MockDelegate delegate_
GAsyncResult * result
double y
double x
UnimplementedNativeViewAccessible * NativeViewAccessible