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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/events/UIEventWithKeyState.cpp
diff --git a/Source/core/events/UIEventWithKeyState.cpp b/Source/core/events/UIEventWithKeyState.cpp
index 4e4efcef26e65737150d4ec4c9b803bb4b3ebfa5..3cf5f1ceb41768841c20da20e87aa44247a0b068 100644
--- a/Source/core/events/UIEventWithKeyState.cpp
+++ b/Source/core/events/UIEventWithKeyState.cpp
@@ -35,6 +35,21 @@ void UIEventWithKeyState::didCreateEventInIsolatedWorld(bool ctrlKey, bool shift
s_newTabModifierSetFromIsolatedWorld |= newTabModifierSet;
}
+bool UIEventWithKeyState::getModifierState(const String& keyIdentifier) const
+{
+ // FIXME: The following keyIdentifiers are not supported yet (crbug.com/265458):
+ // "AltGraph", "CapsLock", "Fn", "NumLock", "ScrollLock", "SymbolLock", "OS".
+ if (keyIdentifier == "Control")
+ return ctrlKey();
+ if (keyIdentifier == "Shift")
+ return shiftKey();
+ if (keyIdentifier == "Alt")
+ return altKey();
+ if (keyIdentifier == "Meta")
+ return metaKey();
+ return false;
+}
+
UIEventWithKeyState* findEventWithKeyState(Event* event)
{
for (Event* e = event; e; e = e->underlyingEvent())

Powered by Google App Engine
This is Rietveld 408576698