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

Side by Side Diff: ui/accessibility/platform/ax_platform_node_win.cc

Issue 2833843005: Handling of different types of empty alt (Closed)
Patch Set: Ready to land 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
« no previous file with comments | « ui/accessibility/ax_enums.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 HRESULT result = 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()) { 478 if (FAILED(result) && MSAARole() == ROLE_SYSTEM_DOCUMENT && GetParent()) {
479 // Hack: Some versions of JAWS crash if they get an empty name on 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 480 // a document that's the child of an iframe, so always return a
481 // nonempty string for this role. https://crbug.com/583057 481 // nonempty string for this role. https://crbug.com/583057
482 base::string16 str = L" "; 482 base::string16 str = L" ";
483 483
484 *name = SysAllocString(str.c_str()); 484 *name = SysAllocString(str.c_str());
485 DCHECK(*name); 485 DCHECK(*name);
486 } 486 }
487
487 return result; 488 return result;
488 } 489 }
489 490
490 STDMETHODIMP AXPlatformNodeWin::get_accParent( 491 STDMETHODIMP AXPlatformNodeWin::get_accParent(
491 IDispatch** disp_parent) { 492 IDispatch** disp_parent) {
492 COM_OBJECT_VALIDATE_1_ARG(disp_parent); 493 COM_OBJECT_VALIDATE_1_ARG(disp_parent);
493 *disp_parent = GetParent(); 494 *disp_parent = GetParent();
494 if (*disp_parent) { 495 if (*disp_parent) {
495 (*disp_parent)->AddRef(); 496 (*disp_parent)->AddRef();
496 return S_OK; 497 return S_OK;
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 } 1201 }
1201 1202
1202 HRESULT AXPlatformNodeWin::GetStringAttributeAsBstr( 1203 HRESULT AXPlatformNodeWin::GetStringAttributeAsBstr(
1203 ui::AXStringAttribute attribute, 1204 ui::AXStringAttribute attribute,
1204 BSTR* value_bstr) const { 1205 BSTR* value_bstr) const {
1205 base::string16 str; 1206 base::string16 str;
1206 1207
1207 if (!GetString16Attribute(attribute, &str)) 1208 if (!GetString16Attribute(attribute, &str))
1208 return S_FALSE; 1209 return S_FALSE;
1209 1210
1210 if (str.empty())
1211 return S_FALSE;
1212
1213 *value_bstr = SysAllocString(str.c_str()); 1211 *value_bstr = SysAllocString(str.c_str());
1214 DCHECK(*value_bstr); 1212 DCHECK(*value_bstr);
1215 1213
1216 return S_OK; 1214 return S_OK;
1217 } 1215 }
1218 1216
1219 void AXPlatformNodeWin::AddAlertTarget() { 1217 void AXPlatformNodeWin::AddAlertTarget() {
1220 g_alert_targets.Get().insert(this); 1218 g_alert_targets.Get().insert(this);
1221 } 1219 }
1222 1220
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 1290
1293 AXPlatformNodeBase* base = 1291 AXPlatformNodeBase* base =
1294 FromNativeViewAccessible(node->GetNativeViewAccessible()); 1292 FromNativeViewAccessible(node->GetNativeViewAccessible());
1295 if (base && !IsDescendant(base)) 1293 if (base && !IsDescendant(base))
1296 base = nullptr; 1294 base = nullptr;
1297 1295
1298 return static_cast<AXPlatformNodeWin*>(base); 1296 return static_cast<AXPlatformNodeWin*>(base);
1299 } 1297 }
1300 1298
1301 } // namespace ui 1299 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/ax_enums.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698