| OLD | NEW |
| 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 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "grit/ui_strings.h" | 10 #include "grit/ui_strings.h" |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 return initiating_drag_; | 474 return initiating_drag_; |
| 475 } | 475 } |
| 476 | 476 |
| 477 //////////////////////////////////////////////////////////////////////////////// | 477 //////////////////////////////////////////////////////////////////////////////// |
| 478 // Textfield, View overrides: | 478 // Textfield, View overrides: |
| 479 | 479 |
| 480 int Textfield::GetBaseline() const { | 480 int Textfield::GetBaseline() const { |
| 481 return GetInsets().top() + GetRenderText()->GetBaseline(); | 481 return GetInsets().top() + GetRenderText()->GetBaseline(); |
| 482 } | 482 } |
| 483 | 483 |
| 484 gfx::Size Textfield::GetPreferredSize() { | 484 gfx::Size Textfield::GetPreferredSize() const { |
| 485 const gfx::Insets& insets = GetInsets(); | 485 const gfx::Insets& insets = GetInsets(); |
| 486 return gfx::Size(GetFontList().GetExpectedTextWidth(default_width_in_chars_) + | 486 return gfx::Size(GetFontList().GetExpectedTextWidth(default_width_in_chars_) + |
| 487 insets.width(), GetFontList().GetHeight() + insets.height()); | 487 insets.width(), GetFontList().GetHeight() + insets.height()); |
| 488 } | 488 } |
| 489 | 489 |
| 490 const char* Textfield::GetClassName() const { | 490 const char* Textfield::GetClassName() const { |
| 491 return kViewClassName; | 491 return kViewClassName; |
| 492 } | 492 } |
| 493 | 493 |
| 494 gfx::NativeCursor Textfield::GetCursor(const ui::MouseEvent& event) { | 494 gfx::NativeCursor Textfield::GetCursor(const ui::MouseEvent& event) { |
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 const size_t length = selection_clipboard_text.length(); | 1680 const size_t length = selection_clipboard_text.length(); |
| 1681 range = gfx::Range(range.start() + length, range.end() + length); | 1681 range = gfx::Range(range.start() + length, range.end() + length); |
| 1682 } | 1682 } |
| 1683 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1683 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
| 1684 UpdateAfterChange(true, true); | 1684 UpdateAfterChange(true, true); |
| 1685 OnAfterUserAction(); | 1685 OnAfterUserAction(); |
| 1686 } | 1686 } |
| 1687 } | 1687 } |
| 1688 | 1688 |
| 1689 } // namespace views | 1689 } // namespace views |
| OLD | NEW |