Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: ui/events/keycodes/keyboard_code_conversion.cc

Issue 1559163002: Clean up event flags a bit: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "ui/events/keycodes/keyboard_code_conversion.h" 5 #include "ui/events/keycodes/keyboard_code_conversion.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 bool DomCodeToUsLayoutDomKey(DomCode dom_code, 36 bool DomCodeToUsLayoutDomKey(DomCode dom_code,
37 int flags, 37 int flags,
38 DomKey* out_dom_key, 38 DomKey* out_dom_key,
39 KeyboardCode* out_key_code) { 39 KeyboardCode* out_key_code) {
40 for (const auto& it : kPrintableCodeMap) { 40 for (const auto& it : kPrintableCodeMap) {
41 if (it.dom_code == dom_code) { 41 if (it.dom_code == dom_code) {
42 int state = ((flags & EF_SHIFT_DOWN) == EF_SHIFT_DOWN); 42 int state = ((flags & EF_SHIFT_DOWN) == EF_SHIFT_DOWN);
43 base::char16 ch = it.character[state]; 43 base::char16 ch = it.character[state];
44 if ((flags & EF_CAPS_LOCK_DOWN) == EF_CAPS_LOCK_DOWN) { 44 if ((flags & EF_CAPS_LOCK_ON) == EF_CAPS_LOCK_ON) {
45 ch |= 0x20; 45 ch |= 0x20;
46 if ((ch >= 'a') && (ch <= 'z')) 46 if ((ch >= 'a') && (ch <= 'z'))
47 ch = it.character[state ^ 1]; 47 ch = it.character[state ^ 1];
48 } 48 }
49 *out_dom_key = DomKey::FromCharacter(ch); 49 *out_dom_key = DomKey::FromCharacter(ch);
50 *out_key_code = DomCodeToUsLayoutNonLocatedKeyboardCode(dom_code); 50 *out_key_code = DomCodeToUsLayoutNonLocatedKeyboardCode(dom_code);
51 return true; 51 return true;
52 } 52 }
53 } 53 }
54 for (const auto& it : kNonPrintableCodeMap) { 54 for (const auto& it : kNonPrintableCodeMap) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 return VKEY_UNKNOWN; 259 return VKEY_UNKNOWN;
260 } 260 }
261 261
262 KeyboardCode DomCodeToUsLayoutNonLocatedKeyboardCode(DomCode dom_code) { 262 KeyboardCode DomCodeToUsLayoutNonLocatedKeyboardCode(DomCode dom_code) {
263 return LocatedToNonLocatedKeyboardCode( 263 return LocatedToNonLocatedKeyboardCode(
264 DomCodeToUsLayoutKeyboardCode(dom_code)); 264 DomCodeToUsLayoutKeyboardCode(dom_code));
265 } 265 }
266 266
267 } // namespace ui 267 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698