| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void NativeTextfieldViews::OnFocus() { | 249 void NativeTextfieldViews::OnFocus() { |
| 250 NOTREACHED(); | 250 NOTREACHED(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 void NativeTextfieldViews::OnBlur() { | 253 void NativeTextfieldViews::OnBlur() { |
| 254 NOTREACHED(); | 254 NOTREACHED(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void NativeTextfieldViews::SelectRect(const gfx::Point& start, | 257 void NativeTextfieldViews::SelectRect(const gfx::Point& start, |
| 258 const gfx::Point& end) { | 258 const gfx::Point& end) { |
| 259 if (GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE) | 259 if (GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) |
| 260 return; | 260 return; |
| 261 | 261 |
| 262 gfx::SelectionModel start_pos = GetRenderText()->FindCursorPosition(start); | 262 gfx::SelectionModel start_pos = GetRenderText()->FindCursorPosition(start); |
| 263 gfx::SelectionModel end_pos = GetRenderText()->FindCursorPosition(end); | 263 gfx::SelectionModel end_pos = GetRenderText()->FindCursorPosition(end); |
| 264 | 264 |
| 265 OnBeforeUserAction(); | 265 OnBeforeUserAction(); |
| 266 // Merge selection models of "start_pos" and "end_pos" so that | 266 // Merge selection models of "start_pos" and "end_pos" so that |
| 267 // selection start is the value from "start_pos", while selection end, | 267 // selection start is the value from "start_pos", while selection end, |
| 268 // caret position, and caret placement are values from "end_pos". | 268 // caret position, and caret placement are values from "end_pos". |
| 269 gfx::SelectionModel sel(end_pos); | 269 gfx::SelectionModel sel(end_pos); |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 // Filter out all control characters, including tab and new line characters, | 1031 // Filter out all control characters, including tab and new line characters, |
| 1032 // and all characters with Alt modifier. But we need to allow characters with | 1032 // and all characters with Alt modifier. But we need to allow characters with |
| 1033 // AltGr modifier. | 1033 // AltGr modifier. |
| 1034 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different | 1034 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different |
| 1035 // flag that we don't care about. | 1035 // flag that we don't care about. |
| 1036 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && | 1036 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && |
| 1037 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; | 1037 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 } // namespace views | 1040 } // namespace views |
| OLD | NEW |