| 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/textfield.h" | 5 #include "views/controls/textfield/textfield.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 size_t Textfield::GetCursorPosition() const { | 277 size_t Textfield::GetCursorPosition() const { |
| 278 DCHECK(native_wrapper_); | 278 DCHECK(native_wrapper_); |
| 279 return native_wrapper_ ? native_wrapper_->GetCursorPosition() : 0; | 279 return native_wrapper_ ? native_wrapper_->GetCursorPosition() : 0; |
| 280 } | 280 } |
| 281 | 281 |
| 282 //////////////////////////////////////////////////////////////////////////////// | 282 //////////////////////////////////////////////////////////////////////////////// |
| 283 // Textfield, View overrides: | 283 // Textfield, View overrides: |
| 284 | 284 |
| 285 void Textfield::Layout() { | 285 void Textfield::Layout() { |
| 286 if (native_wrapper_) { | 286 if (native_wrapper_) { |
| 287 native_wrapper_->GetView()->SetBoundsRect(GetContentsBounds()); | 287 native_wrapper_->GetView()->SetBoundsRect(GetLocalBounds()); |
| 288 native_wrapper_->GetView()->Layout(); | 288 native_wrapper_->GetView()->Layout(); |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 gfx::Size Textfield::GetPreferredSize() { | 292 gfx::Size Textfield::GetPreferredSize() { |
| 293 gfx::Insets insets; | 293 gfx::Insets insets; |
| 294 if (draw_border_ && native_wrapper_) | 294 if (draw_border_ && native_wrapper_) |
| 295 insets = native_wrapper_->CalculateInsets(); | 295 insets = native_wrapper_->CalculateInsets(); |
| 296 return gfx::Size(font_.GetExpectedTextWidth(default_width_in_chars_) + | 296 return gfx::Size(font_.GetExpectedTextWidth(default_width_in_chars_) + |
| 297 insets.width(), | 297 insets.width(), |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 410 } |
| 411 #endif | 411 #endif |
| 412 } | 412 } |
| 413 } | 413 } |
| 414 | 414 |
| 415 std::string Textfield::GetClassName() const { | 415 std::string Textfield::GetClassName() const { |
| 416 return kViewClassName; | 416 return kViewClassName; |
| 417 } | 417 } |
| 418 | 418 |
| 419 } // namespace views | 419 } // namespace views |
| OLD | NEW |