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

Unified Diff: webkit/api/src/mac/WebInputEventFactory.mm

Issue 347022: [mac] Mark keys with cmd pressed as isSystemKeys. (Closed)
Patch Set: rebase tot Created 11 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/api/src/mac/WebInputEventFactory.mm
diff --git a/webkit/api/src/mac/WebInputEventFactory.mm b/webkit/api/src/mac/WebInputEventFactory.mm
index 74a7a8713a9c89b4a654b2539cc020ecea375260..5f29c50f7c5627f9c789527e4d18d38f0296da1f 100644
--- a/webkit/api/src/mac/WebInputEventFactory.mm
+++ b/webkit/api/src/mac/WebInputEventFactory.mm
@@ -919,6 +919,14 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(NSEvent* event)
result.timeStampSeconds = [event timestamp];
+ // Windows and Linux set that if alt is down. WebKit looks at this to decide
+ // if it should handle a key or not. E.g. alt-left/right shouldn't be used
+ // by webkit to scroll the current page, because we want to get that key
+ // back for it to do history navigation. Hence, the corresponding situation
+ // on OS X is to set this for cmd key presses.
+ if (result.modifiers & WebInputEvent::MetaKey)
+ result.isSystemKey = true;
+
return result;
}
@@ -938,6 +946,15 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(wchar_t character,
result.nativeKeyCode = character;
result.text[0] = character;
result.unmodifiedText[0] = character;
+
+ // Windows and Linux set that if alt is down. WebKit looks at this to decide
+ // if it should handle a key or not. E.g. alt-left/right shouldn't be used
+ // by webkit to scroll the current page, because we want to get that key
+ // back for it to do history navigation. Hence, the corresponding situation
+ // on OS X is to set this for cmd key presses.
+ if (result.modifiers & WebInputEvent::MetaKey)
+ result.isSystemKey = true;
+
return result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698