Bug 713498 - [b2g] Allow keyCode and charCode to be different in the mozKeyboard interface r=vingtetun

This commit is contained in:
Tim Guan-tin Chien 2011-12-26 15:10:24 +01:00
parent 2ae85fdb11
commit ba150e9b44

View File

@ -312,11 +312,13 @@ function MozKeyboard() {
} }
MozKeyboard.prototype = { MozKeyboard.prototype = {
sendKey: function mozKeyboardSendKey(keyCode) { sendKey: function mozKeyboardSendKey(keyCode, charCode) {
charCode = (charCode == undefined) ? keyCode : charCode;
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor) var utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils); .getInterface(Ci.nsIDOMWindowUtils);
['keydown', 'keypress', 'keyup'].forEach(function sendKeyEvents(type) { ['keydown', 'keypress', 'keyup'].forEach(function sendKeyEvents(type) {
utils.sendKeyEvent(type, keyCode, keyCode, null); utils.sendKeyEvent(type, keyCode, charCode, null);
}); });
} }
}; };