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

Side by Side Diff: Source/core/events/UIEventWithKeyState.cpp

Issue 1350933003: Implement MouseEvent.getModifierState (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add LayoutTests Created 5 years, 3 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 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 17 matching lines...) Expand all
28 void UIEventWithKeyState::didCreateEventInIsolatedWorld(bool ctrlKey, bool shift Key, bool altKey, bool metaKey) 28 void UIEventWithKeyState::didCreateEventInIsolatedWorld(bool ctrlKey, bool shift Key, bool altKey, bool metaKey)
29 { 29 {
30 #if OS(MACOSX) 30 #if OS(MACOSX)
31 const bool newTabModifierSet = metaKey; 31 const bool newTabModifierSet = metaKey;
32 #else 32 #else
33 const bool newTabModifierSet = ctrlKey; 33 const bool newTabModifierSet = ctrlKey;
34 #endif 34 #endif
35 s_newTabModifierSetFromIsolatedWorld |= newTabModifierSet; 35 s_newTabModifierSetFromIsolatedWorld |= newTabModifierSet;
36 } 36 }
37 37
38 bool UIEventWithKeyState::getModifierState(const String& keyIdentifier) const
39 {
40 // FIXME: The following keyIdentifiers are not supported yet (crbug.com/2654 58):
41 // "AltGraph", "CapsLock", "Fn", "NumLock", "ScrollLock", "SymbolLock", "OS" .
42 if (keyIdentifier == "Control")
43 return ctrlKey();
44 if (keyIdentifier == "Shift")
45 return shiftKey();
46 if (keyIdentifier == "Alt")
47 return altKey();
48 if (keyIdentifier == "Meta")
49 return metaKey();
50 return false;
51 }
52
38 UIEventWithKeyState* findEventWithKeyState(Event* event) 53 UIEventWithKeyState* findEventWithKeyState(Event* event)
39 { 54 {
40 for (Event* e = event; e; e = e->underlyingEvent()) 55 for (Event* e = event; e; e = e->underlyingEvent())
41 if (e->isKeyboardEvent() || e->isMouseEvent()) 56 if (e->isKeyboardEvent() || e->isMouseEvent())
42 return static_cast<UIEventWithKeyState*>(e); 57 return static_cast<UIEventWithKeyState*>(e);
43 return nullptr; 58 return nullptr;
44 } 59 }
45 60
46 } // namespace blink 61 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698