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

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

Issue 98913002: Avoid DCHECK failures from get_characterExtents and get_unclippedSubstrings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (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 "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 1925
1926 if (!out_x || !out_y || !out_width || !out_height) 1926 if (!out_x || !out_y || !out_width || !out_height)
1927 return E_INVALIDARG; 1927 return E_INVALIDARG;
1928 1928
1929 const string16& text_str = TextForIAccessibleText(); 1929 const string16& text_str = TextForIAccessibleText();
1930 HandleSpecialTextOffset(text_str, &offset); 1930 HandleSpecialTextOffset(text_str, &offset);
1931 1931
1932 if (offset < 0 || offset > static_cast<LONG>(text_str.size())) 1932 if (offset < 0 || offset > static_cast<LONG>(text_str.size()))
1933 return E_INVALIDARG; 1933 return E_INVALIDARG;
1934 1934
1935 if (role_ != blink::WebAXRoleStaticText)
1936 return E_FAIL;
1937
1935 gfx::Rect character_bounds; 1938 gfx::Rect character_bounds;
1936 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) { 1939 if (coordinate_type == IA2_COORDTYPE_SCREEN_RELATIVE) {
1937 character_bounds = GetGlobalBoundsForRange(offset, 1); 1940 character_bounds = GetGlobalBoundsForRange(offset, 1);
1938 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) { 1941 } else if (coordinate_type == IA2_COORDTYPE_PARENT_RELATIVE) {
1939 character_bounds = GetLocalBoundsForRange(offset, 1); 1942 character_bounds = GetLocalBoundsForRange(offset, 1);
1940 character_bounds -= location().OffsetFromOrigin(); 1943 character_bounds -= location().OffsetFromOrigin();
1941 } else { 1944 } else {
1942 return E_INVALIDARG; 1945 return E_INVALIDARG;
1943 } 1946 }
1944 1947
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
2710 if (!out_x || !out_y || !out_width || !out_height) 2713 if (!out_x || !out_y || !out_width || !out_height)
2711 return E_INVALIDARG; 2714 return E_INVALIDARG;
2712 2715
2713 const string16& text_str = TextForIAccessibleText(); 2716 const string16& text_str = TextForIAccessibleText();
2714 if (start_index > text_str.size() || 2717 if (start_index > text_str.size() ||
2715 end_index > text_str.size() || 2718 end_index > text_str.size() ||
2716 start_index > end_index) { 2719 start_index > end_index) {
2717 return E_INVALIDARG; 2720 return E_INVALIDARG;
2718 } 2721 }
2719 2722
2723 if (role_ != blink::WebAXRoleStaticText)
2724 return E_FAIL;
2725
2720 gfx::Rect bounds = GetGlobalBoundsForRange( 2726 gfx::Rect bounds = GetGlobalBoundsForRange(
2721 start_index, end_index - start_index); 2727 start_index, end_index - start_index);
2722 *out_x = bounds.x(); 2728 *out_x = bounds.x();
2723 *out_y = bounds.y(); 2729 *out_y = bounds.y();
2724 *out_width = bounds.width(); 2730 *out_width = bounds.width();
2725 *out_height = bounds.height(); 2731 *out_height = bounds.height();
2726 return S_OK; 2732 return S_OK;
2727 } 2733 }
2728 2734
2729 STDMETHODIMP BrowserAccessibilityWin::scrollToSubstring( 2735 STDMETHODIMP BrowserAccessibilityWin::scrollToSubstring(
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
3765 // The role should always be set. 3771 // The role should always be set.
3766 DCHECK(!role_name_.empty() || ia_role_); 3772 DCHECK(!role_name_.empty() || ia_role_);
3767 3773
3768 // If we didn't explicitly set the IAccessible2 role, make it the same 3774 // If we didn't explicitly set the IAccessible2 role, make it the same
3769 // as the MSAA role. 3775 // as the MSAA role.
3770 if (!ia2_role_) 3776 if (!ia2_role_)
3771 ia2_role_ = ia_role_; 3777 ia2_role_ = ia_role_;
3772 } 3778 }
3773 3779
3774 } // namespace content 3780 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698