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

Unified Diff: content/browser/accessibility/browser_accessibility_com_win.cc

Issue 2931893002: More precise use of multiline state (Closed)
Patch Set: Remove unnecessary changes Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/accessibility/browser_accessibility_com_win.cc
diff --git a/content/browser/accessibility/browser_accessibility_com_win.cc b/content/browser/accessibility/browser_accessibility_com_win.cc
index 809a6ce4770a0996dd70f6fb806fbd1f7952034a..57ff9025055e2d8197325b35ee3124ff52c63c12 100644
--- a/content/browser/accessibility/browser_accessibility_com_win.cc
+++ b/content/browser/accessibility/browser_accessibility_com_win.cc
@@ -2851,8 +2851,7 @@ STDMETHODIMP BrowserAccessibilityComWin::get_nodeInfo(
*num_children = owner()->PlatformChildCount();
*unique_id = -owner()->unique_id();
- if (owner()->GetRole() == ui::AX_ROLE_ROOT_WEB_AREA ||
- owner()->GetRole() == ui::AX_ROLE_WEB_AREA) {
+ if (owner()->IsDocument()) {
*node_type = NODETYPE_DOCUMENT;
} else if (owner()->IsTextOnlyObject()) {
*node_type = NODETYPE_TEXT;
@@ -3696,8 +3695,7 @@ void BrowserAccessibilityComWin::UpdateStep1ComputeWinAttributes() {
win_attributes_->ia2_attributes.push_back(L"valuetext:" + value);
} else {
// On Windows, the value of a document should be its url.
- if (owner()->GetRole() == ui::AX_ROLE_ROOT_WEB_AREA ||
- owner()->GetRole() == ui::AX_ROLE_WEB_AREA) {
+ if (owner()->IsDocument()) {
value = base::UTF8ToUTF16(Manager()->GetTreeData().url);
}
// If this doesn't have a value and is linked then set its value to the url
@@ -4944,9 +4942,22 @@ void BrowserAccessibilityComWin::InitRoleAndState() {
if (owner()->HasState(ui::AX_STATE_HORIZONTAL))
ia2_state |= IA2_STATE_HORIZONTAL;
- if (owner()->HasState(ui::AX_STATE_EDITABLE))
+ const bool is_editable = owner()->HasState(ui::AX_STATE_EDITABLE);
+ if (is_editable)
ia2_state |= IA2_STATE_EDITABLE;
+ if (owner()->IsRichTextControl() || owner()->IsEditField()) {
+ // Support multi/single line states if root editable or appropriate role.
+ // We support the edit box roles even if the area is not actually editable,
+ // because it is technically feasible for JS to implement the edit box
+ // by controlling selection.
+ if (owner()->HasState(ui::AX_STATE_MULTILINE)) {
+ ia2_state |= IA2_STATE_MULTI_LINE;
+ } else {
+ ia2_state |= IA2_STATE_SINGLE_LINE;
+ }
+ }
+
if (!owner()->GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty())
ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION;
@@ -5319,11 +5330,6 @@ void BrowserAccessibilityComWin::InitRoleAndState() {
case ui::AX_ROLE_TEXT_FIELD:
case ui::AX_ROLE_SEARCH_BOX:
ia_role = ROLE_SYSTEM_TEXT;
- if (owner()->HasState(ui::AX_STATE_MULTILINE)) {
- ia2_state |= IA2_STATE_MULTI_LINE;
- } else {
- ia2_state |= IA2_STATE_SINGLE_LINE;
- }
ia2_state |= IA2_STATE_SELECTABLE_TEXT;
break;
case ui::AX_ROLE_ABBR:

Powered by Google App Engine
This is Rietveld 408576698