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/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" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/i18n/case_conversion.h" | 12 #include "base/i18n/case_conversion.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "grit/app_locale_settings.h" | 16 #include "grit/app_locale_settings.h" |
17 #include "grit/ui_strings.h" | 17 #include "grit/ui_strings.h" |
| 18 #include "third_party/icu/public/common/unicode/uchar.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
19 #include "ui/base/clipboard/clipboard.h" | 20 #include "ui/base/clipboard/clipboard.h" |
20 #include "ui/base/dragdrop/drag_drop_types.h" | 21 #include "ui/base/dragdrop/drag_drop_types.h" |
21 #include "ui/base/events/event.h" | 22 #include "ui/base/events/event.h" |
22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/range/range.h" | 24 #include "ui/base/range/range.h" |
24 #include "ui/compositor/layer.h" | 25 #include "ui/compositor/layer.h" |
25 #include "ui/gfx/canvas.h" | 26 #include "ui/gfx/canvas.h" |
26 #include "ui/gfx/insets.h" | 27 #include "ui/gfx/insets.h" |
27 #include "ui/gfx/render_text.h" | 28 #include "ui/gfx/render_text.h" |
28 #include "ui/gfx/text_constants.h" | 29 #include "ui/gfx/text_constants.h" |
29 #include "ui/native_theme/native_theme.h" | 30 #include "ui/native_theme/native_theme.h" |
30 #include "ui/views/background.h" | 31 #include "ui/views/background.h" |
31 #include "ui/views/border.h" | 32 #include "ui/views/border.h" |
32 #include "ui/views/controls/focusable_border.h" | 33 #include "ui/views/controls/focusable_border.h" |
33 #include "ui/views/controls/menu/menu_item_view.h" | 34 #include "ui/views/controls/menu/menu_item_view.h" |
34 #include "ui/views/controls/menu/menu_model_adapter.h" | 35 #include "ui/views/controls/menu/menu_model_adapter.h" |
35 #include "ui/views/controls/menu/menu_runner.h" | 36 #include "ui/views/controls/menu/menu_runner.h" |
36 #include "ui/views/controls/textfield/textfield.h" | 37 #include "ui/views/controls/textfield/textfield.h" |
37 #include "ui/views/controls/textfield/textfield_controller.h" | 38 #include "ui/views/controls/textfield/textfield_controller.h" |
38 #include "ui/views/controls/textfield/textfield_views_model.h" | 39 #include "ui/views/controls/textfield/textfield_views_model.h" |
39 #include "ui/views/ime/input_method.h" | 40 #include "ui/views/ime/input_method.h" |
40 #include "ui/views/metrics.h" | 41 #include "ui/views/metrics.h" |
41 #include "ui/views/widget/widget.h" | 42 #include "ui/views/widget/widget.h" |
42 #include "unicode/uchar.h" | |
43 | 43 |
44 #if defined(USE_AURA) | 44 #if defined(USE_AURA) |
45 #include "ui/base/cursor/cursor.h" | 45 #include "ui/base/cursor/cursor.h" |
46 #endif | 46 #endif |
47 | 47 |
48 namespace { | 48 namespace { |
49 | 49 |
50 // Default "system" color for text cursor. | 50 // Default "system" color for text cursor. |
51 const SkColor kDefaultCursorColor = SK_ColorBLACK; | 51 const SkColor kDefaultCursorColor = SK_ColorBLACK; |
52 | 52 |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 // Filter out all control characters, including tab and new line characters, | 1271 // Filter out all control characters, including tab and new line characters, |
1272 // and all characters with Alt modifier. But we need to allow characters with | 1272 // and all characters with Alt modifier. But we need to allow characters with |
1273 // AltGr modifier. | 1273 // AltGr modifier. |
1274 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different | 1274 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different |
1275 // flag that we don't care about. | 1275 // flag that we don't care about. |
1276 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && | 1276 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && |
1277 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; | 1277 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; |
1278 } | 1278 } |
1279 | 1279 |
1280 } // namespace views | 1280 } // namespace views |
OLD | NEW |