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