Bug 895274 part.9 Rename NS_KEY_PRESS to eKeyPress r=smaug

This commit is contained in:
Masayuki Nakano 2015-08-29 08:58:27 +09:00
parent 71c64c941a
commit 56f12a5cf3
37 changed files with 90 additions and 90 deletions

View File

@ -2851,7 +2851,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) {
@ -2932,7 +2932,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;
@ -3010,7 +3010,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
}
break;
case NS_KEY_PRESS:
case eKeyPress:
{
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if (keyEvent && keyEvent->keyCode == NS_VK_RETURN) {

View File

@ -7728,14 +7728,14 @@ nsContentUtils::SendKeyEvent(nsIWidget* aWidget,
else if (aType.EqualsLiteral("keyup"))
msg = NS_KEY_UP;
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 {

View File

@ -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;

View File

@ -231,7 +231,7 @@ EVENT(keydown,
EventNameType_HTMLXUL,
eKeyboardEventClass)
EVENT(keypress,
NS_KEY_PRESS,
eKeyPress,
EventNameType_HTMLXUL,
eKeyboardEventClass)
EVENT(keyup,

View File

@ -658,7 +658,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
GenerateDragDropEnterExit(aPresContext, aEvent->AsDragEvent());
break;
case NS_KEY_PRESS:
case eKeyPress:
{
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
@ -3310,7 +3310,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
case NS_KEY_AFTER_UP:
break;
case NS_KEY_PRESS:
case eKeyPress:
{
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
PostHandleKeyboardEvent(keyEvent, *aStatus, dispatchedToContentProcess);

View File

@ -160,7 +160,7 @@ KeyboardEvent::CharCode()
case NS_KEY_UP:
case NS_KEY_AFTER_UP:
return 0;
case NS_KEY_PRESS:
case eKeyPress:
return mEvent->AsKeyboardEvent()->charCode;
default:
break;
@ -206,7 +206,7 @@ KeyboardEvent::Which()
case NS_KEY_UP:
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
{

View File

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

View File

@ -282,14 +282,14 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
switch (aVisitor.mEvent->mMessage) {
case NS_KEY_PRESS:
case eKeyPress:
case NS_KEY_UP:
{
// 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)) {
nsEventStatus status = nsEventStatus_eIgnore;
@ -304,7 +304,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
}
}
break;// NS_KEY_PRESS
break;
case NS_MOUSE_BUTTON_DOWN:
{

View File

@ -3722,7 +3722,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() ||
@ -3774,13 +3774,13 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
break;
}
case NS_KEY_PRESS:
case eKeyPress:
case NS_KEY_UP:
{
// 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 &&
keyEvent->keyCode == NS_VK_SPACE)) {
@ -3815,7 +3815,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;
@ -3867,7 +3867,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 ||
@ -3877,7 +3877,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 ||
@ -3936,7 +3936,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
}
} break; // NS_KEY_PRESS || NS_KEY_UP
} break; // eKeyPress || NS_KEY_UP
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_BUTTON_UP:
@ -4146,7 +4146,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();

View File

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

View File

@ -2231,7 +2231,7 @@ TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& event,
{
AutoCacheNativeKeyCommands autoCache(mPuppetWidget);
if (event.mMessage == NS_KEY_PRESS) {
if (event.mMessage == eKeyPress) {
// If content code called preventDefault() on a keydown event, then we don't
// want to process any following keypress events.
if (mIgnoreKeyPressEvent) {

View File

@ -1741,7 +1741,7 @@ bool TabParent::SendRealKeyEvent(WidgetKeyboardEvent& event)
MaybeNativeKeyBinding bindings;
bindings = void_t();
if (event.mMessage == NS_KEY_PRESS) {
if (event.mMessage == eKeyPress) {
nsCOMPtr<nsIWidget> widget = GetWidget();
AutoInfallibleTArray<mozilla::CommandInt, 4> singleLine;
@ -2282,7 +2282,7 @@ TabParent::RecvDispatchAfterKeyboardEvent(const WidgetKeyboardEvent& aEvent)
if (mFrameElement &&
PresShell::BeforeAfterKeyboardEventEnabled() &&
localEvent.mMessage != NS_KEY_PRESS) {
localEvent.mMessage != eKeyPress) {
presShell->DispatchAfterKeyboardEvent(mFrameElement, localEvent,
aEvent.mFlags.mDefaultPrevented);
}

View File

@ -2290,11 +2290,11 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
{
case NS_KEY_DOWN:
// Handle NS_KEY_DOWN for modifier key presses
// For non-modifiers we get NS_KEY_PRESS
// For non-modifiers we get eKeyPress
if (gdkEvent->is_modifier)
event.type = XKeyPress;
break;
case NS_KEY_PRESS:
case eKeyPress:
event.type = XKeyPress;
break;
case NS_KEY_UP:

View File

@ -4695,7 +4695,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->mMessage == NS_KEY_PRESS,
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
"HandleKeyPressEvent gets non-keypress event");
// if we are readonly or disabled, then do nothing.

View File

@ -403,7 +403,7 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
}
#endif // #ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
// keypress
case NS_KEY_PRESS: {
case eKeyPress: {
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
return KeyPress(keyEvent);
}

View File

@ -594,7 +594,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->mMessage == NS_KEY_PRESS,
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
"HandleKeyPressEvent gets non-keypress event");
switch (nativeKeyEvent->keyCode) {

View File

@ -362,7 +362,7 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->mMessage == NS_KEY_PRESS,
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
"HandleKeyPressEvent gets non-keypress event");
switch (nativeKeyEvent->keyCode) {

View File

@ -886,7 +886,7 @@ APZCTreeManager::UpdateWheelTransaction(WidgetInputEvent& aEvent)
txn->OnMouseMove(point);
return;
}
case NS_KEY_PRESS:
case eKeyPress:
case NS_KEY_UP:
case NS_KEY_DOWN:
case NS_MOUSE_BUTTON_UP:

View File

@ -612,7 +612,7 @@ AccessibleCaretEventHub::HandleKeyboardEvent(WidgetKeyboardEvent* aEvent)
switch (aEvent->mMessage) {
case NS_KEY_UP:
case NS_KEY_DOWN:
case NS_KEY_PRESS:
case eKeyPress:
mManager->OnKeyboardEvent();
break;

View File

@ -785,7 +785,7 @@ TouchCaret::HandleEvent(WidgetEvent* aEvent)
break;
case NS_KEY_UP:
case NS_KEY_DOWN:
case NS_KEY_PRESS:
case eKeyPress:
case NS_WHEEL_WHEEL:
case NS_WHEEL_START:
case NS_WHEEL_STOP:

View File

@ -6938,7 +6938,7 @@ PresShell::HandleKeyboardEvent(nsINode* aTarget,
nsEventStatus* aStatus,
EventDispatchingCallback* aEventCB)
{
if (aEvent.mMessage == NS_KEY_PRESS ||
if (aEvent.mMessage == eKeyPress ||
!BeforeAfterKeyboardEventEnabled()) {
EventDispatcher::Dispatch(aTarget, mPresContext,
&aEvent, nullptr, aStatus, aEventCB);
@ -7637,7 +7637,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
NS_IF_RELEASE(gKeyDownTarget);
NS_IF_ADDREF(gKeyDownTarget = eventTarget);
}
else if ((aEvent->mMessage == NS_KEY_PRESS ||
else if ((aEvent->mMessage == eKeyPress ||
aEvent->mMessage == NS_KEY_UP) &&
gKeyDownTarget) {
// If a different element is now focused for the keypress/keyup event
@ -7843,7 +7843,7 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
// XXX How about IME events and input events for plugins?
if (aEvent->mFlags.mIsTrusted) {
switch (aEvent->mMessage) {
case NS_KEY_PRESS:
case eKeyPress:
case NS_KEY_DOWN:
case NS_KEY_UP: {
nsIDocument* doc = GetCurrentEventContent() ?
@ -7978,7 +7978,7 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
}
switch (aEvent->mMessage) {
case NS_KEY_PRESS:
case eKeyPress:
case NS_KEY_DOWN:
case NS_KEY_UP: {
if (aEvent->AsKeyboardEvent()->keyCode == NS_VK_ESCAPE) {

View File

@ -128,7 +128,7 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
// On mac, Return fires the default button, not the focused one.
#ifndef XP_MACOSX
case NS_KEY_PRESS: {
case eKeyPress: {
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
if (!keyEvent) {
break;

View File

@ -394,7 +394,7 @@ nsMenuFrame::HandleEvent(nsPresContext* aPresContext,
bool onmenu = IsOnMenu();
if (aEvent->mMessage == NS_KEY_PRESS && !IsDisabled()) {
if (aEvent->mMessage == eKeyPress && !IsDisabled()) {
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
uint32_t keyCode = keyEvent->keyCode;
#ifdef XP_MACOSX

View File

@ -19,7 +19,7 @@ NS_EVENT_MESSAGE(eWindowEventFirst, 100)
// Widget may be destroyed
NS_EVENT_MESSAGE(eWindowClose, eWindowEventFirst + 1)
NS_EVENT_MESSAGE(NS_KEY_PRESS, eWindowEventFirst + 31)
NS_EVENT_MESSAGE(eKeyPress, eWindowEventFirst + 31)
NS_EVENT_MESSAGE(NS_KEY_UP, eWindowEventFirst + 32)
NS_EVENT_MESSAGE(NS_KEY_DOWN, eWindowEventFirst + 33)

View File

@ -320,14 +320,14 @@ TextEventDispatcher::DispatchKeyboardEventInternal(
uint32_t aIndexOfKeypress)
{
MOZ_ASSERT(aMessage == NS_KEY_DOWN || aMessage == NS_KEY_UP ||
aMessage == NS_KEY_PRESS, "Invalid aMessage value");
aMessage == eKeyPress, "Invalid aMessage value");
nsresult rv = GetState();
if (NS_WARN_IF(NS_FAILED(rv))) {
return false;
}
// If the key shouldn't cause keypress events, don't this patch them.
if (aMessage == NS_KEY_PRESS && !aKeyboardEvent.ShouldCauseKeypressEvents()) {
if (aMessage == eKeyPress && !aKeyboardEvent.ShouldCauseKeypressEvents()) {
return false;
}
@ -336,7 +336,7 @@ TextEventDispatcher::DispatchKeyboardEventInternal(
// However, if we need to behave like other browsers, we need the keydown
// and keyup events. Note that this behavior is also allowed by D3E spec.
// FYI: keypress events must not be fired during composition.
if (!sDispatchKeyEventsDuringComposition || aMessage == NS_KEY_PRESS) {
if (!sDispatchKeyEventsDuringComposition || aMessage == eKeyPress) {
return false;
}
// XXX If there was mOnlyContentDispatch for this case, it might be useful
@ -363,7 +363,7 @@ TextEventDispatcher::DispatchKeyboardEventInternal(
keyEvent.charCode = 0;
} else if (keyEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING) {
MOZ_ASSERT(!aIndexOfKeypress,
"aIndexOfKeypress must be 0 for NS_KEY_PRESS of non-printable key");
"aIndexOfKeypress must be 0 for eKeyPress of non-printable key");
// If keypress event isn't caused by printable key, its charCode should
// be 0.
keyEvent.charCode = 0;
@ -422,7 +422,7 @@ TextEventDispatcher::MaybeDispatchKeypressEvents(
bool consumed = false;
for (size_t i = 0; i < keypressCount; i++) {
aStatus = nsEventStatus_eIgnore;
if (!DispatchKeyboardEventInternal(NS_KEY_PRESS, aKeyboardEvent,
if (!DispatchKeyboardEventInternal(eKeyPress, aKeyboardEvent,
aStatus, aDispatchTo, i)) {
// The widget must have been gone.
break;

View File

@ -205,7 +205,7 @@ public:
*
* @param aMessage Must be NS_KEY_DOWN or NS_KEY_UP.
* Use MaybeDispatchKeypressEvents() for dispatching
* NS_KEY_PRESS.
* eKeyPress.
* @param aKeyboardEvent A keyboard event.
* @param aStatus If dispatching event should be marked as consumed,
* set nsEventStatus_eConsumeNoDefault. Otherwise,
@ -335,8 +335,8 @@ private:
/**
* DispatchKeyboardEventInternal() maybe dispatches aKeyboardEvent.
*
* @param aMessage Must be NS_KEY_DOWN, NS_KEY_UP or NS_KEY_PRESS.
* @param aKeyboardEvent A keyboard event. If aMessage is NS_KEY_PRESS and
* @param aMessage Must be NS_KEY_DOWN, NS_KEY_UP or eKeyPress.
* @param aKeyboardEvent A keyboard event. If aMessage is eKeyPress and
* the event is for second or later character, its
* mKeyValue should be empty string.
* @param aStatus If dispatching event should be marked as consumed,
@ -345,10 +345,10 @@ private:
* a event and it's consumed this returns
* nsEventStatus_eConsumeNoDefault.
* @param aDispatchTo See comments of DispatchTo.
* @param aIndexOfKeypress This must be 0 if aMessage isn't NS_KEY_PRESS or
* @param aIndexOfKeypress This must be 0 if aMessage isn't eKeyPress or
* aKeyboard.mKeyNameIndex isn't
* KEY_NAME_INDEX_USE_STRING. Otherwise, i.e.,
* when an NS_KEY_PRESS event causes inputting
* when an eKeyPress event causes inputting
* text, this must be between 0 and
* mKeyValue.Length() - 1 since keypress events
* sending only one character per event.

View File

@ -120,7 +120,7 @@ WidgetEvent::HasKeyEventMessage() const
{
switch (mMessage) {
case NS_KEY_DOWN:
case NS_KEY_PRESS:
case eKeyPress:
case NS_KEY_UP:
case NS_KEY_BEFORE_DOWN:
case NS_KEY_BEFORE_UP:

View File

@ -1461,7 +1461,7 @@ nsWindow::InitKeyEvent(WidgetKeyboardEvent& event, AndroidGeckoEvent& key,
event.mCodeNameIndex = ConvertAndroidScanCodeToCodeNameIndex(key);
uint32_t domKeyCode = ConvertAndroidKeyCodeToDOMKeyCode(key.KeyCode());
if (event.mMessage == NS_KEY_PRESS) {
if (event.mMessage == eKeyPress) {
// Android gives us \n, so filter out some control characters.
int charCode = key.UnicodeChar();
if (!charCode) {
@ -1500,13 +1500,13 @@ nsWindow::InitKeyEvent(WidgetKeyboardEvent& event, AndroidGeckoEvent& key,
// Note that on Android 4.x, Alt modifier isn't set when the key input
// causes text input even while right Alt key is pressed. However, this
// is necessary for Android 2.3 compatibility.
if (event.mMessage == NS_KEY_PRESS &&
if (event.mMessage == eKeyPress &&
key.UnicodeChar() && key.UnicodeChar() != key.BaseUnicodeChar()) {
event.modifiers &= ~(MODIFIER_ALT | MODIFIER_CONTROL | MODIFIER_META);
}
event.mIsRepeat =
(event.mMessage == NS_KEY_DOWN || event.mMessage == NS_KEY_PRESS) &&
(event.mMessage == NS_KEY_DOWN || event.mMessage == eKeyPress) &&
(!!(key.Flags() & AKEY_EVENT_FLAG_LONG_PRESS) || !!key.RepeatCount());
event.location =
WidgetKeyboardEvent::ComputeLocationFromCodeValue(event.mCodeNameIndex);
@ -1543,7 +1543,7 @@ nsWindow::HandleSpecialKey(AndroidGeckoEvent *ae)
switch (keyCode) {
case AKEYCODE_BACK: {
// XXX Where is the keydown event for this??
WidgetKeyboardEvent pressEvent(true, NS_KEY_PRESS, this);
WidgetKeyboardEvent pressEvent(true, eKeyPress, this);
ANPEvent pluginEvent;
InitKeyEvent(pressEvent, *ae, &pluginEvent);
DispatchEvent(&pressEvent);
@ -1623,7 +1623,7 @@ nsWindow::OnKeyEvent(AndroidGeckoEvent *ae)
return;
}
WidgetKeyboardEvent pressEvent(true, NS_KEY_PRESS, this);
WidgetKeyboardEvent pressEvent(true, eKeyPress, this);
InitKeyEvent(pressEvent, *ae, &pluginEvent);
#ifdef DEBUG_ANDROID_WIDGET
__android_log_print(ANDROID_LOG_INFO, "Gecko", "Dispatching key pressEvent with keyCode %d charCode %d shift %d alt %d sym/ctrl %d metamask %d", pressEvent.keyCode, pressEvent.charCode, pressEvent.IsShift(), pressEvent.IsAlt(), pressEvent.IsControl(), ae->MetaState());

View File

@ -286,7 +286,7 @@ protected:
/**
* InitKeyPressEvent() initializes aKeyEvent for aNativeKeyEvent.
* Don't call this method when aKeyEvent isn't NS_KEY_PRESS.
* Don't call this method when aKeyEvent isn't eKeyPress.
*
* @param aNativeKeyEvent A native key event for which you want to
* dispatch a Gecko key event.
@ -294,7 +294,7 @@ protected:
* event.
* @param aKeyEvent The result -- a Gecko key event initialized
* from the native key event. This must be
* NS_KEY_PRESS event.
* eKeyPress event.
* @param aKbType A native Keyboard Type value. Typically,
* this is a result of ::LMGetKbdType().
*/
@ -1044,7 +1044,7 @@ public:
/**
* Insert the string to content. I.e., this is a text input event handler.
* If this is called during keydown event handling, this may dispatch a
* NS_KEY_PRESS event. If this is called during composition, this commits
* eKeyPress event. If this is called during composition, this commits
* the composition by the aAttrString.
*
* @param aAttrString An inserted string.

View File

@ -228,7 +228,7 @@ GetGeckoKeyEventType(const WidgetEvent& aEvent)
switch (aEvent.mMessage) {
case NS_KEY_DOWN: return "NS_KEY_DOWN";
case NS_KEY_UP: return "NS_KEY_UP";
case NS_KEY_PRESS: return "NS_KEY_PRESS";
case eKeyPress: return "eKeyPress";
default: return "not key event";
}
}
@ -948,7 +948,7 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent,
this, OnOrOff(aKeyEvent.IsShift()), OnOrOff(aKeyEvent.IsControl()),
OnOrOff(aKeyEvent.IsAlt()), OnOrOff(aKeyEvent.IsMeta())));
if (aKeyEvent.mMessage == NS_KEY_PRESS &&
if (aKeyEvent.mMessage == eKeyPress &&
(isPrintableKey || !insertString.IsEmpty())) {
InitKeyPressEvent(aNativeKeyEvent,
insertString.IsEmpty() ? 0 : insertString[0],
@ -1038,8 +1038,8 @@ TISInputSourceWrapper::InitKeyPressEvent(NSEvent *aNativeKeyEvent,
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
NS_ASSERTION(aKeyEvent.mMessage == NS_KEY_PRESS,
"aKeyEvent must be NS_KEY_PRESS event");
NS_ASSERTION(aKeyEvent.mMessage == eKeyPress,
"aKeyEvent must be eKeyPress event");
if (MOZ_LOG_TEST(gLog, LogLevel::Info)) {
nsAutoString chars;
@ -1597,7 +1597,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent)
if (currentKeyEvent->CanDispatchKeyPressEvent() &&
!wasComposing && !IsIMEComposing()) {
WidgetKeyboardEvent keypressEvent(true, NS_KEY_PRESS, mWidget);
WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
InitKeyEvent(aNativeEvent, keypressEvent);
// If we called interpretKeyEvents and this isn't normal character input
@ -2130,7 +2130,7 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString,
}
// Dispatch keypress event with char instead of compositionchange event
WidgetKeyboardEvent keypressEvent(true, NS_KEY_PRESS, mWidget);
WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
keypressEvent.isChar = IsPrintableChar(str.CharAt(0));
// Don't set other modifiers from the current event, because here in
@ -2193,7 +2193,7 @@ TextInputHandler::DoCommandBySelector(const char* aSelector)
TrueOrFalse(currentKeyEvent->mCausedOtherKeyEvents) : "N/A"));
if (currentKeyEvent && currentKeyEvent->CanDispatchKeyPressEvent()) {
WidgetKeyboardEvent keypressEvent(true, NS_KEY_PRESS, mWidget);
WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
InitKeyEvent(currentKeyEvent->mKeyEvent, keypressEvent);
currentKeyEvent->mKeyPressHandled = DispatchEvent(keypressEvent);
currentKeyEvent->mKeyPressDispatched = true;
@ -3777,7 +3777,7 @@ TextInputHandlerBase::OnDestroyWidget(nsChildView* aDestroyingWidget)
bool
TextInputHandlerBase::DispatchEvent(WidgetGUIEvent& aEvent)
{
if (aEvent.mMessage == NS_KEY_PRESS) {
if (aEvent.mMessage == eKeyPress) {
WidgetInputEvent& inputEvent = *aEvent.AsInputEvent();
if (!inputEvent.IsMeta()) {
MOZ_LOG(gLog, LogLevel::Info,

View File

@ -297,7 +297,7 @@ nsEventStatus
KeyEventDispatcher::DispatchKeyEventInternal(EventMessage aEventMessage)
{
WidgetKeyboardEvent event(true, aEventMessage, nullptr);
if (aEventMessage == NS_KEY_PRESS) {
if (aEventMessage == eKeyPress) {
// XXX If the charCode is not a printable character, the charCode
// should be computed without Ctrl/Alt/Meta modifiers.
event.charCode = static_cast<uint32_t>(mChar);
@ -343,7 +343,7 @@ KeyEventDispatcher::DispatchKeyDownEvent()
{
nsEventStatus status = DispatchKeyEventInternal(NS_KEY_DOWN);
if (status != nsEventStatus_eConsumeNoDefault) {
DispatchKeyEventInternal(NS_KEY_PRESS);
DispatchKeyEventInternal(eKeyPress);
}
}

View File

@ -984,12 +984,12 @@ KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
aGdkKeyEvent->hardware_keycode,
GetBoolName(aGdkKeyEvent->is_modifier),
((aKeyEvent.mMessage == NS_KEY_DOWN) ? "NS_KEY_DOWN" :
(aKeyEvent.mMessage == NS_KEY_PRESS) ? "NS_KEY_PRESS" :
"NS_KEY_UP"),
(aKeyEvent.mMessage == eKeyPress) ? "eKeyPress" :
"NS_KEY_UP"),
GetBoolName(aKeyEvent.IsShift()), GetBoolName(aKeyEvent.IsControl()),
GetBoolName(aKeyEvent.IsAlt()), GetBoolName(aKeyEvent.IsMeta())));
if (aKeyEvent.mMessage == NS_KEY_PRESS) {
if (aKeyEvent.mMessage == eKeyPress) {
keymapWrapper->InitKeypressEvent(aKeyEvent, aGdkKeyEvent);
}
@ -1323,7 +1323,7 @@ void
KeymapWrapper::InitKeypressEvent(WidgetKeyboardEvent& aKeyEvent,
GdkEventKey* aGdkKeyEvent)
{
NS_ENSURE_TRUE_VOID(aKeyEvent.mMessage == NS_KEY_PRESS);
NS_ENSURE_TRUE_VOID(aKeyEvent.mMessage == eKeyPress);
aKeyEvent.charCode = GetCharCodeFor(aGdkKeyEvent);
if (!aKeyEvent.charCode) {

View File

@ -333,7 +333,7 @@ protected:
* InitKeypressEvent() intializes keyCode, charCode and
* alternativeCharCodes of keypress event.
*
* @param aKeyEvent An NS_KEY_PRESS event, must not be nullptr.
* @param aKeyEvent An eKeyPress event, must not be nullptr.
* The modifier related members and keyCode must
* be initialized already.
* @param aGdkKeyEvent A native key event which causes dispatching

View File

@ -3008,8 +3008,8 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent)
}
}
// Don't pass modifiers as NS_KEY_PRESS events.
// TODO: Instead of selectively excluding some keys from NS_KEY_PRESS events,
// Don't pass modifiers as eKeyPress events.
// TODO: Instead of selectively excluding some keys from eKeyPress events,
// we should instead selectively include (as per MSDN spec; no official
// spec covers KeyPress events).
if (!KeymapWrapper::IsKeyPressEventNecessary(aEvent)) {
@ -3052,7 +3052,7 @@ nsWindow::OnKeyPressEvent(GdkEventKey *aEvent)
#endif /* ! AIX */
#endif /* MOZ_X11 */
WidgetKeyboardEvent event(true, NS_KEY_PRESS, this);
WidgetKeyboardEvent event(true, eKeyPress, this);
KeymapWrapper::InitKeyEvent(event, aEvent);
// before we dispatch a key, check if it's the context menu key.

View File

@ -2645,7 +2645,7 @@ case _value: eventName.AssignLiteral(_name) ; break
_ASSIGN_eventName(NS_IMAGE_ABORT,"NS_IMAGE_ABORT");
_ASSIGN_eventName(NS_LOAD_ERROR,"NS_LOAD_ERROR");
_ASSIGN_eventName(NS_KEY_DOWN,"NS_KEY_DOWN");
_ASSIGN_eventName(NS_KEY_PRESS,"NS_KEY_PRESS");
_ASSIGN_eventName(eKeyPress,"eKeyPress");
_ASSIGN_eventName(NS_KEY_UP,"NS_KEY_UP");
_ASSIGN_eventName(NS_MOUSE_ENTER_WIDGET,"NS_MOUSE_ENTER_WIDGET");
_ASSIGN_eventName(NS_MOUSE_EXIT_WIDGET,"NS_MOUSE_EXIT_WIDGET");

View File

@ -1100,7 +1100,7 @@ InitKeyEvent(WidgetKeyboardEvent& aEvent, QKeyEvent* aQEvent)
aQEvent->modifiers() & Qt::MetaModifier);
aEvent.mIsRepeat =
(aEvent.mMessage == NS_KEY_DOWN || aEvent.mMessage == NS_KEY_PRESS) &&
(aEvent.mMessage == NS_KEY_DOWN || aEvent.mMessage == eKeyPress) &&
aQEvent->isAutoRepeat();
aEvent.time = 0;
@ -1173,8 +1173,8 @@ nsWindow::keyPressEvent(QKeyEvent* aEvent)
}
}
// Don't pass modifiers as NS_KEY_PRESS events.
// Instead of selectively excluding some keys from NS_KEY_PRESS events,
// Don't pass modifiers as eKeyPress events.
// Instead of selectively excluding some keys from eKeyPress events,
// we instead selectively include (as per MSDN spec
// ( http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keypress%28VS.71%29.aspx );
// no official spec covers KeyPress events).
@ -1224,7 +1224,7 @@ nsWindow::keyPressEvent(QKeyEvent* aEvent)
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_UNDO);
}
WidgetKeyboardEvent event(true, NS_KEY_PRESS, this);
WidgetKeyboardEvent event(true, eKeyPress, this);
InitKeyEvent(event, aEvent);
// Seend the key press event
return DispatchEvent(&event);

View File

@ -1160,7 +1160,7 @@ NativeKey::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
aKeyEvent.mFlags.mDefaultPrevented =
(mOriginalVirtualKeyCode == VK_MENU && mMsg.message != WM_SYSKEYUP);
break;
case NS_KEY_PRESS:
case eKeyPress:
aKeyEvent.mUniqueId = sUniqueKeyEventId;
break;
default:
@ -1572,7 +1572,7 @@ NativeKey::HandleCharMessage(const MSG& aCharMsg,
mModKeyState.IsAltGr() ||
(mOriginalVirtualKeyCode &&
!KeyboardLayout::IsPrintableCharKey(mOriginalVirtualKeyCode))) {
WidgetKeyboardEvent keypressEvent(true, NS_KEY_PRESS, mWidget);
WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
if (aCharMsg.wParam >= U_SPACE) {
keypressEvent.charCode = static_cast<uint32_t>(aCharMsg.wParam);
} else {
@ -1636,7 +1636,7 @@ NativeKey::HandleCharMessage(const MSG& aCharMsg,
uniChar = towlower(uniChar);
}
WidgetKeyboardEvent keypressEvent(true, NS_KEY_PRESS, mWidget);
WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
keypressEvent.charCode = uniChar;
if (!keypressEvent.charCode) {
keypressEvent.keyCode = mDOMKeyCode;
@ -2106,7 +2106,7 @@ NativeKey::DispatchKeyPressEventsWithKeyboardLayout() const
if (inputtingChars.IsEmpty() &&
shiftedChars.IsEmpty() && unshiftedChars.IsEmpty()) {
WidgetKeyboardEvent keypressEvent(true, NS_KEY_PRESS, mWidget);
WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
keypressEvent.keyCode = mDOMKeyCode;
InitKeyEvent(keypressEvent, mModKeyState);
return DispatchKeyEvent(keypressEvent);
@ -2176,7 +2176,7 @@ NativeKey::DispatchKeyPressEventsWithKeyboardLayout() const
}
}
WidgetKeyboardEvent keypressEvent(true, NS_KEY_PRESS, mWidget);
WidgetKeyboardEvent keypressEvent(true, eKeyPress, mWidget);
keypressEvent.charCode = uniChar;
keypressEvent.alternativeCharCodes.AppendElements(altArray);
InitKeyEvent(keypressEvent, modKeyState);