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

Side by Side Diff: Source/platform/PlatformKeyboardEvent.cpp

Issue 1177043016: [SP] Add a drawing recorder before painting caps lock indicator in password fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Need to rebaseline new tests under virtual/antialiasedtext as well. Created 5 years, 6 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
« no previous file with comments | « Source/platform/PlatformKeyboardEvent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Google Inc. 3 * Copyright (C) 2008, 2009 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 23 matching lines...) Expand all
34 #else 34 #else
35 #include "platform/NotImplemented.h" 35 #include "platform/NotImplemented.h"
36 #endif 36 #endif
37 37
38 namespace blink { 38 namespace blink {
39 39
40 #if OS(WIN) 40 #if OS(WIN)
41 static const unsigned short HIGHBITMASKSHORT = 0x8000; 41 static const unsigned short HIGHBITMASKSHORT = 0x8000;
42 #endif 42 #endif
43 43
44 PlatformKeyboardEvent::OverrideCapsLockState PlatformKeyboardEvent::s_overrideCa psLockState =
45 PlatformKeyboardEvent::OverrideCapsLockState::Default;
46
44 void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type) 47 void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type)
45 { 48 {
46 #if OS(WIN) 49 #if OS(WIN)
47 // No KeyDown events on Windows to disambiguate. 50 // No KeyDown events on Windows to disambiguate.
48 ASSERT_NOT_REACHED(); 51 ASSERT_NOT_REACHED();
49 #else 52 #else
50 // Can only change type from KeyDown to RawKeyDown or Char, as we lack infor mation for other conversions. 53 // Can only change type from KeyDown to RawKeyDown or Char, as we lack infor mation for other conversions.
51 ASSERT(m_type == PlatformEvent::KeyDown); 54 ASSERT(m_type == PlatformEvent::KeyDown);
52 ASSERT(type == PlatformEvent::RawKeyDown || type == PlatformEvent::Char); 55 ASSERT(type == PlatformEvent::RawKeyDown || type == PlatformEvent::Char);
53 m_type = type; 56 m_type = type;
(...skipping 12 matching lines...) Expand all
66 m_text = String(); 69 m_text = String();
67 m_unmodifiedText = String(); 70 m_unmodifiedText = String();
68 } 71 }
69 #endif 72 #endif
70 } 73 }
71 #endif 74 #endif
72 } 75 }
73 76
74 bool PlatformKeyboardEvent::currentCapsLockState() 77 bool PlatformKeyboardEvent::currentCapsLockState()
75 { 78 {
79 switch (s_overrideCapsLockState) {
80 case OverrideCapsLockState::Default:
76 #if OS(WIN) 81 #if OS(WIN)
77 // FIXME: Does this even work inside the sandbox? 82 // FIXME: Does this even work inside the sandbox?
78 return GetKeyState(VK_CAPITAL) & 1; 83 return GetKeyState(VK_CAPITAL) & 1;
79 #elif OS(MACOSX) 84 #elif OS(MACOSX)
80 return GetCurrentKeyModifiers() & alphaLock; 85 return GetCurrentKeyModifiers() & alphaLock;
81 #else 86 #else
82 notImplemented(); 87 notImplemented();
83 return false; 88 return false;
84 #endif 89 #endif
90 case OverrideCapsLockState::On:
91 return true;
92 case OverrideCapsLockState::Off:
93 default:
94 return false;
95 }
85 } 96 }
86 97
87 void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKe y, bool& altKey, bool& metaKey) 98 void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKe y, bool& altKey, bool& metaKey)
88 { 99 {
89 #if OS(WIN) 100 #if OS(WIN)
90 shiftKey = GetKeyState(VK_SHIFT) & HIGHBITMASKSHORT; 101 shiftKey = GetKeyState(VK_SHIFT) & HIGHBITMASKSHORT;
91 ctrlKey = GetKeyState(VK_CONTROL) & HIGHBITMASKSHORT; 102 ctrlKey = GetKeyState(VK_CONTROL) & HIGHBITMASKSHORT;
92 altKey = GetKeyState(VK_MENU) & HIGHBITMASKSHORT; 103 altKey = GetKeyState(VK_MENU) & HIGHBITMASKSHORT;
93 metaKey = false; 104 metaKey = false;
94 #elif OS(MACOSX) 105 #elif OS(MACOSX)
95 UInt32 currentModifiers = GetCurrentKeyModifiers(); 106 UInt32 currentModifiers = GetCurrentKeyModifiers();
96 shiftKey = currentModifiers & ::shiftKey; 107 shiftKey = currentModifiers & ::shiftKey;
97 ctrlKey = currentModifiers & ::controlKey; 108 ctrlKey = currentModifiers & ::controlKey;
98 altKey = currentModifiers & ::optionKey; 109 altKey = currentModifiers & ::optionKey;
99 metaKey = currentModifiers & ::cmdKey; 110 metaKey = currentModifiers & ::cmdKey;
100 #else 111 #else
101 shiftKey = false; 112 shiftKey = false;
102 ctrlKey = false; 113 ctrlKey = false;
103 altKey = false; 114 altKey = false;
104 metaKey = false; 115 metaKey = false;
105 notImplemented(); 116 notImplemented();
106 #endif 117 #endif
107 } 118 }
108 119
109 } // namespace blink 120 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/PlatformKeyboardEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698