diff --git a/dom/base/TextInputProcessor.cpp b/dom/base/TextInputProcessor.cpp index b24a7bd127d3..7df54a2327cb 100644 --- a/dom/base/TextInputProcessor.cpp +++ b/dom/base/TextInputProcessor.cpp @@ -4,7 +4,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "gfxPrefs.h" #include "mozilla/EventForwards.h" #include "mozilla/TextEventDispatcher.h" #include "mozilla/TextEvents.h" @@ -285,11 +284,8 @@ TextInputProcessor::MaybeDispatchKeydownForComposition( return result; } - uint32_t consumedFlags = 0; - result.mResult = KeydownInternal(*aKeyboardEvent, aKeyFlags, false, - consumedFlags); - result.mDoDefault = !consumedFlags; + result.mDoDefault); if (NS_WARN_IF(NS_FAILED(result.mResult))) { result.mCanContinue = false; return result; @@ -758,9 +754,9 @@ NS_IMETHODIMP TextInputProcessor::Keydown(nsIDOMKeyEvent* aDOMKeyEvent, uint32_t aKeyFlags, uint8_t aOptionalArgc, - uint32_t* aConsumedFlags) + bool* aDoDefault) { - MOZ_RELEASE_ASSERT(aConsumedFlags, "aConsumedFlags must not be nullptr"); + MOZ_RELEASE_ASSERT(aDoDefault, "aDoDefault must not be nullptr"); MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome()); if (!aOptionalArgc) { aKeyFlags = 0; @@ -773,33 +769,16 @@ TextInputProcessor::Keydown(nsIDOMKeyEvent* aDOMKeyEvent, if (NS_WARN_IF(!originalKeyEvent)) { return NS_ERROR_INVALID_ARG; } - return KeydownInternal(*originalKeyEvent, aKeyFlags, true, *aConsumedFlags); -} - -TextEventDispatcher::DispatchTo -TextInputProcessor::GetDispatchTo() const -{ - // Support asynchronous tests. - if (mForTests) { - return gfxPrefs::TestEventsAsyncEnabled() ? - TextEventDispatcher::eDispatchToParentProcess : - TextEventDispatcher::eDispatchToCurrentProcess; - } - - // Otherwise, TextInputProcessor supports only keyboard apps on B2G. - // Keyboard apps on B2G doesn't want to dispatch keyboard events to - // chrome process. Therefore, this should dispatch key events only in - // the current process. - return TextEventDispatcher::eDispatchToCurrentProcess; + return KeydownInternal(*originalKeyEvent, aKeyFlags, true, *aDoDefault); } nsresult TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent, uint32_t aKeyFlags, bool aAllowToDispatchKeypress, - uint32_t& aConsumedFlags) + bool& aDoDefault) { - aConsumedFlags = KEYEVENT_NOT_CONSUMED; + aDoDefault = false; // We shouldn't modify the internal WidgetKeyboardEvent. WidgetKeyboardEvent keyEvent(aKeyboardEvent); @@ -808,8 +787,7 @@ TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent, return rv; } - aConsumedFlags = (aKeyFlags & KEY_DEFAULT_PREVENTED) ? KEYDOWN_IS_CONSUMED : - KEYEVENT_NOT_CONSUMED; + aDoDefault = !(aKeyFlags & KEY_DEFAULT_PREVENTED); if (WidgetKeyboardEvent::GetModifierForKeyName(keyEvent.mKeyNameIndex)) { ModifierKeyData modifierKeyData(keyEvent); @@ -836,27 +814,19 @@ TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent, return rv; } - nsEventStatus status = aConsumedFlags ? nsEventStatus_eConsumeNoDefault : - nsEventStatus_eIgnore; - if (!mDispatcher->DispatchKeyboardEvent(NS_KEY_DOWN, keyEvent, status, - GetDispatchTo())) { + nsEventStatus status = aDoDefault ? nsEventStatus_eIgnore : + nsEventStatus_eConsumeNoDefault; + if (!mDispatcher->DispatchKeyboardEvent(NS_KEY_DOWN, keyEvent, status)) { // If keydown event isn't dispatched, we don't need to dispatch keypress // events. return NS_OK; } - aConsumedFlags |= - (status == nsEventStatus_eConsumeNoDefault) ? KEYDOWN_IS_CONSUMED : - KEYEVENT_NOT_CONSUMED; - - if (aAllowToDispatchKeypress && - mDispatcher->MaybeDispatchKeypressEvents(keyEvent, status, - GetDispatchTo())) { - aConsumedFlags |= - (status == nsEventStatus_eConsumeNoDefault) ? KEYPRESS_IS_CONSUMED : - KEYEVENT_NOT_CONSUMED; + if (aAllowToDispatchKeypress) { + mDispatcher->MaybeDispatchKeypressEvents(keyEvent, status); } + aDoDefault = (status != nsEventStatus_eConsumeNoDefault); return NS_OK; } @@ -920,8 +890,7 @@ TextInputProcessor::KeyupInternal(const WidgetKeyboardEvent& aKeyboardEvent, nsEventStatus status = aDoDefault ? nsEventStatus_eIgnore : nsEventStatus_eConsumeNoDefault; - mDispatcher->DispatchKeyboardEvent(NS_KEY_UP, keyEvent, status, - GetDispatchTo()); + mDispatcher->DispatchKeyboardEvent(NS_KEY_UP, keyEvent, status); aDoDefault = (status != nsEventStatus_eConsumeNoDefault); return NS_OK; } diff --git a/dom/base/TextInputProcessor.h b/dom/base/TextInputProcessor.h index 811598c23482..14b7a2fb5db0 100644 --- a/dom/base/TextInputProcessor.h +++ b/dom/base/TextInputProcessor.h @@ -9,7 +9,6 @@ #include "mozilla/Attributes.h" #include "mozilla/EventForwards.h" -#include "mozilla/TextEventDispatcher.h" #include "mozilla/TextEventDispatcherListener.h" #include "nsAutoPtr.h" #include "nsITextInputProcessor.h" @@ -18,6 +17,10 @@ namespace mozilla { +namespace widget{ +class TextEventDispatcher; +} // namespace widget + class TextInputProcessor final : public nsITextInputProcessor , public widget::TextEventDispatcherListener { @@ -57,11 +60,10 @@ private: nsresult KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent, uint32_t aKeyFlags, bool aAllowToDispatchKeypress, - uint32_t& aConsumedFlags); + bool& aDoDefault); nsresult KeyupInternal(const WidgetKeyboardEvent& aKeyboardEvent, uint32_t aKeyFlags, bool& aDoDefault); - TextEventDispatcher::DispatchTo GetDispatchTo() const; nsresult IsValidStateForComposition(); void UnlinkFromTextEventDispatcher(); nsresult PrepareKeyboardEventToDispatch(WidgetKeyboardEvent& aKeyboardEvent, diff --git a/dom/base/test/chrome/window_nsITextInputProcessor.xul b/dom/base/test/chrome/window_nsITextInputProcessor.xul index fcd7c147aa3d..38efcfa11883 100644 --- a/dom/base/test/chrome/window_nsITextInputProcessor.xul +++ b/dom/base/test/chrome/window_nsITextInputProcessor.xul @@ -15,7 +15,7 @@ src="data:text/html,<textarea id='textarea' cols='20' rows='4'></textarea>">

 
@@ -2340,8 +2340,8 @@ function runKeyTests() reset(); var doDefaultKeydown = TIP.keydown(keyA); - is(doDefaultKeydown, TIP.KEYPRESS_IS_CONSUMED, - description + "TIP.keydown(keyA) should return 0x02 because the keypress event should be consumed by the input element"); + ok(!doDefaultKeydown, + description + "TIP.keydown(keyA) should return false because the keypress event should be consumed by the input element"); is(events.length, 2, description + "TIP.keydown(keyA) should cause keydown and keypress event"); checkKeyAttrs("TIP.keydown(keyA)", events[0], @@ -2371,8 +2371,8 @@ function runKeyTests() reset(); doDefaultKeydown = TIP.keydown(keyEnter); - is(doDefaultKeydown, 0, - description + "TIP.keydown(keyEnter) should return 0"); + ok(doDefaultKeydown, + description + "TIP.keydown(keyEnter) should return true"); is(events.length, 2, description + "TIP.keydown(keyEnter) should cause keydown and keypress event"); checkKeyAttrs("TIP.keydown(keyEnter)", events[0], @@ -2402,8 +2402,8 @@ function runKeyTests() doDefaultKeydown = TIP.keydown(keyB, TIP.KEY_DEFAULT_PREVENTED); doDefaultKeyup = TIP.keyup(keyB, TIP.KEY_DEFAULT_PREVENTED); - is(doDefaultKeydown, TIP.KEYDOWN_IS_CONSUMED, - description + "TIP.keydown(keyB, TIP.KEY_DEFAULT_PREVENTED) should return 0x01 because it's marked as consumed at dispatching the event"); + ok(!doDefaultKeydown, + description + "TIP.keydown(keyB, TIP.KEY_DEFAULT_PREVENTED) should return false because it's marked as consumed at dispatching the event"); ok(!doDefaultKeyup, description + "TIP.keyup(keyB, TIP.KEY_DEFAULT_PREVENTED) should return false because it's marked as consumed at dispatching the event"); is(events.length, 2, @@ -2423,7 +2423,7 @@ function runKeyTests() doDefaultKeydown = TIP.keydown(keyABC); doDefaultKeyup = TIP.keyup(keyABC); - is(doDefaultKeydown, TIP.KEYPRESS_IS_CONSUMED, + ok(!doDefaultKeydown, description + "TIP.keydown(keyABC) should return false because the keypress events should be consumed by the input element"); ok(doDefaultKeyup, description + "TIP.keyup(keyABC) should return true"); @@ -2450,8 +2450,8 @@ function runKeyTests() doDefaultKeydown = TIP.keydown(keyEnterPrintable, TIP.KEY_FORCE_PRINTABLE_KEY); doDefaultKeyup = TIP.keyup(keyEnterPrintable, TIP.KEY_FORCE_PRINTABLE_KEY); - is(doDefaultKeydown, TIP.KEYPRESS_IS_CONSUMED, - description + "TIP.keydown(keyEnterPrintable, TIP.KEY_FORCE_PRINTABLE_KEY) should return 0x02 because the keypress events should be consumed by the input element"); + ok(!doDefaultKeydown, + description + "TIP.keydown(keyEnterPrintable, TIP.KEY_FORCE_PRINTABLE_KEY) should return false because the keypress events should be consumed by the input element"); ok(doDefaultKeyup, description + "TIP.keyup(keyEnterPrintable, TIP.KEY_FORCE_PRINTABLE_KEY) should return true"); is(events.length, 7, @@ -2480,8 +2480,8 @@ function runKeyTests() doDefaultKeydown = TIP.keydown(keyWithModifiers); doDefaultKeyup = TIP.keyup(keyWithModifiers); - is(doDefaultKeydown, 0, - description + "TIP.keydown(keyWithModifiers) should return 0"); + ok(doDefaultKeydown, + description + "TIP.keydown(keyWithModifiers) should return true"); ok(doDefaultKeyup, description + "TIP.keyup(keyWithModifiers) should return true"); is(events.length, 3, @@ -2502,8 +2502,8 @@ function runKeyTests() doDefaultKeydown = TIP.keydown(keyA); doDefaultKeyup = TIP.keyup(keyA); - is(doDefaultKeydown, TIP.KEYDOWN_IS_CONSUMED, - description + "TIP.keydown(keyA) should return 0x01 because keydown event's preventDefault should be called"); + ok(!doDefaultKeydown, + description + "TIP.keydown(keyA) should return false because keydown event's preventDefault should be called"); ok(doDefaultKeyup, description + "TIP.keyup(keyA) should return true"); is(events.length, 2, @@ -2521,8 +2521,8 @@ function runKeyTests() doDefaultKeydown = TIP.keydown(keyA); doDefaultKeyup = TIP.keyup(keyA); - is(doDefaultKeydown, TIP.KEYPRESS_IS_CONSUMED, - description + "TIP.keydown(keyA) should return 0x02 because keypress event's preventDefault should be called"); + ok(!doDefaultKeydown, + description + "TIP.keydown(keyA) should return false because keypress event's preventDefault should be called"); ok(doDefaultKeyup, description + "TIP.keyup(keyA) should return true"); is(events.length, 3, @@ -2543,8 +2543,8 @@ function runKeyTests() doDefaultKeydown = TIP.keydown(keyA); doDefaultKeyup = TIP.keyup(keyA); - is(doDefaultKeydown, TIP.KEYPRESS_IS_CONSUMED, - description + "TIP.keydown(keyA) should return 0x02 because the key event should be consumed by the input element"); + ok(!doDefaultKeydown, + description + "TIP.keydown(keyA) should return false because the key event should be consumed by the input element"); ok(!doDefaultKeyup, description + "TIP.keyup(keyA) should return false because keyup event's preventDefault should be called"); is(events.length, 3, diff --git a/dom/inputmethod/MozKeyboard.js b/dom/inputmethod/MozKeyboard.js index 87c7f902c63c..bdb1a45544ef 100644 --- a/dom/inputmethod/MozKeyboard.js +++ b/dom/inputmethod/MozKeyboard.js @@ -573,7 +573,7 @@ MozInputContext.prototype = { switch (msg.name) { case "Keyboard:SendKey:Result:OK": - resolver.resolve(true); + resolver.resolve(); break; case "Keyboard:SendKey:Result:Error": resolver.reject(json.error); @@ -596,7 +596,7 @@ MozInputContext.prototype = { break; case "Keyboard:SetComposition:Result:OK": // Fall through. case "Keyboard:EndComposition:Result:OK": - resolver.resolve(true); + resolver.resolve(); break; default: dump("Could not find a handler for " + msg.name); @@ -738,79 +738,40 @@ MozInputContext.prototype = { return this.replaceSurroundingText(null, offset, length); }, - sendKey: function ic_sendKey(dictOrKeyCode, charCode, modifiers, repeat) { - if (typeof dictOrKeyCode === 'number') { - // XXX: modifiers are ignored in this API method. - - return this._sendPromise((resolverId) => { - cpmmSendAsyncMessageWithKbID(this, 'Keyboard:SendKey', { - contextId: this._contextId, - requestId: resolverId, - method: 'sendKey', - keyCode: dictOrKeyCode, - charCode: charCode, - repeat: repeat - }); - }); - } else if (typeof dictOrKeyCode === 'object') { - return this._sendPromise((resolverId) => { - cpmmSendAsyncMessageWithKbID(this, 'Keyboard:SendKey', { - contextId: this._contextId, - requestId: resolverId, - method: 'sendKey', - keyboardEventDict: this._getkeyboardEventDict(dictOrKeyCode) - }); - }); - } else { - // XXX: Should not reach here; implies WebIDL binding error. - throw new TypeError('Unknown argument passed.'); - } - }, - - keydown: function ic_keydown(dict) { - return this._sendPromise((resolverId) => { - cpmmSendAsyncMessageWithKbID(this, 'Keyboard:SendKey', { - contextId: this._contextId, - requestId: resolverId, - method: 'keydown', - keyboardEventDict: this._getkeyboardEventDict(dict) - }); - }); - }, - - keyup: function ic_keyup(dict) { - return this._sendPromise((resolverId) => { - cpmmSendAsyncMessageWithKbID(this, 'Keyboard:SendKey', { - contextId: this._contextId, + sendKey: function ic_sendKey(keyCode, charCode, modifiers, repeat) { + let self = this; + return this._sendPromise(function(resolverId) { + cpmmSendAsyncMessageWithKbID(self, 'Keyboard:SendKey', { + contextId: self._contextId, requestId: resolverId, - method: 'keyup', - keyboardEventDict: this._getkeyboardEventDict(dict) + keyCode: keyCode, + charCode: charCode, + modifiers: modifiers, + repeat: repeat }); }); }, - setComposition: function ic_setComposition(text, cursor, clauses, dict) { + setComposition: function ic_setComposition(text, cursor, clauses) { let self = this; - return this._sendPromise((resolverId) => { + return this._sendPromise(function(resolverId) { cpmmSendAsyncMessageWithKbID(self, 'Keyboard:SetComposition', { contextId: self._contextId, requestId: resolverId, text: text, cursor: (typeof cursor !== 'undefined') ? cursor : text.length, - clauses: clauses || null, - keyboardEventDict: this._getkeyboardEventDict(dict) + clauses: clauses || null }); }); }, - endComposition: function ic_endComposition(text, dict) { + endComposition: function ic_endComposition(text) { let self = this; - return this._sendPromise((resolverId) => { + return this._sendPromise(function(resolverId) { cpmmSendAsyncMessageWithKbID(self, 'Keyboard:EndComposition', { contextId: self._contextId, requestId: resolverId, - text: text || '', - keyboardEventDict: this._getkeyboardEventDict(dict) + text: text || '' }); }); }, @@ -825,43 +786,6 @@ MozInputContext.prototype = { } callback(aResolverId); }); - }, - - // Take a MozInputMethodKeyboardEventDict dict, creates a keyboardEventDict - // object that can be sent to forms.js - _getkeyboardEventDict: function(dict) { - if (typeof dict !== 'object' || !dict.key) { - return; - } - - var keyboardEventDict = { - key: dict.key, - code: dict.code, - repeat: dict.repeat, - flags: 0 - }; - - if (dict.printable) { - keyboardEventDict.flags |= - Ci.nsITextInputProcessor.KEY_FORCE_PRINTABLE_KEY; - } - - if (/^[a-zA-Z0-9]$/.test(dict.key)) { - // keyCode must follow the key value in this range; - // disregard the keyCode from content. - keyboardEventDict.keyCode = dict.key.toUpperCase().charCodeAt(0); - } else if (typeof dict.keyCode === 'number') { - // Allow keyCode to be specified for other key values. - keyboardEventDict.keyCode = dict.keyCode; - - // Allow keyCode to be explicitly set to zero. - if (dict.keyCode === 0) { - keyboardEventDict.flags |= - Ci.nsITextInputProcessor.KEY_KEEP_KEYCODE_ZERO; - } - } - - return keyboardEventDict; } }; diff --git a/dom/inputmethod/forms.js b/dom/inputmethod/forms.js index 2e17416c864c..e65a7bf5e084 100644 --- a/dom/inputmethod/forms.js +++ b/dom/inputmethod/forms.js @@ -11,7 +11,6 @@ dump("###################################### forms.js loaded\n"); let Ci = Components.interfaces; let Cc = Components.classes; let Cu = Components.utils; -let Cr = Components.results; Cu.import("resource://gre/modules/Services.jsm"); Cu.import('resource://gre/modules/XPCOMUtils.jsm'); @@ -19,50 +18,10 @@ XPCOMUtils.defineLazyServiceGetter(Services, "fm", "@mozilla.org/focus-manager;1", "nsIFocusManager"); -/* - * A WeakMap to map window to objects keeping it's TextInputProcessor instance. - */ -let WindowMap = { - // WeakMap of pairs. - _map: null, - - /* - * Set the object associated to the window and return it. - */ - _getObjForWin: function(win) { - if (!this._map) { - this._map = new WeakMap(); - } - if (this._map.has(win)) { - return this._map.get(win); - } else { - let obj = { - tip: null - }; - this._map.set(win, obj); - - return obj; - } - }, - - getTextInputProcessor: function(win) { - if (!win) { - return; - } - let obj = this._getObjForWin(win); - let tip = obj.tip - - if (!tip) { - tip = obj.tip = Cc["@mozilla.org/text-input-processor;1"] - .createInstance(Ci.nsITextInputProcessor); - } - - if (!tip.beginInputTransaction(win, textInputProcessorCallback)) { - tip = obj.tip = null; - } - return tip; - } -}; +XPCOMUtils.defineLazyGetter(this, "domWindowUtils", function () { + return content.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); +}); const RESIZE_SCROLL_DELAY = 20; // In content editable node, when there are hidden elements such as
, it @@ -82,151 +41,6 @@ let HTMLSelectElement = Ci.nsIDOMHTMLSelectElement; let HTMLOptGroupElement = Ci.nsIDOMHTMLOptGroupElement; let HTMLOptionElement = Ci.nsIDOMHTMLOptionElement; -function guessKeyNameFromKeyCode(KeyboardEvent, aKeyCode) { - switch (aKeyCode) { - case KeyboardEvent.DOM_VK_CANCEL: - return "Cancel"; - case KeyboardEvent.DOM_VK_HELP: - return "Help"; - case KeyboardEvent.DOM_VK_BACK_SPACE: - return "Backspace"; - case KeyboardEvent.DOM_VK_TAB: - return "Tab"; - case KeyboardEvent.DOM_VK_CLEAR: - return "Clear"; - case KeyboardEvent.DOM_VK_RETURN: - return "Enter"; - case KeyboardEvent.DOM_VK_SHIFT: - return "Shift"; - case KeyboardEvent.DOM_VK_CONTROL: - return "Control"; - case KeyboardEvent.DOM_VK_ALT: - return "Alt"; - case KeyboardEvent.DOM_VK_PAUSE: - return "Pause"; - case KeyboardEvent.DOM_VK_EISU: - return "Eisu"; - case KeyboardEvent.DOM_VK_ESCAPE: - return "Escape"; - case KeyboardEvent.DOM_VK_CONVERT: - return "Convert"; - case KeyboardEvent.DOM_VK_NONCONVERT: - return "NonConvert"; - case KeyboardEvent.DOM_VK_ACCEPT: - return "Accept"; - case KeyboardEvent.DOM_VK_MODECHANGE: - return "ModeChange"; - case KeyboardEvent.DOM_VK_PAGE_UP: - return "PageUp"; - case KeyboardEvent.DOM_VK_PAGE_DOWN: - return "PageDown"; - case KeyboardEvent.DOM_VK_END: - return "End"; - case KeyboardEvent.DOM_VK_HOME: - return "Home"; - case KeyboardEvent.DOM_VK_LEFT: - return "ArrowLeft"; - case KeyboardEvent.DOM_VK_UP: - return "ArrowUp"; - case KeyboardEvent.DOM_VK_RIGHT: - return "ArrowRight"; - case KeyboardEvent.DOM_VK_DOWN: - return "ArrowDown"; - case KeyboardEvent.DOM_VK_SELECT: - return "Select"; - case KeyboardEvent.DOM_VK_PRINT: - return "Print"; - case KeyboardEvent.DOM_VK_EXECUTE: - return "Execute"; - case KeyboardEvent.DOM_VK_PRINTSCREEN: - return "PrintScreen"; - case KeyboardEvent.DOM_VK_INSERT: - return "Insert"; - case KeyboardEvent.DOM_VK_DELETE: - return "Delete"; - case KeyboardEvent.DOM_VK_WIN: - return "OS"; - case KeyboardEvent.DOM_VK_CONTEXT_MENU: - return "ContextMenu"; - case KeyboardEvent.DOM_VK_SLEEP: - return "Standby"; - case KeyboardEvent.DOM_VK_F1: - return "F1"; - case KeyboardEvent.DOM_VK_F2: - return "F2"; - case KeyboardEvent.DOM_VK_F3: - return "F3"; - case KeyboardEvent.DOM_VK_F4: - return "F4"; - case KeyboardEvent.DOM_VK_F5: - return "F5"; - case KeyboardEvent.DOM_VK_F6: - return "F6"; - case KeyboardEvent.DOM_VK_F7: - return "F7"; - case KeyboardEvent.DOM_VK_F8: - return "F8"; - case KeyboardEvent.DOM_VK_F9: - return "F9"; - case KeyboardEvent.DOM_VK_F10: - return "F10"; - case KeyboardEvent.DOM_VK_F11: - return "F11"; - case KeyboardEvent.DOM_VK_F12: - return "F12"; - case KeyboardEvent.DOM_VK_F13: - return "F13"; - case KeyboardEvent.DOM_VK_F14: - return "F14"; - case KeyboardEvent.DOM_VK_F15: - return "F15"; - case KeyboardEvent.DOM_VK_F16: - return "F16"; - case KeyboardEvent.DOM_VK_F17: - return "F17"; - case KeyboardEvent.DOM_VK_F18: - return "F18"; - case KeyboardEvent.DOM_VK_F19: - return "F19"; - case KeyboardEvent.DOM_VK_F20: - return "F20"; - case KeyboardEvent.DOM_VK_F21: - return "F21"; - case KeyboardEvent.DOM_VK_F22: - return "F22"; - case KeyboardEvent.DOM_VK_F23: - return "F23"; - case KeyboardEvent.DOM_VK_F24: - return "F24"; - case KeyboardEvent.DOM_VK_NUM_LOCK: - return "NumLock"; - case KeyboardEvent.DOM_VK_SCROLL_LOCK: - return "ScrollLock"; - case KeyboardEvent.DOM_VK_VOLUME_MUTE: - return "VolumeMute"; - case KeyboardEvent.DOM_VK_VOLUME_DOWN: - return "VolumeDown"; - case KeyboardEvent.DOM_VK_VOLUME_UP: - return "VolumeUp"; - case KeyboardEvent.DOM_VK_META: - return "Meta"; - case KeyboardEvent.DOM_VK_ALTGR: - return "AltGraph"; - case KeyboardEvent.DOM_VK_ATTN: - return "Attn"; - case KeyboardEvent.DOM_VK_CRSEL: - return "CrSel"; - case KeyboardEvent.DOM_VK_EXSEL: - return "ExSel"; - case KeyboardEvent.DOM_VK_EREOF: - return "EraseEof"; - case KeyboardEvent.DOM_VK_PLAY: - return "Play"; - default: - return "Unidentified"; - } -} - let FormVisibility = { /** * Searches upwards in the DOM for an element that has been scrolled. @@ -370,41 +184,6 @@ let FormVisibility = { } }; -// This object implements nsITextInputProcessorCallback -let textInputProcessorCallback = { - onNotify: function(aTextInputProcessor, aNotification) { - try { - switch (aNotification.type) { - case "request-to-commit": - // TODO: Send a notification through asyncMessage to the keyboard here. - aTextInputProcessor.commitComposition(); - - break; - case "request-to-cancel": - // TODO: Send a notification through asyncMessage to the keyboard here. - aTextInputProcessor.cancelComposition(); - - break; - - case "notify-detached": - // TODO: Send a notification through asyncMessage to the keyboard here. - break; - - // TODO: Manage _focusedElement for text input from here instead. - // (except for