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

Unified Diff: views/controls/textfield/native_textfield_views.cc

Issue 5988010: focus reverse traversal was not working for TextfieldViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: explicitly forward key/focus event to TextfieldViews Created 9 years, 12 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: views/controls/textfield/native_textfield_views.cc
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc
index a3ad114eb91a49c752df741c441d3499428b0ca5..b50e8d64ed6733eff68fd8981f54411f1f1499cb 100644
--- a/views/controls/textfield/native_textfield_views.cc
+++ b/views/controls/textfield/native_textfield_views.cc
@@ -57,7 +57,6 @@ NativeTextfieldViews::NativeTextfieldViews(Textfield* parent)
insert_(true),
is_cursor_visible_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(cursor_timer_(this)) {
- SetFocusable(true);
set_border(text_border_);
// Multiline is not supported.
@@ -73,7 +72,7 @@ NativeTextfieldViews::~NativeTextfieldViews() {
// NativeTextfieldViews, View overrides:
bool NativeTextfieldViews::OnMousePressed(const views::MouseEvent& e) {
- RequestFocus();
+ textfield_->RequestFocus();
size_t pos = FindCursorPosition(e.location());
if (model_->MoveCursorTo(pos, false)) {
UpdateCursorBoundsAndTextOffset();
@@ -110,7 +109,7 @@ bool NativeTextfieldViews::OnKeyReleased(const views::KeyEvent& e) {
}
void NativeTextfieldViews::Paint(gfx::Canvas* canvas) {
- text_border_->set_has_focus(HasFocus());
+ text_border_->set_has_focus(textfield_->HasFocus());
PaintBackground(canvas);
PaintTextAndCursor(canvas);
if (textfield_->draw_border())
@@ -140,7 +139,7 @@ void NativeTextfieldViews::WillLoseFocus() {
}
void NativeTextfieldViews::DidChangeBounds(const gfx::Rect& previous,
- const gfx::Rect& current) {
+ const gfx::Rect& current) {
UpdateCursorBoundsAndTextOffset();
}
@@ -225,15 +224,10 @@ void NativeTextfieldViews::UpdateIsPassword() {
}
void NativeTextfieldViews::UpdateEnabled() {
+ SetEnabled(textfield_->IsEnabled());
SchedulePaint();
}
-bool NativeTextfieldViews::IsPassword() {
- // looks unnecessary. should we remove?
- NOTREACHED();
- return false;
-}
-
gfx::Insets NativeTextfieldViews::CalculateInsets() {
return GetInsets();
}
@@ -258,8 +252,8 @@ void NativeTextfieldViews::UpdateVerticalMargins() {
UpdateCursorBoundsAndTextOffset();
}
-void NativeTextfieldViews::SetFocus() {
- RequestFocus();
+bool NativeTextfieldViews::SetFocus() {
+ return false;
}
View* NativeTextfieldViews::GetView() {
@@ -370,7 +364,8 @@ void NativeTextfieldViews::PaintTextAndCursor(gfx::Canvas* canvas) {
int y = insets.top();
int text_height = height() - insets.height();
SkColor selection_color =
- HasFocus() ? kFocusedSelectionColor : kUnfocusedSelectionColor;
+ textfield_->HasFocus() ?
+ kFocusedSelectionColor : kUnfocusedSelectionColor;
SkColor text_color =
textfield_->read_only() ? kReadonlyTextColor : GetTextColor();

Powered by Google App Engine
This is Rietveld 408576698