Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: content/browser/accessibility/browser_accessibility_com_win.h

Issue 2864953002: Split out the MSCOM pieces of BrowserAccessibilityWin into a seperate class. (Closed)
Patch Set: follow up comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_
7 7
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlcom.h> 9 #include <atlcom.h>
10 #include <oleacc.h> 10 #include <oleacc.h>
11 #include <stddef.h> 11 #include <stddef.h>
12 #include <stdint.h> 12 #include <stdint.h>
13 #include <vector>
14
13 #include <UIAutomationCore.h> 15 #include <UIAutomationCore.h>
14 16
15 #include <vector>
16
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/gtest_prod_util.h" 18 #include "base/gtest_prod_util.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "content/browser/accessibility/browser_accessibility.h" 20 #include "content/browser/accessibility/browser_accessibility.h"
21 #include "content/browser/accessibility/browser_accessibility_win.h"
21 #include "content/common/content_export.h" 22 #include "content/common/content_export.h"
22 #include "third_party/iaccessible2/ia2_api_all.h" 23 #include "third_party/iaccessible2/ia2_api_all.h"
23 #include "third_party/isimpledom/ISimpleDOMDocument.h" 24 #include "third_party/isimpledom/ISimpleDOMDocument.h"
24 #include "third_party/isimpledom/ISimpleDOMNode.h" 25 #include "third_party/isimpledom/ISimpleDOMNode.h"
25 #include "third_party/isimpledom/ISimpleDOMText.h" 26 #include "third_party/isimpledom/ISimpleDOMText.h"
26 #include "ui/accessibility/platform/ax_platform_node_win.h" 27 #include "ui/accessibility/platform/ax_platform_node_win.h"
27 28
29 namespace ui {
30 enum TextBoundaryDirection;
31 enum TextBoundaryType;
32 }
33
28 namespace content { 34 namespace content {
35 class BrowserAccessibilityWin;
29 class BrowserAccessibilityRelation; 36 class BrowserAccessibilityRelation;
30 37
31 //////////////////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////////////////
32 // 39 //
33 // BrowserAccessibilityWin 40 // BrowserAccessibilityComWin
34 // 41 //
35 // Class implementing the windows accessible interface for the Browser-Renderer 42 // Class implementing the windows accessible interface used by screen readers
36 // communication of accessibility information, providing accessibility 43 // and other assistive technology (AT). It typically is created and owned by
37 // to be used by screen readers and other assistive technology (AT). 44 // a BrowserAccessibilityWin |owner_|. When this owner goes away, the
45 // BrowserAccessibilityComWin objects may continue to exists being held onto by
46 // MSCOM (due to reference counting). However, such objects are invalid and
47 // should gracefully fail by returning E_FAIL from all MSCOM methods.
38 // 48 //
39 //////////////////////////////////////////////////////////////////////////////// 49 ////////////////////////////////////////////////////////////////////////////////
40 class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79")) 50 class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79"))
41 BrowserAccessibilityWin 51 BrowserAccessibilityComWin : public ui::AXPlatformNodeWin,
42 : public BrowserAccessibility, 52 public IAccessibleApplication,
43 public CComObjectRootEx<CComMultiThreadModel>, 53 public IAccessibleHyperlink,
44 public IDispatchImpl<IAccessible2, &IID_IAccessible2, 54 public IAccessibleHypertext,
45 &LIBID_IAccessible2Lib>, 55 public IAccessibleImage,
46 public IAccessibleApplication, 56 public IAccessibleTable,
47 public IAccessibleHyperlink, 57 public IAccessibleTable2,
48 public IAccessibleHypertext, 58 public IAccessibleTableCell,
49 public IAccessibleImage, 59 public IAccessibleValue,
50 public IAccessibleTable, 60 public ISimpleDOMDocument,
51 public IAccessibleTable2, 61 public ISimpleDOMNode,
52 public IAccessibleTableCell, 62 public ISimpleDOMText,
53 public IAccessibleValue, 63 public IAccessibleEx,
54 public IServiceProvider, 64 public IRawElementProviderSimple {
55 public ISimpleDOMDocument,
56 public ISimpleDOMNode,
57 public ISimpleDOMText,
58 public IAccessibleEx,
59 public IRawElementProviderSimple {
60 public: 65 public:
61 BEGIN_COM_MAP(BrowserAccessibilityWin) 66 BEGIN_COM_MAP(BrowserAccessibilityComWin)
62 COM_INTERFACE_ENTRY2(IDispatch, IAccessible2) 67 COM_INTERFACE_ENTRY(IAccessibleAction)
63 COM_INTERFACE_ENTRY(IAccessible) 68 COM_INTERFACE_ENTRY(IAccessibleApplication)
64 COM_INTERFACE_ENTRY(IAccessible2) 69 COM_INTERFACE_ENTRY(IAccessibleEx)
65 COM_INTERFACE_ENTRY(IAccessibleAction) 70 COM_INTERFACE_ENTRY(IAccessibleHyperlink)
66 COM_INTERFACE_ENTRY(IAccessibleApplication) 71 COM_INTERFACE_ENTRY(IAccessibleHypertext)
67 COM_INTERFACE_ENTRY(IAccessibleEx) 72 COM_INTERFACE_ENTRY(IAccessibleImage)
68 COM_INTERFACE_ENTRY(IAccessibleHyperlink) 73 COM_INTERFACE_ENTRY(IAccessibleTable)
69 COM_INTERFACE_ENTRY(IAccessibleHypertext) 74 COM_INTERFACE_ENTRY(IAccessibleTable2)
70 COM_INTERFACE_ENTRY(IAccessibleImage) 75 COM_INTERFACE_ENTRY(IAccessibleTableCell)
71 COM_INTERFACE_ENTRY(IAccessibleTable) 76 COM_INTERFACE_ENTRY(IAccessibleValue)
72 COM_INTERFACE_ENTRY(IAccessibleTable2) 77 COM_INTERFACE_ENTRY(IRawElementProviderSimple)
73 COM_INTERFACE_ENTRY(IAccessibleTableCell) 78 COM_INTERFACE_ENTRY(ISimpleDOMDocument)
74 COM_INTERFACE_ENTRY(IAccessibleText) 79 COM_INTERFACE_ENTRY(ISimpleDOMNode)
75 COM_INTERFACE_ENTRY(IAccessibleValue) 80 COM_INTERFACE_ENTRY(ISimpleDOMText)
76 COM_INTERFACE_ENTRY(IRawElementProviderSimple) 81 COM_INTERFACE_ENTRY_CHAIN(ui::AXPlatformNodeWin)
77 COM_INTERFACE_ENTRY(IServiceProvider)
78 COM_INTERFACE_ENTRY(ISimpleDOMDocument)
79 COM_INTERFACE_ENTRY(ISimpleDOMNode)
80 COM_INTERFACE_ENTRY(ISimpleDOMText)
81 END_COM_MAP() 82 END_COM_MAP()
82 83
83 // Represents a non-static text node in IAccessibleHypertext. This character 84 // Represents a non-static text node in IAccessibleHypertext. This character
84 // is embedded in the response to IAccessibleText::get_text, indicating the 85 // is embedded in the response to IAccessibleText::get_text, indicating the
85 // position where a non-static text child object appears. 86 // position where a non-static text child object appears.
86 CONTENT_EXPORT static const base::char16 kEmbeddedCharacter; 87 CONTENT_EXPORT static const base::char16 kEmbeddedCharacter;
87 88
88 // Mappings from roles and states to human readable strings. Initialize 89 // Mappings from roles and states to human readable strings. Initialize
89 // with |InitializeStringMaps|. 90 // with |InitializeStringMaps|.
90 static std::map<int32_t, base::string16> role_string_map; 91 static std::map<int32_t, base::string16> role_string_map;
91 static std::map<int32_t, base::string16> state_string_map; 92 static std::map<int32_t, base::string16> state_string_map;
92 93
93 CONTENT_EXPORT BrowserAccessibilityWin(); 94 CONTENT_EXPORT BrowserAccessibilityComWin();
94 95 CONTENT_EXPORT ~BrowserAccessibilityComWin() override;
95 CONTENT_EXPORT ~BrowserAccessibilityWin() override;
96 96
97 // Called after an atomic tree update completes. See 97 // Called after an atomic tree update completes. See
98 // BrowserAccessibilityManagerWin::OnAtomicUpdateFinished for more 98 // BrowserAccessibilityManagerWin::OnAtomicUpdateFinished for more
99 // details on what these do. 99 // details on what these do.
100 CONTENT_EXPORT void UpdateStep1ComputeWinAttributes(); 100 CONTENT_EXPORT void UpdateStep1ComputeWinAttributes();
101 CONTENT_EXPORT void UpdateStep2ComputeHypertext(); 101 CONTENT_EXPORT void UpdateStep2ComputeHypertext();
102 CONTENT_EXPORT void UpdateStep3FireEvents(bool is_subtree_creation); 102 CONTENT_EXPORT void UpdateStep3FireEvents(bool is_subtree_creation);
103 103
104 // This is used to call UpdateStep1ComputeWinAttributes, ... above when
105 // a node needs to be updated for some other reason other than via
106 // OnAtomicUpdateFinished.
107 CONTENT_EXPORT void UpdatePlatformAttributes() override;
108
109 //
110 // BrowserAccessibility methods.
111 //
112 CONTENT_EXPORT void OnSubtreeWillBeDeleted() override;
113 CONTENT_EXPORT void NativeAddReference() override;
114 CONTENT_EXPORT void NativeReleaseReference() override;
115 CONTENT_EXPORT bool IsNative() const override;
116 CONTENT_EXPORT void OnLocationChanged() override;
117
118 // 104 //
119 // IAccessible methods. 105 // IAccessible methods.
120 // 106 //
121 107
122 // Performs the default action on a given object. 108 // Performs the default action on a given object.
123 CONTENT_EXPORT STDMETHODIMP accDoDefaultAction(VARIANT var_id) override; 109 CONTENT_EXPORT STDMETHODIMP accDoDefaultAction(VARIANT var_id) override;
124 110
125 // Retrieves the child element or child object at a given point on the screen. 111 // Retrieves the child element or child object at a given point on the screen.
126 CONTENT_EXPORT STDMETHODIMP 112 CONTENT_EXPORT STDMETHODIMP accHitTest(LONG x_left,
127 accHitTest(LONG x_left, LONG y_top, VARIANT* child) override; 113 LONG y_top,
114 VARIANT* child) override;
128 115
129 // Retrieves the specified object's current screen location. 116 // Retrieves the specified object's current screen location.
130 CONTENT_EXPORT STDMETHODIMP accLocation(LONG* x_left, 117 CONTENT_EXPORT STDMETHODIMP accLocation(LONG* x_left,
131 LONG* y_top, 118 LONG* y_top,
132 LONG* width, 119 LONG* width,
133 LONG* height, 120 LONG* height,
134 VARIANT var_id) override; 121 VARIANT var_id) override;
135 122
136 // Traverses to another UI element and retrieves the object. 123 // Traverses to another UI element and retrieves the object.
137 CONTENT_EXPORT STDMETHODIMP 124 CONTENT_EXPORT STDMETHODIMP accNavigate(LONG nav_dir,
138 accNavigate(LONG nav_dir, VARIANT start, VARIANT* end) override; 125 VARIANT start,
126 VARIANT* end) override;
139 127
140 // Retrieves an IDispatch interface pointer for the specified child. 128 // Retrieves an IDispatch interface pointer for the specified child.
141 CONTENT_EXPORT STDMETHODIMP 129 CONTENT_EXPORT STDMETHODIMP get_accChild(VARIANT var_child,
142 get_accChild(VARIANT var_child, IDispatch** disp_child) override; 130 IDispatch** disp_child) override;
143 131
144 // Retrieves the number of accessible children. 132 // Retrieves the number of accessible children.
145 CONTENT_EXPORT STDMETHODIMP get_accChildCount(LONG* child_count) override; 133 CONTENT_EXPORT STDMETHODIMP get_accChildCount(LONG* child_count) override;
146 134
147 // Retrieves a string that describes the object's default action. 135 // Retrieves a string that describes the object's default action.
148 CONTENT_EXPORT STDMETHODIMP 136 CONTENT_EXPORT STDMETHODIMP
149 get_accDefaultAction(VARIANT var_id, BSTR* default_action) override; 137 get_accDefaultAction(VARIANT var_id, BSTR* default_action) override;
150 138
151 // Retrieves the object's description. 139 // Retrieves the object's description.
152 CONTENT_EXPORT STDMETHODIMP 140 CONTENT_EXPORT STDMETHODIMP get_accDescription(VARIANT var_id,
153 get_accDescription(VARIANT var_id, BSTR* desc) override; 141 BSTR* desc) override;
154 142
155 // Retrieves the object that has the keyboard focus. 143 // Retrieves the object that has the keyboard focus.
156 CONTENT_EXPORT STDMETHODIMP get_accFocus(VARIANT* focus_child) override; 144 CONTENT_EXPORT STDMETHODIMP get_accFocus(VARIANT* focus_child) override;
157 145
158 // Retrieves the help information associated with the object. 146 // Retrieves the help information associated with the object.
159 CONTENT_EXPORT STDMETHODIMP get_accHelp(VARIANT var_id, BSTR* heflp) override; 147 CONTENT_EXPORT STDMETHODIMP get_accHelp(VARIANT var_id, BSTR* heflp) override;
160 148
161 // Retrieves the specified object's shortcut. 149 // Retrieves the specified object's shortcut.
162 CONTENT_EXPORT STDMETHODIMP 150 CONTENT_EXPORT STDMETHODIMP
163 get_accKeyboardShortcut(VARIANT var_id, BSTR* access_key) override; 151 get_accKeyboardShortcut(VARIANT var_id, BSTR* access_key) override;
164 152
165 // Retrieves the name of the specified object. 153 // Retrieves the name of the specified object.
166 CONTENT_EXPORT STDMETHODIMP get_accName(VARIANT var_id, BSTR* name) override; 154 CONTENT_EXPORT STDMETHODIMP get_accName(VARIANT var_id, BSTR* name) override;
167 155
168 // Retrieves the IDispatch interface of the object's parent. 156 // Retrieves the IDispatch interface of the object's parent.
169 CONTENT_EXPORT STDMETHODIMP get_accParent(IDispatch** disp_parent) override; 157 CONTENT_EXPORT STDMETHODIMP get_accParent(IDispatch** disp_parent) override;
170 158
171 // Retrieves information describing the role of the specified object. 159 // Retrieves information describing the role of the specified object.
172 CONTENT_EXPORT STDMETHODIMP 160 CONTENT_EXPORT STDMETHODIMP get_accRole(VARIANT var_id,
173 get_accRole(VARIANT var_id, VARIANT* role) override; 161 VARIANT* role) override;
174 162
175 // Retrieves the current state of the specified object. 163 // Retrieves the current state of the specified object.
176 CONTENT_EXPORT STDMETHODIMP 164 CONTENT_EXPORT STDMETHODIMP get_accState(VARIANT var_id,
177 get_accState(VARIANT var_id, VARIANT* state) override; 165 VARIANT* state) override;
178 166
179 // Returns the value associated with the object. 167 // Returns the value associated with the object.
180 CONTENT_EXPORT STDMETHODIMP 168 CONTENT_EXPORT STDMETHODIMP get_accValue(VARIANT var_id,
181 get_accValue(VARIANT var_id, BSTR* value) override; 169 BSTR* value) override;
182 170
183 // Make an object take focus or extend the selection. 171 // Make an object take focus or extend the selection.
184 CONTENT_EXPORT STDMETHODIMP 172 CONTENT_EXPORT STDMETHODIMP accSelect(LONG flags_sel,
185 accSelect(LONG flags_sel, VARIANT var_id) override; 173 VARIANT var_id) override;
186 174
187 CONTENT_EXPORT STDMETHODIMP 175 CONTENT_EXPORT STDMETHODIMP get_accHelpTopic(BSTR* help_file,
188 get_accHelpTopic(BSTR* help_file, VARIANT var_id, LONG* topic_id) override; 176 VARIANT var_id,
177 LONG* topic_id) override;
189 178
190 CONTENT_EXPORT STDMETHODIMP get_accSelection(VARIANT* selected) override; 179 CONTENT_EXPORT STDMETHODIMP get_accSelection(VARIANT* selected) override;
191 180
192 // Deprecated methods, not implemented. 181 // Deprecated methods, not implemented.
193 CONTENT_EXPORT STDMETHODIMP 182 CONTENT_EXPORT STDMETHODIMP put_accName(VARIANT var_id,
194 put_accName(VARIANT var_id, BSTR put_name) override; 183 BSTR put_name) override;
195 CONTENT_EXPORT STDMETHODIMP 184 CONTENT_EXPORT STDMETHODIMP put_accValue(VARIANT var_id,
196 put_accValue(VARIANT var_id, BSTR put_val) override; 185 BSTR put_val) override;
197 186
198 // 187 //
199 // IAccessible2 methods. 188 // IAccessible2 methods.
200 // 189 //
201 190
202 // Returns role from a longer list of possible roles. 191 // Returns role from a longer list of possible roles.
203 CONTENT_EXPORT STDMETHODIMP role(LONG* role) override; 192 CONTENT_EXPORT STDMETHODIMP role(LONG* role) override;
204 193
205 // Returns the state bitmask from a larger set of possible states. 194 // Returns the state bitmask from a larger set of possible states.
206 CONTENT_EXPORT STDMETHODIMP get_states(AccessibleStates* states) override; 195 CONTENT_EXPORT STDMETHODIMP get_states(AccessibleStates* states) override;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 LONG* y) override; 271 LONG* y) override;
283 272
284 CONTENT_EXPORT STDMETHODIMP get_imageSize(LONG* height, LONG* width) override; 273 CONTENT_EXPORT STDMETHODIMP get_imageSize(LONG* height, LONG* width) override;
285 274
286 // 275 //
287 // IAccessibleTable methods. 276 // IAccessibleTable methods.
288 // 277 //
289 278
290 // get_description - also used by IAccessibleImage 279 // get_description - also used by IAccessibleImage
291 280
292 CONTENT_EXPORT STDMETHODIMP 281 CONTENT_EXPORT STDMETHODIMP get_accessibleAt(long row,
293 get_accessibleAt(long row, long column, IUnknown** accessible) override; 282 long column,
283 IUnknown** accessible) override;
294 284
295 CONTENT_EXPORT STDMETHODIMP get_caption(IUnknown** accessible) override; 285 CONTENT_EXPORT STDMETHODIMP get_caption(IUnknown** accessible) override;
296 286
297 CONTENT_EXPORT STDMETHODIMP 287 CONTENT_EXPORT STDMETHODIMP get_childIndex(long row_index,
298 get_childIndex(long row_index, long column_index, long* cell_index) override; 288 long column_index,
289 long* cell_index) override;
299 290
300 CONTENT_EXPORT STDMETHODIMP 291 CONTENT_EXPORT STDMETHODIMP get_columnDescription(long column,
301 get_columnDescription(long column, BSTR* description) override; 292 BSTR* description) override;
302 293
303 CONTENT_EXPORT STDMETHODIMP 294 CONTENT_EXPORT STDMETHODIMP
304 get_columnExtentAt(long row, long column, long* n_columns_spanned) override; 295 get_columnExtentAt(long row, long column, long* n_columns_spanned) override;
305 296
306 CONTENT_EXPORT STDMETHODIMP 297 CONTENT_EXPORT STDMETHODIMP
307 get_columnHeader(IAccessibleTable** accessible_table, 298 get_columnHeader(IAccessibleTable** accessible_table,
308 long* starting_row_index) override; 299 long* starting_row_index) override;
309 300
310 CONTENT_EXPORT STDMETHODIMP 301 CONTENT_EXPORT STDMETHODIMP get_columnIndex(long cell_index,
311 get_columnIndex(long cell_index, long* column_index) override; 302 long* column_index) override;
312 303
313 CONTENT_EXPORT STDMETHODIMP get_nColumns(long* column_count) override; 304 CONTENT_EXPORT STDMETHODIMP get_nColumns(long* column_count) override;
314 305
315 CONTENT_EXPORT STDMETHODIMP get_nRows(long* row_count) override; 306 CONTENT_EXPORT STDMETHODIMP get_nRows(long* row_count) override;
316 307
317 CONTENT_EXPORT STDMETHODIMP get_nSelectedChildren(long* cell_count) override; 308 CONTENT_EXPORT STDMETHODIMP get_nSelectedChildren(long* cell_count) override;
318 309
319 CONTENT_EXPORT STDMETHODIMP get_nSelectedColumns(long* column_count) override; 310 CONTENT_EXPORT STDMETHODIMP get_nSelectedColumns(long* column_count) override;
320 311
321 CONTENT_EXPORT STDMETHODIMP get_nSelectedRows(long* row_count) override; 312 CONTENT_EXPORT STDMETHODIMP get_nSelectedRows(long* row_count) override;
322 313
323 CONTENT_EXPORT STDMETHODIMP 314 CONTENT_EXPORT STDMETHODIMP get_rowDescription(long row,
324 get_rowDescription(long row, BSTR* description) override; 315 BSTR* description) override;
325 316
326 CONTENT_EXPORT STDMETHODIMP 317 CONTENT_EXPORT STDMETHODIMP get_rowExtentAt(long row,
327 get_rowExtentAt(long row, long column, long* n_rows_spanned) override; 318 long column,
319 long* n_rows_spanned) override;
328 320
329 CONTENT_EXPORT STDMETHODIMP 321 CONTENT_EXPORT STDMETHODIMP
330 get_rowHeader(IAccessibleTable** accessible_table, 322 get_rowHeader(IAccessibleTable** accessible_table,
331 long* starting_column_index) override; 323 long* starting_column_index) override;
332 324
333 CONTENT_EXPORT STDMETHODIMP 325 CONTENT_EXPORT STDMETHODIMP get_rowIndex(long cell_index,
334 get_rowIndex(long cell_index, long* row_index) override; 326 long* row_index) override;
335 327
336 CONTENT_EXPORT STDMETHODIMP get_selectedChildren(long max_children, 328 CONTENT_EXPORT STDMETHODIMP get_selectedChildren(long max_children,
337 long** children, 329 long** children,
338 long* n_children) override; 330 long* n_children) override;
339 331
340 CONTENT_EXPORT STDMETHODIMP get_selectedColumns(long max_columns, 332 CONTENT_EXPORT STDMETHODIMP get_selectedColumns(long max_columns,
341 long** columns, 333 long** columns,
342 long* n_columns) override; 334 long* n_columns) override;
343 335
344 CONTENT_EXPORT STDMETHODIMP 336 CONTENT_EXPORT STDMETHODIMP get_selectedRows(long max_rows,
345 get_selectedRows(long max_rows, long** rows, long* n_rows) override; 337 long** rows,
338 long* n_rows) override;
346 339
347 CONTENT_EXPORT STDMETHODIMP get_summary(IUnknown** accessible) override; 340 CONTENT_EXPORT STDMETHODIMP get_summary(IUnknown** accessible) override;
348 341
349 CONTENT_EXPORT STDMETHODIMP 342 CONTENT_EXPORT STDMETHODIMP
350 get_isColumnSelected(long column, boolean* is_selected) override; 343 get_isColumnSelected(long column, boolean* is_selected) override;
351 344
352 CONTENT_EXPORT STDMETHODIMP 345 CONTENT_EXPORT STDMETHODIMP get_isRowSelected(long row,
353 get_isRowSelected(long row, boolean* is_selected) override; 346 boolean* is_selected) override;
354 347
355 CONTENT_EXPORT STDMETHODIMP 348 CONTENT_EXPORT STDMETHODIMP get_isSelected(long row,
356 get_isSelected(long row, long column, boolean* is_selected) override; 349 long column,
350 boolean* is_selected) override;
357 351
358 CONTENT_EXPORT STDMETHODIMP 352 CONTENT_EXPORT STDMETHODIMP
359 get_rowColumnExtentsAtIndex(long index, 353 get_rowColumnExtentsAtIndex(long index,
360 long* row, 354 long* row,
361 long* column, 355 long* column,
362 long* row_extents, 356 long* row_extents,
363 long* column_extents, 357 long* column_extents,
364 boolean* is_selected) override; 358 boolean* is_selected) override;
365 359
366 CONTENT_EXPORT STDMETHODIMP selectRow(long row) override; 360 CONTENT_EXPORT STDMETHODIMP selectRow(long row) override;
367 361
368 CONTENT_EXPORT STDMETHODIMP selectColumn(long column) override; 362 CONTENT_EXPORT STDMETHODIMP selectColumn(long column) override;
369 363
370 CONTENT_EXPORT STDMETHODIMP unselectRow(long row) override; 364 CONTENT_EXPORT STDMETHODIMP unselectRow(long row) override;
371 365
372 CONTENT_EXPORT STDMETHODIMP unselectColumn(long column) override; 366 CONTENT_EXPORT STDMETHODIMP unselectColumn(long column) override;
373 367
374 CONTENT_EXPORT STDMETHODIMP 368 CONTENT_EXPORT STDMETHODIMP
375 get_modelChange(IA2TableModelChange* model_change) override; 369 get_modelChange(IA2TableModelChange* model_change) override;
376 370
377 // 371 //
378 // IAccessibleTable2 methods. 372 // IAccessibleTable2 methods.
379 // 373 //
380 // (Most of these are duplicates of IAccessibleTable methods, only the 374 // (Most of these are duplicates of IAccessibleTable methods, only the
381 // unique ones are included here.) 375 // unique ones are included here.)
382 // 376 //
383 377
384 CONTENT_EXPORT STDMETHODIMP 378 CONTENT_EXPORT STDMETHODIMP get_cellAt(long row,
385 get_cellAt(long row, long column, IUnknown** cell) override; 379 long column,
380 IUnknown** cell) override;
386 381
387 CONTENT_EXPORT STDMETHODIMP get_nSelectedCells(long* cell_count) override; 382 CONTENT_EXPORT STDMETHODIMP get_nSelectedCells(long* cell_count) override;
388 383
389 CONTENT_EXPORT STDMETHODIMP 384 CONTENT_EXPORT STDMETHODIMP
390 get_selectedCells(IUnknown*** cells, long* n_selected_cells) override; 385 get_selectedCells(IUnknown*** cells, long* n_selected_cells) override;
391 386
392 CONTENT_EXPORT STDMETHODIMP 387 CONTENT_EXPORT STDMETHODIMP get_selectedColumns(long** columns,
393 get_selectedColumns(long** columns, long* n_columns) override; 388 long* n_columns) override;
394 389
395 CONTENT_EXPORT STDMETHODIMP 390 CONTENT_EXPORT STDMETHODIMP get_selectedRows(long** rows,
396 get_selectedRows(long** rows, long* n_rows) override; 391 long* n_rows) override;
397 392
398 // 393 //
399 // IAccessibleTableCell methods. 394 // IAccessibleTableCell methods.
400 // 395 //
401 396
402 CONTENT_EXPORT STDMETHODIMP 397 CONTENT_EXPORT STDMETHODIMP
403 get_columnExtent(long* n_columns_spanned) override; 398 get_columnExtent(long* n_columns_spanned) override;
404 399
405 CONTENT_EXPORT STDMETHODIMP 400 CONTENT_EXPORT STDMETHODIMP
406 get_columnHeaderCells(IUnknown*** cell_accessibles, 401 get_columnHeaderCells(IUnknown*** cell_accessibles,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 LONG* out_y, 437 LONG* out_y,
443 LONG* out_width, 438 LONG* out_width,
444 LONG* out_height) override; 439 LONG* out_height) override;
445 440
446 CONTENT_EXPORT STDMETHODIMP get_nSelections(LONG* n_selections) override; 441 CONTENT_EXPORT STDMETHODIMP get_nSelections(LONG* n_selections) override;
447 442
448 CONTENT_EXPORT STDMETHODIMP get_selection(LONG selection_index, 443 CONTENT_EXPORT STDMETHODIMP get_selection(LONG selection_index,
449 LONG* start_offset, 444 LONG* start_offset,
450 LONG* end_offset) override; 445 LONG* end_offset) override;
451 446
452 CONTENT_EXPORT STDMETHODIMP 447 CONTENT_EXPORT STDMETHODIMP get_text(LONG start_offset,
453 get_text(LONG start_offset, LONG end_offset, BSTR* text) override; 448 LONG end_offset,
449 BSTR* text) override;
454 450
455 CONTENT_EXPORT STDMETHODIMP 451 CONTENT_EXPORT STDMETHODIMP
456 get_textAtOffset(LONG offset, 452 get_textAtOffset(LONG offset,
457 enum IA2TextBoundaryType boundary_type, 453 enum IA2TextBoundaryType boundary_type,
458 LONG* start_offset, 454 LONG* start_offset,
459 LONG* end_offset, 455 LONG* end_offset,
460 BSTR* text) override; 456 BSTR* text) override;
461 457
462 CONTENT_EXPORT STDMETHODIMP 458 CONTENT_EXPORT STDMETHODIMP
463 get_textBeforeOffset(LONG offset, 459 get_textBeforeOffset(LONG offset,
(...skipping 24 matching lines...) Expand all
488 LONG end_index, 484 LONG end_index,
489 enum IA2ScrollType scroll_type) override; 485 enum IA2ScrollType scroll_type) override;
490 486
491 CONTENT_EXPORT STDMETHODIMP 487 CONTENT_EXPORT STDMETHODIMP
492 scrollSubstringToPoint(LONG start_index, 488 scrollSubstringToPoint(LONG start_index,
493 LONG end_index, 489 LONG end_index,
494 enum IA2CoordinateType coordinate_type, 490 enum IA2CoordinateType coordinate_type,
495 LONG x, 491 LONG x,
496 LONG y) override; 492 LONG y) override;
497 493
498 CONTENT_EXPORT STDMETHODIMP 494 CONTENT_EXPORT STDMETHODIMP addSelection(LONG start_offset,
499 addSelection(LONG start_offset, LONG end_offset) override; 495 LONG end_offset) override;
500 496
501 CONTENT_EXPORT STDMETHODIMP removeSelection(LONG selection_index) override; 497 CONTENT_EXPORT STDMETHODIMP removeSelection(LONG selection_index) override;
502 498
503 CONTENT_EXPORT STDMETHODIMP setCaretOffset(LONG offset) override; 499 CONTENT_EXPORT STDMETHODIMP setCaretOffset(LONG offset) override;
504 500
505 CONTENT_EXPORT STDMETHODIMP setSelection(LONG selection_index, 501 CONTENT_EXPORT STDMETHODIMP setSelection(LONG selection_index,
506 LONG start_offset, 502 LONG start_offset,
507 LONG end_offset) override; 503 LONG end_offset) override;
508 504
509 // IAccessibleText methods not implemented. 505 // IAccessibleText methods not implemented.
(...skipping 19 matching lines...) Expand all
529 CONTENT_EXPORT STDMETHODIMP get_anchorTarget(long index, 525 CONTENT_EXPORT STDMETHODIMP get_anchorTarget(long index,
530 VARIANT* anchor_target) override; 526 VARIANT* anchor_target) override;
531 CONTENT_EXPORT STDMETHODIMP get_startIndex(long* index) override; 527 CONTENT_EXPORT STDMETHODIMP get_startIndex(long* index) override;
532 CONTENT_EXPORT STDMETHODIMP get_endIndex(long* index) override; 528 CONTENT_EXPORT STDMETHODIMP get_endIndex(long* index) override;
533 // This method is deprecated in the IA2 Spec and so we don't implement it. 529 // This method is deprecated in the IA2 Spec and so we don't implement it.
534 CONTENT_EXPORT STDMETHODIMP get_valid(boolean* valid) override; 530 CONTENT_EXPORT STDMETHODIMP get_valid(boolean* valid) override;
535 531
536 // IAccessibleAction mostly not implemented. 532 // IAccessibleAction mostly not implemented.
537 CONTENT_EXPORT STDMETHODIMP nActions(long* n_actions) override; 533 CONTENT_EXPORT STDMETHODIMP nActions(long* n_actions) override;
538 CONTENT_EXPORT STDMETHODIMP doAction(long action_index) override; 534 CONTENT_EXPORT STDMETHODIMP doAction(long action_index) override;
539 CONTENT_EXPORT STDMETHODIMP 535 CONTENT_EXPORT STDMETHODIMP get_description(long action_index,
540 get_description(long action_index, BSTR* description) override; 536 BSTR* description) override;
541 CONTENT_EXPORT STDMETHODIMP get_keyBinding(long action_index, 537 CONTENT_EXPORT STDMETHODIMP get_keyBinding(long action_index,
542 long n_max_bindings, 538 long n_max_bindings,
543 BSTR** key_bindings, 539 BSTR** key_bindings,
544 long* n_bindings) override; 540 long* n_bindings) override;
545 CONTENT_EXPORT STDMETHODIMP get_name(long action_index, BSTR* name) override; 541 CONTENT_EXPORT STDMETHODIMP get_name(long action_index, BSTR* name) override;
546 CONTENT_EXPORT STDMETHODIMP 542 CONTENT_EXPORT STDMETHODIMP get_localizedName(long action_index,
547 get_localizedName(long action_index, BSTR* localized_name) override; 543 BSTR* localized_name) override;
548 544
549 // 545 //
550 // IAccessibleValue methods. 546 // IAccessibleValue methods.
551 // 547 //
552 548
553 CONTENT_EXPORT STDMETHODIMP get_currentValue(VARIANT* value) override; 549 CONTENT_EXPORT STDMETHODIMP get_currentValue(VARIANT* value) override;
554 550
555 CONTENT_EXPORT STDMETHODIMP get_minimumValue(VARIANT* value) override; 551 CONTENT_EXPORT STDMETHODIMP get_minimumValue(VARIANT* value) override;
556 552
557 CONTENT_EXPORT STDMETHODIMP get_maximumValue(VARIANT* value) override; 553 CONTENT_EXPORT STDMETHODIMP get_maximumValue(VARIANT* value) override;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 614
619 CONTENT_EXPORT STDMETHODIMP get_firstChild(ISimpleDOMNode** node) override; 615 CONTENT_EXPORT STDMETHODIMP get_firstChild(ISimpleDOMNode** node) override;
620 616
621 CONTENT_EXPORT STDMETHODIMP get_lastChild(ISimpleDOMNode** node) override; 617 CONTENT_EXPORT STDMETHODIMP get_lastChild(ISimpleDOMNode** node) override;
622 618
623 CONTENT_EXPORT STDMETHODIMP 619 CONTENT_EXPORT STDMETHODIMP
624 get_previousSibling(ISimpleDOMNode** node) override; 620 get_previousSibling(ISimpleDOMNode** node) override;
625 621
626 CONTENT_EXPORT STDMETHODIMP get_nextSibling(ISimpleDOMNode** node) override; 622 CONTENT_EXPORT STDMETHODIMP get_nextSibling(ISimpleDOMNode** node) override;
627 623
628 CONTENT_EXPORT STDMETHODIMP 624 CONTENT_EXPORT STDMETHODIMP get_childAt(unsigned int child_index,
629 get_childAt(unsigned int child_index, ISimpleDOMNode** node) override; 625 ISimpleDOMNode** node) override;
630 626
631 CONTENT_EXPORT STDMETHODIMP get_innerHTML(BSTR* innerHTML) override; 627 CONTENT_EXPORT STDMETHODIMP get_innerHTML(BSTR* innerHTML) override;
632 628
633 CONTENT_EXPORT STDMETHODIMP 629 CONTENT_EXPORT STDMETHODIMP
634 get_localInterface(void** local_interface) override; 630 get_localInterface(void** local_interface) override;
635 631
636 CONTENT_EXPORT STDMETHODIMP get_language(BSTR* language) override; 632 CONTENT_EXPORT STDMETHODIMP get_language(BSTR* language) override;
637 633
638 // 634 //
639 // ISimpleDOMText methods. 635 // ISimpleDOMText methods.
(...skipping 19 matching lines...) Expand all
659 655
660 CONTENT_EXPORT STDMETHODIMP 656 CONTENT_EXPORT STDMETHODIMP
661 scrollToSubstring(unsigned int start_index, unsigned int end_index) override; 657 scrollToSubstring(unsigned int start_index, unsigned int end_index) override;
662 658
663 CONTENT_EXPORT STDMETHODIMP get_fontFamily(BSTR* font_family) override; 659 CONTENT_EXPORT STDMETHODIMP get_fontFamily(BSTR* font_family) override;
664 660
665 // 661 //
666 // IServiceProvider methods. 662 // IServiceProvider methods.
667 // 663 //
668 664
669 CONTENT_EXPORT STDMETHODIMP 665 CONTENT_EXPORT STDMETHODIMP QueryService(REFGUID guidService,
670 QueryService(REFGUID guidService, REFIID riid, void** object) override; 666 REFIID riid,
667 void** object) override;
671 668
672 // IAccessibleEx methods not implemented. 669 // IAccessibleEx methods not implemented.
673 CONTENT_EXPORT STDMETHODIMP 670 CONTENT_EXPORT STDMETHODIMP GetObjectForChild(long child_id,
674 GetObjectForChild(long child_id, IAccessibleEx** ret) override; 671 IAccessibleEx** ret) override;
675 672
676 CONTENT_EXPORT STDMETHODIMP 673 CONTENT_EXPORT STDMETHODIMP GetIAccessiblePair(IAccessible** acc,
677 GetIAccessiblePair(IAccessible** acc, long* child_id) override; 674 long* child_id) override;
678 675
679 CONTENT_EXPORT STDMETHODIMP GetRuntimeId(SAFEARRAY** runtime_id) override; 676 CONTENT_EXPORT STDMETHODIMP GetRuntimeId(SAFEARRAY** runtime_id) override;
680 677
681 CONTENT_EXPORT STDMETHODIMP 678 CONTENT_EXPORT STDMETHODIMP
682 ConvertReturnedElement(IRawElementProviderSimple* element, 679 ConvertReturnedElement(IRawElementProviderSimple* element,
683 IAccessibleEx** acc) override; 680 IAccessibleEx** acc) override;
684 681
685 // 682 //
686 // IRawElementProviderSimple methods. 683 // IRawElementProviderSimple methods.
687 // 684 //
688 // The GetPatternProvider/GetPropertyValue methods need to be implemented for 685 // The GetPatternProvider/GetPropertyValue methods need to be implemented for
689 // the on-screen keyboard to show up in Windows 8 metro. 686 // the on-screen keyboard to show up in Windows 8 metro.
690 CONTENT_EXPORT STDMETHODIMP 687 CONTENT_EXPORT STDMETHODIMP GetPatternProvider(PATTERNID id,
691 GetPatternProvider(PATTERNID id, IUnknown** provider) override; 688 IUnknown** provider) override;
692 CONTENT_EXPORT STDMETHODIMP 689 CONTENT_EXPORT STDMETHODIMP GetPropertyValue(PROPERTYID id,
693 GetPropertyValue(PROPERTYID id, VARIANT* ret) override; 690 VARIANT* ret) override;
694 691
695 // 692 //
696 // IRawElementProviderSimple methods not implemented 693 // IRawElementProviderSimple methods not implemented
697 // 694 //
698 CONTENT_EXPORT STDMETHODIMP 695 CONTENT_EXPORT STDMETHODIMP
699 get_ProviderOptions(enum ProviderOptions* ret) override; 696 get_ProviderOptions(enum ProviderOptions* ret) override;
700 CONTENT_EXPORT STDMETHODIMP 697 CONTENT_EXPORT STDMETHODIMP
701 get_HostRawElementProvider(IRawElementProviderSimple** provider) override; 698 get_HostRawElementProvider(IRawElementProviderSimple** provider) override;
702 699
703 // 700 //
704 // CComObjectRootEx methods. 701 // CComObjectRootEx methods.
705 // 702 //
706 703
707 // Called by BEGIN_COM_MAP() / END_COM_MAP(). 704 // Called by BEGIN_COM_MAP() / END_COM_MAP().
708 static CONTENT_EXPORT HRESULT WINAPI 705 static CONTENT_EXPORT HRESULT WINAPI
709 InternalQueryInterface(void* this_ptr, 706 InternalQueryInterface(void* this_ptr,
710 const _ATL_INTMAP_ENTRY* entries, 707 const _ATL_INTMAP_ENTRY* entries,
711 REFIID iid, 708 REFIID iid,
712 void** object); 709 void** object);
713 710
714 // Computes and caches the IA2 text style attributes for the text and other 711 // Computes and caches the IA2 text style attributes for the text and other
715 // embedded child objects. 712 // embedded child objects.
716 CONTENT_EXPORT void ComputeStylesIfNeeded(); 713 CONTENT_EXPORT void ComputeStylesIfNeeded();
717 714
718 // |offset| could either be a text character or a child index in case of 715 // |offset| could either be a text character or a child index in case of
719 // non-text objects. 716 // non-text objects.
720 AXPlatformPosition::AXPositionInstance CreatePositionForSelectionAt( 717 AXPlatformPosition::AXPositionInstance CreatePositionForSelectionAt(
721 int offset) const; 718 int offset) const;
722 719
723 CONTENT_EXPORT base::string16 GetText() const override;
724
725 // Accessors. 720 // Accessors.
726 int32_t ia_role() const { return win_attributes_->ia_role; } 721 int32_t ia_role() const { return win_attributes_->ia_role; }
727 int32_t ia_state() const { return win_attributes_->ia_state; } 722 int32_t ia_state() const { return win_attributes_->ia_state; }
728 const base::string16& role_name() const { return win_attributes_->role_name; } 723 const base::string16& role_name() const { return win_attributes_->role_name; }
729 int32_t ia2_role() const { return win_attributes_->ia2_role; } 724 int32_t ia2_role() const { return win_attributes_->ia2_role; }
730 int32_t ia2_state() const { return win_attributes_->ia2_state; } 725 int32_t ia2_state() const { return win_attributes_->ia2_state; }
731 const std::vector<base::string16>& ia2_attributes() const { 726 const std::vector<base::string16>& ia2_attributes() const {
732 return win_attributes_->ia2_attributes; 727 return win_attributes_->ia2_attributes;
733 } 728 }
734 base::string16 name() const { return win_attributes_->name; } 729 base::string16 name() const { return win_attributes_->name; }
735 base::string16 description() const { return win_attributes_->description; } 730 base::string16 description() const { return win_attributes_->description; }
736 base::string16 value() const { return win_attributes_->value; } 731 base::string16 value() const { return win_attributes_->value; }
737 const std::map<int, std::vector<base::string16>>& offset_to_text_attributes() 732 const std::map<int, std::vector<base::string16>>& offset_to_text_attributes()
738 const { 733 const {
739 return win_attributes_->offset_to_text_attributes; 734 return win_attributes_->offset_to_text_attributes;
740 } 735 }
741 std::map<int32_t, int32_t>& hyperlink_offset_to_index() const { 736 std::map<int32_t, int32_t>& hyperlink_offset_to_index() const {
742 return win_attributes_->hyperlink_offset_to_index; 737 return win_attributes_->hyperlink_offset_to_index;
743 } 738 }
744 std::vector<int32_t>& hyperlinks() const { 739 std::vector<int32_t>& hyperlinks() const {
745 return win_attributes_->hyperlinks; 740 return win_attributes_->hyperlinks;
746 } 741 }
747 742
748 private: 743 private:
744 // Setter and getter for the browser accessibility owner
745 BrowserAccessibilityWin* GetOwner() const { return owner_; }
746 void SetOwner(BrowserAccessibilityWin* owner) { owner_ = owner; }
747
749 // Returns the IA2 text attributes for this object. 748 // Returns the IA2 text attributes for this object.
750 std::vector<base::string16> ComputeTextAttributes() const; 749 std::vector<base::string16> ComputeTextAttributes() const;
751 750
752 // Add one to the reference count and return the same object. Always 751 // Add one to the reference count and return the same object. Always
753 // use this method when returning a BrowserAccessibilityWin object as 752 // use this method when returning a BrowserAccessibilityComWin object as
754 // an output parameter to a COM interface, never use it otherwise. 753 // an output parameter to a COM interface, never use it otherwise.
755 BrowserAccessibilityWin* NewReference(); 754 BrowserAccessibilityComWin* NewReference();
756 755
757 // Returns a list of IA2 attributes indicating the offsets in the text of a 756 // Returns a list of IA2 attributes indicating the offsets in the text of a
758 // leaf object, such as a text field or static text, where spelling errors are 757 // leaf object, such as a text field or static text, where spelling errors are
759 // present. 758 // present.
760 std::map<int, std::vector<base::string16>> GetSpellingAttributes() const; 759 std::map<int, std::vector<base::string16>> GetSpellingAttributes();
761 760
762 // Many MSAA methods take a var_id parameter indicating that the operation 761 // Many MSAA methods take a var_id parameter indicating that the operation
763 // should be performed on a particular child ID, rather than this object. 762 // should be performed on a particular child ID, rather than this object.
764 // This method tries to figure out the target object from |var_id| and 763 // This method tries to figure out the target object from |var_id| and
765 // returns a pointer to the target object if it exists, otherwise NULL. 764 // returns a pointer to the target object if it exists, otherwise NULL.
766 // Does not return a new reference. 765 // Does not return a new reference.
767 BrowserAccessibilityWin* GetTargetFromChildID(const VARIANT& var_id); 766 BrowserAccessibilityComWin* GetTargetFromChildID(const VARIANT& var_id);
768 767
769 // Initialize the role and state metadata from the role enum and state 768 // Initialize the role and state metadata from the role enum and state
770 // bitmasks defined in ui::AXNodeData. 769 // bitmasks defined in ui::AXNodeData.
771 void InitRoleAndState(); 770 void InitRoleAndState();
772 771
773 // Retrieve the value of an attribute from the string attribute map and 772 // Retrieve the value of an attribute from the string attribute map and
774 // if found and nonempty, allocate a new BSTR (with SysAllocString) 773 // if found and nonempty, allocate a new BSTR (with SysAllocString)
775 // and return S_OK. If not found or empty, return S_FALSE. 774 // and return S_OK. If not found or empty, return S_FALSE.
776 HRESULT GetStringAttributeAsBstr( 775 HRESULT GetStringAttributeAsBstr(ui::AXStringAttribute attribute,
777 ui::AXStringAttribute attribute, 776 BSTR* value_bstr);
778 BSTR* value_bstr);
779 777
780 // Escapes characters in string attributes as required by the IA2 Spec. 778 // Escapes characters in string attributes as required by the IA2 Spec.
781 // It's okay for input to be the same as output. 779 // It's okay for input to be the same as output.
782 CONTENT_EXPORT static void SanitizeStringAttributeForIA2( 780 CONTENT_EXPORT static void SanitizeStringAttributeForIA2(
783 const base::string16& input, 781 const base::string16& input,
784 base::string16* output); 782 base::string16* output);
785 FRIEND_TEST_ALL_PREFIXES(BrowserAccessibilityTest, 783 FRIEND_TEST_ALL_PREFIXES(BrowserAccessibilityTest,
786 TestSanitizeStringAttributeForIA2); 784 TestSanitizeStringAttributeForIA2);
787 785
788 // Sets the selection given a start and end offset in IA2 Hypertext. 786 // Sets the selection given a start and end offset in IA2 Hypertext.
789 void SetIA2HypertextSelection(LONG start_offset, LONG end_offset); 787 void SetIA2HypertextSelection(LONG start_offset, LONG end_offset);
790 788
791 // If the string attribute |attribute| is present, add its value as an 789 // If the string attribute |attribute| is present, add its value as an
792 // IAccessible2 attribute with the name |ia2_attr|. 790 // IAccessible2 attribute with the name |ia2_attr|.
793 void StringAttributeToIA2(ui::AXStringAttribute attribute, 791 void StringAttributeToIA2(ui::AXStringAttribute attribute,
794 const char* ia2_attr); 792 const char* ia2_attr);
795 793
796 // If the bool attribute |attribute| is present, add its value as an 794 // If the bool attribute |attribute| is present, add its value as an
797 // IAccessible2 attribute with the name |ia2_attr|. 795 // IAccessible2 attribute with the name |ia2_attr|.
798 void BoolAttributeToIA2(ui::AXBoolAttribute attribute, 796 void BoolAttributeToIA2(ui::AXBoolAttribute attribute, const char* ia2_attr);
799 const char* ia2_attr);
800 797
801 // If the int attribute |attribute| is present, add its value as an 798 // If the int attribute |attribute| is present, add its value as an
802 // IAccessible2 attribute with the name |ia2_attr|. 799 // IAccessible2 attribute with the name |ia2_attr|.
803 void IntAttributeToIA2(ui::AXIntAttribute attribute, 800 void IntAttributeToIA2(ui::AXIntAttribute attribute, const char* ia2_attr);
804 const char* ia2_attr);
805 801
806 // 802 //
807 // Helper methods for IA2 hyperlinks. 803 // Helper methods for IA2 hyperlinks.
808 // 804 //
809 // Hyperlink is an IA2 misnomer. It refers to objects embedded within other 805 // Hyperlink is an IA2 misnomer. It refers to objects embedded within other
810 // objects, such as a numbered list within a contenteditable div. 806 // objects, such as a numbered list within a contenteditable div.
811 // Also, in IA2, text that includes embedded objects is called hypertext. 807 // Also, in IA2, text that includes embedded objects is called hypertext.
812 808
813 // Returns true if the current object is an IA2 hyperlink. 809 // Returns true if the current object is an IA2 hyperlink.
814 bool IsHyperlink() const; 810 bool IsHyperlink() const;
815 // Returns the hyperlink at the given text position, or nullptr if no 811 // Returns the hyperlink at the given text position, or nullptr if no
816 // hyperlink can be found. 812 // hyperlink can be found.
817 BrowserAccessibilityWin* GetHyperlinkFromHypertextOffset(int offset) const; 813 BrowserAccessibilityComWin* GetHyperlinkFromHypertextOffset(int offset) const;
818 814
819 // Functions for retrieving offsets for hyperlinks and hypertext. 815 // Functions for retrieving offsets for hyperlinks and hypertext.
820 // Return -1 in case of failure. 816 // Return -1 in case of failure.
821 int32_t GetHyperlinkIndexFromChild( 817 int32_t GetHyperlinkIndexFromChild(
822 const BrowserAccessibilityWin& child) const; 818 const BrowserAccessibilityComWin& child) const;
823 int32_t GetHypertextOffsetFromHyperlinkIndex(int32_t hyperlink_index) const; 819 int32_t GetHypertextOffsetFromHyperlinkIndex(int32_t hyperlink_index) const;
824 int32_t GetHypertextOffsetFromChild( 820 int32_t GetHypertextOffsetFromChild(BrowserAccessibilityComWin& child);
825 const BrowserAccessibilityWin& child) const;
826 int32_t GetHypertextOffsetFromDescendant( 821 int32_t GetHypertextOffsetFromDescendant(
827 const BrowserAccessibilityWin& descendant) const; 822 const BrowserAccessibilityComWin& descendant) const;
828 823
829 // If the selection endpoint is either equal to or an ancestor of this object, 824 // If the selection endpoint is either equal to or an ancestor of this object,
830 // returns endpoint_offset. 825 // returns endpoint_offset.
831 // If the selection endpoint is a descendant of this object, returns its 826 // If the selection endpoint is a descendant of this object, returns its
832 // offset. Otherwise, returns either 0 or the length of the hypertext 827 // offset. Otherwise, returns either 0 or the length of the hypertext
833 // depending on the direction of the selection. 828 // depending on the direction of the selection.
834 // Returns -1 in case of unexpected failure, e.g. the selection endpoint 829 // Returns -1 in case of unexpected failure, e.g. the selection endpoint
835 // cannot be found in the accessibility tree. 830 // cannot be found in the accessibility tree.
836 int GetHypertextOffsetFromEndpoint( 831 int GetHypertextOffsetFromEndpoint(
837 const BrowserAccessibilityWin& endpoint_object, 832 const BrowserAccessibilityComWin& endpoint_object,
838 int endpoint_offset) const; 833 int endpoint_offset) const;
839 834
840 // 835 //
841 // Selection helper functions. 836 // Selection helper functions.
842 // 837 //
843 // The following functions retrieve the endpoints of the current selection. 838 // The following functions retrieve the endpoints of the current selection.
844 // First they check for a local selection found on the current control, e.g. 839 // First they check for a local selection found on the current control, e.g.
845 // when querying the selection on a textarea. 840 // when querying the selection on a textarea.
846 // If not found they retrieve the global selection found on the current frame. 841 // If not found they retrieve the global selection found on the current frame.
847 int GetSelectionAnchor() const; 842 int GetSelectionAnchor() const;
848 int GetSelectionFocus() const; 843 int GetSelectionFocus() const;
849 // Retrieves the selection offsets in the way required by the IA2 APIs. 844 // Retrieves the selection offsets in the way required by the IA2 APIs.
850 // selection_start and selection_end are -1 when there is no selection active 845 // selection_start and selection_end are -1 when there is no selection active
851 // on this object. 846 // on this object.
852 // The greatest of the two offsets is one past the last character of the 847 // The greatest of the two offsets is one past the last character of the
853 // selection.) 848 // selection.)
854 void GetSelectionOffsets(int* selection_start, int* selection_end) const; 849 void GetSelectionOffsets(int* selection_start, int* selection_end) const;
855 850
856 // Get the value text, which might come from the floating-point 851 // Get the value text, which might come from the floating-point
857 // value for some roles. 852 // value for some roles.
858 base::string16 GetValueText(); 853 base::string16 GetValueText();
859 854
860 bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index); 855 bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index);
861 void ComputeHypertextRemovedAndInserted( 856 void ComputeHypertextRemovedAndInserted(int* start,
862 int* start, int* old_len, int* new_len); 857 int* old_len,
858 int* new_len);
863 859
864 // If offset is a member of IA2TextSpecialOffsets this function updates the 860 // If offset is a member of IA2TextSpecialOffsets this function updates the
865 // value of offset and returns, otherwise offset remains unchanged. 861 // value of offset and returns, otherwise offset remains unchanged.
866 void HandleSpecialTextOffset(LONG* offset); 862 void HandleSpecialTextOffset(LONG* offset);
867 863
868 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType. 864 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType.
869 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type); 865 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type);
870 866
871 // Search forwards (direction == 1) or backwards (direction == -1) 867 // Search forwards (direction == 1) or backwards (direction == -1)
872 // from the given offset until the given boundary is found, and 868 // from the given offset until the given boundary is found, and
873 // return the offset of that boundary. 869 // return the offset of that boundary.
874 LONG FindBoundary(const base::string16& text, 870 LONG FindBoundary(const base::string16& text,
875 IA2TextBoundaryType ia2_boundary, 871 IA2TextBoundaryType ia2_boundary,
876 LONG start_offset, 872 LONG start_offset,
877 ui::TextBoundaryDirection direction); 873 ui::TextBoundaryDirection direction);
878 874
879 // Searches forward from the given offset until the start of the next style 875 // Searches forward from the given offset until the start of the next style
880 // is found, or searches backward from the given offset until the start of the 876 // is found, or searches backward from the given offset until the start of the
881 // current style is found. 877 // current style is found.
882 LONG FindStartOfStyle(LONG start_offset, 878 LONG FindStartOfStyle(LONG start_offset,
883 ui::TextBoundaryDirection direction) const; 879 ui::TextBoundaryDirection direction) const;
884 880
885 // ID refers to the node ID in the current tree, not the globally unique ID. 881 // ID refers to the node ID in the current tree, not the globally unique ID.
886 // TODO(nektar): Could we use globally unique IDs everywhere? 882 // TODO(nektar): Could we use globally unique IDs everywhere?
887 // TODO(nektar): Rename this function to GetFromNodeID. 883 // TODO(nektar): Rename this function to GetFromNodeID.
888 BrowserAccessibilityWin* GetFromID(int32_t id) const; 884 BrowserAccessibilityComWin* GetFromID(int32_t id) const;
889 885
890 // Returns true if this is a list box option with a parent of type list box, 886 // Returns true if this is a list box option with a parent of type list box,
891 // or a menu list option with a parent of type menu list popup. 887 // or a menu list option with a parent of type menu list popup.
892 bool IsListBoxOptionOrMenuListOption(); 888 bool IsListBoxOptionOrMenuListOption();
893 889
894 // For adding / removing IA2 relations. 890 // For adding / removing IA2 relations.
895 891
896 void AddRelation(const base::string16& relation_type, int target_id); 892 void AddRelation(const base::string16& relation_type, int target_id);
897 void AddBidirectionalRelations(const base::string16& relation_type, 893 void AddBidirectionalRelations(const base::string16& relation_type,
898 const base::string16& reverse_relation_type, 894 const base::string16& reverse_relation_type,
899 ui::AXIntListAttribute attribute); 895 ui::AXIntListAttribute attribute);
900 // Clears all the forward relations from this object to any other object and 896 // Clears all the forward relations from this object to any other object and
901 // the associated reverse relations on the other objects, but leaves any 897 // the associated reverse relations on the other objects, but leaves any
902 // reverse relations on this object alone. 898 // reverse relations on this object alone.
903 void ClearOwnRelations(); 899 void ClearOwnRelations();
904 void RemoveBidirectionalRelationsOfType( 900 void RemoveBidirectionalRelationsOfType(
905 const base::string16& relation_type, 901 const base::string16& relation_type,
906 const base::string16& reverse_relation_type); 902 const base::string16& reverse_relation_type);
907 void RemoveTargetFromRelation(const base::string16& relation_type, 903 void RemoveTargetFromRelation(const base::string16& relation_type,
908 int target_id); 904 int target_id);
909 905
910 // Updates object attributes of IA2 with html attributes. 906 // Updates object attributes of IA2 with html attributes.
911 void UpdateRequiredAttributes(); 907 void UpdateRequiredAttributes();
912 908
913 // Fire a Windows-specific accessibility event notification on this node. 909 // Fire a Windows-specific accessibility event notification on this node.
914 void FireNativeEvent(LONG win_event_type) const; 910 void FireNativeEvent(LONG win_event_type) const;
915 911
916 ui::AXPlatformNodeWin* GetPlatformNodeWin() const;
917
918 static bool IsInTreeGrid(const BrowserAccessibility* item); 912 static bool IsInTreeGrid(const BrowserAccessibility* item);
919 913
920 struct WinAttributes { 914 struct WinAttributes {
921 WinAttributes(); 915 WinAttributes();
922 ~WinAttributes(); 916 ~WinAttributes();
923 917
924 // IAccessible role and state. 918 // IAccessible role and state.
925 int32_t ia_role; 919 int32_t ia_role;
926 int32_t ia_state; 920 int32_t ia_state;
927 base::string16 role_name; 921 base::string16 role_name;
(...skipping 13 matching lines...) Expand all
941 // Hypertext. 935 // Hypertext.
942 base::string16 hypertext; 936 base::string16 hypertext;
943 937
944 // Maps each style span to its start offset in hypertext. 938 // Maps each style span to its start offset in hypertext.
945 std::map<int, std::vector<base::string16>> offset_to_text_attributes; 939 std::map<int, std::vector<base::string16>> offset_to_text_attributes;
946 940
947 // Maps an embedded character offset in |hypertext_| to an index in 941 // Maps an embedded character offset in |hypertext_| to an index in
948 // |hyperlinks_|. 942 // |hyperlinks_|.
949 std::map<int32_t, int32_t> hyperlink_offset_to_index; 943 std::map<int32_t, int32_t> hyperlink_offset_to_index;
950 944
951 // The unique id of a BrowserAccessibilityWin for each hyperlink. 945 // The unique id of a BrowserAccessibilityComWin for each hyperlink.
952 // TODO(nektar): Replace object IDs with child indices if we decide that 946 // TODO(nektar): Replace object IDs with child indices if we decide that
953 // we are not implementing IA2 hyperlinks for anything other than IA2 947 // we are not implementing IA2 hyperlinks for anything other than IA2
954 // Hypertext. 948 // Hypertext.
955 std::vector<int32_t> hyperlinks; 949 std::vector<int32_t> hyperlinks;
956 }; 950 };
957 951
952 BrowserAccessibilityWin* owner_;
953
958 std::unique_ptr<WinAttributes> win_attributes_; 954 std::unique_ptr<WinAttributes> win_attributes_;
959 955
960 // Only valid during the scope of a IA2_EVENT_TEXT_REMOVED or 956 // Only valid during the scope of a IA2_EVENT_TEXT_REMOVED or
961 // IA2_EVENT_TEXT_INSERTED event. 957 // IA2_EVENT_TEXT_INSERTED event.
962 std::unique_ptr<WinAttributes> old_win_attributes_; 958 std::unique_ptr<WinAttributes> old_win_attributes_;
963 959
964 // Relationships between this node and other nodes. 960 // Relationships between this node and other nodes.
965 std::vector<BrowserAccessibilityRelation*> relations_; 961 std::vector<BrowserAccessibilityRelation*> relations_;
966 962
967 // The previous scroll position, so we can tell if this object scrolled. 963 // The previous scroll position, so we can tell if this object scrolled.
968 int previous_scroll_x_; 964 int previous_scroll_x_;
969 int previous_scroll_y_; 965 int previous_scroll_y_;
970 966
971 // Give BrowserAccessibility::Create access to our constructor. 967 // Give BrowserAccessibility::Create access to our constructor.
972 friend class BrowserAccessibility; 968 friend class BrowserAccessibility;
969 friend class BrowserAccessibilityWin;
973 friend class BrowserAccessibilityRelation; 970 friend class BrowserAccessibilityRelation;
974 971
975 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin); 972 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityComWin);
976 }; 973 };
977 974
978 CONTENT_EXPORT BrowserAccessibilityWin* 975 CONTENT_EXPORT BrowserAccessibilityComWin* ToBrowserAccessibilityComWin(
979 ToBrowserAccessibilityWin(BrowserAccessibility* obj); 976 BrowserAccessibility* obj);
980
981 CONTENT_EXPORT const BrowserAccessibilityWin*
982 ToBrowserAccessibilityWin(const BrowserAccessibility* obj);
983 977
984 } // namespace content 978 } // namespace content
985 979
986 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ 980 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698