Browse Source

import changes from `dev' branch of rmottola/Arctic-Fox:

- let->var (7417185de3)
- Bug 1200194 - Expose nsCaret::GetFrameAndOffset for reuse. r=roc This function can be reused by AccessibleCaret. (4506d97981)
- Bug 1200194 - Fix AccessibleCaret is out of scrollport in cursor mode. r=roc (3c80be5af1)
- Bug 1175171 - Deallocate GTK's KeymapWrapper on shutdown. r=karlt (e5e5468d71)
- Bug 895274 part.6 Rename NS_EVENT_ALL to eAllEvents r=smaug (cc76e8ecc8)
- Bug 895274 part.7 Rename NS_WINDOW_START to eWindowEventFirst r=smaug (c7414fa347)
- Bug 895274 part.8 Rename NS_XUL_CLOSE to eWindowClose r=smaug (30e8142328)
- Bug 895274 part.5 Rename NS_EVENT_NULL to eVoidEvent r=smaug (1950fb6c82)
- Bug 895274 part.4 Clean up the macro names of EventNameList.h r=smaug (46a0c74362)
- Bug 895274 part.9 Rename NS_KEY_PRESS to eKeyPress r=smaug (fb863b578a)
- Bug 895274 part.10 Rename NS_KEY_UP to eKeyUp r=smaug (67a2e3c03a)
- fix (f3a9ad8088)
- Bug 1137557 - Part 1: Allow callee of TIP.keydown() to figure out preventDefault() of keydown and keypress event. r=masayuki, r+sr=smaug (c1d9bca9d0)
- Bug 1119133 Implement TextEventDispatcher::EndInputTransaction() for ensuring TextEventDispatcher forgets the link with TextInputProcessor r=smaug (fffdced45e)
master
roytam1 3 months ago
parent
commit
8ace8dfc05
  1. 8
      dom/apps/OfflineCacheInstaller.jsm
  2. 6
      dom/base/Element.cpp
  3. 47
      dom/base/TextInputProcessor.cpp
  4. 2
      dom/base/TextInputProcessor.h
  5. 12
      dom/base/nsContentUtils.cpp
  6. 2
      dom/base/nsDOMWindowUtils.cpp
  7. 36
      dom/base/test/chrome/window_nsITextInputProcessor.xul
  8. 2
      dom/events/AnimationEvent.cpp
  9. 2
      dom/events/BeforeAfterKeyboardEvent.cpp
  10. 2
      dom/events/ClipboardEvent.cpp
  11. 2
      dom/events/CompositionEvent.cpp
  12. 2
      dom/events/DragEvent.cpp
  13. 12
      dom/events/Event.cpp
  14. 2
      dom/events/EventDispatcher.cpp
  15. 2
      dom/events/EventDispatcher.h
  16. 12
      dom/events/EventListenerManager.cpp
  17. 2
      dom/events/EventListenerService.cpp
  18. 48
      dom/events/EventNameList.h
  19. 12
      dom/events/EventStateManager.cpp
  20. 3
      dom/events/InputEvent.cpp
  21. 10
      dom/events/KeyboardEvent.cpp
  22. 2
      dom/events/MouseEvent.cpp
  23. 3
      dom/events/MouseScrollEvent.cpp
  24. 2
      dom/events/MutationEvent.cpp
  25. 2
      dom/events/NotifyPaintEvent.h
  26. 2
      dom/events/PointerEvent.cpp
  27. 2
      dom/events/SimpleGestureEvent.cpp
  28. 2
      dom/events/TouchEvent.cpp
  29. 2
      dom/events/TransitionEvent.cpp
  30. 2
      dom/events/UIEvent.cpp
  31. 3
      dom/events/WheelEvent.cpp
  32. 4
      dom/events/WheelHandlingHelper.cpp
  33. 2
      dom/events/XULCommandEvent.cpp
  34. 10
      dom/html/HTMLButtonElement.cpp
  35. 22
      dom/html/HTMLInputElement.cpp
  36. 4
      dom/html/HTMLSummaryElement.cpp
  37. 2
      dom/html/nsTextEditorState.cpp
  38. 25
      dom/interfaces/base/nsITextInputProcessor.idl
  39. 2
      dom/ipc/TabChild.cpp
  40. 4
      dom/ipc/TabParent.cpp
  41. 10
      dom/plugins/base/nsPluginInstanceOwner.cpp
  42. 2
      dom/smil/TimeEvent.cpp
  43. 2
      editor/libeditor/nsEditor.cpp
  44. 4
      editor/libeditor/nsEditorEventListener.cpp
  45. 2
      editor/libeditor/nsHTMLEditor.cpp
  46. 2
      editor/libeditor/nsPlaintextEditor.cpp
  47. 4
      gfx/layers/apz/src/APZCTreeManager.cpp
  48. 4
      layout/base/AccessibleCaretEventHub.cpp
  49. 56
      layout/base/AccessibleCaretManager.cpp
  50. 4
      layout/base/TouchCaret.cpp
  51. 8
      layout/base/nsCaret.cpp
  52. 10
      layout/base/nsCaret.h
  53. 2
      layout/base/nsLayoutUtils.cpp
  54. 28
      layout/base/nsPresShell.cpp
  55. 2
      layout/generic/nsSelection.cpp
  56. 4
      layout/xul/nsButtonBoxFrame.cpp
  57. 2
      layout/xul/nsMenuFrame.cpp
  58. 42
      widget/EventMessageList.h
  59. 2
      widget/IMEData.h
  60. 6
      widget/InputData.cpp
  61. 38
      widget/TextEventDispatcher.cpp
  62. 20
      widget/TextEventDispatcher.h
  63. 4
      widget/WidgetEventImpl.cpp
  64. 6
      widget/cocoa/TextInputHandler.h
  65. 24
      widget/cocoa/TextInputHandler.mm
  66. 6
      widget/gonk/nsAppShell.cpp
  67. 38
      widget/gtk/nsGtkKeyUtils.cpp
  68. 9
      widget/gtk/nsGtkKeyUtils.h
  69. 2
      widget/gtk/nsWidgetFactory.cpp
  70. 8
      widget/gtk/nsWindow.cpp
  71. 4
      widget/nsBaseWidget.cpp
  72. 10
      widget/qt/nsWindow.cpp
  73. 18
      widget/windows/KeyboardLayout.cpp
  74. 2
      widget/windows/nsWindow.cpp
  75. 4
      xpfe/appshell/nsWebShellWindow.cpp

8
dom/apps/OfflineCacheInstaller.jsm

@ -15,15 +15,15 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppsUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
let Namespace = CC('@mozilla.org/network/application-cache-namespace;1',
var Namespace = CC('@mozilla.org/network/application-cache-namespace;1',
'nsIApplicationCacheNamespace',
'init');
let makeFile = CC('@mozilla.org/file/local;1',
var makeFile = CC('@mozilla.org/file/local;1',
'nsIFile',
'initWithPath');
let MutableArray = CC('@mozilla.org/array;1', 'nsIMutableArray');
var MutableArray = CC('@mozilla.org/array;1', 'nsIMutableArray');
let {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
var {LoadContextInfo} = Cu.import("resource://gre/modules/LoadContextInfo.jsm", {});
const nsICacheStorage = Ci.nsICacheStorage;
const nsIApplicationCache = Ci.nsIApplicationCache;

6
dom/base/Element.cpp

@ -2904,7 +2904,7 @@ Element::CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
if (aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault ||
(!aVisitor.mEvent->mFlags.mIsTrusted &&
(aVisitor.mEvent->mMessage != NS_MOUSE_CLICK) &&
(aVisitor.mEvent->mMessage != NS_KEY_PRESS) &&
(aVisitor.mEvent->mMessage != eKeyPress) &&
(aVisitor.mEvent->mMessage != NS_UI_ACTIVATE)) ||
!aVisitor.mPresContext ||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented) {
@ -2985,7 +2985,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_CLICK:
case NS_UI_ACTIVATE:
case NS_KEY_PRESS:
case eKeyPress:
break;
default:
return NS_OK;
@ -3063,7 +3063,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
}
break;
case NS_KEY_PRESS:
case eKeyPress:
{
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if (keyEvent && keyEvent->keyCode == NS_VK_RETURN) {

47
dom/base/TextInputProcessor.cpp

@ -187,7 +187,14 @@ TextInputProcessor::BeginInputTransactionInternal(
// This instance has finished preparing to link to the dispatcher. Therefore,
// let's forget the old dispatcher and purpose.
UnlinkFromTextEventDispatcher();
if (mDispatcher) {
mDispatcher->EndInputTransaction(this);
if (NS_WARN_IF(mDispatcher)) {
// Forcibly initialize the members if we failed to end the input
// transaction.
UnlinkFromTextEventDispatcher();
}
}
if (aForTests) {
rv = dispatcher->BeginInputTransactionForTests(this);
@ -278,8 +285,11 @@ TextInputProcessor::MaybeDispatchKeydownForComposition(
return result;
}
uint32_t consumedFlags = 0;
result.mResult = KeydownInternal(*aKeyboardEvent, aKeyFlags, false,
result.mDoDefault);
consumedFlags);
result.mDoDefault = !consumedFlags;
if (NS_WARN_IF(NS_FAILED(result.mResult))) {
result.mCanContinue = false;
return result;
@ -748,9 +758,9 @@ NS_IMETHODIMP
TextInputProcessor::Keydown(nsIDOMKeyEvent* aDOMKeyEvent,
uint32_t aKeyFlags,
uint8_t aOptionalArgc,
bool* aDoDefault)
uint32_t* aConsumedFlags)
{
MOZ_RELEASE_ASSERT(aDoDefault, "aDoDefault must not be nullptr");
MOZ_RELEASE_ASSERT(aConsumedFlags, "aConsumedFlags must not be nullptr");
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
if (!aOptionalArgc) {
aKeyFlags = 0;
@ -763,7 +773,7 @@ TextInputProcessor::Keydown(nsIDOMKeyEvent* aDOMKeyEvent,
if (NS_WARN_IF(!originalKeyEvent)) {
return NS_ERROR_INVALID_ARG;
}
return KeydownInternal(*originalKeyEvent, aKeyFlags, true, *aDoDefault);
return KeydownInternal(*originalKeyEvent, aKeyFlags, true, *aConsumedFlags);
}
TextEventDispatcher::DispatchTo
@ -787,9 +797,9 @@ nsresult
TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
uint32_t aKeyFlags,
bool aAllowToDispatchKeypress,
bool& aDoDefault)
uint32_t& aConsumedFlags)
{
aDoDefault = false;
aConsumedFlags = KEYEVENT_NOT_CONSUMED;
// We shouldn't modify the internal WidgetKeyboardEvent.
WidgetKeyboardEvent keyEvent(aKeyboardEvent);
@ -798,7 +808,8 @@ TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
return rv;
}
aDoDefault = !(aKeyFlags & KEY_DEFAULT_PREVENTED);
aConsumedFlags = (aKeyFlags & KEY_DEFAULT_PREVENTED) ? KEYDOWN_IS_CONSUMED :
KEYEVENT_NOT_CONSUMED;
if (WidgetKeyboardEvent::GetModifierForKeyName(keyEvent.mKeyNameIndex)) {
ModifierKeyData modifierKeyData(keyEvent);
@ -825,8 +836,8 @@ TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
return rv;
}
nsEventStatus status = aDoDefault ? nsEventStatus_eIgnore :
nsEventStatus_eConsumeNoDefault;
nsEventStatus status = aConsumedFlags ? nsEventStatus_eConsumeNoDefault :
nsEventStatus_eIgnore;
if (!mDispatcher->DispatchKeyboardEvent(NS_KEY_DOWN, keyEvent, status,
GetDispatchTo())) {
// If keydown event isn't dispatched, we don't need to dispatch keypress
@ -834,11 +845,18 @@ TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
return NS_OK;
}
if (aAllowToDispatchKeypress) {
mDispatcher->MaybeDispatchKeypressEvents(keyEvent, status, GetDispatchTo());
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;
}
aDoDefault = (status != nsEventStatus_eConsumeNoDefault);
return NS_OK;
}
@ -902,8 +920,7 @@ TextInputProcessor::KeyupInternal(const WidgetKeyboardEvent& aKeyboardEvent,
nsEventStatus status = aDoDefault ? nsEventStatus_eIgnore :
nsEventStatus_eConsumeNoDefault;
mDispatcher->DispatchKeyboardEvent(NS_KEY_UP, keyEvent, status,
GetDispatchTo());
mDispatcher->DispatchKeyboardEvent(eKeyUp, keyEvent, status, GetDispatchTo());
aDoDefault = (status != nsEventStatus_eConsumeNoDefault);
return NS_OK;
}

2
dom/base/TextInputProcessor.h

@ -57,7 +57,7 @@ private:
nsresult KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
uint32_t aKeyFlags,
bool aAllowToDispatchKeypress,
bool& aDoDefault);
uint32_t& aConsumedFlags);
nsresult KeyupInternal(const WidgetKeyboardEvent& aKeyboardEvent,
uint32_t aKeyFlags,
bool& aDoDefault);

12
dom/base/nsContentUtils.cpp

@ -686,15 +686,15 @@ nsContentUtils::InitializeModifierStrings()
}
// Because of SVG/SMIL we have several atoms mapped to the same
// id, but we can rely on ID_TO_EVENT to map id to only one atom.
// id, but we can rely on MESSAGE_TO_EVENT to map id to only one atom.
static bool
ShouldAddEventToStringEventTable(const EventNameMapping& aMapping)
{
switch(aMapping.mMessage) {
#define ID_TO_EVENT(name_, message_, type_, struct_) \
#define MESSAGE_TO_EVENT(name_, message_, type_, struct_) \
case message_: return nsGkAtoms::on##name_ == aMapping.mAtom;
#include "mozilla/EventNameList.h"
#undef ID_TO_EVENT
#undef MESSAGE_TO_EVENT
default:
break;
}
@ -7685,16 +7685,16 @@ nsContentUtils::SendKeyEvent(nsCOMPtr<nsIWidget> aWidget,
if (aType.EqualsLiteral("keydown"))
msg = NS_KEY_DOWN;
else if (aType.EqualsLiteral("keyup"))
msg = NS_KEY_UP;
msg = eKeyUp;
else if (aType.EqualsLiteral("keypress"))
msg = NS_KEY_PRESS;
msg = eKeyPress;
else
return NS_ERROR_FAILURE;
WidgetKeyboardEvent event(true, msg, aWidget);
event.modifiers = GetWidgetModifiers(aModifiers);
if (msg == NS_KEY_PRESS) {
if (msg == eKeyPress) {
event.keyCode = aCharCode ? 0 : aKeyCode;
event.charCode = aCharCode;
} else {

2
dom/base/nsDOMWindowUtils.cpp

@ -3427,7 +3427,7 @@ nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal)
while (node) {
if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
nsCOMPtr<nsIFormControl> fc = do_QueryInterface(node);
if (fc && fc->IsDisabledForEvents(NS_EVENT_NULL)) {
if (fc && fc->IsDisabledForEvents(eVoidEvent)) {
*aRetVal = true;
break;
}

36
dom/base/test/chrome/window_nsITextInputProcessor.xul

@ -15,7 +15,7 @@
src="data:text/html,&lt;textarea id='textarea' cols='20' rows='4'&gt;&lt;/textarea&gt;"></iframe><br/>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
@ -2340,8 +2340,8 @@ function runKeyTests()
reset();
var doDefaultKeydown = TIP.keydown(keyA);
ok(!doDefaultKeydown,
description + "TIP.keydown(keyA) should return false because the keypress event should be consumed by the input element");
is(doDefaultKeydown, TIP.KEYPRESS_IS_CONSUMED,
description + "TIP.keydown(keyA) should return 0x02 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);
ok(doDefaultKeydown,
description + "TIP.keydown(keyEnter) should return true");
is(doDefaultKeydown, 0,
description + "TIP.keydown(keyEnter) should return 0");
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);
ok(!doDefaultKeydown,
description + "TIP.keydown(keyB, TIP.KEY_DEFAULT_PREVENTED) should return false because it's marked as consumed at dispatching the event");
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(!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);
ok(!doDefaultKeydown,
is(doDefaultKeydown, TIP.KEYPRESS_IS_CONSUMED,
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);
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");
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(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);
ok(doDefaultKeydown,
description + "TIP.keydown(keyWithModifiers) should return true");
is(doDefaultKeydown, 0,
description + "TIP.keydown(keyWithModifiers) should return 0");
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);
ok(!doDefaultKeydown,
description + "TIP.keydown(keyA) should return false because keydown event's preventDefault should be called");
is(doDefaultKeydown, TIP.KEYDOWN_IS_CONSUMED,
description + "TIP.keydown(keyA) should return 0x01 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);
ok(!doDefaultKeydown,
description + "TIP.keydown(keyA) should return false because keypress event's preventDefault should be called");
is(doDefaultKeydown, TIP.KEYPRESS_IS_CONSUMED,
description + "TIP.keydown(keyA) should return 0x02 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);
ok(!doDefaultKeydown,
description + "TIP.keydown(keyA) should return false because the key event should be consumed by the input element");
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(!doDefaultKeyup,
description + "TIP.keyup(keyA) should return false because keyup event's preventDefault should be called");
is(events.length, 3,

2
dom/events/AnimationEvent.cpp

@ -15,7 +15,7 @@ AnimationEvent::AnimationEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalAnimationEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalAnimationEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalAnimationEvent(false, eVoidEvent))
{
if (aEvent) {
mEventIsInternal = false;

2
dom/events/BeforeAfterKeyboardEvent.cpp

@ -18,7 +18,7 @@ BeforeAfterKeyboardEvent::BeforeAfterKeyboardEvent(
: KeyboardEvent(aOwner, aPresContext,
aEvent ? aEvent :
new InternalBeforeAfterKeyboardEvent(false,
NS_EVENT_NULL,
eVoidEvent,
nullptr))
{
MOZ_ASSERT(mEvent->mClass == eBeforeAfterKeyboardEventClass,

2
dom/events/ClipboardEvent.cpp

@ -16,7 +16,7 @@ ClipboardEvent::ClipboardEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalClipboardEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalClipboardEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalClipboardEvent(false, eVoidEvent))
{
if (aEvent) {
mEventIsInternal = false;

2
dom/events/CompositionEvent.cpp

@ -16,7 +16,7 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
WidgetCompositionEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetCompositionEvent(false, NS_EVENT_NULL, nullptr))
new WidgetCompositionEvent(false, eVoidEvent, nullptr))
{
NS_ASSERTION(mEvent->mClass == eCompositionEventClass,
"event type mismatch");

2
dom/events/DragEvent.cpp

@ -17,7 +17,7 @@ DragEvent::DragEvent(EventTarget* aOwner,
WidgetDragEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetDragEvent(false, NS_EVENT_NULL, nullptr))
new WidgetDragEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

12
dom/events/Event.cpp

@ -106,7 +106,7 @@ Event::ConstructorInit(EventTarget* aOwner,
...
}
*/
mEvent = new WidgetEvent(false, NS_EVENT_NULL);
mEvent = new WidgetEvent(false, eVoidEvent);
mEvent->time = PR_Now();
}
@ -770,7 +770,7 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
if (aEvent->mFlags.mIsTrusted) {
uint32_t key = aEvent->AsKeyboardEvent()->keyCode;
switch(aEvent->mMessage) {
case NS_KEY_PRESS :
case eKeyPress:
// return key on focused button. see note at NS_MOUSE_CLICK.
if (key == nsIDOMKeyEvent::DOM_VK_RETURN) {
abuse = openAllowed;
@ -778,7 +778,7 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
abuse = openControlled;
}
break;
case NS_KEY_UP :
case eKeyUp:
// space key on focused button. see note at NS_MOUSE_CLICK.
if (key == nsIDOMKeyEvent::DOM_VK_SPACE) {
abuse = openAllowed;
@ -1055,10 +1055,10 @@ const char*
Event::GetEventName(EventMessage aEventType)
{
switch(aEventType) {
#define ID_TO_EVENT(name_, _id, _type, _struct) \
case _id: return #name_;
#define MESSAGE_TO_EVENT(name_, _message, _type, _struct) \
case _message: return #name_;
#include "mozilla/EventNameList.h"
#undef ID_TO_EVENT
#undef MESSAGE_TO_EVENT
default:
break;
}

2
dom/events/EventDispatcher.cpp

@ -493,7 +493,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
}
#ifdef DEBUG
if (aEvent->mMessage != NS_EVENT_NULL &&
if (aEvent->mMessage != eVoidEvent &&
!nsContentUtils::IsSafeToRunScript()) {
nsresult rv = NS_ERROR_FAILURE;
if (target->GetContextForEventHandlers(&rv) ||

2
dom/events/EventDispatcher.h

@ -247,7 +247,7 @@ public:
*
* If aTargets is non-null, event target chain will be created, but
* event won't be handled. In this case aEvent->mMessage should be
* NS_EVENT_NULL.
* eVoidEvent.
* @note Use this method when dispatching a WidgetEvent.
*/
static nsresult Dispatch(nsISupports* aTarget,

12
dom/events/EventListenerManager.cpp

@ -95,7 +95,7 @@ MutationBitForEventType(EventMessage aEventType)
uint32_t EventListenerManager::sMainThreadCreatedCount = 0;
EventListenerManagerBase::EventListenerManagerBase()
: mNoListenerForEvent(NS_EVENT_NULL)
: mNoListenerForEvent(eVoidEvent)
, mMayHavePaintEventListener(false)
, mMayHaveMutationListeners(false)
, mMayHaveCapturingListeners(false)
@ -257,7 +257,7 @@ EventListenerManager::AddEventListenerInternal(
}
}
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEvent = eVoidEvent;
mNoListenerForEventAtom = nullptr;
listener = aAllEvents ? mListeners.InsertElementAt(0) :
@ -531,7 +531,7 @@ EventListenerManager::RemoveEventListenerInternal(
nsRefPtr<EventListenerManager> kungFuDeathGrip(this);
mListeners.RemoveElementAt(i);
--count;
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEvent = eVoidEvent;
mNoListenerForEventAtom = nullptr;
if (mTarget && aUserType) {
mTarget->EventListenerRemoved(aUserType);
@ -798,7 +798,7 @@ EventListenerManager::RemoveEventHandler(nsIAtom* aName,
if (listener) {
mListeners.RemoveElementAt(uint32_t(listener - &mListeners.ElementAt(0)));
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEvent = eVoidEvent;
mNoListenerForEventAtom = nullptr;
if (mTarget && aName) {
mTarget->EventListenerRemoved(aName);
@ -1231,7 +1231,7 @@ EventListenerManager::AddListenerForAllEvents(nsIDOMEventListener* aDOMListener,
flags.mAllowUntrustedEvents = aWantsUntrusted;
flags.mInSystemGroup = aSystemEventGroup;
EventListenerHolder listenerHolder(aDOMListener);
AddEventListenerInternal(listenerHolder, NS_EVENT_ALL, nullptr, EmptyString(),
AddEventListenerInternal(listenerHolder, eAllEvents, nullptr, EmptyString(),
flags, false, true);
}
@ -1245,7 +1245,7 @@ EventListenerManager::RemoveListenerForAllEvents(
flags.mCapture = aUseCapture;
flags.mInSystemGroup = aSystemEventGroup;
EventListenerHolder listenerHolder(aDOMListener);
RemoveEventListenerInternal(listenerHolder, NS_EVENT_ALL, nullptr,
RemoveEventListenerInternal(listenerHolder, eAllEvents, nullptr,
EmptyString(), flags, true);
}

2
dom/events/EventListenerService.cpp

@ -226,7 +226,7 @@ EventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget,
*aCount = 0;
*aOutArray = nullptr;
NS_ENSURE_ARG(aEventTarget);
WidgetEvent event(true, NS_EVENT_NULL);
WidgetEvent event(true, eVoidEvent);
nsTArray<EventTarget*> targets;
nsresult rv = EventDispatcher::Dispatch(aEventTarget, nullptr, &event,
nullptr, nullptr, nullptr, &targets);

48
dom/events/EventNameList.h

@ -11,7 +11,7 @@
*
* Each entry consists of 4 pieces of information:
* 1) The name of the event
* 2) The event ID (see BasicEvents.h)
* 2) The event message
* 3) The event type (see the EventNameType enum in nsContentUtils.h)
* 4) The event struct type for this event.
* Items 2-4 might be empty strings for events for which they don't make sense.
@ -52,7 +52,7 @@
* update the tests for bug 689564 and bug 659350 as needed.
*/
#ifdef ID_TO_EVENT
#ifdef MESSAGE_TO_EVENT
#ifdef EVENT
#error "Don't define EVENT"
#endif /* EVENT */
@ -69,11 +69,11 @@
#error "Don't define NON_IDL_EVENT"
#endif /* NON_IDL_EVENT */
#define EVENT ID_TO_EVENT
#define WINDOW_ONLY_EVENT ID_TO_EVENT
#define TOUCH_EVENT ID_TO_EVENT
#define DOCUMENT_ONLY_EVENT ID_TO_EVENT
#define NON_IDL_EVENT ID_TO_EVENT
#define EVENT MESSAGE_TO_EVENT
#define WINDOW_ONLY_EVENT MESSAGE_TO_EVENT
#define TOUCH_EVENT MESSAGE_TO_EVENT
#define DOCUMENT_ONLY_EVENT MESSAGE_TO_EVENT
#define NON_IDL_EVENT MESSAGE_TO_EVENT
#endif
#ifdef DEFINED_FORWARDED_EVENT
@ -90,7 +90,7 @@
#endif /* DEFINED_WINDOW_ONLY_EVENT */
#ifndef WINDOW_ONLY_EVENT
#define WINDOW_ONLY_EVENT(_name, _id, _type, _struct)
#define WINDOW_ONLY_EVENT(_name, _message, _type, _struct)
#define DEFINED_WINDOW_ONLY_EVENT
#endif /* WINDOW_ONLY_EVENT */
@ -108,7 +108,7 @@
#endif /* DEFINED_TOUCH_EVENT */
#ifndef TOUCH_EVENT
#define TOUCH_EVENT(_name, _id, _type, _struct)
#define TOUCH_EVENT(_name, _message, _type, _struct)
#define DEFINED_TOUCH_EVENT
#endif /* TOUCH_EVENT */
@ -117,7 +117,7 @@
#endif /* DEFINED_DOCUMENT_ONLY_EVENT */
#ifndef DOCUMENT_ONLY_EVENT
#define DOCUMENT_ONLY_EVENT(_name, _id, _type, _struct)
#define DOCUMENT_ONLY_EVENT(_name, _message, _type, _struct)
#define DEFINED_DOCUMENT_ONLY_EVENT
#endif /* DOCUMENT_ONLY_EVENT */
@ -126,7 +126,7 @@
#endif /* DEFINED_NON_IDL_EVENT */
#ifndef NON_IDL_EVENT
#define NON_IDL_EVENT(_name, _id, _type, _struct)
#define NON_IDL_EVENT(_name, _message, _type, _struct)
#define DEFINED_NON_IDL_EVENT
#endif /* NON_IDL_EVENT */
@ -231,11 +231,11 @@ EVENT(keydown,
EventNameType_HTMLXUL,
eKeyboardEventClass)
EVENT(keypress,
NS_KEY_PRESS,
eKeyPress,
EventNameType_HTMLXUL,
eKeyboardEventClass)
EVENT(keyup,
NS_KEY_UP,
eKeyUp,
EventNameType_HTMLXUL,
eKeyboardEventClass)
NON_IDL_EVENT(mozbrowserbeforekeydown,
@ -708,7 +708,7 @@ NON_IDL_EVENT(command,
EventNameType_XUL,
eInputEventClass)
NON_IDL_EVENT(close,
NS_XUL_CLOSE,
eWindowClose,
EventNameType_XUL,
eBasicEventClass)
NON_IDL_EVENT(popupshowing,
@ -779,16 +779,16 @@ NON_IDL_EVENT(SVGZoom,
EventNameType_None,
eSVGZoomEventClass)
// Only map the ID to the real event name when ID_TO_EVENT is defined.
#ifndef ID_TO_EVENT
// Only map the ID to the real event name when MESSAGE_TO_EVENT is defined.
#ifndef MESSAGE_TO_EVENT
// This is a bit hackish, but SVG's event names are weird.
NON_IDL_EVENT(zoom,
NS_SVG_ZOOM,
EventNameType_SVGSVG,
eBasicEventClass)
#endif
// Only map the ID to the real event name when ID_TO_EVENT is defined.
#ifndef ID_TO_EVENT
// Only map the ID to the real event name when MESSAGE_TO_EVENT is defined.
#ifndef MESSAGE_TO_EVENT
NON_IDL_EVENT(begin,
NS_SMIL_BEGIN,
EventNameType_SMIL,
@ -798,8 +798,8 @@ NON_IDL_EVENT(beginEvent,
NS_SMIL_BEGIN,
EventNameType_None,
eSMILTimeEventClass)
// Only map the ID to the real event name when ID_TO_EVENT is defined.
#ifndef ID_TO_EVENT
// Only map the ID to the real event name when MESSAGE_TO_EVENT is defined.
#ifndef MESSAGE_TO_EVENT
NON_IDL_EVENT(end,
NS_SMIL_END,
EventNameType_SMIL,
@ -809,8 +809,8 @@ NON_IDL_EVENT(endEvent,
NS_SMIL_END,
EventNameType_None,
eSMILTimeEventClass)
// Only map the ID to the real event name when ID_TO_EVENT is defined.
#ifndef ID_TO_EVENT
// Only map the ID to the real event name when MESSAGE_TO_EVENT is defined.
#ifndef MESSAGE_TO_EVENT
NON_IDL_EVENT(repeat,
NS_SMIL_REPEAT,
EventNameType_SMIL,
@ -983,11 +983,11 @@ NON_IDL_EVENT(complete,
#undef BEFOREUNLOAD_EVENT
#endif /* BEFOREUNLOAD_EVENT */
#ifdef ID_TO_EVENT
#ifdef MESSAGE_TO_EVENT
#undef EVENT
#undef WINDOW_ONLY_EVENT
#undef TOUCH_EVENT
#undef DOCUMENT_ONLY_EVENT
#undef NON_IDL_EVENT
#endif /* ID_TO_EVENT */
#endif /* MESSAGE_TO_EVENT */

12
dom/events/EventStateManager.cpp

@ -518,7 +518,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
nsCOMPtr<nsINode> node = do_QueryInterface(aTargetContent);
if (node &&
(aEvent->mMessage == NS_KEY_UP || aEvent->mMessage == NS_MOUSE_BUTTON_UP ||
(aEvent->mMessage == eKeyUp || aEvent->mMessage == NS_MOUSE_BUTTON_UP ||
aEvent->mMessage == NS_WHEEL_WHEEL || aEvent->mMessage == NS_TOUCH_END ||
aEvent->mMessage == NS_POINTER_UP)) {
nsIDocument* doc = node->OwnerDoc();
@ -641,7 +641,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
}
GenerateMouseEnterExit(mouseEvent);
//This is a window level mouse exit event and should stop here
aEvent->mMessage = NS_EVENT_NULL;
aEvent->mMessage = eVoidEvent;
break;
}
case NS_MOUSE_MOVE:
@ -674,7 +674,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
GenerateDragDropEnterExit(aPresContext, aEvent->AsDragEvent());
break;
case NS_KEY_PRESS:
case eKeyPress:
{
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
@ -703,7 +703,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
case NS_KEY_DOWN:
case NS_KEY_AFTER_DOWN:
case NS_KEY_BEFORE_UP:
case NS_KEY_UP:
case eKeyUp:
case NS_KEY_AFTER_UP:
{
nsIContent* content = GetFocusedContent();
@ -3337,11 +3337,11 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
break;
case NS_KEY_BEFORE_UP:
case NS_KEY_UP:
case eKeyUp:
case NS_KEY_AFTER_UP:
break;
case NS_KEY_PRESS:
case eKeyPress:
{
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
PostHandleKeyboardEvent(keyEvent, *aStatus, dispatchedToContentProcess);

3
dom/events/InputEvent.cpp

@ -16,8 +16,7 @@ InputEvent::InputEvent(EventTarget* aOwner,
InternalEditorInputEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new InternalEditorInputEvent(false, NS_EVENT_NULL,
nullptr))
new InternalEditorInputEvent(false, eVoidEvent, nullptr))
{
NS_ASSERTION(mEvent->mClass == eEditorInputEventClass,
"event type mismatch");

10
dom/events/KeyboardEvent.cpp

@ -16,7 +16,7 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
WidgetKeyboardEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetKeyboardEvent(false, NS_EVENT_NULL, nullptr))
new WidgetKeyboardEvent(false, eVoidEvent, nullptr))
, mInitializedByCtor(false)
, mInitializedWhichValue(0)
{
@ -157,10 +157,10 @@ KeyboardEvent::CharCode()
case NS_KEY_DOWN:
case NS_KEY_AFTER_DOWN:
case NS_KEY_BEFORE_UP:
case NS_KEY_UP:
case eKeyUp:
case NS_KEY_AFTER_UP:
return 0;
case NS_KEY_PRESS:
case eKeyPress:
return mEvent->AsKeyboardEvent()->charCode;
default:
break;
@ -203,10 +203,10 @@ KeyboardEvent::Which()
case NS_KEY_DOWN:
case NS_KEY_AFTER_DOWN:
case NS_KEY_BEFORE_UP:
case NS_KEY_UP:
case eKeyUp:
case NS_KEY_AFTER_UP:
return KeyCode();
case NS_KEY_PRESS:
case eKeyPress:
//Special case for 4xp bug 62878. Try to make value of which
//more closely mirror the values that 4.x gave for RETURN and BACKSPACE
{

2
dom/events/MouseEvent.cpp

@ -18,7 +18,7 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
WidgetMouseEventBase* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetMouseEvent(false, NS_EVENT_NULL, nullptr,
new WidgetMouseEvent(false, eVoidEvent, nullptr,
WidgetMouseEvent::eReal))
{
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.

3
dom/events/MouseScrollEvent.cpp

@ -16,8 +16,7 @@ MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
WidgetMouseScrollEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetMouseScrollEvent(false, NS_EVENT_NULL,
nullptr))
new WidgetMouseScrollEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

2
dom/events/MutationEvent.cpp

@ -17,7 +17,7 @@ MutationEvent::MutationEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalMutationEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalMutationEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalMutationEvent(false, eVoidEvent))
{
mEventIsInternal = (aEvent == nullptr);
}

2
dom/events/NotifyPaintEvent.h

@ -73,7 +73,7 @@ NS_NewDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent,
mozilla::EventMessage aEventMessage =
mozilla::NS_EVENT_NULL,
mozilla::eVoidEvent,
nsInvalidateRequestList* aInvalidateRequests =
nullptr);

2
dom/events/PointerEvent.cpp

@ -18,7 +18,7 @@ PointerEvent::PointerEvent(EventTarget* aOwner,
WidgetPointerEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetPointerEvent(false, NS_EVENT_NULL, nullptr))
new WidgetPointerEvent(false, eVoidEvent, nullptr))
{
NS_ASSERTION(mEvent->mClass == ePointerEventClass,
"event type mismatch ePointerEventClass");

2
dom/events/SimpleGestureEvent.cpp

@ -16,7 +16,7 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
WidgetSimpleGestureEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetSimpleGestureEvent(false, NS_EVENT_NULL,
new WidgetSimpleGestureEvent(false, eVoidEvent,
nullptr))
{
NS_ASSERTION(mEvent->mClass == eSimpleGestureEventClass,

2
dom/events/TouchEvent.cpp

@ -64,7 +64,7 @@ TouchEvent::TouchEvent(EventTarget* aOwner,
WidgetTouchEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetTouchEvent(false, NS_EVENT_NULL, nullptr))
new WidgetTouchEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

2
dom/events/TransitionEvent.cpp

@ -15,7 +15,7 @@ TransitionEvent::TransitionEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalTransitionEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalTransitionEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalTransitionEvent(false, eVoidEvent))
{
if (aEvent) {
mEventIsInternal = false;

2
dom/events/UIEvent.cpp

@ -29,7 +29,7 @@ UIEvent::UIEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetGUIEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalUIEvent(false, NS_EVENT_NULL, nullptr))
aEvent ? aEvent : new InternalUIEvent(false, eVoidEvent, nullptr))
, mClientPoint(0, 0)
, mLayerPoint(0, 0)
, mPagePoint(0, 0)

3
dom/events/WheelEvent.cpp

@ -16,8 +16,7 @@ WheelEvent::WheelEvent(EventTarget* aOwner,
WidgetWheelEvent* aWheelEvent)
: MouseEvent(aOwner, aPresContext,
aWheelEvent ? aWheelEvent :
new WidgetWheelEvent(false, NS_EVENT_NULL,
nullptr))
new WidgetWheelEvent(false, eVoidEvent, nullptr))
, mAppUnitsPerDevPixel(0)
{
if (aWheelEvent) {

4
dom/events/WheelHandlingHelper.cpp

@ -207,8 +207,8 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
}
return;
}
case NS_KEY_PRESS:
case NS_KEY_UP:
case eKeyPress:
case eKeyUp:
case NS_KEY_DOWN:
case NS_MOUSE_BUTTON_UP:
case NS_MOUSE_BUTTON_DOWN:

2
dom/events/XULCommandEvent.cpp

@ -15,7 +15,7 @@ XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
WidgetInputEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetInputEvent(false, NS_EVENT_NULL, nullptr))
new WidgetInputEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

10
dom/html/HTMLButtonElement.cpp

@ -287,22 +287,22 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
switch (aVisitor.mEvent->mMessage) {
case NS_KEY_PRESS:
case NS_KEY_UP:
case eKeyPress:
case eKeyUp:
{
// For backwards compat, trigger buttons with space or enter
// (bug 25300)
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if ((keyEvent->keyCode == NS_VK_RETURN &&
NS_KEY_PRESS == aVisitor.mEvent->mMessage) ||
eKeyPress == aVisitor.mEvent->mMessage) ||
(keyEvent->keyCode == NS_VK_SPACE &&
NS_KEY_UP == aVisitor.mEvent->mMessage)) {
eKeyUp == aVisitor.mEvent->mMessage)) {
DispatchSimulatedClick(this, aVisitor.mEvent->mFlags.mIsTrusted,
aVisitor.mPresContext);
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
}
}
break;// NS_KEY_PRESS
break;
case NS_MOUSE_BUTTON_DOWN:
{

22
dom/html/HTMLInputElement.cpp

@ -3246,7 +3246,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
// that).
frame->InvalidateFrame();
}
} else if (aVisitor.mEvent->mMessage == NS_KEY_UP) {
} else if (aVisitor.mEvent->mMessage == eKeyUp) {
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if ((keyEvent->keyCode == NS_VK_UP || keyEvent->keyCode == NS_VK_DOWN) &&
!(keyEvent->IsShift() || keyEvent->IsControl() ||
@ -3711,7 +3711,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (NS_SUCCEEDED(rv)) {
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if (mType == NS_FORM_INPUT_NUMBER &&
keyEvent && keyEvent->mMessage == NS_KEY_PRESS &&
keyEvent && keyEvent->mMessage == eKeyPress &&
aVisitor.mEvent->mFlags.mIsTrusted &&
(keyEvent->keyCode == NS_VK_UP || keyEvent->keyCode == NS_VK_DOWN) &&
!(keyEvent->IsShift() || keyEvent->IsControl() ||
@ -3763,15 +3763,15 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
break;
}
case NS_KEY_PRESS:
case NS_KEY_UP:
case eKeyPress:
case eKeyUp:
{
// For backwards compat, trigger checks/radios/buttons with
// space or enter (bug 25300)
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if ((aVisitor.mEvent->mMessage == NS_KEY_PRESS &&
if ((aVisitor.mEvent->mMessage == eKeyPress &&
keyEvent->keyCode == NS_VK_RETURN) ||
(aVisitor.mEvent->mMessage == NS_KEY_UP &&
(aVisitor.mEvent->mMessage == eKeyUp &&
keyEvent->keyCode == NS_VK_SPACE)) {
switch(mType) {
case NS_FORM_INPUT_CHECKBOX:
@ -3797,7 +3797,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
} // case
} // switch
}
if (aVisitor.mEvent->mMessage == NS_KEY_PRESS &&
if (aVisitor.mEvent->mMessage == eKeyPress &&
mType == NS_FORM_INPUT_RADIO && !keyEvent->IsAlt() &&
!keyEvent->IsControl() && !keyEvent->IsMeta()) {
bool isMovingBack = false;
@ -3843,7 +3843,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
* not submit, period.
*/
if (aVisitor.mEvent->mMessage == NS_KEY_PRESS &&
if (aVisitor.mEvent->mMessage == eKeyPress &&
keyEvent->keyCode == NS_VK_RETURN &&
(IsSingleLineTextControl(false, mType) ||
mType == NS_FORM_INPUT_NUMBER ||
@ -3853,7 +3853,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
NS_ENSURE_SUCCESS(rv, rv);
}
if (aVisitor.mEvent->mMessage == NS_KEY_PRESS &&
if (aVisitor.mEvent->mMessage == eKeyPress &&
mType == NS_FORM_INPUT_RANGE && !keyEvent->IsAlt() &&
!keyEvent->IsControl() && !keyEvent->IsMeta() &&
(keyEvent->keyCode == NS_VK_LEFT ||
@ -3912,7 +3912,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
}
} break; // NS_KEY_PRESS || NS_KEY_UP
} break; // eKeyPress || eKeyUp
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_BUTTON_UP:
@ -4122,7 +4122,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
break;
case NS_KEY_PRESS:
case eKeyPress:
if (mIsDraggingRange &&
aVisitor.mEvent->AsKeyboardEvent()->keyCode == NS_VK_ESCAPE) {
CancelRangeThumbDrag();

4
dom/html/HTMLSummaryElement.cpp

@ -78,7 +78,7 @@ HTMLSummaryElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
bool dispatchClick = false;
switch (event->mMessage) {
case NS_KEY_PRESS:
case eKeyPress:
if (keyboardEvent->charCode == nsIDOMKeyEvent::DOM_VK_SPACE) {
// Consume 'space' key to prevent scrolling the page down.
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
@ -87,7 +87,7 @@ HTMLSummaryElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
dispatchClick = keyboardEvent->keyCode == nsIDOMKeyEvent::DOM_VK_RETURN;
break;
case NS_KEY_UP:
case eKeyUp:
dispatchClick = keyboardEvent->keyCode == nsIDOMKeyEvent::DOM_VK_SPACE;
break;

2
dom/html/nsTextEditorState.cpp

@ -907,7 +907,7 @@ nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent)
return NS_ERROR_UNEXPECTED;
}
if (keyEvent->mMessage != NS_KEY_PRESS) {
if (keyEvent->mMessage != eKeyPress) {
return NS_OK;
}

25
dom/interfaces/base/nsITextInputProcessor.idl

@ -254,7 +254,7 @@ interface nsITextInputProcessorCallback;
* TIP.keyup(leftShift);
*/
[scriptable, builtinclass, uuid(6617a9f6-3e16-4086-9e1e-c8a6c5d505c7)]
[scriptable, builtinclass, uuid(581f6619-76ed-478c-905d-b8e6553a714a)]
interface nsITextInputProcessor : nsISupports
{
/**
@ -489,6 +489,12 @@ interface nsITextInputProcessor : nsISupports
// or emulating legacy API behavior.
const unsigned long KEY_DONT_DISPATCH_MODIFIER_KEY_EVENT = 0x00000020;
// These values can be used to do bitwise operation with the return value of
// the keydown() method.
const unsigned long KEYEVENT_NOT_CONSUMED = 0x00000000;
const unsigned long KEYDOWN_IS_CONSUMED = 0x00000001;
const unsigned long KEYPRESS_IS_CONSUMED = 0x00000002;
/**
* keydown() may dispatch a keydown event and some keypress events if
* preceding keydown event isn't consumed and they are necessary.
@ -529,13 +535,20 @@ interface nsITextInputProcessor : nsISupports
* each instance and set automatically.
* @param aKeyFlags Special flags. The values can be some of KEY_*
* constants.
* @return true if neither the keydown event or following
* keypress events is *not* consumed.
* Otherwise, i.e., preventDefault() is called, false.
* @return KEYEVENT_NOT_CONSUMED, if the keydown event nor
* the following keypress event(s) are consumed.
* KEYDOWN_IS_CONSUMED, if the keydown event is
* consumed. No keypress event will be dispatched in
* this case.
* KEYPRESS_IS_CONSUMED, if the keypress event(s) is
* consumed when dispatched.
* Note that keypress event is always consumed by
* native code for the printable keys (indicating the
* default action has been taken).
*/
[optional_argc]
boolean keydown(in nsIDOMKeyEvent aKeyboardEvent,