| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/textfield/native_textfield_win.h" | 5 #include "views/controls/textfield/native_textfield_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 429 |
| 430 VARIANT var; | 430 VARIANT var; |
| 431 | 431 |
| 432 // Set the accessible role. | 432 // Set the accessible role. |
| 433 var.vt = VT_I4; | 433 var.vt = VT_I4; |
| 434 var.lVal = ROLE_SYSTEM_TEXT; | 434 var.lVal = ROLE_SYSTEM_TEXT; |
| 435 hr = pAccPropServices->SetHwndProp(m_hWnd, OBJID_CLIENT, | 435 hr = pAccPropServices->SetHwndProp(m_hWnd, OBJID_CLIENT, |
| 436 CHILDID_SELF, PROPID_ACC_ROLE, var); | 436 CHILDID_SELF, PROPID_ACC_ROLE, var); |
| 437 | 437 |
| 438 // Set the accessible name by getting the label text. | 438 // Set the accessible name by getting the label text. |
| 439 View* parent = textfield_->GetParent(); | 439 View* parent = textfield_->parent(); |
| 440 int label_index = parent->GetChildIndex(textfield_) - 1; | 440 int label_index = parent->GetIndexOf(textfield_) - 1; |
| 441 if (label_index >= 0) { | 441 if (label_index >= 0) { |
| 442 // Try to find the name of this text field. | 442 // Try to find the name of this text field. |
| 443 // We expect it to be a Label preceeding this view (if it exists). | 443 // We expect it to be a Label preceeding this view (if it exists). |
| 444 string16 name; | 444 string16 name; |
| 445 View* label_view = parent->GetChildViewAt(label_index); | 445 View* label_view = parent->GetChildViewAt(label_index); |
| 446 if (label_view->GetClassName() == Label::kViewClassName && | 446 if (label_view->GetClassName() == Label::kViewClassName && |
| 447 label_view->GetAccessibleName(&name)) { | 447 label_view->GetAccessibleName(&name)) { |
| 448 hr = pAccPropServices->SetHwndPropStr(m_hWnd, OBJID_CLIENT, | 448 hr = pAccPropServices->SetHwndPropStr(m_hWnd, OBJID_CLIENT, |
| 449 CHILDID_SELF, PROPID_ACC_NAME, name.c_str()); | 449 CHILDID_SELF, PROPID_ACC_NAME, name.c_str()); |
| 450 } | 450 } |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1162 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
| 1163 Textfield* field) { | 1163 Textfield* field) { |
| 1164 if (NativeTextfieldViews::IsTextfieldViewsEnabled()) { | 1164 if (NativeTextfieldViews::IsTextfieldViewsEnabled()) { |
| 1165 return new NativeTextfieldViews(field); | 1165 return new NativeTextfieldViews(field); |
| 1166 } else { | 1166 } else { |
| 1167 return new NativeTextfieldWin(field); | 1167 return new NativeTextfieldWin(field); |
| 1168 } | 1168 } |
| 1169 } | 1169 } |
| 1170 | 1170 |
| 1171 } // namespace views | 1171 } // namespace views |
| OLD | NEW |