| 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_views.h" | 5 #include "views/controls/textfield/native_textfield_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 cursor_timer_.InvalidateWeakPtrs(); | 548 cursor_timer_.InvalidateWeakPtrs(); |
| 549 if (is_cursor_visible_) { | 549 if (is_cursor_visible_) { |
| 550 is_cursor_visible_ = false; | 550 is_cursor_visible_ = false; |
| 551 RepaintCursor(); | 551 RepaintCursor(); |
| 552 } | 552 } |
| 553 | 553 |
| 554 if (touch_selection_controller_.get()) | 554 if (touch_selection_controller_.get()) |
| 555 touch_selection_controller_->ClientViewLostFocus(); | 555 touch_selection_controller_->ClientViewLostFocus(); |
| 556 } | 556 } |
| 557 | 557 |
| 558 TextInputClient* NativeTextfieldViews::GetTextInputClient() { | 558 ui::TextInputClient* NativeTextfieldViews::GetTextInputClient() { |
| 559 return textfield_->read_only() ? NULL : this; | 559 return textfield_->read_only() ? NULL : this; |
| 560 } | 560 } |
| 561 | 561 |
| 562 void NativeTextfieldViews::ClearEditHistory() { | 562 void NativeTextfieldViews::ClearEditHistory() { |
| 563 model_->ClearEditHistory(); | 563 model_->ClearEditHistory(); |
| 564 } | 564 } |
| 565 | 565 |
| 566 ///////////////////////////////////////////////////////////////// | 566 ///////////////////////////////////////////////////////////////// |
| 567 // NativeTextfieldViews, ui::SimpleMenuModel::Delegate overrides: | 567 // NativeTextfieldViews, ui::SimpleMenuModel::Delegate overrides: |
| 568 | 568 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 gfx::Insets insets = GetInsets(); | 645 gfx::Insets insets = GetInsets(); |
| 646 gfx::Rect display_rect(insets.left(), | 646 gfx::Rect display_rect(insets.left(), |
| 647 insets.top(), | 647 insets.top(), |
| 648 width() - insets.width(), | 648 width() - insets.width(), |
| 649 height() - insets.height()); | 649 height() - insets.height()); |
| 650 GetRenderText()->SetDisplayRect(display_rect); | 650 GetRenderText()->SetDisplayRect(display_rect); |
| 651 OnCaretBoundsChanged(); | 651 OnCaretBoundsChanged(); |
| 652 } | 652 } |
| 653 | 653 |
| 654 /////////////////////////////////////////////////////////////////////////////// | 654 /////////////////////////////////////////////////////////////////////////////// |
| 655 // NativeTextfieldViews, TextInputClient implementation, private: | 655 // NativeTextfieldViews, ui::TextInputClient implementation, private: |
| 656 | 656 |
| 657 void NativeTextfieldViews::SetCompositionText( | 657 void NativeTextfieldViews::SetCompositionText( |
| 658 const ui::CompositionText& composition) { | 658 const ui::CompositionText& composition) { |
| 659 if (GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) | 659 if (GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) |
| 660 return; | 660 return; |
| 661 | 661 |
| 662 OnBeforeUserAction(); | 662 OnBeforeUserAction(); |
| 663 skip_input_method_cancel_composition_ = true; | 663 skip_input_method_cancel_composition_ = true; |
| 664 model_->SetCompositionText(composition); | 664 model_->SetCompositionText(composition); |
| 665 skip_input_method_cancel_composition_ = false; | 665 skip_input_method_cancel_composition_ = false; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 void NativeTextfieldViews::OnInputMethodChanged() { | 806 void NativeTextfieldViews::OnInputMethodChanged() { |
| 807 NOTIMPLEMENTED(); | 807 NOTIMPLEMENTED(); |
| 808 } | 808 } |
| 809 | 809 |
| 810 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( | 810 bool NativeTextfieldViews::ChangeTextDirectionAndLayoutAlignment( |
| 811 base::i18n::TextDirection direction) { | 811 base::i18n::TextDirection direction) { |
| 812 NOTIMPLEMENTED(); | 812 NOTIMPLEMENTED(); |
| 813 return false; | 813 return false; |
| 814 } | 814 } |
| 815 | 815 |
| 816 View* NativeTextfieldViews::GetOwnerViewOfTextInputClient() { | |
| 817 return textfield_; | |
| 818 } | |
| 819 | |
| 820 void NativeTextfieldViews::OnCompositionTextConfirmedOrCleared() { | 816 void NativeTextfieldViews::OnCompositionTextConfirmedOrCleared() { |
| 821 if (skip_input_method_cancel_composition_) | 817 if (skip_input_method_cancel_composition_) |
| 822 return; | 818 return; |
| 823 DCHECK(textfield_->GetInputMethod()); | 819 DCHECK(textfield_->GetInputMethod()); |
| 824 textfield_->GetInputMethod()->CancelComposition(textfield_); | 820 textfield_->GetInputMethod()->CancelComposition(textfield_); |
| 825 } | 821 } |
| 826 | 822 |
| 827 gfx::RenderText* NativeTextfieldViews::GetRenderText() const { | 823 gfx::RenderText* NativeTextfieldViews::GetRenderText() const { |
| 828 return model_->render_text(); | 824 return model_->render_text(); |
| 829 } | 825 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 | 1074 |
| 1079 #if defined(USE_AURA) | 1075 #if defined(USE_AURA) |
| 1080 // static | 1076 // static |
| 1081 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1077 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
| 1082 Textfield* field) { | 1078 Textfield* field) { |
| 1083 return new NativeTextfieldViews(field); | 1079 return new NativeTextfieldViews(field); |
| 1084 } | 1080 } |
| 1085 #endif | 1081 #endif |
| 1086 | 1082 |
| 1087 } // namespace views | 1083 } // namespace views |
| OLD | NEW |