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

Side by Side Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 2833843005: Handling of different types of empty alt (Closed)
Patch Set: One more try to do Linux the right way 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) 2012 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 "content/browser/accessibility/browser_accessibility_win.h" 5 #include "content/browser/accessibility/browser_accessibility_win.h"
6 6
7 #include <UIAutomationClient.h> 7 #include <UIAutomationClient.h>
8 #include <UIAutomationCoreApi.h> 8 #include <UIAutomationCoreApi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 return E_INVALIDARG; 669 return E_INVALIDARG;
670 670
671 base::string16 name_str = target->name(); 671 base::string16 name_str = target->name();
672 if (name_str.empty()) { 672 if (name_str.empty()) {
673 if (target->ia2_role() == ROLE_SYSTEM_DOCUMENT && PlatformGetParent()) { 673 if (target->ia2_role() == ROLE_SYSTEM_DOCUMENT && PlatformGetParent()) {
674 // Hack: Some versions of JAWS crash if they get an empty name on 674 // Hack: Some versions of JAWS crash if they get an empty name on
675 // a document that's the child of an iframe, so always return a 675 // a document that's the child of an iframe, so always return a
676 // nonempty string for this role. https://crbug.com/583057 676 // nonempty string for this role. https://crbug.com/583057
677 name_str = L" "; 677 name_str = L" ";
678 } else { 678 } else {
679 return S_FALSE; 679 // For no accessible name, we return S_FALSE
680 // Explicitly empty names like <img alt=""> will return return ""/S_OK
dmazzoni 2017/05/01 17:49:23 delete /S_OK
aleventhal 2017/05/17 17:45:47 Done.
681 if (!target->HasExplicitlyEmptyName())
682 return S_FALSE;
680 } 683 }
681 } 684 }
682 685
683 *name = SysAllocString(name_str.c_str()); 686 *name = SysAllocString(name_str.c_str());
684 687
685 DCHECK(*name); 688 DCHECK(*name);
686 return S_OK; 689 return S_OK;
687 } 690 }
688 691
689 STDMETHODIMP BrowserAccessibilityWin::get_accParent(IDispatch** disp_parent) { 692 STDMETHODIMP BrowserAccessibilityWin::get_accParent(IDispatch** disp_parent) {
(...skipping 4982 matching lines...) Expand 10 before | Expand all | Expand 10 after
5672 return static_cast<BrowserAccessibilityWin*>(obj); 5675 return static_cast<BrowserAccessibilityWin*>(obj);
5673 } 5676 }
5674 5677
5675 const BrowserAccessibilityWin* 5678 const BrowserAccessibilityWin*
5676 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { 5679 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) {
5677 DCHECK(!obj || obj->IsNative()); 5680 DCHECK(!obj || obj->IsNative());
5678 return static_cast<const BrowserAccessibilityWin*>(obj); 5681 return static_cast<const BrowserAccessibilityWin*>(obj);
5679 } 5682 }
5680 5683
5681 } // namespace content 5684 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698