diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 60e85a0180a..5017a60eb9f 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -182,7 +182,6 @@ var Browser = { /* handles web progress management for open browsers */ Elements.browsers.webProgress = new Browser.WebProgress(); - this.keyFilter = new KeyFilter(Elements.browsers); let mouseModule = new MouseModule(); let gestureModule = new GestureModule(Elements.browsers); let scrollWheelModule = new ScrollwheelModule(Elements.browsers); @@ -1226,19 +1225,14 @@ var Browser = { break; } - case "Browser:KeyPress": { - let keyset = document.getElementById("mainKeyset"); - keyset.setAttribute("disabled", "false"); - if (json.preventDefault) - break; - + case "Browser:KeyPress": let event = document.createEvent("KeyEvents"); event.initKeyEvent("keypress", true, true, null, json.ctrlKey, json.altKey, json.shiftKey, json.metaKey, json.keyCode, json.charCode); - keyset.dispatchEvent(event); + document.getElementById("mainKeyset").dispatchEvent(event); break; - } + case "Browser:ZoomToPoint:Return": if (json.zoomTo) { let rect = Rect.fromRect(json.zoomTo); @@ -1978,31 +1972,6 @@ const ContentTouchHandler = { } }; - -/** Prevent chrome from consuming key events before remote content has a chance. */ -function KeyFilter(container) { - container.addEventListener("keypress", this, false); - container.addEventListener("keyup", this, false); - container.addEventListener("keydown", this, false); -} - -KeyFilter.prototype = { - handleEvent: function handleEvent(aEvent) { - if (Elements.contentShowing.getAttribute("disabled") == "true") - return; - - let browser = getBrowser(); - if (browser && browser.active && browser.getAttribute("remote") == "true") { - document.getElementById("mainKeyset").setAttribute("disabled", "true"); - } - }, - - toString: function toString() { - return "[KeyFilter] { }"; - } -}; - - /** * Utility class to handle manipulations of the identity indicators in the UI */ diff --git a/mobile/chrome/content/common-ui.js b/mobile/chrome/content/common-ui.js index eb49e0703b7..1b2c15323c7 100644 --- a/mobile/chrome/content/common-ui.js +++ b/mobile/chrome/content/common-ui.js @@ -816,7 +816,6 @@ var FormHelperUI = { if (focusedElement && focusedElement.localName == "browser") return; - Browser.keyFilter.handleEvent(aEvent); break; case "SizeChanged": diff --git a/mobile/chrome/content/content.js b/mobile/chrome/content/content.js index 79ac4cbea57..e72d77e166d 100644 --- a/mobile/chrome/content/content.js +++ b/mobile/chrome/content/content.js @@ -299,14 +299,16 @@ let Content = { // let's send it back to the chrome process to have it handle shortcuts case "keypress": let timer = new Util.Timeout(function() { + if(aEvent.getPreventDefault()) + return; + let eventData = { ctrlKey: aEvent.ctrlKey, altKey: aEvent.altKey, shiftKey: aEvent.shiftKey, metaKey: aEvent.metaKey, keyCode: aEvent.keyCode, - charCode: aEvent.charCode, - preventDefault: aEvent.getPreventDefault() + charCode: aEvent.charCode }; sendAsyncMessage("Browser:KeyPress", eventData); });