6#ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_WIN_H_
7#define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_WIN_H_
14#include <uiautomation.h>
15#include <wrl/client.h>
33#define UIA_VALIDATE_CALL() \
34 if (!AXPlatformNodeBase::GetDelegate()) \
35 return UIA_E_ELEMENTNOTAVAILABLE;
36#define UIA_VALIDATE_CALL_1_ARG(arg) \
37 if (!AXPlatformNodeBase::GetDelegate()) \
38 return UIA_E_ELEMENTNOTAVAILABLE; \
40 return E_INVALIDARG; \
51class AXPlatformNodeWin;
53class AX_EXPORT __declspec(uuid("26f5641a-246
d-457
b-a96d-07f3fae6acf2"))
54 AXPlatformNodeWin :
public CComObjectRootEx<CComMultiThreadModel>,
55 public IDispatchImpl<IAccessible>,
56 public IExpandCollapseProvider,
57 public IGridItemProvider,
59 public IInvokeProvider,
60 public IRangeValueProvider,
61 public IRawElementProviderFragment,
62 public IRawElementProviderSimple2,
63 public IScrollItemProvider,
64 public IScrollProvider,
65 public ISelectionItemProvider,
66 public ISelectionProvider,
67 public IServiceProvider,
68 public ITableItemProvider,
69 public ITableProvider,
70 public IToggleProvider,
71 public IValueProvider,
72 public IWindowProvider,
73 public AXPlatformNodeBase {
77 BEGIN_COM_MAP(AXPlatformNodeWin)
80 COM_INTERFACE_ENTRY(AXPlatformNodeWin)
81 COM_INTERFACE_ENTRY(IAccessible)
82 COM_INTERFACE_ENTRY(IDispatch)
83 COM_INTERFACE_ENTRY(IExpandCollapseProvider)
84 COM_INTERFACE_ENTRY(IGridItemProvider)
85 COM_INTERFACE_ENTRY(IGridProvider)
86 COM_INTERFACE_ENTRY(IInvokeProvider)
87 COM_INTERFACE_ENTRY(IRangeValueProvider)
88 COM_INTERFACE_ENTRY(IRawElementProviderFragment)
89 COM_INTERFACE_ENTRY(IRawElementProviderSimple)
90 COM_INTERFACE_ENTRY(IRawElementProviderSimple2)
91 COM_INTERFACE_ENTRY(IScrollItemProvider)
92 COM_INTERFACE_ENTRY(IScrollProvider)
93 COM_INTERFACE_ENTRY(ISelectionItemProvider)
94 COM_INTERFACE_ENTRY(ISelectionProvider)
95 COM_INTERFACE_ENTRY(ITableItemProvider)
96 COM_INTERFACE_ENTRY(ITableProvider)
97 COM_INTERFACE_ENTRY(IToggleProvider)
98 COM_INTERFACE_ENTRY(IValueProvider)
99 COM_INTERFACE_ENTRY(IWindowProvider)
100 COM_INTERFACE_ENTRY(IServiceProvider)
103 ~AXPlatformNodeWin()
override;
105 void Init(AXPlatformNodeDelegate* delegate)
override;
112 void Destroy()
override;
113 std::u16string
GetValue()
const override;
114 bool IsPlatformCheckable()
const override;
121 IFACEMETHODIMP accHitTest(
LONG screen_physical_pixel_x,
122 LONG screen_physical_pixel_y,
126 IFACEMETHODIMP accDoDefaultAction(
VARIANT var_id)
override;
129 IFACEMETHODIMP accLocation(
LONG* physical_pixel_left,
130 LONG* physical_pixel_top,
136 IFACEMETHODIMP accNavigate(
LONG nav_dir,
141 IFACEMETHODIMP get_accChild(
VARIANT var_child,
142 IDispatch** disp_child)
override;
145 IFACEMETHODIMP get_accChildCount(
LONG* child_count)
override;
148 IFACEMETHODIMP get_accDefaultAction(
VARIANT var_id,
149 BSTR* default_action)
override;
152 IFACEMETHODIMP get_accDescription(
VARIANT var_id, BSTR*
desc)
override;
155 IFACEMETHODIMP get_accFocus(
VARIANT* focus_child)
override;
158 IFACEMETHODIMP get_accKeyboardShortcut(
VARIANT var_id,
159 BSTR* access_key)
override;
162 IFACEMETHODIMP get_accName(
VARIANT var_id, BSTR*
name)
override;
165 IFACEMETHODIMP get_accParent(IDispatch** disp_parent)
override;
168 IFACEMETHODIMP get_accRole(
VARIANT var_id,
VARIANT* role)
override;
174 IFACEMETHODIMP get_accHelp(
VARIANT var_id, BSTR*
help)
override;
179 IFACEMETHODIMP get_accValue(
VARIANT var_id, BSTR*
value)
override;
180 IFACEMETHODIMP put_accValue(
VARIANT var_id, BSTR new_value)
override;
183 IFACEMETHODIMP get_accSelection(
VARIANT* selected)
override;
184 IFACEMETHODIMP accSelect(
LONG flags_sel,
VARIANT var_id)
override;
185 IFACEMETHODIMP get_accHelpTopic(BSTR* help_file,
187 LONG* topic_id)
override;
188 IFACEMETHODIMP put_accName(
VARIANT var_id, BSTR put_name)
override;
194 IFACEMETHODIMP Collapse()
override;
196 IFACEMETHODIMP Expand()
override;
198 IFACEMETHODIMP get_ExpandCollapseState(ExpandCollapseState*
result)
override;
204 IFACEMETHODIMP get_Column(
int*
result)
override;
206 IFACEMETHODIMP get_ColumnSpan(
int*
result)
override;
208 IFACEMETHODIMP get_ContainingGrid(
209 IRawElementProviderSimple**
result)
override;
211 IFACEMETHODIMP get_Row(
int*
result)
override;
213 IFACEMETHODIMP get_RowSpan(
int*
result)
override;
219 IFACEMETHODIMP GetItem(
int row,
221 IRawElementProviderSimple**
result)
override;
223 IFACEMETHODIMP get_RowCount(
int*
result)
override;
225 IFACEMETHODIMP get_ColumnCount(
int*
result)
override;
231 IFACEMETHODIMP
Invoke()
override;
237 IFACEMETHODIMP ScrollIntoView()
override;
243 IFACEMETHODIMP Scroll(ScrollAmount horizontal_amount,
244 ScrollAmount vertical_amount)
override;
246 IFACEMETHODIMP SetScrollPercent(
double horizontal_percent,
247 double vertical_percent)
override;
249 IFACEMETHODIMP get_HorizontallyScrollable(
BOOL*
result)
override;
251 IFACEMETHODIMP get_HorizontalScrollPercent(
double*
result)
override;
255 IFACEMETHODIMP get_HorizontalViewSize(
double*
result)
override;
257 IFACEMETHODIMP get_VerticallyScrollable(
BOOL*
result)
override;
259 IFACEMETHODIMP get_VerticalScrollPercent(
double*
result)
override;
263 IFACEMETHODIMP get_VerticalViewSize(
double*
result)
override;
269 IFACEMETHODIMP AddToSelection()
override;
271 IFACEMETHODIMP RemoveFromSelection()
override;
273 IFACEMETHODIMP Select()
override;
275 IFACEMETHODIMP get_IsSelected(
BOOL*
result)
override;
277 IFACEMETHODIMP get_SelectionContainer(
278 IRawElementProviderSimple**
result)
override;
284 IFACEMETHODIMP GetSelection(SAFEARRAY**
result)
override;
286 IFACEMETHODIMP get_CanSelectMultiple(
BOOL*
result)
override;
288 IFACEMETHODIMP get_IsSelectionRequired(
BOOL*
result)
override;
294 IFACEMETHODIMP GetColumnHeaderItems(SAFEARRAY**
result)
override;
296 IFACEMETHODIMP GetRowHeaderItems(SAFEARRAY**
result)
override;
302 IFACEMETHODIMP GetColumnHeaders(SAFEARRAY**
result)
override;
304 IFACEMETHODIMP GetRowHeaders(SAFEARRAY**
result)
override;
306 IFACEMETHODIMP get_RowOrColumnMajor(RowOrColumnMajor*
result)
override;
312 IFACEMETHODIMP Toggle()
override;
314 IFACEMETHODIMP get_ToggleState(ToggleState*
result)
override;
320 IFACEMETHODIMP SetValue(LPCWSTR val)
override;
322 IFACEMETHODIMP get_IsReadOnly(
BOOL*
result)
override;
324 IFACEMETHODIMP get_Value(BSTR*
result)
override;
330 IFACEMETHODIMP SetVisualState(WindowVisualState window_visual_state)
override;
332 IFACEMETHODIMP
Close()
override;
334 IFACEMETHODIMP WaitForInputIdle(
int milliseconds,
BOOL*
result)
override;
336 IFACEMETHODIMP get_CanMaximize(
BOOL*
result)
override;
338 IFACEMETHODIMP get_CanMinimize(
BOOL*
result)
override;
340 IFACEMETHODIMP get_IsModal(
BOOL*
result)
override;
342 IFACEMETHODIMP get_WindowVisualState(WindowVisualState*
result)
override;
344 IFACEMETHODIMP get_WindowInteractionState(
345 WindowInteractionState*
result)
override;
347 IFACEMETHODIMP get_IsTopmost(
BOOL*
result)
override;
353 IFACEMETHODIMP SetValue(
double val)
override;
355 IFACEMETHODIMP get_LargeChange(
double*
result)
override;
357 IFACEMETHODIMP get_Maximum(
double*
result)
override;
359 IFACEMETHODIMP get_Minimum(
double*
result)
override;
361 IFACEMETHODIMP get_SmallChange(
double*
result)
override;
363 IFACEMETHODIMP get_Value(
double*
result)
override;
369 IFACEMETHODIMP Navigate(
370 NavigateDirection direction,
371 IRawElementProviderFragment** element_provider)
override;
372 IFACEMETHODIMP GetRuntimeId(SAFEARRAY** runtime_id)
override;
373 IFACEMETHODIMP get_BoundingRectangle(
374 UiaRect* screen_physical_pixel_bounds)
override;
375 IFACEMETHODIMP GetEmbeddedFragmentRoots(
376 SAFEARRAY** embedded_fragment_roots)
override;
377 IFACEMETHODIMP SetFocus()
override;
378 IFACEMETHODIMP get_FragmentRoot(
379 IRawElementProviderFragmentRoot** fragment_root)
override;
385 IFACEMETHODIMP GetPatternProvider(PATTERNID pattern_id,
386 IUnknown**
result)
override;
388 IFACEMETHODIMP GetPropertyValue(PROPERTYID property_id,
392 get_ProviderOptions(
enum ProviderOptions* ret)
override;
395 get_HostRawElementProvider(IRawElementProviderSimple** provider)
override;
401 IFACEMETHODIMP ShowContextMenu()
override;
407 IFACEMETHODIMP QueryService(
REFGUID guidService,
409 void**
object)
override;
416 static STDMETHODIMP InternalQueryInterface(
void* this_ptr,
417 const _ATL_INTMAP_ENTRY* entries,
424 HRESULT GetTextAttributeValue(TEXTATTRIBUTEID attribute_id,
425 const std::optional<int>& start_offset,
426 const std::optional<int>& end_offset,
430 bool IsPatternProviderSupported(PATTERNID pattern_id);
435 HRESULT GetPatternProviderImpl(PATTERNID pattern_id, IUnknown**
result);
440 HRESULT GetPropertyValueImpl(PROPERTYID property_id,
VARIANT*
result);
443 using RuntimeIdArray = std::array<int, 2>;
444 void GetRuntimeIdArray(RuntimeIdArray& runtime_id);
448 void OnActiveComposition(
const gfx::Range& range,
449 const std::u16string& active_composition_text,
450 bool is_composition_committed);
452 bool HasActiveComposition()
const;
454 gfx::Range GetActiveCompositionOffsets()
const;
457 void FireLiveRegionChangeRecursive();
460 AXPlatformNodeWin* GetLowestAccessibleElement();
464 AXPlatformNodeWin* GetFirstTextOnlyDescendant();
476 bool IsDescendantOf(AXPlatformNode* ancestor)
const override;
482 static constexpr const wchar_t* FRAMEWORK_ID =
L"Chrome";
486 int MSAAState()
const;
490 std::u16string UIAAriaRole();
492 std::u16string ComputeUIAProperties();
494 LONG ComputeUIAControlType();
496 AXPlatformNodeWin* ComputeUIALabeledBy();
498 bool CanHaveUIALabeledBy();
500 bool IsNameExposed()
const;
502 bool IsUIAControl()
const;
504 std::optional<LONG> ComputeUIALandmarkType()
const;
506 bool IsInaccessibleDueToAncestor()
const;
508 bool ShouldHideChildrenForUIA()
const;
510 ExpandCollapseState ComputeExpandCollapseState()
const;
513 void Dispose()
override;
515 AXHypertext old_hypertext_;
522 void AddAttributeToList(
const char*
name,
524 PlatformAttributeList* attributes)
override;
527 bool IsWebAreaForPresentationalIframe();
528 bool ShouldNodeHaveFocusableState(
const AXNodeData&
data)
const;
532 static BSTR GetValueAttributeAsBstr(AXPlatformNodeWin*
target);
535 BSTR* value_bstr)
const;
537 HRESULT GetNameAsBstr(BSTR* value_bstr)
const;
541 static void SanitizeStringAttributeForUIAAriaProperty(
542 const std::u16string& input,
547 void StringAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
549 const char* uia_aria_property);
553 void BoolAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
555 const char* uia_aria_property);
559 void IntAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
561 const char* uia_aria_property);
565 void FloatAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
567 const char* uia_aria_property);
572 void StateToUIAAriaProperty(std::vector<std::u16string>& properties,
574 const char* uia_aria_property);
578 void HtmlAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
579 const char* html_attribute_name,
580 const char* uia_aria_property);
586 SAFEARRAY* CreateUIAElementsArrayForRelation(
594 SAFEARRAY* CreateUIAControllerForArray();
598 SAFEARRAY* CreateUIAElementsArrayForReverseRelation(
604 std::vector<AXPlatformNodeWin*> CreatePlatformNodeVectorFromRelationIdVector(
605 std::vector<int32_t>& relation_id_list);
611 SAFEARRAY* CreateUIAElementsSafeArray(
612 std::vector<AXPlatformNodeWin*>& platform_node_list);
616 SAFEARRAY* CreateClickablePointArray();
621 const ScrollAmount horizontal_amount,
622 const ScrollAmount vertical_amount)
const;
624 void AddAlertTarget();
625 void RemoveAlertTarget();
629 enum class TextOffsetType { kAtOffset, kBeforeOffset, kAfterOffset };
636 AXPlatformNodeWin* GetTargetFromChildID(
const VARIANT& var_id);
643 HRESULT AllocateComArrayFromVector(std::vector<LONG>& results,
649 HRESULT ISelectionItemProviderSetSelected(
bool selected)
const;
652 bool ISelectionItemProviderIsSelected()
const;
659 HRESULT GetAnnotationTypesAttribute(
const std::optional<int>& start_offset,
660 const std::optional<int>& end_offset,
664 std::optional<LCID> GetCultureAttributeAsLCID()
const;
668 BulletStyle ComputeUIABulletStyle()
const;
670 LONG ComputeUIAStyleId()
const;
672 static std::optional<HorizontalTextAlignment>
675 static LONG AXHierarchicalLevelToUIAStyleId(int32_t hierarchical_level);
679 static FlowDirections TextDirectionToFlowDirections(
684 static void AggregateRangesForMarkerType(
685 AXPlatformNodeBase* node,
687 int offset_ranges_amount,
688 std::vector<std::pair<int, int>>* ranges);
690 enum class MarkerTypeRangeResult {
701 MarkerTypeRangeResult GetMarkerTypeFromRange(
702 const std::optional<int>& start_offset,
703 const std::optional<int>& end_offset,
706 bool IsAncestorComboBox();
708 bool IsPlaceholderText()
const;
711 double GetHorizontalScrollPercent();
714 double GetVerticalScrollPercent();
717 BSTR GetFontNameAttributeAsBSTR()
const;
720 BSTR GetStyleNameAttributeAsBSTR()
const;
723 TextDecorationLineStyle GetUIATextDecorationStyle(
728 using PatternProviderFactoryMethod = void (*)(AXPlatformNodeWin*, IUnknown**);
730 PatternProviderFactoryMethod GetPatternProviderFactoryMethod(
731 PATTERNID pattern_id);
734 void FireUiaTextEditTextChangedEvent(
736 const std::u16string& active_composition_text,
737 bool is_composition_committed);
741 static bool IsValidUiaRelationTarget(AXPlatformNode* ax_platform_node);
ax::mojom::Event event_type
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
static float max(float r, float g, float b)
static int64_t GetValue(Dart_Handle arg)
ObjectPtr Invoke(const Library &lib, const char *name)
DEF_SWITCHES_START aot vmservice shared library name
UnimplementedNativeViewAccessible * NativeViewAccessible
void Close(PathBuilder *builder)
std::shared_ptr< const fml::Mapping > data