| 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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 gfx::Range range = GetRenderText()->selection(); | 1433 gfx::Range range = GetRenderText()->selection(); |
| 1434 DCHECK_GE(range.start(), before); | 1434 DCHECK_GE(range.start(), before); |
| 1435 | 1435 |
| 1436 range.set_start(range.start() - before); | 1436 range.set_start(range.start() - before); |
| 1437 range.set_end(range.end() + after); | 1437 range.set_end(range.end() + after); |
| 1438 gfx::Range text_range; | 1438 gfx::Range text_range; |
| 1439 if (GetTextRange(&text_range) && text_range.Contains(range)) | 1439 if (GetTextRange(&text_range) && text_range.Contains(range)) |
| 1440 DeleteRange(range); | 1440 DeleteRange(range); |
| 1441 } | 1441 } |
| 1442 | 1442 |
| 1443 void Textfield::EnsureCaretInRect(const gfx::Rect& rect) {} | 1443 void Textfield::EnsureCaretNotInRect(const gfx::Rect& rect) {} |
| 1444 | 1444 |
| 1445 bool Textfield::IsTextEditCommandEnabled(ui::TextEditCommand command) const { | 1445 bool Textfield::IsTextEditCommandEnabled(ui::TextEditCommand command) const { |
| 1446 base::string16 result; | 1446 base::string16 result; |
| 1447 bool editable = !read_only(); | 1447 bool editable = !read_only(); |
| 1448 bool readable = text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD; | 1448 bool readable = text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD; |
| 1449 switch (command) { | 1449 switch (command) { |
| 1450 case ui::TextEditCommand::DELETE_BACKWARD: | 1450 case ui::TextEditCommand::DELETE_BACKWARD: |
| 1451 case ui::TextEditCommand::DELETE_FORWARD: | 1451 case ui::TextEditCommand::DELETE_FORWARD: |
| 1452 case ui::TextEditCommand::DELETE_TO_BEGINNING_OF_LINE: | 1452 case ui::TextEditCommand::DELETE_TO_BEGINNING_OF_LINE: |
| 1453 case ui::TextEditCommand::DELETE_TO_BEGINNING_OF_PARAGRAPH: | 1453 case ui::TextEditCommand::DELETE_TO_BEGINNING_OF_PARAGRAPH: |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 void Textfield::OnCursorBlinkTimerFired() { | 2055 void Textfield::OnCursorBlinkTimerFired() { |
| 2056 DCHECK(ShouldBlinkCursor()); | 2056 DCHECK(ShouldBlinkCursor()); |
| 2057 gfx::RenderText* render_text = GetRenderText(); | 2057 gfx::RenderText* render_text = GetRenderText(); |
| 2058 render_text->set_cursor_visible(!render_text->cursor_visible()); | 2058 render_text->set_cursor_visible(!render_text->cursor_visible()); |
| 2059 RepaintCursor(); | 2059 RepaintCursor(); |
| 2060 } | 2060 } |
| 2061 | 2061 |
| 2062 } // namespace views | 2062 } // namespace views |
| OLD | NEW |