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

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

Issue 1046883002: Use multiline attribute to check for IA2_STATE_MULTILINE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 } 1936 }
1937 1937
1938 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { 1938 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) {
1939 if (!instance_active()) 1939 if (!instance_active())
1940 return E_FAIL; 1940 return E_FAIL;
1941 1941
1942 if (!offset) 1942 if (!offset)
1943 return E_INVALIDARG; 1943 return E_INVALIDARG;
1944 1944
1945 *offset = 0; 1945 *offset = 0;
1946 if (GetRole() == ui::AX_ROLE_TEXT_FIELD || 1946 if (GetRole() == ui::AX_ROLE_TEXT_FIELD) {
1947 GetRole() == ui::AX_ROLE_TEXT_AREA) {
1948 int sel_start = 0; 1947 int sel_start = 0;
1949 if (GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, 1948 if (GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START,
1950 &sel_start)) 1949 &sel_start))
1951 *offset = sel_start; 1950 *offset = sel_start;
1952 } 1951 }
1953 1952
1954 return S_OK; 1953 return S_OK;
1955 } 1954 }
1956 1955
1957 STDMETHODIMP BrowserAccessibilityWin::get_characterExtents( 1956 STDMETHODIMP BrowserAccessibilityWin::get_characterExtents(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 } 1991 }
1993 1992
1994 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { 1993 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) {
1995 if (!instance_active()) 1994 if (!instance_active())
1996 return E_FAIL; 1995 return E_FAIL;
1997 1996
1998 if (!n_selections) 1997 if (!n_selections)
1999 return E_INVALIDARG; 1998 return E_INVALIDARG;
2000 1999
2001 *n_selections = 0; 2000 *n_selections = 0;
2002 if (GetRole() == ui::AX_ROLE_TEXT_FIELD || 2001 if (GetRole() == ui::AX_ROLE_TEXT_FIELD) {
2003 GetRole() == ui::AX_ROLE_TEXT_AREA) {
2004 int sel_start = 0; 2002 int sel_start = 0;
2005 int sel_end = 0; 2003 int sel_end = 0;
2006 if (GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, 2004 if (GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START,
2007 &sel_start) && 2005 &sel_start) &&
2008 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, &sel_end) && 2006 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, &sel_end) &&
2009 sel_start != sel_end) 2007 sel_start != sel_end)
2010 *n_selections = 1; 2008 *n_selections = 1;
2011 } 2009 }
2012 2010
2013 return S_OK; 2011 return S_OK;
2014 } 2012 }
2015 2013
2016 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, 2014 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index,
2017 LONG* start_offset, 2015 LONG* start_offset,
2018 LONG* end_offset) { 2016 LONG* end_offset) {
2019 if (!instance_active()) 2017 if (!instance_active())
2020 return E_FAIL; 2018 return E_FAIL;
2021 2019
2022 if (!start_offset || !end_offset || selection_index != 0) 2020 if (!start_offset || !end_offset || selection_index != 0)
2023 return E_INVALIDARG; 2021 return E_INVALIDARG;
2024 2022
2025 *start_offset = 0; 2023 *start_offset = 0;
2026 *end_offset = 0; 2024 *end_offset = 0;
2027 if (GetRole() == ui::AX_ROLE_TEXT_FIELD || 2025 if (GetRole() == ui::AX_ROLE_TEXT_FIELD) {
2028 GetRole() == ui::AX_ROLE_TEXT_AREA) {
2029 int sel_start = 0; 2026 int sel_start = 0;
2030 int sel_end = 0; 2027 int sel_end = 0;
2031 if (GetIntAttribute( 2028 if (GetIntAttribute(
2032 ui::AX_ATTR_TEXT_SEL_START, &sel_start) && 2029 ui::AX_ATTR_TEXT_SEL_START, &sel_start) &&
2033 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, &sel_end)) { 2030 GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, &sel_end)) {
2034 *start_offset = sel_start; 2031 *start_offset = sel_start;
2035 *end_offset = sel_end; 2032 *end_offset = sel_end;
2036 } 2033 }
2037 } 2034 }
2038 2035
(...skipping 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after
4050 case ui::AX_ROLE_TAB_LIST: 4047 case ui::AX_ROLE_TAB_LIST:
4051 ia_role = ROLE_SYSTEM_PAGETABLIST; 4048 ia_role = ROLE_SYSTEM_PAGETABLIST;
4052 break; 4049 break;
4053 case ui::AX_ROLE_TAB_PANEL: 4050 case ui::AX_ROLE_TAB_PANEL:
4054 ia_role = ROLE_SYSTEM_PROPERTYPAGE; 4051 ia_role = ROLE_SYSTEM_PROPERTYPAGE;
4055 break; 4052 break;
4056 case ui::AX_ROLE_TOGGLE_BUTTON: 4053 case ui::AX_ROLE_TOGGLE_BUTTON:
4057 ia_role = ROLE_SYSTEM_PUSHBUTTON; 4054 ia_role = ROLE_SYSTEM_PUSHBUTTON;
4058 ia2_role = IA2_ROLE_TOGGLE_BUTTON; 4055 ia2_role = IA2_ROLE_TOGGLE_BUTTON;
4059 break; 4056 break;
4060 case ui::AX_ROLE_TEXT_AREA:
4061 ia_role = ROLE_SYSTEM_TEXT;
4062 ia2_state |= IA2_STATE_MULTI_LINE;
4063 ia2_state |= IA2_STATE_EDITABLE;
4064 ia2_state |= IA2_STATE_SELECTABLE_TEXT;
4065 break;
4066 case ui::AX_ROLE_TEXT_FIELD: 4057 case ui::AX_ROLE_TEXT_FIELD:
4067 case ui::AX_ROLE_SEARCH_BOX: 4058 case ui::AX_ROLE_SEARCH_BOX:
4068 ia_role = ROLE_SYSTEM_TEXT; 4059 ia_role = ROLE_SYSTEM_TEXT;
4069 ia2_state |= IA2_STATE_SINGLE_LINE; 4060 if (HasState(ui::AX_STATE_MULTILINE))
4061 ia2_state |= IA2_STATE_MULTI_LINE
4062 else
4063 ia2_state |= IA2_STATE_SINGLE_LINE
4070 ia2_state |= IA2_STATE_EDITABLE; 4064 ia2_state |= IA2_STATE_EDITABLE;
4071 ia2_state |= IA2_STATE_SELECTABLE_TEXT; 4065 ia2_state |= IA2_STATE_SELECTABLE_TEXT;
4072 break; 4066 break;
4073 case ui::AX_ROLE_TIME: 4067 case ui::AX_ROLE_TIME:
4074 ia_role = ROLE_SYSTEM_SPINBUTTON; 4068 ia_role = ROLE_SYSTEM_SPINBUTTON;
4075 break; 4069 break;
4076 case ui::AX_ROLE_TIMER: 4070 case ui::AX_ROLE_TIMER:
4077 ia_role = ROLE_SYSTEM_CLOCK; 4071 ia_role = ROLE_SYSTEM_CLOCK;
4078 ia_state |= STATE_SYSTEM_READONLY; 4072 ia_state |= STATE_SYSTEM_READONLY;
4079 break; 4073 break;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4137 ia2_role = ia_role; 4131 ia2_role = ia_role;
4138 4132
4139 win_attributes_->ia_role = ia_role; 4133 win_attributes_->ia_role = ia_role;
4140 win_attributes_->ia_state = ia_state; 4134 win_attributes_->ia_state = ia_state;
4141 win_attributes_->role_name = role_name; 4135 win_attributes_->role_name = role_name;
4142 win_attributes_->ia2_role = ia2_role; 4136 win_attributes_->ia2_role = ia2_role;
4143 win_attributes_->ia2_state = ia2_state; 4137 win_attributes_->ia2_state = ia2_state;
4144 } 4138 }
4145 4139
4146 } // namespace content 4140 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698