author | Masayuki Nakano <masayuki@d-toybox.com> |
Tue, 29 Oct 2013 13:14:42 +0900 | |
changeset 152593 | 55ea77a28509f776da6f4d18e3d2cc5b8b4e8a68 |
parent 152592 | 340cb402065a747a86d6e7a04ce682dd6300bf52 |
child 152594 | 7f7c141390b20c7e569186a77850ccba6b43ac91 |
push id | 25552 |
push user | cbook@mozilla.com |
push date | Tue, 29 Oct 2013 12:21:45 +0000 |
treeherder | mozilla-central@cd94525c17a4 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smaug |
bugs | 930900 |
milestone | 28.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/events/src/nsDOMKeyboardEvent.cpp +++ b/content/events/src/nsDOMKeyboardEvent.cpp @@ -18,16 +18,17 @@ nsDOMKeyboardEvent::nsDOMKeyboardEvent(m NS_ASSERTION(mEvent->eventStructType == NS_KEY_EVENT, "event type mismatch"); if (aEvent) { mEventIsInternal = false; } else { mEventIsInternal = true; mEvent->time = PR_Now(); + mEvent->AsKeyboardEvent()->mKeyNameIndex = KEY_NAME_INDEX_USE_STRING; } } NS_IMPL_ADDREF_INHERITED(nsDOMKeyboardEvent, nsDOMUIEvent) NS_IMPL_RELEASE_INHERITED(nsDOMKeyboardEvent, nsDOMUIEvent) NS_INTERFACE_MAP_BEGIN(nsDOMKeyboardEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent) @@ -97,19 +98,17 @@ nsDOMKeyboardEvent::GetModifierState(con *aState = GetModifierState(aKey); return NS_OK; } NS_IMETHODIMP nsDOMKeyboardEvent::GetKey(nsAString& aKeyName) { - if (!mEventIsInternal) { - mEvent->AsKeyboardEvent()->GetDOMKeyName(aKeyName); - } + mEvent->AsKeyboardEvent()->GetDOMKeyName(aKeyName); return NS_OK; } NS_IMETHODIMP nsDOMKeyboardEvent::GetCharCode(uint32_t* aCharCode) { NS_ENSURE_ARG_POINTER(aCharCode); *aCharCode = CharCode();
--- a/widget/EventForwards.h +++ b/widget/EventForwards.h @@ -31,19 +31,19 @@ namespace mozilla { typedef uint16_t Modifiers; #define NS_DEFINE_KEYNAME(aCPPName, aDOMKeyName) \ KEY_NAME_INDEX_##aCPPName, enum KeyNameIndex { #include "nsDOMKeyNameList.h" - // There shouldn't be "," at the end of enum definition, this dummy item - // avoids bustage on some platforms. - NUMBER_OF_KEY_NAME_INDEX + // If a DOM keyboard event is synthesized by script, this is used. Then, + // specified key name should be stored and use it as .key value. + KEY_NAME_INDEX_USE_STRING }; #undef NS_DEFINE_KEYNAME } // namespace mozilla /** * All header files should include this header instead of *Events.h.
--- a/widget/TextEvents.h +++ b/widget/TextEvents.h @@ -119,16 +119,17 @@ public: static void GetDOMKeyName(mozilla::KeyNameIndex aKeyNameIndex, nsAString& aKeyName) { #define NS_DEFINE_KEYNAME(aCPPName, aDOMKeyName) \ case KEY_NAME_INDEX_##aCPPName: \ aKeyName.Assign(NS_LITERAL_STRING(aDOMKeyName)); return; switch (aKeyNameIndex) { #include "nsDOMKeyNameList.h" + case KEY_NAME_INDEX_USE_STRING: default: aKeyName.Truncate(); return; } #undef NS_DEFINE_KEYNAME } void AssignKeyEventData(const WidgetKeyboardEvent& aEvent, bool aCopyTargets)
--- a/widget/tests/test_assign_event_data.html +++ b/widget/tests/test_assign_event_data.html @@ -141,67 +141,67 @@ const kTests = [ gUtils.sendNativeKeyEvent(WIN_KL_US, WIN_VK_A, 0, "a", "a"); } else if (kIsMac) { gUtils.sendNativeKeyEvent(MAC_KL_US, MAC_VK_ANSI_A, 0, "a", "a"); } }, canRun: function () { return (kIsMac || kIsWin); }, - todoMismatch: [ "key" ], + todoMismatch: [], }, { description: "nsKeyEvent (keyup of 'a' key without modifiers)", targetID: "input-text", eventType: "keydown", dispatchEvent: function () { document.getElementById(this.targetID).value = ""; document.getElementById(this.targetID).focus(); if (kIsWin) { gUtils.sendNativeKeyEvent(WIN_KL_US, WIN_VK_A, 0, "a", "a"); } else if (kIsMac) { gUtils.sendNativeKeyEvent(MAC_KL_US, MAC_VK_ANSI_A, 0, "a", "a"); } }, canRun: function () { return (kIsMac || kIsWin); }, - todoMismatch: [ "key" ], + todoMismatch: [], }, { description: "nsKeyEvent (keypress of 'b' key with Shift)", targetID: "input-text", eventType: "keypress", dispatchEvent: function () { document.getElementById(this.targetID).value = ""; document.getElementById(this.targetID).focus(); if (kIsWin) { gUtils.sendNativeKeyEvent(WIN_KL_US, WIN_VK_B, NATIVE_SHIFT_LEFT, "B", "B"); } else if (kIsMac) { gUtils.sendNativeKeyEvent(MAC_KL_US, MAC_VK_ANSI_B, NATIVE_SHIFT_LEFT, "B", "B"); } }, canRun: function () { return (kIsMac || kIsWin); }, // "defaultPrevented" becomes true because the editor consumes the keypress event. - todoMismatch: [ "key", "defaultPrevented" ], + todoMismatch: [ "defaultPrevented" ], }, { description: "nsKeyEvent (keypress of 'c' key with Accel)", targetID: "input-text", eventType: "keypress", dispatchEvent: function () { document.getElementById(this.targetID).value = ""; document.getElementById(this.targetID).focus(); if (kIsWin) { gUtils.sendNativeKeyEvent(WIN_KL_US, WIN_VK_C, NATIVE_CONTROL_RIGHT, "\u0003", "c"); } else if (kIsMac) { gUtils.sendNativeKeyEvent(MAC_KL_US, MAC_VK_ANSI_C, NATIVE_META_RIGHT, "c", "c"); } }, canRun: function () { return (kIsMac || kIsWin); }, // "defaultPrevented" becomes true because the editor consumes the keypress event. - todoMismatch: [ "key", "defaultPrevented" ], + todoMismatch: [ "defaultPrevented" ], }, { description: "nsMouseEvent (mousedown of left button without modifier)", targetID: "button", eventType: "mousedown", dispatchEvent: function () { synthesizeMouseAtCenter(document.getElementById(this.targetID), { button: 0 }); }, canRun: function () {