| Index: views/controls/textfield/textfield.cc
|
| diff --git a/views/controls/textfield/textfield.cc b/views/controls/textfield/textfield.cc
|
| index 89959cc551eedaf095214834c327ed9d80169a3c..637e1b8b55590a9da7939b47df9796d6341d3f9e 100644
|
| --- a/views/controls/textfield/textfield.cc
|
| +++ b/views/controls/textfield/textfield.cc
|
| @@ -261,7 +261,7 @@ gfx::Size Textfield::GetPreferredSize() {
|
| }
|
|
|
| bool Textfield::IsFocusable() const {
|
| - return IsEnabled() && !read_only_;
|
| + return View::IsFocusable() && !read_only_;
|
| }
|
|
|
| void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) {
|
| @@ -290,6 +290,29 @@ void Textfield::PaintFocusBorder(gfx::Canvas* canvas) {
|
| View::PaintFocusBorder(canvas);
|
| }
|
|
|
| +bool Textfield::OnKeyPressed(const views::KeyEvent& e) {
|
| + return native_wrapper_ && native_wrapper_->OnKeyPressed(e);
|
| +}
|
| +
|
| +bool Textfield::OnKeyReleased(const views::KeyEvent& e) {
|
| + return native_wrapper_ && native_wrapper_->OnKeyReleased(e);
|
| +}
|
| +
|
| +void Textfield::WillGainFocus() {
|
| + if (native_wrapper_)
|
| + native_wrapper_->WillGainFocus();
|
| +}
|
| +
|
| +void Textfield::DidGainFocus() {
|
| + if (native_wrapper_)
|
| + native_wrapper_->DidGainFocus();
|
| +}
|
| +
|
| +void Textfield::WillLoseFocus() {
|
| + if (native_wrapper_)
|
| + native_wrapper_->WillLoseFocus();
|
| +}
|
| +
|
| AccessibilityTypes::Role Textfield::GetAccessibleRole() {
|
| return AccessibilityTypes::ROLE_TEXT;
|
| }
|
| @@ -316,12 +339,11 @@ void Textfield::SetEnabled(bool enabled) {
|
| }
|
|
|
| void Textfield::Focus() {
|
| - if (native_wrapper_) {
|
| - // Forward the focus to the wrapper if it exists.
|
| - native_wrapper_->SetFocus();
|
| - } else {
|
| - // If there is no wrapper, cause the RootView to be focused so that we still
|
| - // get keyboard messages.
|
| + // Forward the focus to the wrapper if it exists.
|
| + if (!native_wrapper_ || !native_wrapper_->SetFocus()) {
|
| + // If there is no wrapper or the wrapper din't take focus, call
|
| + // View::Focus to clear the native focus so that we still get
|
| + // keyboard messages.
|
| View::Focus();
|
| }
|
| }
|
|
|