| Index: views/controls/textfield/textfield.cc
|
| diff --git a/views/controls/textfield/textfield.cc b/views/controls/textfield/textfield.cc
|
| index c4ab7996b449cdbd2e8b07b2284f5d903a6509b8..9da78ecd900ad97ae335ad234d3fe6ec67995a07 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_->HandleKeyPressed(e);
|
| +}
|
| +
|
| +bool Textfield::OnKeyReleased(const views::KeyEvent& e) {
|
| + return native_wrapper_ && native_wrapper_->HandleKeyReleased(e);
|
| +}
|
| +
|
| +void Textfield::WillGainFocus() {
|
| + if (native_wrapper_)
|
| + native_wrapper_->HandleWillGainFocus();
|
| +}
|
| +
|
| +void Textfield::DidGainFocus() {
|
| + if (native_wrapper_)
|
| + native_wrapper_->HandleDidGainFocus();
|
| +}
|
| +
|
| +void Textfield::WillLoseFocus() {
|
| + if (native_wrapper_)
|
| + native_wrapper_->HandleWillLoseFocus();
|
| +}
|
| +
|
| 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();
|
| }
|
| }
|
|
|