7#include <unordered_map>
17 public IItemContainerProvider,
18 public IRawElementProviderFragmentRoot,
19 public IRawElementProviderAdviseEvents {
22 COM_INTERFACE_ENTRY(IItemContainerProvider)
23 COM_INTERFACE_ENTRY(IRawElementProviderFragmentRoot)
24 COM_INTERFACE_ENTRY(IRawElementProviderAdviseEvents)
25 COM_INTERFACE_ENTRY_CHAIN(AXPlatformNodeWin)
33 CComObject<AXFragmentRootPlatformNodeWin>*
instance =
nullptr;
35 CComObject<AXFragmentRootPlatformNodeWin>::CreateInstance(&
instance);
46 IRawElementProviderSimple* start_after_element,
47 PROPERTYID property_id,
49 IRawElementProviderSimple**
result)
override {
56 value.vt == VT_BSTR) {
66 if (AXPlatformNodeWin* result_platform_node =
67 static_cast<AXPlatformNodeWin*
>(GetFromUniqueId(-ax_unique_id))) {
68 if (start_after_element) {
69 Microsoft::WRL::ComPtr<AXPlatformNodeWin> start_after_platform_node;
70 if (!
SUCCEEDED(start_after_element->QueryInterface(
71 IID_PPV_ARGS(&start_after_platform_node))))
76 if (start_after_platform_node->CompareTo(*result_platform_node) >= 0)
80 return result_platform_node->QueryInterface(IID_PPV_ARGS(
result));
92 IRawElementProviderSimple** host_element_provider)
override {
95 HWND hwnd = GetDelegate()->GetTargetForNativeAccessibilityEvent();
96 return UiaHostProviderFromHwnd(hwnd, host_element_provider);
100 IUnknown**
result)
override {
104 if (pattern_id == UIA_ItemContainerPatternId) {
106 *
result =
static_cast<IItemContainerProvider*
>(
this);
110 return AXPlatformNodeWin::GetPatternProviderImpl(pattern_id,
result);
117 switch (property_id) {
127 case UIA_IsControlElementPropertyId:
128 case UIA_IsContentElementPropertyId:
147 IRawElementProviderFragmentRoot** fragment_root)
override {
150 QueryInterface(IID_PPV_ARGS(fragment_root));
158 double screen_physical_pixel_x,
159 double screen_physical_pixel_y,
160 IRawElementProviderFragment** element_provider)
override {
163 *element_provider =
nullptr;
172 screen_physical_pixel_y);
173 if (test_result !=
nullptr && test_result != hit_element) {
174 hit_element = test_result;
177 node_to_test =
nullptr;
179 }
while (node_to_test);
182 hit_element->QueryInterface(element_provider);
187 IFACEMETHODIMP
GetFocus(IRawElementProviderFragment** focus)
override {
201 if (test_result !=
nullptr && test_result != focused_element) {
202 focused_element = test_result;
206 node_to_test =
nullptr;
208 }
while (node_to_test);
211 focused_element->QueryInterface(IID_PPV_ARGS(focus));
220 SAFEARRAY* property_ids)
override {
221 if (event_id == UIA_LiveRegionChangedEventId) {
222 live_region_change_listeners_++;
224 if (live_region_change_listeners_ == 1) {
235 FireLiveRegionChangeRecursive();
242 SAFEARRAY* property_ids)
override {
243 if (event_id == UIA_LiveRegionChangedEventId) {
245 live_region_change_listeners_--;
251 int32_t live_region_change_listeners_ = 0;
263 map_[widget] = fragment_root;
269 const auto& entry = map_.find(widget);
270 if (entry != map_.end())
271 return entry->second;
278 for (
const auto& entry : map_) {
287 std::unordered_map<gfx::AcceleratedWidget, AXFragmentRootWin*> map_;
292 : widget_(widget),
delegate_(delegate), alert_node_(nullptr) {
299 platform_node_->Destroy();
300 platform_node_ =
nullptr;
304 gfx::AcceleratedWidget widget) {
316 return platform_node_.Get();
327int AXFragmentRootWin::GetChildCount()
const {
334 }
else if (index == 1 && alert_node_) {
342 int child_index = GetIndexInParentOfChild();
343 if (child_index >= 0) {
345 if (parent && child_index < (parent->GetChildCount() - 1))
346 return GetParentNodeDelegate()->
ChildAtIndex(child_index + 1);
353 int child_index = GetIndexInParentOfChild();
355 return GetParentNodeDelegate()->
ChildAtIndex(child_index - 1);
363 return child_delegate->HitTestSync(
x,
y);
371 return child_delegate->GetFocus();
380gfx::AcceleratedWidget
395AXPlatformNodeDelegate* AXFragmentRootWin::GetParentNodeDelegate()
const {
411int AXFragmentRootWin::GetIndexInParentOfChild()
const {
420 for (
int child_index = 0; child_index < child_count; child_index++) {
431 alert_node_ = alert_node;
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
virtual gfx::NativeViewAccessible GetChildOfAXFragmentRoot()=0
virtual gfx::NativeViewAccessible GetParentOfAXFragmentRoot()=0
virtual bool IsAXFragmentRootAControlElement()=0
static AXFragmentRootMapWin & GetInstance()
void RemoveFragmentRoot(gfx::AcceleratedWidget widget)
void AddFragmentRoot(gfx::AcceleratedWidget widget, AXFragmentRootWin *fragment_root)
ui::AXFragmentRootWin * GetFragmentRootParentOf(gfx::NativeViewAccessible accessible) const
ui::AXFragmentRootWin * GetFragmentRoot(gfx::AcceleratedWidget widget) const
gfx::NativeViewAccessible GetNativeViewAccessible() override
static AXFragmentRootWin * GetForAcceleratedWidget(gfx::AcceleratedWidget widget)
void SetAlertNode(AXPlatformNodeWin *alert_node)
static AXFragmentRootWin * GetFragmentRootParentOf(gfx::NativeViewAccessible accessible)
~AXFragmentRootWin() override
gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override
AXFragmentRootWin(gfx::AcceleratedWidget widget, AXFragmentRootDelegateWin *delegate)
AXPlatformNodeDelegate * GetChildNodeDelegate() const
static const UiaRegistrarWin & GetInstance()
bool stoi(std::string_view s, SKSL_INT *value)
UnimplementedNativeViewAccessible * NativeViewAccessible
void CreateATLModuleIfNeeded()
#define BASE_DCHECK(condition)