Chromium Code Reviews| 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/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "ui/accessibility/ax_view_state.h" | 10 #include "ui/accessibility/ax_view_state.h" |
| (...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1551 | 1551 |
| 1552 bool Textfield::SetSelectionRange(const gfx::Range& range) { | 1552 bool Textfield::SetSelectionRange(const gfx::Range& range) { |
| 1553 if (!ImeEditingAllowed() || !range.IsValid()) | 1553 if (!ImeEditingAllowed() || !range.IsValid()) |
| 1554 return false; | 1554 return false; |
| 1555 OnBeforeUserAction(); | 1555 OnBeforeUserAction(); |
| 1556 SelectRange(range); | 1556 SelectRange(range); |
| 1557 OnAfterUserAction(); | 1557 OnAfterUserAction(); |
| 1558 return true; | 1558 return true; |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 uint32 Textfield::GetSelectionOffset() const { | |
| 1562 return 0; | |
|
Shu Chen
2015/08/12 07:23:16
Why always return 0?
rsadam
2015/08/12 21:46:52
From my understanding textfield.h is for all nativ
Shu Chen
2015/08/13 01:27:24
Let's not change the existing behavior for now.
Re
| |
| 1563 } | |
| 1564 | |
| 1561 bool Textfield::DeleteRange(const gfx::Range& range) { | 1565 bool Textfield::DeleteRange(const gfx::Range& range) { |
| 1562 if (!ImeEditingAllowed() || range.is_empty()) | 1566 if (!ImeEditingAllowed() || range.is_empty()) |
| 1563 return false; | 1567 return false; |
| 1564 | 1568 |
| 1565 OnBeforeUserAction(); | 1569 OnBeforeUserAction(); |
| 1566 model_->SelectRange(range); | 1570 model_->SelectRange(range); |
| 1567 if (model_->HasSelection()) { | 1571 if (model_->HasSelection()) { |
| 1568 model_->DeleteSelection(); | 1572 model_->DeleteSelection(); |
| 1569 UpdateAfterChange(true, true); | 1573 UpdateAfterChange(true, true); |
| 1570 } | 1574 } |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1892 RequestFocus(); | 1896 RequestFocus(); |
| 1893 model_->MoveCursorTo(mouse); | 1897 model_->MoveCursorTo(mouse); |
| 1894 if (!selection_clipboard_text.empty()) { | 1898 if (!selection_clipboard_text.empty()) { |
| 1895 model_->InsertText(selection_clipboard_text); | 1899 model_->InsertText(selection_clipboard_text); |
| 1896 UpdateAfterChange(true, true); | 1900 UpdateAfterChange(true, true); |
| 1897 } | 1901 } |
| 1898 OnAfterUserAction(); | 1902 OnAfterUserAction(); |
| 1899 } | 1903 } |
| 1900 | 1904 |
| 1901 } // namespace views | 1905 } // namespace views |
| OLD | NEW |