Flutter Engine
The Flutter Engine
ax_platform_node_win.h
Go to the documentation of this file.
1//
2// Copyright 2015 The Chromium Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5
6#ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_WIN_H_
7#define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_WIN_H_
8
9#include <atlbase.h>
10#include <atlcom.h>
11#include <objbase.h>
12#include <oleacc.h>
13#include <oleauto.h>
14#include <uiautomation.h>
15#include <wrl/client.h>
16
17#include <array>
18#include <map>
19#include <string>
20#include <vector>
21
22#include "ax/ax_export.h"
25#include "gfx/range/range.h"
26
27//
28// Macros to use at the top of any AXPlatformNodeWin (or derived class) method
29// that implements a UIA COM interface. The error code UIA_E_ELEMENTNOTAVAILABLE
30// signals to the OS that the object is no longer valid and no further methods
31// should be called on it.
32//
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; \
39 if (!arg) \
40 return E_INVALIDARG; \
41 *arg = {};
42
43namespace base {
44namespace win {
45class VariantVector;
46} // namespace win
47} // namespace base
48
49namespace ui {
50
51class AXPlatformNodeWin;
52// TODO(nektar): Remove multithread superclass since we don't support it.
53class AX_EXPORT __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2"))
54 AXPlatformNodeWin : public CComObjectRootEx<CComMultiThreadModel>,
55 public IDispatchImpl<IAccessible>,
56 public IExpandCollapseProvider,
57 public IGridItemProvider,
58 public IGridProvider,
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 {
75
76 public:
77 BEGIN_COM_MAP(AXPlatformNodeWin)
78 // TODO(nektar): Find a way to remove the following entry because it's not
79 // an interface.
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)
101 END_COM_MAP()
102
103 ~AXPlatformNodeWin() override;
104
105 void Init(AXPlatformNodeDelegate* delegate) override;
106
107 // AXPlatformNode overrides.
108 gfx::NativeViewAccessible GetNativeViewAccessible() override;
109 void NotifyAccessibilityEvent(ax::mojom::Event event_type) override;
110
111 // AXPlatformNodeBase overrides.
112 void Destroy() override;
113 std::u16string GetValue() const override;
114 bool IsPlatformCheckable() const override;
115
116 //
117 // IAccessible methods.
118 //
119
120 // Retrieves the child element or child object at a given point on the screen.
121 IFACEMETHODIMP accHitTest(LONG screen_physical_pixel_x,
122 LONG screen_physical_pixel_y,
123 VARIANT* child) override;
124
125 // Performs the object's default action.
126 IFACEMETHODIMP accDoDefaultAction(VARIANT var_id) override;
127
128 // Retrieves the specified object's current screen location.
129 IFACEMETHODIMP accLocation(LONG* physical_pixel_left,
130 LONG* physical_pixel_top,
131 LONG* width,
132 LONG* height,
133 VARIANT var_id) override;
134
135 // Traverses to another UI element and retrieves the object.
136 IFACEMETHODIMP accNavigate(LONG nav_dir,
137 VARIANT start,
138 VARIANT* end) override;
139
140 // Retrieves an IDispatch interface pointer for the specified child.
141 IFACEMETHODIMP get_accChild(VARIANT var_child,
142 IDispatch** disp_child) override;
143
144 // Retrieves the number of accessible children.
145 IFACEMETHODIMP get_accChildCount(LONG* child_count) override;
146
147 // Retrieves a string that describes the object's default action.
148 IFACEMETHODIMP get_accDefaultAction(VARIANT var_id,
149 BSTR* default_action) override;
150
151 // Retrieves the tooltip description.
152 IFACEMETHODIMP get_accDescription(VARIANT var_id, BSTR* desc) override;
153
154 // Retrieves the object that has the keyboard focus.
155 IFACEMETHODIMP get_accFocus(VARIANT* focus_child) override;
156
157 // Retrieves the specified object's shortcut.
158 IFACEMETHODIMP get_accKeyboardShortcut(VARIANT var_id,
159 BSTR* access_key) override;
160
161 // Retrieves the name of the specified object.
162 IFACEMETHODIMP get_accName(VARIANT var_id, BSTR* name) override;
163
164 // Retrieves the IDispatch interface of the object's parent.
165 IFACEMETHODIMP get_accParent(IDispatch** disp_parent) override;
166
167 // Retrieves information describing the role of the specified object.
168 IFACEMETHODIMP get_accRole(VARIANT var_id, VARIANT* role) override;
169
170 // Retrieves the current state of the specified object.
171 IFACEMETHODIMP get_accState(VARIANT var_id, VARIANT* state) override;
172
173 // Gets the help string for the specified object.
174 IFACEMETHODIMP get_accHelp(VARIANT var_id, BSTR* help) override;
175
176 // Retrieve or set the string value associated with the specified object.
177 // Setting the value is not typically used by screen readers, but it's
178 // used frequently by automation software.
179 IFACEMETHODIMP get_accValue(VARIANT var_id, BSTR* value) override;
180 IFACEMETHODIMP put_accValue(VARIANT var_id, BSTR new_value) override;
181
182 // IAccessible methods not implemented.
183 IFACEMETHODIMP get_accSelection(VARIANT* selected) override;
184 IFACEMETHODIMP accSelect(LONG flags_sel, VARIANT var_id) override;
185 IFACEMETHODIMP get_accHelpTopic(BSTR* help_file,
186 VARIANT var_id,
187 LONG* topic_id) override;
188 IFACEMETHODIMP put_accName(VARIANT var_id, BSTR put_name) override;
189
190 //
191 // IExpandCollapseProvider methods.
192 //
193
194 IFACEMETHODIMP Collapse() override;
195
196 IFACEMETHODIMP Expand() override;
197
198 IFACEMETHODIMP get_ExpandCollapseState(ExpandCollapseState* result) override;
199
200 //
201 // IGridItemProvider methods.
202 //
203
204 IFACEMETHODIMP get_Column(int* result) override;
205
206 IFACEMETHODIMP get_ColumnSpan(int* result) override;
207
208 IFACEMETHODIMP get_ContainingGrid(
209 IRawElementProviderSimple** result) override;
210
211 IFACEMETHODIMP get_Row(int* result) override;
212
213 IFACEMETHODIMP get_RowSpan(int* result) override;
214
215 //
216 // IGridProvider methods.
217 //
218
219 IFACEMETHODIMP GetItem(int row,
220 int column,
221 IRawElementProviderSimple** result) override;
222
223 IFACEMETHODIMP get_RowCount(int* result) override;
224
225 IFACEMETHODIMP get_ColumnCount(int* result) override;
226
227 //
228 // IInvokeProvider methods.
229 //
230
231 IFACEMETHODIMP Invoke() override;
232
233 //
234 // IScrollItemProvider methods.
235 //
236
237 IFACEMETHODIMP ScrollIntoView() override;
238
239 //
240 // IScrollProvider methods.
241 //
242
243 IFACEMETHODIMP Scroll(ScrollAmount horizontal_amount,
244 ScrollAmount vertical_amount) override;
245
246 IFACEMETHODIMP SetScrollPercent(double horizontal_percent,
247 double vertical_percent) override;
248
249 IFACEMETHODIMP get_HorizontallyScrollable(BOOL* result) override;
250
251 IFACEMETHODIMP get_HorizontalScrollPercent(double* result) override;
252
253 // Horizontal size of the viewable region as a percentage of the total content
254 // area.
255 IFACEMETHODIMP get_HorizontalViewSize(double* result) override;
256
257 IFACEMETHODIMP get_VerticallyScrollable(BOOL* result) override;
258
259 IFACEMETHODIMP get_VerticalScrollPercent(double* result) override;
260
261 // Vertical size of the viewable region as a percentage of the total content
262 // area.
263 IFACEMETHODIMP get_VerticalViewSize(double* result) override;
264
265 //
266 // ISelectionItemProvider methods.
267 //
268
269 IFACEMETHODIMP AddToSelection() override;
270
271 IFACEMETHODIMP RemoveFromSelection() override;
272
273 IFACEMETHODIMP Select() override;
274
275 IFACEMETHODIMP get_IsSelected(BOOL* result) override;
276
277 IFACEMETHODIMP get_SelectionContainer(
278 IRawElementProviderSimple** result) override;
279
280 //
281 // ISelectionProvider methods.
282 //
283
284 IFACEMETHODIMP GetSelection(SAFEARRAY** result) override;
285
286 IFACEMETHODIMP get_CanSelectMultiple(BOOL* result) override;
287
288 IFACEMETHODIMP get_IsSelectionRequired(BOOL* result) override;
289
290 //
291 // ITableItemProvider methods.
292 //
293
294 IFACEMETHODIMP GetColumnHeaderItems(SAFEARRAY** result) override;
295
296 IFACEMETHODIMP GetRowHeaderItems(SAFEARRAY** result) override;
297
298 //
299 // ITableProvider methods.
300 //
301
302 IFACEMETHODIMP GetColumnHeaders(SAFEARRAY** result) override;
303
304 IFACEMETHODIMP GetRowHeaders(SAFEARRAY** result) override;
305
306 IFACEMETHODIMP get_RowOrColumnMajor(RowOrColumnMajor* result) override;
307
308 //
309 // IToggleProvider methods.
310 //
311
312 IFACEMETHODIMP Toggle() override;
313
314 IFACEMETHODIMP get_ToggleState(ToggleState* result) override;
315
316 //
317 // IValueProvider methods.
318 //
319
320 IFACEMETHODIMP SetValue(LPCWSTR val) override;
321
322 IFACEMETHODIMP get_IsReadOnly(BOOL* result) override;
323
324 IFACEMETHODIMP get_Value(BSTR* result) override;
325
326 //
327 // IWindowProvider methods.
328 //
329
330 IFACEMETHODIMP SetVisualState(WindowVisualState window_visual_state) override;
331
332 IFACEMETHODIMP Close() override;
333
334 IFACEMETHODIMP WaitForInputIdle(int milliseconds, BOOL* result) override;
335
336 IFACEMETHODIMP get_CanMaximize(BOOL* result) override;
337
338 IFACEMETHODIMP get_CanMinimize(BOOL* result) override;
339
340 IFACEMETHODIMP get_IsModal(BOOL* result) override;
341
342 IFACEMETHODIMP get_WindowVisualState(WindowVisualState* result) override;
343
344 IFACEMETHODIMP get_WindowInteractionState(
345 WindowInteractionState* result) override;
346
347 IFACEMETHODIMP get_IsTopmost(BOOL* result) override;
348
349 //
350 // IRangeValueProvider methods.
351 //
352
353 IFACEMETHODIMP SetValue(double val) override;
354
355 IFACEMETHODIMP get_LargeChange(double* result) override;
356
357 IFACEMETHODIMP get_Maximum(double* result) override;
358
359 IFACEMETHODIMP get_Minimum(double* result) override;
360
361 IFACEMETHODIMP get_SmallChange(double* result) override;
362
363 IFACEMETHODIMP get_Value(double* result) override;
364
365 //
366 // IRawElementProviderFragment methods.
367 //
368
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;
380
381 //
382 // IRawElementProviderSimple methods.
383 //
384
385 IFACEMETHODIMP GetPatternProvider(PATTERNID pattern_id,
386 IUnknown** result) override;
387
388 IFACEMETHODIMP GetPropertyValue(PROPERTYID property_id,
389 VARIANT* result) override;
390
391 IFACEMETHODIMP
392 get_ProviderOptions(enum ProviderOptions* ret) override;
393
394 IFACEMETHODIMP
395 get_HostRawElementProvider(IRawElementProviderSimple** provider) override;
396
397 //
398 // IRawElementProviderSimple2 methods.
399 //
400
401 IFACEMETHODIMP ShowContextMenu() override;
402
403 //
404 // IServiceProvider methods.
405 //
406
407 IFACEMETHODIMP QueryService(REFGUID guidService,
408 REFIID riid,
409 void** object) override;
410
411 //
412 // Methods used by the ATL COM map.
413 //
414
415 // Called by BEGIN_COM_MAP() / END_COM_MAP().
416 static STDMETHODIMP InternalQueryInterface(void* this_ptr,
417 const _ATL_INTMAP_ENTRY* entries,
418 REFIID riid,
419 void** object);
420
421 // Support method for ITextRangeProvider::GetAttributeValue.
422 // If either |start_offset| or |end_offset| are not provided then the
423 // endpoint is treated as the start or end of the node respectively.
424 HRESULT GetTextAttributeValue(TEXTATTRIBUTEID attribute_id,
425 const std::optional<int>& start_offset,
426 const std::optional<int>& end_offset,
428
429 // IRawElementProviderSimple support method.
430 bool IsPatternProviderSupported(PATTERNID pattern_id);
431
432 // Prefer GetPatternProviderImpl when calling internally. We should avoid
433 // calling external APIs internally as it will cause the histograms to become
434 // innaccurate.
435 HRESULT GetPatternProviderImpl(PATTERNID pattern_id, IUnknown** result);
436
437 // Prefer GetPropertyValueImpl when calling internally. We should avoid
438 // calling external APIs internally as it will cause the histograms to become
439 // innaccurate.
440 HRESULT GetPropertyValueImpl(PROPERTYID property_id, VARIANT* result);
441
442 // Helper to return the runtime id (without going through a SAFEARRAY)
443 using RuntimeIdArray = std::array<int, 2>;
444 void GetRuntimeIdArray(RuntimeIdArray& runtime_id);
445
446 // Updates the active composition range and fires UIA text edit event about
447 // composition (active or committed)
448 void OnActiveComposition(const gfx::Range& range,
449 const std::u16string& active_composition_text,
450 bool is_composition_committed);
451 // Returns true if there is an active composition
452 bool HasActiveComposition() const;
453 // Returns the start/end offsets of the active composition
454 gfx::Range GetActiveCompositionOffsets() const;
455
456 // Helper to recursively find live-regions and fire a change event on them
457 void FireLiveRegionChangeRecursive();
458
459 // Returns the parent node that makes this node inaccessible.
460 AXPlatformNodeWin* GetLowestAccessibleElement();
461
462 // Returns the first |IsTextOnlyObject| descendant using
463 // depth-first pre-order traversal.
464 AXPlatformNodeWin* GetFirstTextOnlyDescendant();
465
466 // Convert a mojo event to an MSAA event. Exposed for testing.
467 static std::optional<DWORD> MojoEventToMSAAEvent(ax::mojom::Event event);
468
469 // Convert a mojo event to a UIA event. Exposed for testing.
470 static std::optional<EVENTID> MojoEventToUIAEvent(ax::mojom::Event event);
471
472 // Convert a mojo event to a UIA property id. Exposed for testing.
473 std::optional<PROPERTYID> MojoEventToUIAProperty(ax::mojom::Event event);
474
475 // |AXPlatformNodeBase|
476 bool IsDescendantOf(AXPlatformNode* ancestor) const override;
477
478 protected:
479 // This is hard-coded; all products based on the Chromium engine will have the
480 // same framework name, so that assistive technology can detect any
481 // Chromium-based product.
482 static constexpr const wchar_t* FRAMEWORK_ID = L"Chrome";
483
484 AXPlatformNodeWin();
485
486 int MSAAState() const;
487
488 int MSAARole();
489
490 std::u16string UIAAriaRole();
491
492 std::u16string ComputeUIAProperties();
493
494 LONG ComputeUIAControlType();
495
496 AXPlatformNodeWin* ComputeUIALabeledBy();
497
498 bool CanHaveUIALabeledBy();
499
500 bool IsNameExposed() const;
501
502 bool IsUIAControl() const;
503
504 std::optional<LONG> ComputeUIALandmarkType() const;
505
506 bool IsInaccessibleDueToAncestor() const;
507
508 bool ShouldHideChildrenForUIA() const;
509
510 ExpandCollapseState ComputeExpandCollapseState() const;
511
512 // AXPlatformNodeBase overrides.
513 void Dispose() override;
514
515 AXHypertext old_hypertext_;
516
517 // These protected methods are still used by BrowserAccessibilityComWin. At
518 // some point post conversion, we can probably move these to be private
519 // methods.
520
521 // A helper to add the given string value to |attributes|.
522 void AddAttributeToList(const char* name,
523 const char* value,
524 PlatformAttributeList* attributes) override;
525
526 private:
527 bool IsWebAreaForPresentationalIframe();
528 bool ShouldNodeHaveFocusableState(const AXNodeData& data) const;
529
530 // Get the value attribute as a Bstr, this means something different depending
531 // on the type of element being queried. (e.g. kColorWell uses kColorValue).
532 static BSTR GetValueAttributeAsBstr(AXPlatformNodeWin* target);
533
534 HRESULT GetStringAttributeAsBstr(ax::mojom::StringAttribute attribute,
535 BSTR* value_bstr) const;
536
537 HRESULT GetNameAsBstr(BSTR* value_bstr) const;
538
539 // Escapes characters in string attributes as required by the UIA Aria
540 // Property Spec. It's okay for input to be the same as output.
541 static void SanitizeStringAttributeForUIAAriaProperty(
542 const std::u16string& input,
543 std::u16string* output);
544
545 // If the string attribute |attribute| is present, add its value as a
546 // UIA AriaProperties Property with the name |uia_aria_property|.
547 void StringAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
549 const char* uia_aria_property);
550
551 // If the bool attribute |attribute| is present, add its value as a
552 // UIA AriaProperties Property with the name |uia_aria_property|.
553 void BoolAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
554 ax::mojom::BoolAttribute attribute,
555 const char* uia_aria_property);
556
557 // If the int attribute |attribute| is present, add its value as a
558 // UIA AriaProperties Property with the name |uia_aria_property|.
559 void IntAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
560 ax::mojom::IntAttribute attribute,
561 const char* uia_aria_property);
562
563 // If the float attribute |attribute| is present, add its value as a
564 // UIA AriaProperties Property with the name |uia_aria_property|.
565 void FloatAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
567 const char* uia_aria_property);
568
569 // If the state |state| exists, set the
570 // UIA AriaProperties Property with the name |uia_aria_property| to "true".
571 // Otherwise set the AriaProperties Property to "false".
572 void StateToUIAAriaProperty(std::vector<std::u16string>& properties,
574 const char* uia_aria_property);
575
576 // If the Html attribute |html_attribute_name| is present, add its value as a
577 // UIA AriaProperties Property with the name |uia_aria_property|.
578 void HtmlAttributeToUIAAriaProperty(std::vector<std::u16string>& properties,
579 const char* html_attribute_name,
580 const char* uia_aria_property);
581
582 // If the IntList attribute |attribute| is present, return an array
583 // of automation elements referenced by the ids in the
584 // IntList attribute. Otherwise return an empty array.
585 // The function will skip over any ids that cannot be resolved.
586 SAFEARRAY* CreateUIAElementsArrayForRelation(
587 const ax::mojom::IntListAttribute& attribute);
588
589 // Return an array of automation elements based on the attribute
590 // IntList::kControlsIds for web content and IntAttribute::kViewPopupId. These
591 // two attributes denote the controllees, web content elements and view popup
592 // element respectively.
593 // The function will skip over any ids that cannot be resolved.
594 SAFEARRAY* CreateUIAControllerForArray();
595
596 // Return an unordered array of automation elements which reference this node
597 // for the given attribute.
598 SAFEARRAY* CreateUIAElementsArrayForReverseRelation(
599 const ax::mojom::IntListAttribute& attribute);
600
601 // Return a vector of AXPlatformNodeWin referenced by the ids in function
602 // argument. The function will skip over any ids that cannot be resolved as
603 // valid relation target.
604 std::vector<AXPlatformNodeWin*> CreatePlatformNodeVectorFromRelationIdVector(
605 std::vector<int32_t>& relation_id_list);
606
607 // Create a safearray of automation elements from a vector of
608 // AXPlatformNodeWin.
609 // The caller should validate that all of the given ax platform nodes are
610 // valid relation targets.
611 SAFEARRAY* CreateUIAElementsSafeArray(
612 std::vector<AXPlatformNodeWin*>& platform_node_list);
613
614 // Return an array that contains the center x, y coordinates of the
615 // clickable point.
616 SAFEARRAY* CreateClickablePointArray();
617
618 // Returns the scroll offsets to which UI Automation should scroll an
619 // accessible object, given the horizontal and vertical scroll amounts.
620 gfx::Vector2d CalculateUIAScrollPoint(
621 const ScrollAmount horizontal_amount,
622 const ScrollAmount vertical_amount) const;
623
624 void AddAlertTarget();
625 void RemoveAlertTarget();
626
627 // Enum used to specify whether IAccessibleText is requesting text
628 // At, Before, or After a specified offset.
629 enum class TextOffsetType { kAtOffset, kBeforeOffset, kAfterOffset };
630
631 // Many MSAA methods take a var_id parameter indicating that the operation
632 // should be performed on a particular child ID, rather than this object.
633 // This method tries to figure out the target object from |var_id| and
634 // returns a pointer to the target object if it exists, otherwise nullptr.
635 // Does not return a new reference.
636 AXPlatformNodeWin* GetTargetFromChildID(const VARIANT& var_id);
637
638 // Returns true if this node is in a treegrid.
639 bool IsInTreeGrid();
640
641 // Helper method for returning selected indicies. It is expected that the
642 // caller ensures that the input has been validated.
643 HRESULT AllocateComArrayFromVector(std::vector<LONG>& results,
644 LONG max,
645 LONG** selected,
646 LONG* n_selected);
647
648 // Helper method for mutating the ISelectionItemProvider selected state
649 HRESULT ISelectionItemProviderSetSelected(bool selected) const;
650
651 // Helper method getting the selected status.
652 bool ISelectionItemProviderIsSelected() const;
653
654 //
655 // Getters for UIA GetTextAttributeValue
656 //
657
658 // Computes the AnnotationTypes Attribute for the current node.
659 HRESULT GetAnnotationTypesAttribute(const std::optional<int>& start_offset,
660 const std::optional<int>& end_offset,
662 // Lookup the LCID for the language this node is using.
663 // Returns base::nullopt if there was an error.
664 std::optional<LCID> GetCultureAttributeAsLCID() const;
665 // Converts an int attribute to a COLORREF
666 COLORREF GetIntAttributeAsCOLORREF(ax::mojom::IntAttribute attribute) const;
667 // Converts the ListStyle to UIA BulletStyle
668 BulletStyle ComputeUIABulletStyle() const;
669 // Helper to get the UIA StyleId enumeration for this node
670 LONG ComputeUIAStyleId() const;
671 // Convert mojom TextAlign to UIA HorizontalTextAlignment enumeration
672 static std::optional<HorizontalTextAlignment>
673 AXTextAlignToUIAHorizontalTextAlignment(ax::mojom::TextAlign text_align);
674 // Converts IntAttribute::kHierarchicalLevel to UIA StyleId enumeration
675 static LONG AXHierarchicalLevelToUIAStyleId(int32_t hierarchical_level);
676 // Converts a ListStyle to UIA StyleId enumeration
677 static LONG AXListStyleToUIAStyleId(ax::mojom::ListStyle list_style);
678 // Convert mojom TextDirection to UIA FlowDirections enumeration
679 static FlowDirections TextDirectionToFlowDirections(
681
682 // Helper method for |GetMarkerTypeFromRange| which aggregates all
683 // of the ranges for |marker_type| attached to |node|.
684 static void AggregateRangesForMarkerType(
685 AXPlatformNodeBase* node,
686 ax::mojom::MarkerType marker_type,
687 int offset_ranges_amount,
688 std::vector<std::pair<int, int>>* ranges);
689
690 enum class MarkerTypeRangeResult {
691 // The MarkerType does not overlap the range.
692 kNone,
693 // The MarkerType overlaps the entire range.
694 kMatch,
695 // The MarkerType partially overlaps the range.
696 kMixed,
697 };
698
699 // Determine if a text range overlaps a |marker_type|, and whether
700 // the overlap is a partial or complete match.
701 MarkerTypeRangeResult GetMarkerTypeFromRange(
702 const std::optional<int>& start_offset,
703 const std::optional<int>& end_offset,
704 ax::mojom::MarkerType marker_type);
705
706 bool IsAncestorComboBox();
707
708 bool IsPlaceholderText() const;
709
710 // Helper method for getting the horizontal scroll percent.
711 double GetHorizontalScrollPercent();
712
713 // Helper method for getting the vertical scroll percent.
714 double GetVerticalScrollPercent();
715
716 // Helper to get the UIA FontName for this node as a BSTR.
717 BSTR GetFontNameAttributeAsBSTR() const;
718
719 // Helper to get the UIA StyleName for this node as a BSTR.
720 BSTR GetStyleNameAttributeAsBSTR() const;
721
722 // Gets the TextDecorationLineStyle based on the provided int attribute.
723 TextDecorationLineStyle GetUIATextDecorationStyle(
724 const ax::mojom::IntAttribute int_attribute) const;
725
726 // IRawElementProviderSimple support methods.
727
728 using PatternProviderFactoryMethod = void (*)(AXPlatformNodeWin*, IUnknown**);
729
730 PatternProviderFactoryMethod GetPatternProviderFactoryMethod(
731 PATTERNID pattern_id);
732
733 // Fires UIA text edit event about composition (active or committed)
734 void FireUiaTextEditTextChangedEvent(
735 const gfx::Range& range,
736 const std::u16string& active_composition_text,
737 bool is_composition_committed);
738
739 // Return true if the given element is valid enough to be returned as a value
740 // for a UIA relation property (e.g. ControllerFor).
741 static bool IsValidUiaRelationTarget(AXPlatformNode* ax_platform_node);
742
743 // Start and end offsets of an active composition
744 gfx::Range active_composition_range_;
745};
746
747} // namespace ui
748
749#endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_WIN_H_
ax::mojom::Event event_type
#define AX_EXPORT
Definition: ax_export.h:29
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
static bool b
AtkStateType state
FlKeyEvent * event
uint8_t value
GAsyncResult * result
uint32_t * target
void Init()
static float max(float r, float g, float b)
Definition: hsl.cpp:49
StringAttribute
Definition: ax_enums.h:521
FloatAttribute
Definition: ax_enums.h:699
WritingDirection
Definition: ax_enums.h:964
IntListAttribute
Definition: ax_enums.h:799
static int64_t GetValue(Dart_Handle arg)
ObjectPtr Invoke(const Library &lib, const char *name)
@ kNone
Definition: layer.h:53
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
UnimplementedNativeViewAccessible * NativeViewAccessible
void Close(PathBuilder *builder)
Definition: tessellator.cc:38
help
Definition: zip.py:79
int32_t height
int32_t width
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
int BOOL
Definition: windows_types.h:37
long LONG
Definition: windows_types.h:23
#define REFGUID
Definition: windows_types.h:76