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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 void Textfield::SetFontList(const gfx::FontList& font_list) { | 389 void Textfield::SetFontList(const gfx::FontList& font_list) { |
390 GetRenderText()->SetFontList(font_list); | 390 GetRenderText()->SetFontList(font_list); |
391 OnCaretBoundsChanged(); | 391 OnCaretBoundsChanged(); |
392 PreferredSizeChanged(); | 392 PreferredSizeChanged(); |
393 } | 393 } |
394 | 394 |
395 base::string16 Textfield::GetPlaceholderText() const { | 395 base::string16 Textfield::GetPlaceholderText() const { |
396 return placeholder_text_; | 396 return placeholder_text_; |
397 } | 397 } |
398 | 398 |
| 399 gfx::HorizontalAlignment Textfield::GetHorizontalAlignment() const { |
| 400 return GetRenderText()->horizontal_alignment(); |
| 401 } |
| 402 |
| 403 void Textfield::SetHorizontalAlignment(gfx::HorizontalAlignment alignment) { |
| 404 GetRenderText()->SetHorizontalAlignment(alignment); |
| 405 } |
| 406 |
399 void Textfield::ShowImeIfNeeded() { | 407 void Textfield::ShowImeIfNeeded() { |
400 if (enabled() && !read_only()) | 408 if (enabled() && !read_only()) |
401 GetInputMethod()->ShowImeIfNeeded(); | 409 GetInputMethod()->ShowImeIfNeeded(); |
402 } | 410 } |
403 | 411 |
404 bool Textfield::IsIMEComposing() const { | 412 bool Textfield::IsIMEComposing() const { |
405 return model_->HasCompositionText(); | 413 return model_->HasCompositionText(); |
406 } | 414 } |
407 | 415 |
408 const gfx::Range& Textfield::GetSelectedRange() const { | 416 const gfx::Range& Textfield::GetSelectedRange() const { |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 const size_t length = selection_clipboard_text.length(); | 1688 const size_t length = selection_clipboard_text.length(); |
1681 range = gfx::Range(range.start() + length, range.end() + length); | 1689 range = gfx::Range(range.start() + length, range.end() + length); |
1682 } | 1690 } |
1683 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); | 1691 model_->MoveCursorTo(gfx::SelectionModel(range, affinity)); |
1684 UpdateAfterChange(true, true); | 1692 UpdateAfterChange(true, true); |
1685 OnAfterUserAction(); | 1693 OnAfterUserAction(); |
1686 } | 1694 } |
1687 } | 1695 } |
1688 | 1696 |
1689 } // namespace views | 1697 } // namespace views |
OLD | NEW |