Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/native_textfield_views.h" | 5 #include "ui/views/controls/textfield/native_textfield_views.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <set> | 8 #include <set> | 
| 9 | 9 | 
| 10 #include "base/bind.h" | 10 #include "base/bind.h" | 
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1172 break; | 1172 break; | 
| 1173 case ui::VKEY_C: | 1173 case ui::VKEY_C: | 
| 1174 if (control && readable) | 1174 if (control && readable) | 
| 1175 Copy(); | 1175 Copy(); | 
| 1176 break; | 1176 break; | 
| 1177 case ui::VKEY_V: | 1177 case ui::VKEY_V: | 
| 1178 if (control && editable) | 1178 if (control && editable) | 
| 1179 cursor_changed = text_changed = Paste(); | 1179 cursor_changed = text_changed = Paste(); | 
| 1180 break; | 1180 break; | 
| 1181 case ui::VKEY_RIGHT: | 1181 case ui::VKEY_RIGHT: | 
| 1182 case ui::VKEY_LEFT: | 1182 case ui::VKEY_LEFT: { | 
| 1183 // We should ignore the alt-left/right keys because alt key doesn't make | 1183 // We should ignore the alt-left/right keys because alt key doesn't make | 
| 1184 // any special effects for them and they can be shortcut keys such like | 1184 // any special effects for them and they can be shortcut keys such like | 
| 1185 // forward/back of the browser history. | 1185 // forward/back of the browser history. | 
| 1186 if (key_event.IsAltDown()) | 1186 if (key_event.IsAltDown()) | 
| 1187 break; | 1187 break; | 
| 1188 size_t cursor_position = model_->GetCursorPosition(); | |
| 1188 model_->MoveCursor( | 1189 model_->MoveCursor( | 
| 1189 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, | 1190 control ? gfx::WORD_BREAK : gfx::CHARACTER_BREAK, | 
| 1190 (key_code == ui::VKEY_RIGHT) ? gfx::CURSOR_RIGHT : gfx::CURSOR_LEFT, | 1191 (key_code == ui::VKEY_RIGHT) ? gfx::CURSOR_RIGHT : gfx::CURSOR_LEFT, | 
| 1191 shift); | 1192 shift); | 
| 1192 cursor_changed = true; | 1193 cursor_changed = model_->GetCursorPosition() != cursor_position; | 
| 
 
msw
2013/07/25 00:32:53
This is wrong and caused a regression, see http://
 
 | |
| 1193 break; | 1194 break; | 
| 1195 } | |
| 1194 case ui::VKEY_END: | 1196 case ui::VKEY_END: | 
| 1195 case ui::VKEY_HOME: | 1197 case ui::VKEY_HOME: | 
| 1196 if ((key_code == ui::VKEY_HOME) == | 1198 if ((key_code == ui::VKEY_HOME) == | 
| 1197 (GetRenderText()->GetTextDirection() == base::i18n::RIGHT_TO_LEFT)) | 1199 (GetRenderText()->GetTextDirection() == base::i18n::RIGHT_TO_LEFT)) | 
| 1198 model_->MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, shift); | 1200 model_->MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_RIGHT, shift); | 
| 1199 else | 1201 else | 
| 1200 model_->MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_LEFT, shift); | 1202 model_->MoveCursor(gfx::LINE_BREAK, gfx::CURSOR_LEFT, shift); | 
| 1201 cursor_changed = true; | 1203 cursor_changed = true; | 
| 1202 break; | 1204 break; | 
| 1203 case ui::VKEY_BACK: | 1205 case ui::VKEY_BACK: | 
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1450 | 1452 | 
| 1451 void NativeTextfieldViews::PlatformGestureEventHandling( | 1453 void NativeTextfieldViews::PlatformGestureEventHandling( | 
| 1452 const ui::GestureEvent* event) { | 1454 const ui::GestureEvent* event) { | 
| 1453 #if defined(OS_WIN) && defined(USE_AURA) | 1455 #if defined(OS_WIN) && defined(USE_AURA) | 
| 1454 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) | 1456 if (event->type() == ui::ET_GESTURE_TAP_DOWN && !textfield_->read_only()) | 
| 1455 base::win::DisplayVirtualKeyboard(); | 1457 base::win::DisplayVirtualKeyboard(); | 
| 1456 #endif | 1458 #endif | 
| 1457 } | 1459 } | 
| 1458 | 1460 | 
| 1459 } // namespace views | 1461 } // namespace views | 
| OLD | NEW |