Bug 682017 - Remove CustomKeySender and use content KeyEvents forwarding; r=mfinkle
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -177,17 +177,16 @@ var Browser = {
// XXX change
/* handles dispatching clicks on browser into clicks in content or zooms */
Elements.browsers.customDragger = new Browser.MainDragger();
/* handles web progress management for open browsers */
Elements.browsers.webProgress = new Browser.WebProgress();
- this.keySender = new ContentCustomKeySender(Elements.browsers);
let mouseModule = new MouseModule();
let gestureModule = new GestureModule(Elements.browsers);
let scrollWheelModule = new ScrollwheelModule(Elements.browsers);
ContentTouchHandler.init();
// Warning, total hack ahead. All of the real-browser related scrolling code
// lies in a pretend scrollbox here. Let's not land this as-is. Maybe it's time
@@ -1972,62 +1971,16 @@ const ContentTouchHandler = {
this._dispatchMouseEvent("Browser:MouseLong", aX, aY);
},
toString: function toString() {
return "[ContentTouchHandler] { }";
}
};
-
-/** Watches for mouse events in chrome and sends them to content. */
-function ContentCustomKeySender(container) {
- container.addEventListener("keypress", this, false);
- container.addEventListener("keyup", this, false);
- container.addEventListener("keydown", this, false);
-}
-
-ContentCustomKeySender.prototype = {
- handleEvent: function handleEvent(aEvent) {
- if (Elements.contentShowing.getAttribute("disabled") == "true")
- return;
-
- let browser = getBrowser();
- if (browser && browser.active && browser.getAttribute("remote") == "true") {
- aEvent.stopPropagation();
- aEvent.preventDefault();
-
- let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
- fl.sendCrossProcessKeyEvent(aEvent.type,
- aEvent.keyCode,
- (aEvent.type != "keydown") ? aEvent.charCode : null,
- this._parseModifiers(aEvent));
- }
- },
-
- _parseModifiers: function _parseModifiers(aEvent) {
- const masks = Ci.nsIDOMNSEvent;
- let mval = 0;
- if (aEvent.shiftKey)
- mval |= masks.SHIFT_MASK;
- if (aEvent.ctrlKey)
- mval |= masks.CONTROL_MASK;
- if (aEvent.altKey)
- mval |= masks.ALT_MASK;
- if (aEvent.metaKey)
- mval |= masks.META_MASK;
- return mval;
- },
-
- toString: function toString() {
- return "[ContentCustomKeySender] { }";
- }
-};
-
-
/**
* Utility class to handle manipulations of the identity indicators in the UI
*/
function IdentityHandler() {
this._staticStrings = {};
this._staticStrings[this.IDENTITY_MODE_DOMAIN_VERIFIED] = {
encryption_label: Strings.browser.GetStringFromName("identity.encrypted2")
};
@@ -2916,17 +2869,16 @@ Tab.prototype = {
notification.appendChild(browser);
Elements.browsers.insertBefore(notification, aInsertBefore);
// stop about:blank from loading
browser.stop();
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
fl.renderMode = Ci.nsIFrameLoader.RENDER_MODE_ASYNC_SCROLL;
- fl.eventMode = Ci.nsIFrameLoader.EVENT_MODE_DONT_FORWARD_TO_CHILD;
return browser;
},
_destroyBrowser: function _destroyBrowser() {
if (this._browser) {
let notification = this._notification;
let browser = this._browser;
--- a/mobile/chrome/content/common-ui.js
+++ b/mobile/chrome/content/common-ui.js
@@ -805,17 +805,16 @@ var FormHelperUI = {
}
// If the focus is not on the browser element, the key will not be sent
// to the content so do it ourself
let focusedElement = gFocusManager.getFocusedElementForWindow(window, true, {});
if (focusedElement && focusedElement.localName == "browser")
return;
- Browser.keySender.handleEvent(aEvent);
break;
case "SizeChanged":
setTimeout(function(self) {
SelectHelperUI.sizeToContent();
self._zoom(self._currentElementRect, self._currentCaretRect);
}, 0, this);
break;