| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <atlcom.h> | 6 #include <atlcom.h> |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <oleacc.h> | 8 #include <oleacc.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/win/scoped_comptr.h" | 13 #include "base/win/scoped_comptr.h" |
| 14 #include "base/win/scoped_variant.h" | 14 #include "base/win/scoped_variant.h" |
| 15 #include "third_party/iaccessible2/ia2_api_all.h" | 15 #include "third_party/iaccessible2/ia2_api_all.h" |
| 16 #include "ui/accessibility/ax_action_data.h" |
| 16 #include "ui/accessibility/ax_node_data.h" | 17 #include "ui/accessibility/ax_node_data.h" |
| 17 #include "ui/accessibility/ax_text_utils.h" | 18 #include "ui/accessibility/ax_text_utils.h" |
| 18 #include "ui/accessibility/platform/ax_platform_node_delegate.h" | 19 #include "ui/accessibility/platform/ax_platform_node_delegate.h" |
| 19 #include "ui/accessibility/platform/ax_platform_node_win.h" | 20 #include "ui/accessibility/platform/ax_platform_node_win.h" |
| 20 #include "ui/base/win/atl_module.h" | 21 #include "ui/base/win/atl_module.h" |
| 21 #include "ui/gfx/geometry/rect_conversions.h" | 22 #include "ui/gfx/geometry/rect_conversions.h" |
| 22 | 23 |
| 23 // | 24 // |
| 24 // Macros to use at the top of any AXPlatformNodeWin function that implements | 25 // Macros to use at the top of any AXPlatformNodeWin function that implements |
| 25 // a COM interface. Because COM objects are reference counted and clients | 26 // a COM interface. Because COM objects are reference counted and clients |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 return S_FALSE; | 447 return S_FALSE; |
| 447 } | 448 } |
| 448 | 449 |
| 449 STDMETHODIMP AXPlatformNodeWin::get_accValue(VARIANT var_id, BSTR* value) { | 450 STDMETHODIMP AXPlatformNodeWin::get_accValue(VARIANT var_id, BSTR* value) { |
| 450 COM_OBJECT_VALIDATE_VAR_ID_1_ARG(var_id, value); | 451 COM_OBJECT_VALIDATE_VAR_ID_1_ARG(var_id, value); |
| 451 return GetStringAttributeAsBstr(ui::AX_ATTR_VALUE, value); | 452 return GetStringAttributeAsBstr(ui::AX_ATTR_VALUE, value); |
| 452 } | 453 } |
| 453 | 454 |
| 454 STDMETHODIMP AXPlatformNodeWin::put_accValue(VARIANT var_id, | 455 STDMETHODIMP AXPlatformNodeWin::put_accValue(VARIANT var_id, |
| 455 BSTR new_value) { | 456 BSTR new_value) { |
| 457 AXActionData data; |
| 458 data.action = ui::AX_ACTION_SET_VALUE; |
| 459 data.value = new_value; |
| 456 COM_OBJECT_VALIDATE_VAR_ID(var_id); | 460 COM_OBJECT_VALIDATE_VAR_ID(var_id); |
| 457 if (delegate_->SetStringValue(new_value, true)) | 461 if (delegate_->AccessibilityPerformAction(data)) |
| 458 return S_OK; | 462 return S_OK; |
| 459 return E_FAIL; | 463 return E_FAIL; |
| 460 } | 464 } |
| 461 | 465 |
| 462 // IAccessible functions not supported. | 466 // IAccessible functions not supported. |
| 463 | 467 |
| 464 STDMETHODIMP AXPlatformNodeWin::get_accSelection(VARIANT* selected) { | 468 STDMETHODIMP AXPlatformNodeWin::get_accSelection(VARIANT* selected) { |
| 465 COM_OBJECT_VALIDATE_1_ARG(selected); | 469 COM_OBJECT_VALIDATE_1_ARG(selected); |
| 466 if (selected) | 470 if (selected) |
| 467 selected->vt = VT_EMPTY; | 471 selected->vt = VT_EMPTY; |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 ui::TextBoundaryDirection direction) { | 1151 ui::TextBoundaryDirection direction) { |
| 1148 HandleSpecialTextOffset(text, &start_offset); | 1152 HandleSpecialTextOffset(text, &start_offset); |
| 1149 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); | 1153 ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); |
| 1150 std::vector<int32_t> line_breaks; | 1154 std::vector<int32_t> line_breaks; |
| 1151 return static_cast<LONG>(ui::FindAccessibleTextBoundary( | 1155 return static_cast<LONG>(ui::FindAccessibleTextBoundary( |
| 1152 text, line_breaks, boundary, start_offset, direction, | 1156 text, line_breaks, boundary, start_offset, direction, |
| 1153 AX_TEXT_AFFINITY_DOWNSTREAM)); | 1157 AX_TEXT_AFFINITY_DOWNSTREAM)); |
| 1154 } | 1158 } |
| 1155 | 1159 |
| 1156 } // namespace ui | 1160 } // namespace ui |
| OLD | NEW |