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

Side by Side Diff: ui/views/controls/textfield/textfield.cc

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Delete AXNodeData::Init() and clear bitfields in AXNodeData() instead. 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 "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 } 901 }
902 902
903 void Textfield::GetAccessibleNodeData(ui::AXNodeData* node_data) { 903 void Textfield::GetAccessibleNodeData(ui::AXNodeData* node_data) {
904 node_data->role = ui::AX_ROLE_TEXT_FIELD; 904 node_data->role = ui::AX_ROLE_TEXT_FIELD;
905 node_data->SetName(accessible_name_); 905 node_data->SetName(accessible_name_);
906 if (enabled()) { 906 if (enabled()) {
907 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, 907 node_data->AddIntAttribute(ui::AX_ATTR_ACTION,
908 ui::AX_SUPPORTED_ACTION_ACTIVATE); 908 ui::AX_SUPPORTED_ACTION_ACTIVATE);
909 } 909 }
910 if (read_only()) 910 if (read_only())
911 node_data->AddStateFlag(ui::AX_STATE_READ_ONLY); 911 node_data->AddState(ui::AX_STATE_READ_ONLY);
912 else 912 else
913 node_data->AddStateFlag(ui::AX_STATE_EDITABLE); 913 node_data->AddState(ui::AX_STATE_EDITABLE);
914 if (text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD) { 914 if (text_input_type_ == ui::TEXT_INPUT_TYPE_PASSWORD) {
915 node_data->AddStateFlag(ui::AX_STATE_PROTECTED); 915 node_data->AddState(ui::AX_STATE_PROTECTED);
916 node_data->SetValue(base::string16(text().size(), '*')); 916 node_data->SetValue(base::string16(text().size(), '*'));
917 } else { 917 } else {
918 node_data->SetValue(text()); 918 node_data->SetValue(text());
919 } 919 }
920 node_data->AddStringAttribute(ui::AX_ATTR_PLACEHOLDER, 920 node_data->AddStringAttribute(ui::AX_ATTR_PLACEHOLDER,
921 base::UTF16ToUTF8(GetPlaceholderText())); 921 base::UTF16ToUTF8(GetPlaceholderText()));
922 922
923 const gfx::Range range = GetSelectedRange(); 923 const gfx::Range range = GetSelectedRange();
924 node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, range.start()); 924 node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, range.start());
925 node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, range.end()); 925 node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, range.end());
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 cursor_blink_timer_.Stop(); 2094 cursor_blink_timer_.Stop();
2095 } 2095 }
2096 2096
2097 void Textfield::OnCursorBlinkTimerFired() { 2097 void Textfield::OnCursorBlinkTimerFired() {
2098 DCHECK(ShouldBlinkCursor()); 2098 DCHECK(ShouldBlinkCursor());
2099 cursor_view_.SetVisible(!cursor_view_.visible()); 2099 cursor_view_.SetVisible(!cursor_view_.visible());
2100 UpdateCursorViewPosition(); 2100 UpdateCursorViewPosition();
2101 } 2101 }
2102 2102
2103 } // namespace views 2103 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698