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 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 COM_OBJECT_VALIDATE_VAR_ID_1_ARG_AND_GET_TARGET(var_id, acc_key, target); | 467 COM_OBJECT_VALIDATE_VAR_ID_1_ARG_AND_GET_TARGET(var_id, acc_key, target); |
468 | 468 |
469 return target->GetStringAttributeAsBstr(ui::AX_ATTR_SHORTCUT, acc_key); | 469 return target->GetStringAttributeAsBstr(ui::AX_ATTR_SHORTCUT, acc_key); |
470 } | 470 } |
471 | 471 |
472 STDMETHODIMP AXPlatformNodeWin::get_accName( | 472 STDMETHODIMP AXPlatformNodeWin::get_accName( |
473 VARIANT var_id, BSTR* name) { | 473 VARIANT var_id, BSTR* name) { |
474 AXPlatformNodeWin* target; | 474 AXPlatformNodeWin* target; |
475 COM_OBJECT_VALIDATE_VAR_ID_1_ARG_AND_GET_TARGET(var_id, name, target); | 475 COM_OBJECT_VALIDATE_VAR_ID_1_ARG_AND_GET_TARGET(var_id, name, target); |
476 | 476 |
477 return target->GetStringAttributeAsBstr(ui::AX_ATTR_NAME, name); | 477 HRESULT result = target->GetStringAttributeAsBstr(ui::AX_ATTR_NAME, name); |
| 478 if (FAILED(result) && MSAARole() == ROLE_SYSTEM_DOCUMENT && GetParent()) { |
| 479 // Hack: Some versions of JAWS crash if they get an empty name on |
| 480 // a document that's the child of an iframe, so always return a |
| 481 // nonempty string for this role. https://crbug.com/583057 |
| 482 base::string16 str = L" "; |
| 483 |
| 484 *name = SysAllocString(str.c_str()); |
| 485 DCHECK(*name); |
| 486 } |
| 487 return result; |
478 } | 488 } |
479 | 489 |
480 STDMETHODIMP AXPlatformNodeWin::get_accParent( | 490 STDMETHODIMP AXPlatformNodeWin::get_accParent( |
481 IDispatch** disp_parent) { | 491 IDispatch** disp_parent) { |
482 COM_OBJECT_VALIDATE_1_ARG(disp_parent); | 492 COM_OBJECT_VALIDATE_1_ARG(disp_parent); |
483 *disp_parent = GetParent(); | 493 *disp_parent = GetParent(); |
484 if (*disp_parent) { | 494 if (*disp_parent) { |
485 (*disp_parent)->AddRef(); | 495 (*disp_parent)->AddRef(); |
486 return S_OK; | 496 return S_OK; |
487 } | 497 } |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 | 1291 |
1282 AXPlatformNodeBase* base = | 1292 AXPlatformNodeBase* base = |
1283 FromNativeViewAccessible(node->GetNativeViewAccessible()); | 1293 FromNativeViewAccessible(node->GetNativeViewAccessible()); |
1284 if (base && !IsDescendant(base)) | 1294 if (base && !IsDescendant(base)) |
1285 base = nullptr; | 1295 base = nullptr; |
1286 | 1296 |
1287 return static_cast<AXPlatformNodeWin*>(base); | 1297 return static_cast<AXPlatformNodeWin*>(base); |
1288 } | 1298 } |
1289 | 1299 |
1290 } // namespace ui | 1300 } // namespace ui |
OLD | NEW |