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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 11 #include "build/build_config.h" |
11 #include "ui/accessibility/ax_view_state.h" | 12 #include "ui/accessibility/ax_view_state.h" |
12 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 13 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
13 #include "ui/base/cursor/cursor.h" | 14 #include "ui/base/cursor/cursor.h" |
14 #include "ui/base/dragdrop/drag_drop_types.h" | 15 #include "ui/base/dragdrop/drag_drop_types.h" |
15 #include "ui/base/dragdrop/drag_utils.h" | 16 #include "ui/base/dragdrop/drag_utils.h" |
16 #include "ui/base/ime/input_method.h" | 17 #include "ui/base/ime/input_method.h" |
17 #include "ui/base/touch/selection_bound.h" | 18 #include "ui/base/touch/selection_bound.h" |
18 #include "ui/base/ui_base_switches_util.h" | 19 #include "ui/base/ui_base_switches_util.h" |
19 #include "ui/compositor/canvas_painter.h" | 20 #include "ui/compositor/canvas_painter.h" |
20 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 21 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 bool Textfield::CanComposeInline() const { | 1491 bool Textfield::CanComposeInline() const { |
1491 return true; | 1492 return true; |
1492 } | 1493 } |
1493 | 1494 |
1494 gfx::Rect Textfield::GetCaretBounds() const { | 1495 gfx::Rect Textfield::GetCaretBounds() const { |
1495 gfx::Rect rect = GetRenderText()->GetUpdatedCursorBounds(); | 1496 gfx::Rect rect = GetRenderText()->GetUpdatedCursorBounds(); |
1496 ConvertRectToScreen(this, &rect); | 1497 ConvertRectToScreen(this, &rect); |
1497 return rect; | 1498 return rect; |
1498 } | 1499 } |
1499 | 1500 |
1500 bool Textfield::GetCompositionCharacterBounds(uint32 index, | 1501 bool Textfield::GetCompositionCharacterBounds(uint32_t index, |
1501 gfx::Rect* rect) const { | 1502 gfx::Rect* rect) const { |
1502 DCHECK(rect); | 1503 DCHECK(rect); |
1503 if (!HasCompositionText()) | 1504 if (!HasCompositionText()) |
1504 return false; | 1505 return false; |
1505 gfx::Range composition_range; | 1506 gfx::Range composition_range; |
1506 model_->GetCompositionTextRange(&composition_range); | 1507 model_->GetCompositionTextRange(&composition_range); |
1507 DCHECK(!composition_range.is_empty()); | 1508 DCHECK(!composition_range.is_empty()); |
1508 | 1509 |
1509 size_t text_index = composition_range.start() + index; | 1510 size_t text_index = composition_range.start() + index; |
1510 if (composition_range.end() <= text_index) | 1511 if (composition_range.end() <= text_index) |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 RequestFocus(); | 1893 RequestFocus(); |
1893 model_->MoveCursorTo(mouse); | 1894 model_->MoveCursorTo(mouse); |
1894 if (!selection_clipboard_text.empty()) { | 1895 if (!selection_clipboard_text.empty()) { |
1895 model_->InsertText(selection_clipboard_text); | 1896 model_->InsertText(selection_clipboard_text); |
1896 UpdateAfterChange(true, true); | 1897 UpdateAfterChange(true, true); |
1897 } | 1898 } |
1898 OnAfterUserAction(); | 1899 OnAfterUserAction(); |
1899 } | 1900 } |
1900 | 1901 |
1901 } // namespace views | 1902 } // namespace views |
OLD | NEW |