Bug 1137561 part.5 TextEventDispatcher should decide if keypress events should be fired for specific keys r=m_kato
This commit is contained in:
@@ -527,6 +527,11 @@ TextEventDispatcher::MaybeDispatchKeypressEvents(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the key shouldn't cause keypress events, don't fire them.
|
||||||
|
if (!aKeyboardEvent.ShouldCauseKeypressEvents()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// If the key isn't a printable key or just inputting one character or
|
// If the key isn't a printable key or just inputting one character or
|
||||||
// no character, we should dispatch only one keypress. Otherwise, i.e.,
|
// no character, we should dispatch only one keypress. Otherwise, i.e.,
|
||||||
// if the key is a printable key and inputs multiple characters, keypress
|
// if the key is a printable key and inputs multiple characters, keypress
|
||||||
|
|||||||
@@ -1514,18 +1514,6 @@ NativeKey::HandleKeyDownMessage(bool* aEventDispatched) const
|
|||||||
return defaultPrevented;
|
return defaultPrevented;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't dispatch keypress event for modifier keys.
|
|
||||||
switch (mDOMKeyCode) {
|
|
||||||
case NS_VK_SHIFT:
|
|
||||||
case NS_VK_CONTROL:
|
|
||||||
case NS_VK_ALT:
|
|
||||||
case NS_VK_CAPS_LOCK:
|
|
||||||
case NS_VK_NUM_LOCK:
|
|
||||||
case NS_VK_SCROLL_LOCK:
|
|
||||||
case NS_VK_WIN:
|
|
||||||
return defaultPrevented;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defaultPrevented) {
|
if (defaultPrevented) {
|
||||||
DispatchPluginEventsAndDiscardsCharMessages();
|
DispatchPluginEventsAndDiscardsCharMessages();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user