8#include <wrl/implements.h>
14#include <unordered_set>
35#include "shellscalingapi.h"
41#include "flutter/fml/platform/win/wstring_conversion.h"
58#define COM_OBJECT_VALIDATE() \
61#define COM_OBJECT_VALIDATE_1_ARG(arg) \
65 return E_INVALIDARG; \
67#define COM_OBJECT_VALIDATE_2_ARGS(arg1, arg2) \
71 return E_INVALIDARG; \
74 return E_INVALIDARG; \
76#define COM_OBJECT_VALIDATE_3_ARGS(arg1, arg2, arg3) \
80 return E_INVALIDARG; \
83 return E_INVALIDARG; \
86 return E_INVALIDARG; \
88#define COM_OBJECT_VALIDATE_4_ARGS(arg1, arg2, arg3, arg4) \
92 return E_INVALIDARG; \
95 return E_INVALIDARG; \
98 return E_INVALIDARG; \
101 return E_INVALIDARG; \
103#define COM_OBJECT_VALIDATE_5_ARGS(arg1, arg2, arg3, arg4, arg5) \
104 if (!GetDelegate()) \
107 return E_INVALIDARG; \
110 return E_INVALIDARG; \
113 return E_INVALIDARG; \
116 return E_INVALIDARG; \
119 return E_INVALIDARG; \
121#define COM_OBJECT_VALIDATE_VAR_ID_AND_GET_TARGET(var_id, target) \
122 if (!GetDelegate()) \
124 target = GetTargetFromChildID(var_id); \
126 return E_INVALIDARG; \
127 if (!target->GetDelegate()) \
129#define COM_OBJECT_VALIDATE_VAR_ID_1_ARG_AND_GET_TARGET(var_id, arg, target) \
130 if (!GetDelegate()) \
133 return E_INVALIDARG; \
135 target = GetTargetFromChildID(var_id); \
137 return E_INVALIDARG; \
138 if (!target->GetDelegate()) \
140#define COM_OBJECT_VALIDATE_VAR_ID_2_ARGS_AND_GET_TARGET(var_id, arg1, arg2, \
142 if (!GetDelegate()) \
145 return E_INVALIDARG; \
148 return E_INVALIDARG; \
150 target = GetTargetFromChildID(var_id); \
152 return E_INVALIDARG; \
153 if (!target->GetDelegate()) \
155#define COM_OBJECT_VALIDATE_VAR_ID_3_ARGS_AND_GET_TARGET(var_id, arg1, arg2, \
157 if (!GetDelegate()) \
160 return E_INVALIDARG; \
163 return E_INVALIDARG; \
166 return E_INVALIDARG; \
168 target = GetTargetFromChildID(var_id); \
170 return E_INVALIDARG; \
171 if (!target->GetDelegate()) \
173#define COM_OBJECT_VALIDATE_VAR_ID_4_ARGS_AND_GET_TARGET(var_id, arg1, arg2, \
174 arg3, arg4, target) \
175 if (!GetDelegate()) \
178 return E_INVALIDARG; \
181 return E_INVALIDARG; \
184 return E_INVALIDARG; \
187 return E_INVALIDARG; \
189 target = GetTargetFromChildID(var_id); \
191 return E_INVALIDARG; \
192 if (!target->GetDelegate()) \
199typedef std::unordered_set<AXPlatformNodeWin*> AXPlatformNodeWinSet;
203constexpr int kLargeChangeScaleFactor = 10;
208constexpr float kSmallScrollIncrement = 40.0f;
211constexpr wchar_t kUIADLLFilename[] =
L"uiautomationcore.dll";
213void AppendTextToString(std::u16string extra_text, std::u16string*
string) {
214 if (extra_text.empty())
217 if (string->empty()) {
218 *
string = extra_text;
222 *
string += std::u16string(u
". ") + extra_text;
228void PatternProvider(AXPlatformNodeWin* node, IUnknown**
result) {
230 *
result =
static_cast<T*
>(node);
235void AXPlatformNodeWin::AddAttributeToList(
const char*
name,
237 PlatformAttributeList* attributes) {
238 std::string str_value =
value;
239 SanitizeStringAttribute(str_value, &str_value);
259 CComObject<AXPlatformNodeWin>*
instance =
nullptr;
260 HRESULT hr = CComObject<AXPlatformNodeWin>::CreateInstance(&
instance);
272 Microsoft::WRL::ComPtr<AXPlatformNodeWin> ax_platform_node;
273 accessible->QueryInterface(IID_PPV_ARGS(&ax_platform_node));
274 return ax_platform_node.Get();
281AXPlatformNodeWin::AXPlatformNodeWin() {}
283AXPlatformNodeWin::~AXPlatformNodeWin() {}
290void AXPlatformNodeWin::SanitizeStringAttributeForUIAAriaProperty(
291 const std::u16string& input,
302void AXPlatformNodeWin::StringAttributeToUIAAriaProperty(
303 std::vector<std::u16string>& properties,
305 const char* uia_aria_property) {
306 std::u16string
value;
307 if (GetString16Attribute(attribute, &
value)) {
308 SanitizeStringAttributeForUIAAriaProperty(
value, &
value);
313void AXPlatformNodeWin::BoolAttributeToUIAAriaProperty(
314 std::vector<std::u16string>& properties,
316 const char* uia_aria_property) {
318 if (GetBoolAttribute(attribute, &
value)) {
320 (
value ? u
"true" : u
"false"));
324void AXPlatformNodeWin::IntAttributeToUIAAriaProperty(
325 std::vector<std::u16string>& properties,
327 const char* uia_aria_property) {
329 if (GetIntAttribute(attribute, &
value)) {
335void AXPlatformNodeWin::FloatAttributeToUIAAriaProperty(
336 std::vector<std::u16string>& properties,
338 const char* uia_aria_property) {
340 if (GetFloatAttribute(attribute, &
value)) {
346void AXPlatformNodeWin::StateToUIAAriaProperty(
347 std::vector<std::u16string>& properties,
349 const char* uia_aria_property) {
350 const AXNodeData&
data = GetData();
353 (
value ? u
"true" : u
"false"));
356void AXPlatformNodeWin::HtmlAttributeToUIAAriaProperty(
357 std::vector<std::u16string>& properties,
358 const char* html_attribute_name,
359 const char* uia_aria_property) {
360 std::u16string html_attribute_value;
361 if (GetData().GetHtmlAttribute(html_attribute_name, &html_attribute_value)) {
362 SanitizeStringAttributeForUIAAriaProperty(html_attribute_value,
363 &html_attribute_value);
365 html_attribute_value);
369std::vector<AXPlatformNodeWin*>
370AXPlatformNodeWin::CreatePlatformNodeVectorFromRelationIdVector(
371 std::vector<int32_t>& relation_id_list) {
372 std::vector<AXPlatformNodeWin*> platform_node_list;
374 for (int32_t
id : relation_id_list) {
375 AXPlatformNode* platform_node = GetDelegate()->GetFromNodeID(
id);
376 if (IsValidUiaRelationTarget(platform_node)) {
377 platform_node_list.push_back(
378 static_cast<AXPlatformNodeWin*
>(platform_node));
382 return platform_node_list;
385SAFEARRAY* AXPlatformNodeWin::CreateUIAElementsSafeArray(
386 std::vector<AXPlatformNodeWin*>& platform_node_list) {
387 if (platform_node_list.empty())
390 SAFEARRAY* uia_array =
391 SafeArrayCreateVector(VT_UNKNOWN, 0, platform_node_list.size());
394 for (AXPlatformNodeWin* platform_node : platform_node_list) {
398 BASE_DCHECK(IsValidUiaRelationTarget(platform_node));
399 SafeArrayPutElement(uia_array, &
i,
400 static_cast<IRawElementProviderSimple*
>(platform_node));
407SAFEARRAY* AXPlatformNodeWin::CreateUIAControllerForArray() {
408 std::vector<int32_t> relation_id_list =
411 std::vector<AXPlatformNodeWin*> platform_node_list =
412 CreatePlatformNodeVectorFromRelationIdVector(relation_id_list);
415 AXPlatformNodeWin* view_popup_node_win =
static_cast<AXPlatformNodeWin*
>(
418 if (IsValidUiaRelationTarget(view_popup_node_win))
419 platform_node_list.push_back(view_popup_node_win);
422 return CreateUIAElementsSafeArray(platform_node_list);
425SAFEARRAY* AXPlatformNodeWin::CreateUIAElementsArrayForRelation(
427 std::vector<int32_t> relation_id_list = GetIntListAttribute(attribute);
429 std::vector<AXPlatformNodeWin*> platform_node_list =
430 CreatePlatformNodeVectorFromRelationIdVector(relation_id_list);
432 return CreateUIAElementsSafeArray(platform_node_list);
435SAFEARRAY* AXPlatformNodeWin::CreateUIAElementsArrayForReverseRelation(
437 std::set<AXPlatformNode*> reverse_relations =
438 GetDelegate()->GetReverseRelations(attribute);
440 std::vector<int32_t> id_list;
442 reverse_relations.cbegin(), reverse_relations.cend(),
443 std::back_inserter(id_list), [](AXPlatformNode* platform_node) {
444 return static_cast<AXPlatformNodeWin*>(platform_node)->GetData().id;
447 std::vector<AXPlatformNodeWin*> platform_node_list =
448 CreatePlatformNodeVectorFromRelationIdVector(id_list);
450 return CreateUIAElementsSafeArray(platform_node_list);
453SAFEARRAY* AXPlatformNodeWin::CreateClickablePointArray() {
454 SAFEARRAY* clickable_point_array = SafeArrayCreateVector(VT_R8, 0, 2);
460 double* double_array;
461 SafeArrayAccessData(clickable_point_array,
462 reinterpret_cast<void**
>(&double_array));
463 double_array[0] =
center.x();
464 double_array[1] =
center.y();
465 SafeArrayUnaccessData(clickable_point_array);
467 return clickable_point_array;
471 const ScrollAmount horizontal_amount,
472 const ScrollAmount vertical_amount)
const {
473 if (!GetDelegate() || !IsScrollable())
478 const int large_horizontal_change =
bounds.width();
479 const int large_vertical_change =
bounds.height();
481 const HWND hwnd = GetDelegate()->GetTargetForNativeAccessibilityEvent();
484 const int small_change =
495 switch (horizontal_amount) {
496 case ScrollAmount_LargeDecrement:
497 x -= large_horizontal_change;
499 case ScrollAmount_LargeIncrement:
500 x += large_horizontal_change;
502 case ScrollAmount_NoAmount:
504 case ScrollAmount_SmallDecrement:
507 case ScrollAmount_SmallIncrement:
514 switch (vertical_amount) {
515 case ScrollAmount_LargeDecrement:
516 y -= large_vertical_change;
518 case ScrollAmount_LargeIncrement:
519 y += large_vertical_change;
521 case ScrollAmount_NoAmount:
523 case ScrollAmount_SmallDecrement:
526 case ScrollAmount_SmallIncrement:
540void AXPlatformNodeWin::Dispose() {
544void AXPlatformNodeWin::Destroy() {
569 static_cast<AXPlatformNodeWin*
>(FromNativeViewAccessible(GetParent()));
570 int role = MSAARole();
571 if (role == ROLE_SYSTEM_MENUITEM) {
573 }
else if (role == ROLE_SYSTEM_LISTITEM) {
574 if (AXPlatformNodeBase* container = GetSelectionContainer()) {
575 const AXNodeData&
data = container->GetData();
578 GetDelegate()->GetFocus() == GetNativeViewAccessible()) {
583 int parent_role = parent->MSAARole();
584 if (parent_role == ROLE_SYSTEM_MENUPOPUP ||
585 parent_role == ROLE_SYSTEM_LIST) {
596 if (!GetDelegate()->IsWebContent())
597 UpdateComputedHypertext();
600 if (std::optional<DWORD> native_event = MojoEventToMSAAEvent(
event_type)) {
601 HWND hwnd = GetDelegate()->GetTargetForNativeAccessibilityEvent();
605 ::NotifyWinEvent((*native_event), hwnd, OBJID_CLIENT, -GetUniqueId());
608 if (std::optional<PROPERTYID> uia_property =
612 ::VariantInit(old_value.
Receive());
614 ::VariantInit(new_value.
Receive());
615 GetPropertyValueImpl((*uia_property), new_value.
Receive());
616 ::UiaRaiseAutomationPropertyChangedEvent(
this, (*uia_property), old_value,
620 if (std::optional<EVENTID> uia_event = MojoEventToUIAEvent(
event_type))
621 ::UiaRaiseAutomationEvent(
this, (*uia_event));
628bool AXPlatformNodeWin::HasActiveComposition()
const {
629 return active_composition_range_.end() > active_composition_range_.start();
632gfx::Range AXPlatformNodeWin::GetActiveCompositionOffsets()
const {
633 return active_composition_range_;
636void AXPlatformNodeWin::OnActiveComposition(
638 const std::u16string& active_composition_text,
639 bool is_composition_committed) {
643 active_composition_range_ = range;
645 FireUiaTextEditTextChangedEvent(range, active_composition_text,
646 is_composition_committed);
649void AXPlatformNodeWin::FireUiaTextEditTextChangedEvent(
651 const std::u16string& active_composition_text,
652 bool is_composition_committed) {
655 using UiaRaiseTextEditTextChangedEventFunction = HRESULT(
WINAPI*)(
656 IRawElementProviderSimple*, TextEditChangeType, SAFEARRAY*);
657 UiaRaiseTextEditTextChangedEventFunction text_edit_text_changed_func =
658 reinterpret_cast<UiaRaiseTextEditTextChangedEventFunction
>(
659 ::GetProcAddress(GetModuleHandleW(kUIADLLFilename),
660 "UiaRaiseTextEditTextChangedEvent"));
661 if (!text_edit_text_changed_func) {
665 TextEditChangeType text_edit_change_type =
666 is_composition_committed ? TextEditChangeType_CompositionFinalized
667 : TextEditChangeType_Composition;
671 (
wchar_t*)active_composition_text.data());
673 ::SafeArrayCreateVector(VT_BSTR , 0 ,
675 if (!changed_data.Get()) {
681 SafeArrayPutElement(changed_data.Get(), &index, composition_text.Get());
687 text_edit_text_changed_func(
this, text_edit_change_type,
688 changed_data.Release());
692bool AXPlatformNodeWin::IsValidUiaRelationTarget(
693 AXPlatformNode* ax_platform_node) {
694 if (!ax_platform_node)
696 if (!ax_platform_node->GetDelegate())
700 if (!ax_platform_node->GetDelegate()->GetTargetForNativeAccessibilityEvent())
710IFACEMETHODIMP AXPlatformNodeWin::accHitTest(
LONG screen_physical_pixel_x,
711 LONG screen_physical_pixel_y,
715 gfx::Point point(screen_physical_pixel_x, screen_physical_pixel_y);
721 child->vt = VT_EMPTY;
725 AXPlatformNode* current_result =
this;
728 current_result->GetDelegate()->HitTestSync(screen_physical_pixel_x,
729 screen_physical_pixel_y);
731 child->vt = VT_EMPTY;
735 AXPlatformNode* hit_child_node =
741 if (hit_child_node == current_result)
756 bool is_descendant = hit_child_node->IsDescendantOf(current_result);
758 hit_child_node->GetDelegate()->GetTargetForNativeAccessibilityEvent() ==
759 current_result->GetDelegate()->GetTargetForNativeAccessibilityEvent();
760 if (!is_descendant && is_same_hwnd)
767 current_result = hit_child_node;
770 if (current_result ==
this) {
776 child->lVal = CHILDID_SELF;
780 child->vt = VT_DISPATCH;
781 child->pdispVal =
static_cast<AXPlatformNodeWin*
>(current_result);
783 child->pdispVal->AddRef();
787IFACEMETHODIMP AXPlatformNodeWin::accDoDefaultAction(
VARIANT var_id) {
788 AXPlatformNodeWin*
target;
793 if (
target->GetDelegate()->AccessibilityPerformAction(
data))
798IFACEMETHODIMP AXPlatformNodeWin::accLocation(
LONG* physical_pixel_left,
799 LONG* physical_pixel_top,
803 AXPlatformNodeWin*
target;
810 *physical_pixel_left =
bounds.x();
811 *physical_pixel_top =
bounds.y();
821IFACEMETHODIMP AXPlatformNodeWin::accNavigate(
LONG nav_dir,
824 AXPlatformNodeWin*
target;
827 if ((nav_dir == NAVDIR_FIRSTCHILD || nav_dir == NAVDIR_LASTCHILD) &&
828 V_VT(&start) == VT_I4 && V_I4(&start) != CHILDID_SELF) {
833 IAccessible*
result =
nullptr;
835 case NAVDIR_FIRSTCHILD:
836 if (GetDelegate()->GetChildCount() > 0)
837 result = GetDelegate()->GetFirstChild();
840 case NAVDIR_LASTCHILD:
841 if (GetDelegate()->GetChildCount() > 0)
842 result = GetDelegate()->GetLastChild();
846 AXPlatformNodeBase*
next =
target->GetNextSibling();
852 case NAVDIR_PREVIOUS: {
853 AXPlatformNodeBase* previous =
target->GetPreviousSibling();
855 result = previous->GetNativeViewAccessible();
861 if (!GetTableRow() || !GetTableRowSpan() || !GetTableColumn())
864 AXPlatformNodeBase*
next =
target->GetTableCell(
865 *GetTableRow() + *GetTableRowSpan(), *GetTableColumn());
875 if (!GetTableRow() || !GetTableColumn())
878 AXPlatformNodeBase*
next =
879 target->GetTableCell(*GetTableRow() - 1, *GetTableColumn());
889 if (!GetTableRow() || !GetTableColumn())
892 AXPlatformNodeBase*
next =
893 target->GetTableCell(*GetTableRow(), *GetTableColumn() - 1);
904 if (!GetTableRow() || !GetTableColumn() || !GetTableColumnSpan())
907 AXPlatformNodeBase*
next =
target->GetTableCell(
908 *GetTableRow(), *GetTableColumn() + *GetTableColumnSpan());
920 end->vt = VT_DISPATCH;
923 end->pdispVal->AddRef();
928IFACEMETHODIMP AXPlatformNodeWin::get_accChild(
VARIANT var_child,
929 IDispatch** disp_child) {
930 *disp_child =
nullptr;
931 AXPlatformNodeWin*
target;
935 (*disp_child)->AddRef();
939IFACEMETHODIMP AXPlatformNodeWin::get_accChildCount(
LONG* child_count) {
941 *child_count = GetDelegate()->GetChildCount();
945IFACEMETHODIMP AXPlatformNodeWin::get_accDefaultAction(
VARIANT var_id,
947 AXPlatformNodeWin*
target;
954 *def_action =
nullptr;
962 if (action_verb.empty()) {
963 *def_action =
nullptr;
972IFACEMETHODIMP AXPlatformNodeWin::get_accDescription(
VARIANT var_id,
974 AXPlatformNodeWin*
target;
977 return target->GetStringAttributeAsBstr(
981IFACEMETHODIMP AXPlatformNodeWin::get_accFocus(
VARIANT* focus_child) {
984 if (focus_accessible ==
this) {
985 focus_child->vt = VT_I4;
986 focus_child->lVal = CHILDID_SELF;
987 }
else if (focus_accessible) {
988 Microsoft::WRL::ComPtr<IDispatch> focus_idispatch;
990 focus_accessible->QueryInterface(IID_PPV_ARGS(&focus_idispatch)))) {
991 focus_child->vt = VT_EMPTY;
995 focus_child->vt = VT_DISPATCH;
996 focus_child->pdispVal = focus_idispatch.Detach();
998 focus_child->vt = VT_EMPTY;
1004IFACEMETHODIMP AXPlatformNodeWin::get_accKeyboardShortcut(
VARIANT var_id,
1006 AXPlatformNodeWin*
target;
1009 return target->GetStringAttributeAsBstr(
1013IFACEMETHODIMP AXPlatformNodeWin::get_accName(
VARIANT var_id, BSTR* name_bstr) {
1014 AXPlatformNodeWin*
target;
1017 if (!IsNameExposed())
1021 std::u16string
name =
target->GetNameAsString16();
1024 const std::u16string tooltip =
1026 if (!tooltip.empty()) {
1027 AppendTextToString(tooltip, &
name);
1030 auto status = GetData().GetImageAnnotationStatus();
1044 GetDelegate()->GetLocalizedStringForImageAnnotationStatus(status),
1055 if (
name.empty() && !has_name)
1062IFACEMETHODIMP AXPlatformNodeWin::get_accParent(IDispatch** disp_parent) {
1064 *disp_parent = GetParent();
1066 (*disp_parent)->AddRef();
1069 IRawElementProviderFragmentRoot*
root;
1072 if (
SUCCEEDED(
root->QueryInterface(IID_PPV_ARGS(&parent)))) {
1073 if (parent && parent != GetNativeViewAccessible()) {
1074 *disp_parent = parent;
1083IFACEMETHODIMP AXPlatformNodeWin::get_accRole(
VARIANT var_id,
VARIANT* role) {
1084 AXPlatformNodeWin*
target;
1088 role->lVal =
target->MSAARole();
1093 AXPlatformNodeWin*
target;
1100IFACEMETHODIMP AXPlatformNodeWin::get_accHelp(
VARIANT var_id, BSTR*
help) {
1105IFACEMETHODIMP AXPlatformNodeWin::get_accValue(
VARIANT var_id, BSTR*
value) {
1106 AXPlatformNodeWin*
target;
1112IFACEMETHODIMP AXPlatformNodeWin::put_accValue(
VARIANT var_id, BSTR new_value) {
1113 AXPlatformNodeWin*
target;
1116 return E_INVALIDARG;
1118 std::u16string new_value_utf16((
char16_t*)new_value);
1122 if (
target->GetDelegate()->AccessibilityPerformAction(
data))
1127IFACEMETHODIMP AXPlatformNodeWin::get_accSelection(
VARIANT* selected) {
1129 std::vector<Microsoft::WRL::ComPtr<IDispatch>> selected_nodes;
1130 for (
int i = 0;
i < GetDelegate()->GetChildCount(); ++
i) {
1131 auto* node =
static_cast<AXPlatformNodeWin*
>(
1132 FromNativeViewAccessible(GetDelegate()->ChildAtIndex(
i)));
1135 Microsoft::WRL::ComPtr<IDispatch> node_idispatch;
1136 if (
SUCCEEDED(node->QueryInterface(IID_PPV_ARGS(&node_idispatch))))
1137 selected_nodes.push_back(node_idispatch);
1141 if (selected_nodes.empty()) {
1142 selected->vt = VT_EMPTY;
1146 if (selected_nodes.size() == 1) {
1147 selected->vt = VT_DISPATCH;
1148 selected->pdispVal = selected_nodes[0].Detach();
1153 LONG selected_count =
static_cast<LONG>(selected_nodes.size());
1154 Microsoft::WRL::ComPtr<base::win::EnumVariant> enum_variant =
1155 Microsoft::WRL::Make<base::win::EnumVariant>(selected_count);
1156 for (
LONG i = 0;
i < selected_count; ++
i) {
1157 enum_variant->ItemAt(
i)->vt = VT_DISPATCH;
1158 enum_variant->ItemAt(
i)->pdispVal = selected_nodes[
i].Detach();
1160 selected->vt = VT_UNKNOWN;
1161 return enum_variant.CopyTo(IID_PPV_ARGS(&V_UNKNOWN(selected)));
1164IFACEMETHODIMP AXPlatformNodeWin::accSelect(
LONG flagsSelect,
VARIANT var_id) {
1165 AXPlatformNodeWin*
target;
1168 if (flagsSelect & SELFLAG_TAKEFOCUS) {
1169 AXActionData action_data;
1171 target->GetDelegate()->AccessibilityPerformAction(action_data);
1178IFACEMETHODIMP AXPlatformNodeWin::get_accHelpTopic(BSTR* help_file,
1181 AXPlatformNodeWin*
target;
1185 *help_file =
nullptr;
1188 *topic_id =
static_cast<LONG>(-1);
1193IFACEMETHODIMP AXPlatformNodeWin::put_accName(
VARIANT var_id, BSTR put_name) {
1203IFACEMETHODIMP AXPlatformNodeWin::Collapse() {
1206 return UIA_E_ELEMENTNOTAVAILABLE;
1209 return UIA_E_INVALIDOPERATION;
1211 AXActionData action_data;
1213 if (GetDelegate()->AccessibilityPerformAction(action_data))
1218IFACEMETHODIMP AXPlatformNodeWin::Expand() {
1221 return UIA_E_ELEMENTNOTAVAILABLE;
1224 return UIA_E_INVALIDOPERATION;
1226 AXActionData action_data;
1228 if (GetDelegate()->AccessibilityPerformAction(action_data))
1233ExpandCollapseState AXPlatformNodeWin::ComputeExpandCollapseState()
const {
1234 const AXNodeData&
data = GetData();
1240 if (
data.IsMenuButton()) {
1241 if (
data.IsButtonPressed())
1242 return ExpandCollapseState_Expanded;
1243 return ExpandCollapseState_Collapsed;
1247 return ExpandCollapseState_Expanded;
1249 return ExpandCollapseState_Collapsed;
1251 return ExpandCollapseState_LeafNode;
1255IFACEMETHODIMP AXPlatformNodeWin::get_ExpandCollapseState(
1256 ExpandCollapseState*
result) {
1259 *
result = ComputeExpandCollapseState();
1268IFACEMETHODIMP AXPlatformNodeWin::get_Column(
int*
result) {
1270 std::optional<int> column = GetTableColumn();
1277IFACEMETHODIMP AXPlatformNodeWin::get_ColumnSpan(
int*
result) {
1279 std::optional<int> column_span = GetTableColumnSpan();
1286IFACEMETHODIMP AXPlatformNodeWin::get_ContainingGrid(
1287 IRawElementProviderSimple**
result) {
1290 AXPlatformNodeBase*
table = GetTable();
1294 auto* node_win =
static_cast<AXPlatformNodeWin*
>(
table);
1296 *
result =
static_cast<IRawElementProviderSimple*
>(node_win);
1300IFACEMETHODIMP AXPlatformNodeWin::get_Row(
int*
result) {
1302 std::optional<int> row = GetTableRow();
1309IFACEMETHODIMP AXPlatformNodeWin::get_RowSpan(
int*
result) {
1311 std::optional<int> row_span = GetTableRowSpan();
1322IFACEMETHODIMP AXPlatformNodeWin::GetItem(
int row,
1324 IRawElementProviderSimple**
result) {
1327 AXPlatformNodeBase* cell = GetTableCell(row, column);
1329 return E_INVALIDARG;
1331 auto* node_win =
static_cast<AXPlatformNodeWin*
>(cell);
1333 *
result =
static_cast<IRawElementProviderSimple*
>(node_win);
1337IFACEMETHODIMP AXPlatformNodeWin::get_RowCount(
int*
result) {
1340 std::optional<int> row_count = GetTableAriaRowCount();
1342 row_count = GetTableRowCount();
1345 return E_UNEXPECTED;
1350IFACEMETHODIMP AXPlatformNodeWin::get_ColumnCount(
int*
result) {
1353 std::optional<int> column_count = GetTableAriaColumnCount();
1355 column_count = GetTableColumnCount();
1357 if (!column_count ||
1359 return E_UNEXPECTED;
1373 return UIA_E_ELEMENTNOTENABLED;
1375 AXActionData action_data;
1377 GetDelegate()->AccessibilityPerformAction(action_data);
1386IFACEMETHODIMP AXPlatformNodeWin::ScrollIntoView() {
1391 AXActionData action_data;
1392 action_data.target_node_id = GetData().id;
1393 action_data.target_rect = r;
1394 action_data.horizontal_scroll_alignment =
1396 action_data.vertical_scroll_alignment =
1398 action_data.scroll_behavior =
1400 if (GetDelegate()->AccessibilityPerformAction(action_data))
1409IFACEMETHODIMP AXPlatformNodeWin::Scroll(ScrollAmount horizontal_amount,
1410 ScrollAmount vertical_amount) {
1412 if (!IsScrollable())
1415 AXActionData action_data;
1416 action_data.target_node_id = GetData().id;
1419 CalculateUIAScrollPoint(horizontal_amount, vertical_amount));
1420 if (GetDelegate()->AccessibilityPerformAction(action_data))
1425IFACEMETHODIMP AXPlatformNodeWin::SetScrollPercent(
double horizontal_percent,
1426 double vertical_percent) {
1428 if (!IsScrollable())
1441 AXActionData action_data;
1442 action_data.target_node_id = GetData().id;
1444 action_data.target_point = scroll_to;
1445 if (GetDelegate()->AccessibilityPerformAction(action_data))
1450IFACEMETHODIMP AXPlatformNodeWin::get_HorizontallyScrollable(
BOOL*
result) {
1452 *
result = IsHorizontallyScrollable();
1456IFACEMETHODIMP AXPlatformNodeWin::get_HorizontalScrollPercent(
double*
result) {
1458 *
result = GetHorizontalScrollPercent();
1464IFACEMETHODIMP AXPlatformNodeWin::get_HorizontalViewSize(
double*
result) {
1466 if (!IsHorizontallyScrollable()) {
1471 gfx::RectF clipped_bounds(GetDelegate()->GetBoundsRect(
1475 float total_width = clipped_bounds.width() + x_max - x_min;
1476 BASE_DCHECK(clipped_bounds.width() <= total_width);
1477 *
result = 100.0 * clipped_bounds.width() / total_width;
1481IFACEMETHODIMP AXPlatformNodeWin::get_VerticallyScrollable(
BOOL*
result) {
1483 *
result = IsVerticallyScrollable();
1487IFACEMETHODIMP AXPlatformNodeWin::get_VerticalScrollPercent(
double*
result) {
1489 *
result = GetVerticalScrollPercent();
1495IFACEMETHODIMP AXPlatformNodeWin::get_VerticalViewSize(
double*
result) {
1497 if (!IsVerticallyScrollable()) {
1502 gfx::RectF clipped_bounds(GetDelegate()->GetBoundsRect(
1506 float total_height = clipped_bounds.height() + y_max - y_min;
1507 BASE_DCHECK(clipped_bounds.height() <= total_height);
1508 *
result = 100.0 * clipped_bounds.height() / total_height;
1516HRESULT AXPlatformNodeWin::ISelectionItemProviderSetSelected(
1517 bool selected)
const {
1520 return UIA_E_ELEMENTNOTENABLED;
1537 if (selected == ISelectionItemProviderIsSelected() &&
1543 if (GetDelegate()->AccessibilityPerformAction(
data))
1545 return UIA_E_INVALIDOPERATION;
1548bool AXPlatformNodeWin::ISelectionItemProviderIsSelected()
const {
1562IFACEMETHODIMP AXPlatformNodeWin::AddToSelection() {
1563 return ISelectionItemProviderSetSelected(
true);
1566IFACEMETHODIMP AXPlatformNodeWin::RemoveFromSelection() {
1567 return ISelectionItemProviderSetSelected(
false);
1570IFACEMETHODIMP AXPlatformNodeWin::Select() {
1571 return ISelectionItemProviderSetSelected(
true);
1574IFACEMETHODIMP AXPlatformNodeWin::get_IsSelected(
BOOL*
result) {
1576 *
result = ISelectionItemProviderIsSelected();
1580IFACEMETHODIMP AXPlatformNodeWin::get_SelectionContainer(
1581 IRawElementProviderSimple**
result) {
1584 auto* node_win =
static_cast<AXPlatformNodeWin*
>(GetSelectionContainer());
1589 *
result =
static_cast<IRawElementProviderSimple*
>(node_win);
1597IFACEMETHODIMP AXPlatformNodeWin::GetSelection(SAFEARRAY**
result) {
1600 std::vector<AXPlatformNodeBase*> selected_children;
1601 int max_items = GetMaxSelectableItems();
1603 GetSelectedItems(max_items, &selected_children);
1605 LONG selected_children_count = selected_children.size();
1606 *
result = SafeArrayCreateVector(VT_UNKNOWN, 0, selected_children_count);
1608 return E_OUTOFMEMORY;
1610 for (
LONG i = 0;
i < selected_children_count; ++
i) {
1611 AXPlatformNodeWin* children =
1612 static_cast<AXPlatformNodeWin*
>(selected_children[
i]);
1613 HRESULT hr = SafeArrayPutElement(
1614 *
result, &
i,
static_cast<IRawElementProviderSimple*
>(children));
1616 SafeArrayDestroy(*
result);
1624IFACEMETHODIMP AXPlatformNodeWin::get_CanSelectMultiple(
BOOL*
result) {
1630IFACEMETHODIMP AXPlatformNodeWin::get_IsSelectionRequired(
BOOL*
result) {
1640IFACEMETHODIMP AXPlatformNodeWin::GetColumnHeaderItems(SAFEARRAY**
result) {
1643 std::optional<int> column = GetTableColumn();
1647 std::vector<int32_t> column_header_ids =
1648 GetDelegate()->GetColHeaderNodeIds(*column);
1650 std::vector<AXPlatformNodeWin*> platform_node_list =
1651 CreatePlatformNodeVectorFromRelationIdVector(column_header_ids);
1653 *
result = CreateUIAElementsSafeArray(platform_node_list);
1657IFACEMETHODIMP AXPlatformNodeWin::GetRowHeaderItems(SAFEARRAY**
result) {
1660 std::optional<int> row = GetTableRow();
1664 std::vector<int32_t> row_header_ids =
1665 GetDelegate()->GetRowHeaderNodeIds(*row);
1667 std::vector<AXPlatformNodeWin*> platform_node_list =
1668 CreatePlatformNodeVectorFromRelationIdVector(row_header_ids);
1670 *
result = CreateUIAElementsSafeArray(platform_node_list);
1678IFACEMETHODIMP AXPlatformNodeWin::GetColumnHeaders(SAFEARRAY**
result) {
1681 std::vector<int32_t> column_header_ids = GetDelegate()->GetColHeaderNodeIds();
1683 std::vector<AXPlatformNodeWin*> platform_node_list =
1684 CreatePlatformNodeVectorFromRelationIdVector(column_header_ids);
1686 *
result = CreateUIAElementsSafeArray(platform_node_list);
1690IFACEMETHODIMP AXPlatformNodeWin::GetRowHeaders(SAFEARRAY**
result) {
1693 std::vector<int32_t> row_header_ids = GetDelegate()->GetRowHeaderNodeIds();
1695 std::vector<AXPlatformNodeWin*> platform_node_list =
1696 CreatePlatformNodeVectorFromRelationIdVector(row_header_ids);
1698 *
result = CreateUIAElementsSafeArray(platform_node_list);
1702IFACEMETHODIMP AXPlatformNodeWin::get_RowOrColumnMajor(
1703 RowOrColumnMajor*
result) {
1708 *
result = RowOrColumnMajor_RowMajor;
1716IFACEMETHODIMP AXPlatformNodeWin::Toggle() {
1718 AXActionData action_data;
1721 if (GetDelegate()->AccessibilityPerformAction(action_data))
1726IFACEMETHODIMP AXPlatformNodeWin::get_ToggleState(ToggleState*
result) {
1728 const auto checked_state = GetData().GetCheckedState();
1730 *
result = ToggleState_On;
1732 *
result = ToggleState_Indeterminate;
1734 *
result = ToggleState_Off;
1743IFACEMETHODIMP AXPlatformNodeWin::SetValue(LPCWSTR
value) {
1746 return E_INVALIDARG;
1748 if (GetData().IsReadOnlyOrDisabled())
1749 return UIA_E_ELEMENTNOTENABLED;
1754 if (GetDelegate()->AccessibilityPerformAction(
data))
1759IFACEMETHODIMP AXPlatformNodeWin::get_IsReadOnly(
BOOL*
result) {
1761 *
result = GetData().IsReadOnlyOrDisabled();
1765IFACEMETHODIMP AXPlatformNodeWin::get_Value(BSTR*
result) {
1767 *
result = GetValueAttributeAsBstr(
this);
1775IFACEMETHODIMP AXPlatformNodeWin::SetVisualState(
1776 WindowVisualState window_visual_state) {
1778 return UIA_E_NOTSUPPORTED;
1783 return UIA_E_NOTSUPPORTED;
1786IFACEMETHODIMP AXPlatformNodeWin::WaitForInputIdle(
int milliseconds,
1789 return UIA_E_NOTSUPPORTED;
1792IFACEMETHODIMP AXPlatformNodeWin::get_CanMaximize(
BOOL*
result) {
1794 return UIA_E_NOTSUPPORTED;
1797IFACEMETHODIMP AXPlatformNodeWin::get_CanMinimize(
BOOL*
result) {
1799 return UIA_E_NOTSUPPORTED;
1802IFACEMETHODIMP AXPlatformNodeWin::get_IsModal(
BOOL*
result) {
1810IFACEMETHODIMP AXPlatformNodeWin::get_WindowVisualState(
1811 WindowVisualState*
result) {
1813 return UIA_E_NOTSUPPORTED;
1816IFACEMETHODIMP AXPlatformNodeWin::get_WindowInteractionState(
1817 WindowInteractionState*
result) {
1819 return UIA_E_NOTSUPPORTED;
1822IFACEMETHODIMP AXPlatformNodeWin::get_IsTopmost(
BOOL*
result) {
1824 return UIA_E_NOTSUPPORTED;
1831IFACEMETHODIMP AXPlatformNodeWin::SetValue(
double value) {
1836 if (GetDelegate()->AccessibilityPerformAction(
data))
1841IFACEMETHODIMP AXPlatformNodeWin::get_LargeChange(
double*
result) {
1846 *
result = attribute * kLargeChangeScaleFactor;
1852IFACEMETHODIMP AXPlatformNodeWin::get_Maximum(
double*
result) {
1863IFACEMETHODIMP AXPlatformNodeWin::get_Minimum(
double*
result) {
1874IFACEMETHODIMP AXPlatformNodeWin::get_SmallChange(
double*
result) {
1885IFACEMETHODIMP AXPlatformNodeWin::get_Value(
double*
result) {
1900IFACEMETHODIMP AXPlatformNodeWin::Navigate(
1901 NavigateDirection direction,
1902 IRawElementProviderFragment** element_provider) {
1905 *element_provider =
nullptr;
1955 switch (direction) {
1956 case NavigateDirection_Parent: {
1959 AXFragmentRootWin* fragment_root =
1962 neighbor = fragment_root->GetNativeViewAccessible();
1964 neighbor = GetParent();
1968 case NavigateDirection_FirstChild:
1969 if (GetChildCount() > 0)
1970 neighbor = GetFirstChild()->GetNativeViewAccessible();
1973 case NavigateDirection_LastChild:
1974 if (GetChildCount() > 0)
1975 neighbor = GetLastChild()->GetNativeViewAccessible();
1978 case NavigateDirection_NextSibling:
1981 GetNativeViewAccessible()) ==
nullptr) {
1982 AXPlatformNodeBase* neighbor_node = GetNextSibling();
1984 neighbor = neighbor_node->GetNativeViewAccessible();
1988 case NavigateDirection_PreviousSibling:
1991 GetNativeViewAccessible()) ==
nullptr) {
1992 AXPlatformNodeBase* neighbor_node = GetPreviousSibling();
1994 neighbor = neighbor_node->GetNativeViewAccessible();
2004 if (direction != NavigateDirection_Parent) {
2007 AXFragmentRootWin* fragment_root =
2009 if (
BASE_UNLIKELY(fragment_root && fragment_root != GetDelegate()))
2010 neighbor = fragment_root->GetNativeViewAccessible();
2012 neighbor->QueryInterface(IID_PPV_ARGS(element_provider));
2018void AXPlatformNodeWin::GetRuntimeIdArray(
2019 AXPlatformNodeWin::RuntimeIdArray& runtime_id) {
2020 runtime_id[0] = UiaAppendRuntimeId;
2021 runtime_id[1] = GetUniqueId();
2024IFACEMETHODIMP AXPlatformNodeWin::GetRuntimeId(SAFEARRAY** runtime_id) {
2027 RuntimeIdArray id_array;
2028 GetRuntimeIdArray(id_array);
2029 *runtime_id = ::SafeArrayCreateVector(VT_I4, 0, id_array.size());
2031 int* array_data =
nullptr;
2032 ::SafeArrayAccessData(*runtime_id,
reinterpret_cast<void**
>(&array_data));
2034 size_t runtime_id_byte_count = id_array.size() *
sizeof(
int);
2035 memcpy_s(array_data, runtime_id_byte_count, id_array.data(),
2036 runtime_id_byte_count);
2038 ::SafeArrayUnaccessData(*runtime_id);
2043IFACEMETHODIMP AXPlatformNodeWin::get_BoundingRectangle(
2044 UiaRect* screen_physical_pixel_bounds) {
2050 screen_physical_pixel_bounds->left =
bounds.x();
2051 screen_physical_pixel_bounds->top =
bounds.y();
2052 screen_physical_pixel_bounds->width =
bounds.width();
2053 screen_physical_pixel_bounds->height =
bounds.height();
2057IFACEMETHODIMP AXPlatformNodeWin::GetEmbeddedFragmentRoots(
2058 SAFEARRAY** embedded_fragment_roots) {
2061 *embedded_fragment_roots =
nullptr;
2065IFACEMETHODIMP AXPlatformNodeWin::SetFocus() {
2068 AXActionData action_data;
2070 delegate_->AccessibilityPerformAction(action_data);
2074IFACEMETHODIMP AXPlatformNodeWin::get_FragmentRoot(
2075 IRawElementProviderFragmentRoot** fragment_root) {
2078 gfx::AcceleratedWidget widget =
2079 delegate_->GetTargetForNativeAccessibilityEvent();
2081 AXFragmentRootWin*
root =
2083 if (
root !=
nullptr) {
2084 root->GetNativeViewAccessible()->QueryInterface(
2085 IID_PPV_ARGS(fragment_root));
2091 *fragment_root =
nullptr;
2092 return UIA_E_ELEMENTNOTAVAILABLE;
2099IFACEMETHODIMP AXPlatformNodeWin::GetPatternProvider(PATTERNID pattern_id,
2101 return GetPatternProviderImpl(pattern_id,
result);
2104HRESULT AXPlatformNodeWin::GetPatternProviderImpl(PATTERNID pattern_id,
2110 PatternProviderFactoryMethod factory_method =
2111 GetPatternProviderFactoryMethod(pattern_id);
2113 (*factory_method)(
this,
result);
2118IFACEMETHODIMP AXPlatformNodeWin::GetPropertyValue(PROPERTYID property_id,
2120 return GetPropertyValueImpl(property_id,
result);
2123HRESULT AXPlatformNodeWin::GetPropertyValueImpl(PROPERTYID property_id,
2130 const AXNodeData&
data = GetData();
2133 switch (property_id) {
2134 case UIA_AriaPropertiesPropertyId:
2136 result->bstrVal = ::SysAllocString(
2140 case UIA_AriaRolePropertyId:
2146 case UIA_AutomationIdPropertyId:
2148 V_BSTR(
result) = ::SysAllocString(
2152 case UIA_ClassNamePropertyId:
2158 case UIA_ClickablePointPropertyId:
2159 result->vt = VT_ARRAY | VT_R8;
2160 result->parray = CreateClickablePointArray();
2163 case UIA_ControllerForPropertyId:
2164 result->vt = VT_ARRAY | VT_UNKNOWN;
2165 result->parray = CreateUIAControllerForArray();
2168 case UIA_ControlTypePropertyId:
2170 result->lVal = ComputeUIAControlType();
2173 case UIA_CulturePropertyId: {
2174 std::optional<LCID> lcid = GetCultureAttributeAsLCID();
2178 result->lVal = lcid.value();
2182 case UIA_DescribedByPropertyId:
2183 result->vt = VT_ARRAY | VT_UNKNOWN;
2184 result->parray = CreateUIAElementsArrayForRelation(
2188 case UIA_FlowsFromPropertyId:
2189 V_VT(
result) = VT_ARRAY | VT_UNKNOWN;
2190 V_ARRAY(
result) = CreateUIAElementsArrayForReverseRelation(
2194 case UIA_FlowsToPropertyId:
2195 result->vt = VT_ARRAY | VT_UNKNOWN;
2196 result->parray = CreateUIAElementsArrayForRelation(
2200 case UIA_FrameworkIdPropertyId:
2202 V_BSTR(
result) = SysAllocString(FRAMEWORK_ID);
2205 case UIA_HasKeyboardFocusPropertyId:
2207 result->boolVal = (
delegate_->GetFocus() == GetNativeViewAccessible())
2212 case UIA_FullDescriptionPropertyId:
2218 case UIA_HelpTextPropertyId:
2226 GetNameAsBstr(&V_BSTR(
result));
2234 case UIA_IsContentElementPropertyId:
2235 case UIA_IsControlElementPropertyId:
2237 result->boolVal = IsUIAControl() ? VARIANT_TRUE : VARIANT_FALSE;
2240 case UIA_IsDataValidForFormPropertyId:
2251 case UIA_IsDialogPropertyId:
2256 case UIA_IsKeyboardFocusablePropertyId:
2259 ShouldNodeHaveFocusableState(
data) ? VARIANT_TRUE : VARIANT_FALSE;
2262 case UIA_IsOffscreenPropertyId:
2265 GetDelegate()->IsOffscreen() ? VARIANT_TRUE : VARIANT_FALSE;
2268 case UIA_IsRequiredForFormPropertyId:
2271 result->boolVal = VARIANT_TRUE;
2273 result->boolVal = VARIANT_FALSE;
2277 case UIA_ItemStatusPropertyId: {
2281 int32_t sort_direction;
2291 V_BSTR(
result) = SysAllocString(
L"ascending");
2295 V_BSTR(
result) = SysAllocString(
L"descending");
2299 V_BSTR(
result) = SysAllocString(
L"other");
2306 case UIA_LabeledByPropertyId:
2307 if (AXPlatformNodeWin* node = ComputeUIALabeledBy()) {
2309 result->punkVal = node->GetNativeViewAccessible();
2310 result->punkVal->AddRef();
2314 case UIA_LocalizedControlTypePropertyId: {
2315 std::u16string localized_control_type = GetRoleDescription();
2316 if (!localized_control_type.empty()) {
2318 result->bstrVal = ::SysAllocString(
2327 case UIA_NamePropertyId:
2328 if (IsNameExposed()) {
2330 GetNameAsBstr(&
result->bstrVal);
2334 case UIA_OrientationPropertyId:
2344 result->intVal = OrientationType_Horizontal;
2348 result->intVal = OrientationType_Vertical;
2352 result->intVal = OrientationType_None;
2356 case UIA_IsEnabledPropertyId:
2358 switch (
data.GetRestriction()) {
2360 V_BOOL(
result) = VARIANT_FALSE;
2365 V_BOOL(
result) = VARIANT_TRUE;
2370 case UIA_IsPasswordPropertyId:
2377 case UIA_AcceleratorKeyPropertyId:
2385 case UIA_AccessKeyPropertyId:
2393 case UIA_IsPeripheralPropertyId:
2395 result->boolVal = VARIANT_FALSE;
2398 case UIA_LevelPropertyId:
2402 result->intVal = int_attribute;
2406 case UIA_LiveSettingPropertyId: {
2408 result->intVal = LiveSetting::Off;
2410 std::string string_attribute;
2412 &string_attribute)) {
2413 if (string_attribute ==
"polite")
2414 result->intVal = LiveSetting::Polite;
2415 else if (string_attribute ==
"assertive")
2416 result->intVal = LiveSetting::Assertive;
2421 case UIA_OptimizeForVisualContentPropertyId:
2423 result->boolVal = VARIANT_FALSE;
2426 case UIA_PositionInSetPropertyId: {
2427 std::optional<int> pos_in_set = GetPosInSet();
2430 result->intVal = *pos_in_set;
2434 case UIA_ScrollHorizontalScrollPercentPropertyId: {
2436 V_R8(
result) = GetHorizontalScrollPercent();
2440 case UIA_ScrollVerticalScrollPercentPropertyId: {
2442 V_R8(
result) = GetVerticalScrollPercent();
2446 case UIA_SizeOfSetPropertyId: {
2447 std::optional<int> set_size = GetSetSize();
2450 result->intVal = *set_size;
2455 case UIA_LandmarkTypePropertyId: {
2456 std::optional<LONG> landmark_type = ComputeUIALandmarkType();
2457 if (landmark_type) {
2459 result->intVal = landmark_type.value();
2464 case UIA_LocalizedLandmarkTypePropertyId: {
2465 std::u16string localized_landmark_type =
2466 GetDelegate()->GetLocalizedStringForLandmarkType();
2467 if (!localized_landmark_type.empty()) {
2469 result->bstrVal = ::SysAllocString(
2475 case UIA_ExpandCollapseExpandCollapseStatePropertyId:
2477 result->intVal =
static_cast<int>(ComputeExpandCollapseState());
2480 case UIA_ToggleToggleStatePropertyId: {
2482 get_ToggleState(&
state);
2488 case UIA_ValueValuePropertyId:
2490 result->bstrVal = GetValueAttributeAsBstr(
this);
2494 case UIA_AnnotationObjectsPropertyId:
2495 case UIA_AnnotationTypesPropertyId:
2496 case UIA_CenterPointPropertyId:
2497 case UIA_FillColorPropertyId:
2498 case UIA_FillTypePropertyId:
2499 case UIA_HeadingLevelPropertyId:
2500 case UIA_ItemTypePropertyId:
2501 case UIA_OutlineColorPropertyId:
2502 case UIA_OutlineThicknessPropertyId:
2503 case UIA_RotationPropertyId:
2504 case UIA_SizePropertyId:
2505 case UIA_VisualEffectsPropertyId:
2509 case UIA_BoundingRectanglePropertyId:
2510 case UIA_NativeWindowHandlePropertyId:
2511 case UIA_ProcessIdPropertyId:
2512 case UIA_ProviderDescriptionPropertyId:
2513 case UIA_RuntimeIdPropertyId:
2528 result->bstrVal = ::SysAllocString(
2535IFACEMETHODIMP AXPlatformNodeWin::get_ProviderOptions(ProviderOptions* ret) {
2538 *ret = ProviderOptions_ServerSideProvider | ProviderOptions_UseComThreading |
2539 ProviderOptions_RefuseNonClientSupport |
2540 ProviderOptions_HasNativeIAccessible;
2544IFACEMETHODIMP AXPlatformNodeWin::get_HostRawElementProvider(
2545 IRawElementProviderSimple** provider) {
2548 *provider =
nullptr;
2556IFACEMETHODIMP AXPlatformNodeWin::ShowContextMenu() {
2559 AXActionData action_data;
2561 delegate_->AccessibilityPerformAction(action_data);
2569IFACEMETHODIMP AXPlatformNodeWin::QueryService(
REFGUID guidService,
2574 if (guidService == IID_IAccessible) {
2575 return QueryInterface(riid,
object);
2590STDMETHODIMP AXPlatformNodeWin::InternalQueryInterface(
2592 const _ATL_INTMAP_ENTRY* entries,
2596 return E_INVALIDARG;
2598 AXPlatformNodeWin* accessible =
2599 reinterpret_cast<AXPlatformNodeWin*
>(this_ptr);
2602 return CComObjectRootBase::InternalQueryInterface(this_ptr, entries, riid,
2606HRESULT AXPlatformNodeWin::GetTextAttributeValue(
2607 TEXTATTRIBUTEID attribute_id,
2608 const std::optional<int>& start_offset,
2609 const std::optional<int>& end_offset,
2611 BASE_DCHECK(!start_offset || start_offset.value() >= 0);
2612 BASE_DCHECK(!end_offset || end_offset.value() >= 0);
2614 switch (attribute_id) {
2615 case UIA_AnnotationTypesAttributeId:
2616 return GetAnnotationTypesAttribute(start_offset, end_offset,
result);
2617 case UIA_BackgroundColorAttributeId:
2621 case UIA_BulletStyleAttributeId:
2622 result->Insert<VT_I4>(ComputeUIABulletStyle());
2624 case UIA_CultureAttributeId: {
2625 std::optional<LCID> lcid = GetCultureAttributeAsLCID();
2628 result->Insert<VT_I4>(lcid.value());
2631 case UIA_FontNameAttributeId:
2632 result->Insert<VT_BSTR>(GetFontNameAttributeAsBSTR());
2634 case UIA_FontSizeAttributeId: {
2635 std::optional<float> font_size_in_points = GetFontSizeInPoints();
2636 if (font_size_in_points) {
2637 result->Insert<VT_R8>(*font_size_in_points);
2641 case UIA_FontWeightAttributeId:
2645 case UIA_ForegroundColorAttributeId:
2649 case UIA_IsHiddenAttributeId:
2650 result->Insert<VT_BOOL>(IsInvisibleOrIgnored());
2652 case UIA_IsItalicAttributeId:
2656 case UIA_IsReadOnlyAttributeId:
2658 if (IsPlaceholderText()) {
2659 AXPlatformNodeWin* parent_platform_node =
2660 static_cast<AXPlatformNodeWin*
>(
2661 FromNativeViewAccessible(GetParent()));
2662 return parent_platform_node->GetTextAttributeValue(
2663 attribute_id, start_offset, end_offset,
result);
2665 result->Insert<VT_BOOL>(GetData().IsReadOnlyOrDisabled());
2667 case UIA_IsSubscriptAttributeId:
2668 result->Insert<VT_BOOL>(GetData().GetTextPosition() ==
2671 case UIA_IsSuperscriptAttributeId:
2672 result->Insert<VT_BOOL>(GetData().GetTextPosition() ==
2675 case UIA_OverlineStyleAttributeId:
2676 result->Insert<VT_I4>(GetUIATextDecorationStyle(
2679 case UIA_StrikethroughStyleAttributeId:
2680 result->Insert<VT_I4>(GetUIATextDecorationStyle(
2683 case UIA_StyleNameAttributeId:
2684 result->Insert<VT_BSTR>(GetStyleNameAttributeAsBSTR());
2686 case UIA_StyleIdAttributeId:
2687 result->Insert<VT_I4>(ComputeUIAStyleId());
2689 case UIA_HorizontalTextAlignmentAttributeId: {
2690 std::optional<HorizontalTextAlignment> horizontal_text_alignment =
2691 AXTextAlignToUIAHorizontalTextAlignment(GetData().GetTextAlign());
2692 if (horizontal_text_alignment)
2693 result->Insert<VT_I4>(*horizontal_text_alignment);
2696 case UIA_UnderlineStyleAttributeId:
2697 result->Insert<VT_I4>(GetUIATextDecorationStyle(
2700 case UIA_TextFlowDirectionsAttributeId:
2702 TextDirectionToFlowDirections(GetData().GetTextDirection()));
2705 Microsoft::WRL::ComPtr<IUnknown> not_supported_value;
2706 HRESULT hr = ::UiaGetReservedNotSupportedValue(¬_supported_value);
2708 result->Insert<VT_UNKNOWN>(not_supported_value.Get());
2716HRESULT AXPlatformNodeWin::GetAnnotationTypesAttribute(
2717 const std::optional<int>& start_offset,
2718 const std::optional<int>& end_offset,
2725 if (
IsText() || IsPlainTextField()) {
2726 grammar_result = GetMarkerTypeFromRange(start_offset, end_offset,
2728 spelling_result = GetMarkerTypeFromRange(start_offset, end_offset,
2732 if (grammar_result == MarkerTypeRangeResult::kMixed ||
2733 spelling_result == MarkerTypeRangeResult::kMixed) {
2734 Microsoft::WRL::ComPtr<IUnknown> mixed_attribute_value;
2735 HRESULT hr = ::UiaGetReservedMixedAttributeValue(&mixed_attribute_value);
2737 result->Insert<VT_UNKNOWN>(mixed_attribute_value.Get());
2741 if (spelling_result == MarkerTypeRangeResult::kMatch)
2742 result->Insert<VT_I4>(AnnotationType_SpellingError);
2743 if (grammar_result == MarkerTypeRangeResult::kMatch)
2744 result->Insert<VT_I4>(AnnotationType_GrammarError);
2749std::optional<LCID> AXPlatformNodeWin::GetCultureAttributeAsLCID()
const {
2750 const std::u16string language =
2753 LocaleNameToLCID((
wchar_t*)language.c_str(), LOCALE_ALLOW_NEUTRAL_NAMES);
2755 return std::nullopt;
2760COLORREF AXPlatformNodeWin::GetIntAttributeAsCOLORREF(
2762 uint32_t
color = GetIntAttribute(attribute);
2764 return (_byteswap_ulong(
color) >> 8);
2767BulletStyle AXPlatformNodeWin::ComputeUIABulletStyle()
const {
2772 const AXPlatformNodeBase* current_node =
this;
2773 while (current_node &&
2775 current_node = FromNativeViewAccessible(current_node->GetParent());
2779 current_node ? current_node->GetData().GetListStyle()
2782 switch (list_style) {
2784 return BulletStyle::BulletStyle_None;
2786 return BulletStyle::BulletStyle_HollowRoundBullet;
2788 return BulletStyle::BulletStyle_FilledRoundBullet;
2790 return BulletStyle::BulletStyle_Other;
2793 return BulletStyle::BulletStyle_None;
2795 return BulletStyle::BulletStyle_FilledSquareBullet;
2799LONG AXPlatformNodeWin::ComputeUIAStyleId()
const {
2800 const AXPlatformNodeBase* current_node =
this;
2802 switch (current_node->GetData().role) {
2804 return AXHierarchicalLevelToUIAStyleId(current_node->GetIntAttribute(
2807 return AXListStyleToUIAStyleId(current_node->GetData().GetListStyle());
2809 return StyleId_Custom;
2811 return StyleId_Quote;
2815 current_node = FromNativeViewAccessible(current_node->GetParent());
2816 }
while (current_node);
2818 return StyleId_Normal;
2822std::optional<HorizontalTextAlignment>
2823AXPlatformNodeWin::AXTextAlignToUIAHorizontalTextAlignment(
2825 switch (text_align) {
2827 return std::nullopt;
2829 return HorizontalTextAlignment_Left;
2831 return HorizontalTextAlignment_Right;
2833 return HorizontalTextAlignment_Centered;
2835 return HorizontalTextAlignment_Justified;
2840LONG AXPlatformNodeWin::AXHierarchicalLevelToUIAStyleId(
2841 int32_t hierarchical_level) {
2842 switch (hierarchical_level) {
2844 return StyleId_Normal;
2846 return StyleId_Heading1;
2848 return StyleId_Heading2;
2850 return StyleId_Heading3;
2852 return StyleId_Heading4;
2854 return StyleId_Heading5;
2856 return StyleId_Heading6;
2858 return StyleId_Heading7;
2860 return StyleId_Heading8;
2862 return StyleId_Heading9;
2864 return StyleId_Custom;
2869LONG AXPlatformNodeWin::AXListStyleToUIAStyleId(
2871 switch (list_style) {
2873 return StyleId_Normal;
2878 return StyleId_BulletedList;
2881 return StyleId_NumberedList;
2886FlowDirections AXPlatformNodeWin::TextDirectionToFlowDirections(
2888 switch (text_direction) {
2890 return FlowDirections::FlowDirections_Default;
2892 return FlowDirections::FlowDirections_Default;
2894 return FlowDirections::FlowDirections_RightToLeft;
2896 return FlowDirections::FlowDirections_Vertical;
2898 return FlowDirections::FlowDirections_BottomToTop;
2903void AXPlatformNodeWin::AggregateRangesForMarkerType(
2904 AXPlatformNodeBase* node,
2906 int offset_ranges_amount,
2907 std::vector<std::pair<int, int>>* ranges) {
2909 const std::vector<int32_t>& marker_types =
2911 const std::vector<int>& marker_starts =
2913 const std::vector<int>& marker_ends =
2916 for (
size_t i = 0;
i < marker_types.size(); ++
i) {
2920 const int marker_start = marker_starts[
i] + offset_ranges_amount;
2921 const int marker_end = marker_ends[
i] + offset_ranges_amount;
2922 ranges->emplace_back(std::make_pair(marker_start, marker_end));
2926AXPlatformNodeWin::MarkerTypeRangeResult
2927AXPlatformNodeWin::GetMarkerTypeFromRange(
2928 const std::optional<int>& start_offset,
2929 const std::optional<int>& end_offset,
2932 std::vector<std::pair<int, int>> relevant_ranges;
2935 AggregateRangesForMarkerType(
this, marker_type, 0,
2937 }
else if (IsPlainTextField()) {
2938 int offset_ranges_amount = 0;
2939 for (AXPlatformNodeBase* static_text = GetFirstTextOnlyDescendant();
2940 static_text; static_text = static_text->GetNextSibling()) {
2941 const int child_offset_ranges_amount = offset_ranges_amount;
2942 if (start_offset || end_offset) {
2944 if (end_offset && child_offset_ranges_amount > end_offset.value())
2948 offset_ranges_amount += static_text->GetHypertext().length();
2949 if (start_offset && offset_ranges_amount < start_offset.value())
2953 AggregateRangesForMarkerType(static_text, marker_type,
2954 child_offset_ranges_amount,
2960 const auto sort_ranges_by_start_offset = [](
const std::pair<int, int>&
a,
2961 const std::pair<int, int>&
b) {
2962 return a.first <
b.first;
2964 std::sort(relevant_ranges.begin(), relevant_ranges.end(),
2965 sort_ranges_by_start_offset);
2968 std::optional<std::pair<int, int>> contiguous_range;
2969 for (
const std::pair<int, int>& range : relevant_ranges) {
2970 if (end_offset && range.first > end_offset.value())
2972 if (start_offset && range.second < start_offset.value())
2975 if (!contiguous_range) {
2976 contiguous_range = range;
2981 if ((range.first - contiguous_range->second) > 1)
2982 return MarkerTypeRangeResult::kMixed;
2985 contiguous_range->second =
std::max(contiguous_range->second, range.second);
2989 if (!contiguous_range)
2994 if (!start_offset && contiguous_range->first > 0)
2995 return MarkerTypeRangeResult::kMixed;
2997 if (!end_offset && contiguous_range->second < GetHypertext().
length())
2998 return MarkerTypeRangeResult::kMixed;
3000 if (start_offset && start_offset.value() < contiguous_range->first)
3001 return MarkerTypeRangeResult::kMixed;
3003 if (end_offset && end_offset.value() > contiguous_range->second)
3004 return MarkerTypeRangeResult::kMixed;
3007 return MarkerTypeRangeResult::kMatch;
3012bool AXPlatformNodeWin::IsPatternProviderSupported(PATTERNID pattern_id) {
3013 return GetPatternProviderFactoryMethod(pattern_id);
3019int AXPlatformNodeWin::MSAARole() {
3023 if (IsWebAreaForPresentationalIframe())
3024 return ROLE_SYSTEM_GROUPING;
3026 switch (GetData().role) {
3028 return ROLE_SYSTEM_ALERT;
3031 return ROLE_SYSTEM_DIALOG;
3034 return ROLE_SYSTEM_LINK;
3038 return ROLE_SYSTEM_GROUPING;
3041 return ROLE_SYSTEM_APPLICATION;
3044 return ROLE_SYSTEM_DOCUMENT;
3047 return ROLE_SYSTEM_GROUPING;
3051 return ROLE_SYSTEM_GROUPING;
3054 return ROLE_SYSTEM_GROUPING;
3057 return ROLE_SYSTEM_PUSHBUTTON;
3060 return ROLE_SYSTEM_GRAPHIC;
3063 return ROLE_SYSTEM_TEXT;
3066 return ROLE_SYSTEM_CARET;
3069 return ROLE_SYSTEM_CELL;
3072 return ROLE_SYSTEM_CHECKBUTTON;
3075 return ROLE_SYSTEM_PANE;
3078 return ROLE_SYSTEM_TEXT;
3081 return ROLE_SYSTEM_COLUMN;
3084 return ROLE_SYSTEM_COLUMNHEADER;
3088 return ROLE_SYSTEM_COMBOBOX;
3091 return ROLE_SYSTEM_GROUPING;
3095 return ROLE_SYSTEM_GROUPING;
3099 return ROLE_SYSTEM_GROUPING;
3103 return ROLE_SYSTEM_DROPLIST;
3106 return ROLE_SYSTEM_GROUPING;
3109 return ROLE_SYSTEM_TEXT;
3112 return ROLE_SYSTEM_LIST;
3115 return ROLE_SYSTEM_LISTITEM;
3118 return ROLE_SYSTEM_PANE;
3121 return ROLE_SYSTEM_GROUPING;
3124 return ROLE_SYSTEM_DIALOG;
3127 return ROLE_SYSTEM_PUSHBUTTON;
3130 return ROLE_SYSTEM_LIST;
3133 return ROLE_SYSTEM_GRAPHIC;
3139 return ROLE_SYSTEM_LINK;
3144 return ROLE_SYSTEM_LISTITEM;
3147 return ROLE_SYSTEM_SEPARATOR;
3179 return ROLE_SYSTEM_GROUPING;
3184 return ROLE_SYSTEM_DOCUMENT;
3196 if (GetDelegate()->GetChildCount()) {
3197 return ROLE_SYSTEM_GROUPING;
3199 return ROLE_SYSTEM_CLIENT;
3203 return ROLE_SYSTEM_GROUPING;
3206 return ROLE_SYSTEM_GROUPING;
3209 return ROLE_SYSTEM_GROUPING;
3213 return ROLE_SYSTEM_GROUPING;
3216 return ROLE_SYSTEM_GROUPING;
3219 return ROLE_SYSTEM_GROUPING;
3222 return ROLE_SYSTEM_DOCUMENT;
3225 return ROLE_SYSTEM_PANE;
3228 return ROLE_SYSTEM_GRAPHIC;
3231 return ROLE_SYSTEM_TABLE;
3234 return ROLE_SYSTEM_GROUPING;
3237 return ROLE_SYSTEM_GROUPING;
3240 return ROLE_SYSTEM_DOCUMENT;
3243 return ROLE_SYSTEM_GROUPING;
3247 return ROLE_SYSTEM_GRAPHIC;
3250 return ROLE_SYSTEM_GROUPING;
3253 return ROLE_SYSTEM_STATICTEXT;
3257 return ROLE_SYSTEM_TEXT;
3260 return ROLE_SYSTEM_TABLE;
3263 return ROLE_SYSTEM_CELL;
3266 return ROLE_SYSTEM_ROW;
3269 return ROLE_SYSTEM_LINK;
3272 return ROLE_SYSTEM_LIST;
3275 return ROLE_SYSTEM_LIST;
3278 return ROLE_SYSTEM_LISTITEM;
3281 return ROLE_SYSTEM_LIST;
3284 return ROLE_SYSTEM_LISTITEM;
3287 if (!GetDelegate()->GetChildCount()) {
3292 return ROLE_SYSTEM_STATICTEXT;
3294 return ROLE_SYSTEM_GROUPING;
3297 return ROLE_SYSTEM_GROUPING;
3300 return ROLE_SYSTEM_GROUPING;
3303 return ROLE_SYSTEM_GROUPING;
3306 return ROLE_SYSTEM_ANIMATION;
3309 return ROLE_SYSTEM_EQUATION;
3312 return ROLE_SYSTEM_MENUPOPUP;
3315 return ROLE_SYSTEM_MENUBAR;
3320 return ROLE_SYSTEM_MENUITEM;
3323 return ROLE_SYSTEM_LIST;
3326 return ROLE_SYSTEM_LISTITEM;
3329 return ROLE_SYSTEM_PROGRESSBAR;
3332 return ROLE_SYSTEM_GROUPING;
3335 return ROLE_SYSTEM_GROUPING;
3338 return ROLE_SYSTEM_GROUPING;
3341 return ROLE_SYSTEM_PUSHBUTTON;
3345 if (GetDelegate()->GetChildCount()) {
3346 return ROLE_SYSTEM_GROUPING;
3348 return ROLE_SYSTEM_CLIENT;
3352 std::string html_tag =
3354 if (html_tag ==
"select")
3355 return ROLE_SYSTEM_COMBOBOX;
3356 return ROLE_SYSTEM_BUTTONMENU;
3360 return ROLE_SYSTEM_PUSHBUTTON;
3363 return ROLE_SYSTEM_TEXT;
3366 return ROLE_SYSTEM_PROGRESSBAR;
3369 return ROLE_SYSTEM_RADIOBUTTON;
3372 return ROLE_SYSTEM_GROUPING;
3375 return ROLE_SYSTEM_PANE;
3380 return IsInTreeGrid() ? ROLE_SYSTEM_OUTLINEITEM : ROLE_SYSTEM_ROW;
3384 return ROLE_SYSTEM_GROUPING;
3387 return ROLE_SYSTEM_ROWHEADER;
3390 return ROLE_SYSTEM_TEXT;
3393 if (GetNameAsString16().
empty()) {
3395 return ROLE_SYSTEM_GROUPING;
3398 return ROLE_SYSTEM_PANE;
3402 return ROLE_SYSTEM_SCROLLBAR;
3405 return ROLE_SYSTEM_PANE;
3408 return ROLE_SYSTEM_GROUPING;
3411 return ROLE_SYSTEM_SLIDER;
3414 return ROLE_SYSTEM_SLIDER;
3417 return ROLE_SYSTEM_SPINBUTTON;
3420 return ROLE_SYSTEM_CHECKBUTTON;
3424 return ROLE_SYSTEM_STATICTEXT;
3427 return ROLE_SYSTEM_STATUSBAR;
3430 return ROLE_SYSTEM_SEPARATOR;
3433 return ROLE_SYSTEM_GRAPHIC;
3436 return ROLE_SYSTEM_PAGETAB;
3439 return ROLE_SYSTEM_TABLE;
3442 return ROLE_SYSTEM_GROUPING;
3445 return ROLE_SYSTEM_PAGETABLIST;
3448 return ROLE_SYSTEM_PROPERTYPAGE;
3451 return ROLE_SYSTEM_LISTITEM;
3454 return ROLE_SYSTEM_TITLEBAR;
3457 return ROLE_SYSTEM_CHECKBUTTON;
3461 return ROLE_SYSTEM_TEXT;
3464 return ROLE_SYSTEM_COMBOBOX;
3471 return ROLE_SYSTEM_TEXT;
3474 return ROLE_SYSTEM_CLOCK;
3477 return ROLE_SYSTEM_TOOLBAR;
3480 return ROLE_SYSTEM_TOOLTIP;
3483 return ROLE_SYSTEM_OUTLINE;
3486 return ROLE_SYSTEM_OUTLINE;
3489 return ROLE_SYSTEM_OUTLINEITEM;
3492 return ROLE_SYSTEM_WHITESPACE;
3495 return ROLE_SYSTEM_GROUPING;
3498 return ROLE_SYSTEM_CLIENT;
3506 return ROLE_SYSTEM_PANE;
3514 return ROLE_SYSTEM_PANE;
3518 return ROLE_SYSTEM_GROUPING;
3521bool AXPlatformNodeWin::IsWebAreaForPresentationalIframe() {
3527 AXPlatformNodeBase* parent = FromNativeViewAccessible(GetParent());
3534std::u16string AXPlatformNodeWin::UIAAriaRole() {
3538 if (IsWebAreaForPresentationalIframe())
3541 switch (GetData().role) {
3560 return u
"application";
3582 return u
"description";
3606 return u
"columnheader";
3613 return u
"complementary";
3621 return u
"contentinfo";
3628 return u
"definition";
3631 return u
"description";
3652 return u
"directory";
3669 return u
"separator";
3709 if (GetDelegate()->GetChildCount()) {
3722 return u
"description";
3782 return u
"description";
3812 if (!GetDelegate()->GetChildCount()) {
3817 return u
"description";
3828 return u
"description";
3846 return u
"menuitemcheckbox";
3849 return u
"menuitemradio";
3858 return u
"progressbar";
3861 return u
"navigation";
3873 if (GetDelegate()->GetChildCount()) {
3880 std::string html_tag =
3882 if (html_tag ==
"select")
3894 return u
"progressbar";
3900 return u
"radiogroup";
3908 return IsInTreeGrid() ? u
"treeitem" : u
"row";
3915 return u
"rowheader";
3921 if (GetNameAsString16().
empty()) {
3930 return u
"scrollbar";
3945 return u
"spinbutton";
3955 return u
"description";
3961 return u
"separator";
3994 return u
"searchbox";
4000 return u
"description";
4024 return u
"separator";
4045std::u16string AXPlatformNodeWin::ComputeUIAProperties() {
4046 std::vector<std::u16string> properties;
4047 const AXNodeData&
data = GetData();
4049 BoolAttributeToUIAAriaProperty(
4054 switch (
data.GetCheckedState()) {
4059 properties.emplace_back(u
"pressed=false");
4064 properties.emplace_back(u
"pressed=false");
4065 properties.emplace_back(u
"checked=false");
4067 properties.emplace_back(u
"checked=false");
4072 properties.emplace_back(u
"pressed=true");
4077 properties.emplace_back(u
"pressed=true");
4078 properties.emplace_back(u
"checked=true");
4080 properties.emplace_back(u
"checked=true");
4085 properties.emplace_back(u
"pressed=mixed");
4090 properties.emplace_back(u
"checked=mixed");
4098 properties.push_back(u
"disabled=true");
4104 if (GetData().IsReadOnlyOrDisabled())
4105 properties.push_back(u
"readonly=true");
4110 properties.push_back(u
"dropeffect=" +
4122 properties.push_back(u
"haspopup=true");
4125 properties.push_back(u
"haspopup=menu");
4128 properties.push_back(u
"haspopup=listbox");
4131 properties.push_back(u
"haspopup=tree");
4134 properties.push_back(u
"haspopup=grid");
4137 properties.push_back(u
"haspopup=dialog");
4141 if (IsInvisibleOrIgnored())
4142 properties.push_back(u
"hidden=true");
4147 properties.push_back(u
"invalid=true");
4150 IntAttributeToUIAAriaProperty(
4152 StringAttributeToUIAAriaProperty(
4159 StringAttributeToUIAAriaProperty(
4162 BoolAttributeToUIAAriaProperty(
4167 int32_t sort_direction;
4175 properties.push_back(u
"sort=none");
4178 properties.push_back(u
"sort=ascending");
4181 properties.push_back(u
"sort=descending");
4184 properties.push_back(u
"sort=other");
4189 if (
data.IsRangeValueSupported()) {
4190 FloatAttributeToUIAAriaProperty(
4192 FloatAttributeToUIAAriaProperty(
4194 StringAttributeToUIAAriaProperty(
4197 std::u16string value_now = GetRangeValueText();
4198 SanitizeStringAttributeForUIAAriaProperty(value_now, &value_now);
4199 if (!value_now.empty())
4200 properties.push_back(u
"valuenow=" + value_now);
4207LONG AXPlatformNodeWin::ComputeUIAControlType() {
4211 if (IsWebAreaForPresentationalIframe())
4212 return UIA_GroupControlTypeId;
4214 switch (GetData().role) {
4216 return UIA_TextControlTypeId;
4223 return UIA_TextControlTypeId;
4226 return UIA_HyperlinkControlTypeId;
4230 return ROLE_SYSTEM_GROUPING;
4233 return UIA_PaneControlTypeId;
4236 return UIA_GroupControlTypeId;
4239 return UIA_GroupControlTypeId;
4243 return UIA_GroupControlTypeId;
4246 return UIA_GroupControlTypeId;
4249 return UIA_ButtonControlTypeId;
4252 return UIA_ImageControlTypeId;
4255 return UIA_TextControlTypeId;
4258 return UIA_PaneControlTypeId;
4261 return UIA_DataItemControlTypeId;
4264 return UIA_CheckBoxControlTypeId;
4267 return UIA_PaneControlTypeId;
4270 return UIA_TextControlTypeId;
4273 return UIA_ButtonControlTypeId;
4276 return UIA_PaneControlTypeId;
4279 return UIA_DataItemControlTypeId;
4283 return UIA_ComboBoxControlTypeId;
4286 return UIA_GroupControlTypeId;
4290 return UIA_GroupControlTypeId;
4294 return UIA_GroupControlTypeId;
4298 return UIA_EditControlTypeId;
4301 return UIA_GroupControlTypeId;
4304 return UIA_TextControlTypeId;
4307 return UIA_ListControlTypeId;
4310 return UIA_ListItemControlTypeId;
4313 return UIA_DocumentControlTypeId;
4316 return UIA_GroupControlTypeId;
4319 return UIA_PaneControlTypeId;
4322 return UIA_ButtonControlTypeId;
4325 return UIA_ListControlTypeId;
4328 return UIA_ImageControlTypeId;
4334 return UIA_HyperlinkControlTypeId;
4339 return UIA_ListItemControlTypeId;
4342 return UIA_SeparatorControlTypeId;
4374 return UIA_GroupControlTypeId;
4379 return UIA_DocumentControlTypeId;
4382 return UIA_PaneControlTypeId;
4385 return UIA_TextControlTypeId;
4388 return UIA_GroupControlTypeId;
4391 return UIA_TextControlTypeId;
4394 return UIA_GroupControlTypeId;
4398 return UIA_GroupControlTypeId;
4401 return UIA_GroupControlTypeId;
4404 return UIA_GroupControlTypeId;
4407 return UIA_DocumentControlTypeId;
4410 return UIA_PaneControlTypeId;
4413 return UIA_ImageControlTypeId;
4416 return UIA_DataGridControlTypeId;
4419 return UIA_GroupControlTypeId;
4422 return UIA_TextControlTypeId;
4425 return UIA_DocumentControlTypeId;
4428 return UIA_GroupControlTypeId;
4431 return UIA_ImageControlTypeId;
4434 return UIA_DocumentControlTypeId;
4437 return UIA_GroupControlTypeId;
4440 return UIA_DocumentControlTypeId;
4444 return UIA_TextControlTypeId;
4447 return UIA_TableControlTypeId;
4450 return UIA_DataItemControlTypeId;
4453 return UIA_DataItemControlTypeId;
4456 return UIA_HyperlinkControlTypeId;
4459 return UIA_ListControlTypeId;
4462 return UIA_ListControlTypeId;
4465 return UIA_ListItemControlTypeId;
4468 return UIA_DataGridControlTypeId;
4471 return UIA_ListItemControlTypeId;
4474 if (!GetDelegate()->GetChildCount()) {
4479 return UIA_TextControlTypeId;
4481 return UIA_GroupControlTypeId;
4484 return UIA_GroupControlTypeId;
4487 return UIA_GroupControlTypeId;
4490 return UIA_TextControlTypeId;
4493 return UIA_TextControlTypeId;
4496 return UIA_GroupControlTypeId;
4499 return UIA_MenuControlTypeId;
4502 return UIA_MenuBarControlTypeId;
4505 return UIA_MenuItemControlTypeId;
4508 return UIA_CheckBoxControlTypeId;
4511 return UIA_RadioButtonControlTypeId;
4514 return UIA_ListControlTypeId;
4517 return UIA_ListItemControlTypeId;
4520 return UIA_ProgressBarControlTypeId;
4523 return UIA_GroupControlTypeId;
4526 return UIA_GroupControlTypeId;
4529 return UIA_GroupControlTypeId;
4532 return UIA_CustomControlTypeId;
4535 if (GetDelegate()->GetChildCount()) {
4536 return UIA_GroupControlTypeId;
4538 return UIA_DocumentControlTypeId;
4542 std::string html_tag =
4544 if (html_tag ==
"select")
4545 return UIA_ComboBoxControlTypeId;
4546 return UIA_ButtonControlTypeId;
4550 return UIA_ButtonControlTypeId;
4553 return UIA_PaneControlTypeId;
4556 return UIA_ProgressBarControlTypeId;
4559 return UIA_RadioButtonControlTypeId;
4562 return UIA_GroupControlTypeId;
4565 return UIA_GroupControlTypeId;
4570 return IsInTreeGrid() ? UIA_TreeItemControlTypeId
4571 : UIA_DataItemControlTypeId;
4575 return UIA_GroupControlTypeId;
4578 return UIA_DataItemControlTypeId;
4581 return UIA_PaneControlTypeId;
4584 return UIA_GroupControlTypeId;
4587 return UIA_ScrollBarControlTypeId;
4590 return UIA_PaneControlTypeId;
4593 return UIA_GroupControlTypeId;
4596 return UIA_SliderControlTypeId;
4599 return UIA_SliderControlTypeId;
4602 return UIA_SpinnerControlTypeId;
4605 return UIA_ButtonControlTypeId;
4609 return UIA_TextControlTypeId;
4612 return UIA_StatusBarControlTypeId;
4615 return UIA_TextControlTypeId;
4618 return UIA_SeparatorControlTypeId;
4621 return UIA_ImageControlTypeId;
4624 return UIA_TabItemControlTypeId;
4627 return UIA_TableControlTypeId;
4630 return UIA_GroupControlTypeId;
4633 return UIA_TabControlTypeId;
4636 return UIA_PaneControlTypeId;
4639 return UIA_ListItemControlTypeId;
4642 return UIA_DocumentControlTypeId;
4645 return UIA_ButtonControlTypeId;
4649 return UIA_EditControlTypeId;
4652 return UIA_ComboBoxControlTypeId;
4656 return UIA_TextControlTypeId;
4659 return UIA_PaneControlTypeId;
4662 return UIA_ToolBarControlTypeId;
4665 return UIA_ToolTipControlTypeId;
4668 return UIA_TreeControlTypeId;
4671 return UIA_DataGridControlTypeId;
4674 return UIA_TreeItemControlTypeId;
4677 return UIA_SeparatorControlTypeId;
4680 return UIA_GroupControlTypeId;
4683 return UIA_DocumentControlTypeId;
4693 return UIA_PaneControlTypeId;
4697 return UIA_DocumentControlTypeId;
4700AXPlatformNodeWin* AXPlatformNodeWin::ComputeUIALabeledBy() {
4702 if (!CanHaveUIALabeledBy())
4707 for (int32_t
id : GetData().GetIntListAttribute(
4710 static_cast<AXPlatformNodeWin*
>(GetDelegate()->GetFromNodeID(
id));
4715 if (IsValidUiaRelationTarget(node_win) &&
4721 for (
auto iter = node_win->GetDelegate()->ChildrenBegin();
4722 *iter != *node_win->GetDelegate()->ChildrenEnd(); ++(*iter)) {
4723 AXPlatformNodeWin* child =
static_cast<AXPlatformNodeWin*
>(
4725 iter->GetNativeViewAccessible()));
4726 if (IsValidUiaRelationTarget(child) &&
4736bool AXPlatformNodeWin::CanHaveUIALabeledBy() {
4741 switch (ComputeUIAControlType()) {
4742 case UIA_ButtonControlTypeId:
4743 case UIA_CheckBoxControlTypeId:
4744 case UIA_DataItemControlTypeId:
4745 case UIA_MenuControlTypeId:
4746 case UIA_MenuBarControlTypeId:
4747 case UIA_RadioButtonControlTypeId:
4748 case UIA_ScrollBarControlTypeId:
4749 case UIA_SeparatorControlTypeId:
4750 case UIA_StatusBarControlTypeId:
4751 case UIA_TabItemControlTypeId:
4752 case UIA_TextControlTypeId:
4753 case UIA_ToolBarControlTypeId:
4754 case UIA_ToolTipControlTypeId:
4755 case UIA_TreeItemControlTypeId:
4762bool AXPlatformNodeWin::IsNameExposed()
const {
4763 const AXNodeData&
data = GetData();
4764 switch (
data.role) {
4766 return !GetDelegate()->GetChildCount();
4772bool AXPlatformNodeWin::IsUIAControl()
const {
4777 if (GetDelegate()->IsWebContent()) {
4779 if (IsInvisibleOrIgnored())
4788 auto* parent = FromNativeViewAccessible(GetDelegate()->GetParent());
4790 const AXNodeData&
data = parent->GetData();
4793 switch (
data.role) {
4819 parent = FromNativeViewAccessible(parent->GetParent());
4823 const AXNodeData&
data = GetData();
4835 data.GetNameFrom() ==
4841 switch (
data.role) {
4868 GetNameAsString16().
empty() &&
4878 const AXNodeData&
data = GetData();
4884std::optional<LONG> AXPlatformNodeWin::ComputeUIALandmarkType()
const {
4885 const AXNodeData&
data = GetData();
4886 switch (
data.role) {
4892 return UIA_CustomLandmarkTypeId;
4905 return UIA_FormLandmarkTypeId;
4910 return UIA_MainLandmarkTypeId;
4913 return UIA_NavigationLandmarkTypeId;
4916 return UIA_SearchLandmarkTypeId;
4921 return UIA_CustomLandmarkTypeId;
4929bool AXPlatformNodeWin::IsInaccessibleDueToAncestor()
const {
4930 AXPlatformNodeWin* parent =
static_cast<AXPlatformNodeWin*
>(
4933 if (parent->ShouldHideChildrenForUIA())
4935 parent =
static_cast<AXPlatformNodeWin*
>(
4936 FromNativeViewAccessible(parent->GetParent()));
4941bool AXPlatformNodeWin::ShouldHideChildrenForUIA()
const {
4942 if (IsPlainTextField())
4945 auto role = GetData().role;
4962 if (GetChildCount() == 1) {
4963 AXPlatformNodeBase* only_child = GetFirstChild();
4964 return only_child && only_child->IsText();
4982 if (
value.empty() && (MSAAState() & STATE_SYSTEM_LINKED))
4988bool AXPlatformNodeWin::IsPlatformCheckable()
const {
4995bool AXPlatformNodeWin::ShouldNodeHaveFocusableState(
4996 const AXNodeData&
data)
const {
4997 switch (
data.role) {
5004 AXPlatformNodeBase* parent = FromNativeViewAccessible(GetParent());
5024int AXPlatformNodeWin::MSAAState()
const {
5025 const AXNodeData&
data = GetData();
5032 msaa_state |= STATE_SYSTEM_BUSY;
5035 msaa_state |= STATE_SYSTEM_COLLAPSED;
5038 msaa_state |= STATE_SYSTEM_DEFAULT;
5043 msaa_state |= STATE_SYSTEM_EXPANDED;
5045 if (ShouldNodeHaveFocusableState(
data))
5046 msaa_state |= STATE_SYSTEM_FOCUSABLE;
5050 msaa_state |= STATE_SYSTEM_HASPOPUP;
5058 if (GetDelegate()->ShouldIgnoreHoveredStateForTesting())
5059 msaa_state |= STATE_SYSTEM_HOTTRACKED;
5064 if (IsInvisibleOrIgnored())
5065 msaa_state |= STATE_SYSTEM_INVISIBLE;
5068 msaa_state |= STATE_SYSTEM_LINKED;
5073 msaa_state |= STATE_SYSTEM_EXTSELECTABLE;
5074 msaa_state |= STATE_SYSTEM_MULTISELECTABLE;
5077 if (GetDelegate()->IsOffscreen())
5078 msaa_state |= STATE_SYSTEM_OFFSCREEN;
5081 msaa_state |= STATE_SYSTEM_PROTECTED;
5086 if (
data.IsSelectable())
5087 msaa_state |= STATE_SYSTEM_SELECTABLE;
5090 msaa_state |= STATE_SYSTEM_SELECTED;
5095 msaa_state |= STATE_SYSTEM_TRAVERSED;
5101 switch (
data.GetCheckedState()) {
5107 msaa_state |= STATE_SYSTEM_PRESSED;
5112 msaa_state |= STATE_SYSTEM_PRESSED | STATE_SYSTEM_CHECKED;
5114 msaa_state |= STATE_SYSTEM_CHECKED;
5118 msaa_state |= STATE_SYSTEM_MIXED;
5124 switch (restriction) {
5126 msaa_state |= STATE_SYSTEM_UNAVAILABLE;
5129 msaa_state |= STATE_SYSTEM_READONLY;
5138 msaa_state |= STATE_SYSTEM_READONLY;
5148 msaa_state |= STATE_SYSTEM_UNAVAILABLE;
5155 if (focus ==
const_cast<AXPlatformNodeWin*
>(
this)->GetNativeViewAccessible())
5156 msaa_state |= STATE_SYSTEM_FOCUSED;
5162 AXPlatformNodeBase* container = FromNativeViewAccessible(GetParent());
5163 if (container && container->GetParent() == focus) {
5164 AXNodeData container_data = container->GetData();
5168 msaa_state |= STATE_SYSTEM_FOCUSED;
5181 msaa_state |= STATE_SYSTEM_FOCUSED;
5186 msaa_state |= STATE_SYSTEM_LINKED;
5191 msaa_state |= STATE_SYSTEM_MIXED;
5197std::optional<DWORD> AXPlatformNodeWin::MojoEventToMSAAEvent(
5201 return EVENT_SYSTEM_ALERT;
5205 return EVENT_OBJECT_STATECHANGE;
5208 return EVENT_OBJECT_FOCUS;
5210 return EVENT_OBJECT_LIVEREGIONCHANGED;
5212 return EVENT_SYSTEM_MENUSTART;
5214 return EVENT_SYSTEM_MENUEND;
5216 return EVENT_SYSTEM_MENUPOPUPSTART;
5218 return EVENT_SYSTEM_MENUPOPUPEND;
5220 return EVENT_OBJECT_SELECTION;
5222 return EVENT_OBJECT_SELECTIONADD;
5224 return EVENT_OBJECT_SELECTIONREMOVE;
5226 return EVENT_OBJECT_NAMECHANGE;
5228 return EVENT_OBJECT_HIDE;
5230 return EVENT_OBJECT_SHOW;
5232 return EVENT_OBJECT_VALUECHANGE;
5234 return EVENT_OBJECT_TEXTSELECTIONCHANGED;
5236 return std::nullopt;
5241std::optional<EVENTID> AXPlatformNodeWin::MojoEventToUIAEvent(
5245 return UIA_SystemAlertEventId;
5247 return UIA_Text_TextChangedEventId;
5251 return UIA_AutomationFocusChangedEventId;
5253 return UIA_LiveRegionChangedEventId;
5255 return UIA_SelectionItem_ElementSelectedEventId;
5257 return UIA_SelectionItem_ElementAddedToSelectionEventId;
5259 return UIA_SelectionItem_ElementRemovedFromSelectionEventId;
5261 return UIA_ToolTipClosedEventId;
5263 return UIA_ToolTipOpenedEventId;
5265 return std::nullopt;
5269std::optional<PROPERTYID> AXPlatformNodeWin::MojoEventToUIAProperty(
5273 return UIA_ControllerForPropertyId;
5275 return UIA_ToggleToggleStatePropertyId;
5278 return UIA_ExpandCollapseExpandCollapseStatePropertyId;
5282 return UIA_SelectionItemIsSelectedPropertyId;
5285 return UIA_ToggleToggleStatePropertyId;
5287 return std::nullopt;
5289 return std::nullopt;
5294BSTR AXPlatformNodeWin::GetValueAttributeAsBstr(AXPlatformNodeWin*
target) {
5311 unsigned int color =
static_cast<unsigned int>(
5315 unsigned int red = (((
color) >> 16) & 0xFF);
5316 unsigned int green = (((
color) >> 8) & 0xFF);
5317 unsigned int blue = (((
color) >> 0) & 0xFF);
5318 std::u16string value_text;
5353 if (
result.empty() &&
target->GetData().IsRangeValueSupported()) {
5372HRESULT AXPlatformNodeWin::GetStringAttributeAsBstr(
5374 BSTR* value_bstr)
const {
5377 if (!GetString16Attribute(attribute, &str))
5386HRESULT AXPlatformNodeWin::GetNameAsBstr(BSTR* value_bstr)
const {
5387 std::u16string str = GetNameAsString16();
5395void AXPlatformNodeWin::AddAlertTarget() {}
5397void AXPlatformNodeWin::RemoveAlertTarget() {}
5399AXPlatformNodeWin* AXPlatformNodeWin::GetTargetFromChildID(
5401 if (V_VT(&var_id) != VT_I4)
5404 LONG child_id = V_I4(&var_id);
5405 if (child_id == CHILDID_SELF)
5408 if (child_id >= 1 && child_id <= GetDelegate()->GetChildCount()) {
5411 AXPlatformNodeBase*
base =
5412 FromNativeViewAccessible(GetDelegate()->ChildAtIndex(child_id - 1));
5413 return static_cast<AXPlatformNodeWin*
>(
base);
5420 AXPlatformNode* node = GetFromUniqueId(-child_id);
5424 AXPlatformNodeBase*
base =
5425 FromNativeViewAccessible(node->GetNativeViewAccessible());
5426 if (
base && !
base->IsDescendantOf(
this))
5429 return static_cast<AXPlatformNodeWin*
>(
base);
5432bool AXPlatformNodeWin::IsInTreeGrid() {
5433 AXPlatformNodeBase* container = FromNativeViewAccessible(GetParent());
5437 container = FromNativeViewAccessible(container->GetParent());
5445HRESULT AXPlatformNodeWin::AllocateComArrayFromVector(
5446 std::vector<LONG>& results,
5455 *n_selected =
count;
5456 *selected =
static_cast<LONG*
>(CoTaskMemAlloc(
sizeof(
LONG) *
count));
5459 (*selected)[
i] = results[
i];
5463bool AXPlatformNodeWin::IsPlaceholderText()
const {
5466 AXPlatformNodeWin* parent =
5467 static_cast<AXPlatformNodeWin*
>(FromNativeViewAccessible(GetParent()));
5470 return parent->IsTextField() &&
5474double AXPlatformNodeWin::GetHorizontalScrollPercent() {
5475 if (!IsHorizontallyScrollable())
5476 return UIA_ScrollPatternNoScroll;
5481 return 100.0 * (
x - x_min) / (x_max - x_min);
5484double AXPlatformNodeWin::GetVerticalScrollPercent() {
5485 if (!IsVerticallyScrollable())
5486 return UIA_ScrollPatternNoScroll;
5491 return 100.0 * (
y - y_min) / (y_max - y_min);
5494BSTR AXPlatformNodeWin::GetFontNameAttributeAsBSTR()
const {
5495 const std::u16string
string =
5501BSTR AXPlatformNodeWin::GetStyleNameAttributeAsBSTR()
const {
5502 std::u16string style_name =
5503 GetDelegate()->GetStyleNameAttributeAsLocalizedString();
5508TextDecorationLineStyle AXPlatformNodeWin::GetUIATextDecorationStyle(
5512 GetIntAttribute(int_attribute));
5514 switch (text_decoration_style) {
5516 return TextDecorationLineStyle::TextDecorationLineStyle_None;
5518 return TextDecorationLineStyle::TextDecorationLineStyle_Dot;
5520 return TextDecorationLineStyle::TextDecorationLineStyle_Dash;
5522 return TextDecorationLineStyle::TextDecorationLineStyle_Single;
5524 return TextDecorationLineStyle::TextDecorationLineStyle_Double;
5526 return TextDecorationLineStyle::TextDecorationLineStyle_Wavy;
5532AXPlatformNodeWin::PatternProviderFactoryMethod
5533AXPlatformNodeWin::GetPatternProviderFactoryMethod(PATTERNID pattern_id) {
5534 const AXNodeData&
data = GetData();
5536 switch (pattern_id) {
5537 case UIA_ExpandCollapsePatternId:
5538 if (
data.SupportsExpandCollapse()) {
5539 return &PatternProvider<IExpandCollapseProvider>;
5543 case UIA_GridPatternId:
5545 return &PatternProvider<IGridProvider>;
5549 case UIA_GridItemPatternId:
5551 return &PatternProvider<IGridItemProvider>;
5555 case UIA_InvokePatternId:
5556 if (
data.IsInvocable()) {
5557 return &PatternProvider<IInvokeProvider>;
5561 case UIA_RangeValuePatternId:
5562 if (
data.IsRangeValueSupported()) {
5563 return &PatternProvider<IRangeValueProvider>;
5567 case UIA_ScrollPatternId:
5568 if (IsScrollable()) {
5569 return &PatternProvider<IScrollProvider>;
5573 case UIA_ScrollItemPatternId:
5574 return &PatternProvider<IScrollItemProvider>;
5577 case UIA_SelectionItemPatternId:
5578 if (IsSelectionItemSupported()) {
5579 return &PatternProvider<ISelectionItemProvider>;
5583 case UIA_SelectionPatternId:
5585 return &PatternProvider<ISelectionProvider>;
5589 case UIA_TablePatternId:
5595 std::optional<bool> table_has_headers =
5596 GetDelegate()->GetTableHasColumnOrRowHeaderNode();
5597 if (table_has_headers.has_value() && table_has_headers.value()) {
5598 return &PatternProvider<ITableProvider>;
5603 case UIA_TableItemPatternId:
5610 std::optional<bool> table_has_headers =
5611 GetDelegate()->GetTableHasColumnOrRowHeaderNode();
5612 if (table_has_headers.has_value() && table_has_headers.value()) {
5613 return &PatternProvider<ITableItemProvider>;
5618 case UIA_TextEditPatternId:
5619 case UIA_TextPatternId:
5620 if (
IsText() || IsTextField() ||
5622 return &AXPlatformNodeTextProviderWin::CreateIUnknown;
5626 case UIA_TogglePatternId:
5628 return &PatternProvider<IToggleProvider>;
5632 case UIA_ValuePatternId:
5634 return &PatternProvider<IValueProvider>;
5638 case UIA_WindowPatternId:
5640 return &PatternProvider<IWindowProvider>;
5645 case UIA_AnnotationPatternId:
5646 case UIA_CustomNavigationPatternId:
5647 case UIA_DockPatternId:
5648 case UIA_DragPatternId:
5649 case UIA_DropTargetPatternId:
5650 case UIA_ItemContainerPatternId:
5651 case UIA_MultipleViewPatternId:
5652 case UIA_ObjectModelPatternId:
5653 case UIA_SpreadsheetPatternId:
5654 case UIA_SpreadsheetItemPatternId:
5655 case UIA_StylesPatternId:
5656 case UIA_SynchronizedInputPatternId:
5657 case UIA_TextPattern2Id:
5658 case UIA_TransformPatternId:
5659 case UIA_TransformPattern2Id:
5660 case UIA_VirtualizedItemPatternId:
5664 case UIA_LegacyIAccessiblePatternId:
5670void AXPlatformNodeWin::FireLiveRegionChangeRecursive() {
5672 if (HasStringAttribute(live_status_attr) &&
5673 GetStringAttribute(live_status_attr) !=
"off") {
5675 ::UiaRaiseAutomationEvent(
this, UIA_LiveRegionChangedEventId);
5679 for (
int index = 0; index < GetChildCount(); ++index) {
5680 auto* child =
static_cast<AXPlatformNodeWin*
>(
5681 FromNativeViewAccessible(ChildAtIndex(index)));
5686 if (child->GetDelegate()->IsWebContent())
5687 child->FireLiveRegionChangeRecursive();
5691AXPlatformNodeWin* AXPlatformNodeWin::GetLowestAccessibleElement() {
5692 if (!IsInaccessibleDueToAncestor())
5695 AXPlatformNodeWin* parent =
static_cast<AXPlatformNodeWin*
>(
5698 if (parent->ShouldHideChildrenForUIA())
5700 parent =
static_cast<AXPlatformNodeWin*
>(
5708AXPlatformNodeWin* AXPlatformNodeWin::GetFirstTextOnlyDescendant() {
5709 for (
auto* child =
static_cast<AXPlatformNodeWin*
>(GetFirstChild()); child;
5710 child =
static_cast<AXPlatformNodeWin*
>(child->GetNextSibling())) {
5711 if (child->IsText())
5713 if (AXPlatformNodeWin* descendant = child->GetFirstTextOnlyDescendant())
5719bool AXPlatformNodeWin::IsDescendantOf(AXPlatformNode* ancestor)
const {
5730 IRawElementProviderFragmentRoot*
root;
5732 const_cast<AXPlatformNodeWin*
>(
this)->get_FragmentRoot(&
root))) {
5733 AXPlatformNodeWin* root_win;
5734 if (
SUCCEEDED(
root->QueryInterface(__uuidof(AXPlatformNodeWin),
5735 reinterpret_cast<void**
>(&root_win)))) {
5736 return ancestor ==
static_cast<AXPlatformNode*
>(root_win);
static float next(float f)
static std::vector< SkPDFIndirectReference > sort(const THashSet< SkPDFIndirectReference > &src)
ax::mojom::Event event_type
Vector2d OffsetFromOrigin() const
static AXFragmentRootWin * GetForAcceleratedWidget(gfx::AcceleratedWidget widget)
static AXFragmentRootWin * GetFragmentRootParentOf(gfx::NativeViewAccessible accessible)
static constexpr uint32_t kScreenReader
static constexpr uint32_t kHTML
static const UiaRegistrarWin & GetInstance()
EMSCRIPTEN_KEEPALIVE void empty()
static float max(float r, float g, float b)
static float min(float r, float g, float b)
Optional< SkRect > bounds
@ kPdfActionableHighlight
@ kAttributeExplicitlyEmpty
const int32_t kUnknownAriaColumnOrRowCount
@ kDocumentSelectionChanged
@ kSilentlyEligibleForAnnotation
@ kAnnotationProcessFailed
@ kIneligibleForAnnotation
@ kWillNotAnnotateDueToScheme
@ kTextStrikethroughStyle
float GetScaleFactorForHWND(HWND hwnd)
std::string UTF16ToUTF8(std::u16string src)
void ReplaceChars(std::string in, std::string from, std::string to, std::string *out)
std::u16string UTF8ToUTF16(std::string src)
std::u16string ASCIIToUTF16(std::string src)
std::string JoinString(std::vector< std::string > tokens, std::string delimiter)
Dst ClampRound(Src value)
bool Contains(const Container &container, const Value &value)
std::string NumberToString(int32_t number)
std::u16string NumberToString16(float number)
static int64_t GetValue(Dart_Handle arg)
ObjectPtr Invoke(const Library &lib, const char *name)
DEF_SWITCHES_START aot vmservice shared library name
std::u16string WideStringToUtf16(const std::wstring_view str)
std::wstring Utf16ToWideString(const std::u16string_view str)
Point PointAtOffsetFromOrigin(const Vector2d &offset_from_origin)
Rect ToEnclosingRect(const RectF &r)
UnimplementedNativeViewAccessible * NativeViewAccessible
void Close(PathBuilder *builder)
void CreateATLModuleIfNeeded()
bool IsImage(const ax::mojom::Role role)
const uint32_t kScreenReaderAndHTMLAccessibilityModes
bool IsValuePatternSupported(AXPlatformNodeDelegate *delegate)
bool IsContainerWithSelectableChildren(const ax::mojom::Role role)
bool IsControl(const ax::mojom::Role role)
bool IsReadOnlySupported(const ax::mojom::Role role)
const char * ToString(ax::mojom::Event event)
bool IsCellOrTableHeader(const ax::mojom::Role role)
bool HasPresentationalChildren(const ax::mojom::Role role)
bool IsMenuItem(ax::mojom::Role role)
bool IsTableLike(const ax::mojom::Role role)
bool SupportsOrientation(const ax::mojom::Role role)
bool IsTableHeader(ax::mojom::Role role)
bool SupportsToggle(const ax::mojom::Role role)
bool ShouldHaveReadonlyStateByDefault(const ax::mojom::Role role)
bool IsList(const ax::mojom::Role role)
bool IsDialog(const ax::mojom::Role role)
std::optional< int32_t > GetActivePopupAxUniqueId()
bool IsText(ax::mojom::Role role)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
std::shared_ptr< const fml::Mapping > data
#define BASE_DCHECK(condition)
#define BASE_UNREACHABLE()