| 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/native_textfield_views.h" | 5 #include "views/controls/textfield/native_textfield_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 | 995 |
| 996 // Notify selection controller | 996 // Notify selection controller |
| 997 if (!touch_selection_controller_.get()) | 997 if (!touch_selection_controller_.get()) |
| 998 return; | 998 return; |
| 999 gfx::RenderText* render_text = GetRenderText(); | 999 gfx::RenderText* render_text = GetRenderText(); |
| 1000 const gfx::SelectionModel& sel = render_text->selection_model(); | 1000 const gfx::SelectionModel& sel = render_text->selection_model(); |
| 1001 gfx::SelectionModel start_sel(sel.selection_start(), sel.selection_start(), | 1001 gfx::SelectionModel start_sel(sel.selection_start(), sel.selection_start(), |
| 1002 sel.selection_start(), gfx::SelectionModel::LEADING); | 1002 sel.selection_start(), gfx::SelectionModel::LEADING); |
| 1003 gfx::Rect start_cursor = render_text->GetCursorBounds(start_sel, false); | 1003 gfx::Rect start_cursor = render_text->GetCursorBounds(start_sel, false); |
| 1004 gfx::Rect end_cursor = render_text->GetCursorBounds(sel, false); | 1004 gfx::Rect end_cursor = render_text->GetCursorBounds(sel, false); |
| 1005 gfx::Point start(start_cursor.x(), start_cursor.bottom()); | 1005 gfx::Point start(start_cursor.x(), start_cursor.bottom() - 1); |
| 1006 gfx::Point end(end_cursor.x(), end_cursor.bottom()); | 1006 gfx::Point end(end_cursor.x(), end_cursor.bottom() - 1); |
| 1007 touch_selection_controller_->SelectionChanged(start, end); | 1007 touch_selection_controller_->SelectionChanged(start, end); |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 void NativeTextfieldViews::OnBeforeUserAction() { | 1010 void NativeTextfieldViews::OnBeforeUserAction() { |
| 1011 TextfieldController* controller = textfield_->GetController(); | 1011 TextfieldController* controller = textfield_->GetController(); |
| 1012 if (controller) | 1012 if (controller) |
| 1013 controller->OnBeforeUserAction(textfield_); | 1013 controller->OnBeforeUserAction(textfield_); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void NativeTextfieldViews::OnAfterUserAction() { | 1016 void NativeTextfieldViews::OnAfterUserAction() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1037 // Filter out all control characters, including tab and new line characters, | 1037 // Filter out all control characters, including tab and new line characters, |
| 1038 // and all characters with Alt modifier. But we need to allow characters with | 1038 // and all characters with Alt modifier. But we need to allow characters with |
| 1039 // AltGr modifier. | 1039 // AltGr modifier. |
| 1040 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different | 1040 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different |
| 1041 // flag that we don't care about. | 1041 // flag that we don't care about. |
| 1042 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && | 1042 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && |
| 1043 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; | 1043 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 } // namespace views | 1046 } // namespace views |
| OLD | NEW |