bool TextEventDispatcher::DispatchKeyboardEvent( uint32_t aMessage, const WidgetKeyboardEvent& aKeyboardEvent, nsEventStatus& aStatus) { return DispatchKeyboardEventInternal(aMessage, aKeyboardEvent, aStatus); }
bool TextEventDispatcher::DispatchKeyboardEvent( EventMessage aMessage, const WidgetKeyboardEvent& aKeyboardEvent, nsEventStatus& aStatus, DispatchTo aDispatchTo) { return DispatchKeyboardEventInternal(aMessage, aKeyboardEvent, aStatus, aDispatchTo); }
bool TextEventDispatcher::MaybeDispatchKeypressEvents( const WidgetKeyboardEvent& aKeyboardEvent, nsEventStatus& aStatus, DispatchTo aDispatchTo) { // If the key event was consumed, keypress event shouldn't be fired. if (aStatus == nsEventStatus_eConsumeNoDefault) { return false; } // 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., // if the key is a printable key and inputs multiple characters, keypress // event should be dispatched the count of inputting characters times. size_t keypressCount = aKeyboardEvent.mKeyNameIndex != KEY_NAME_INDEX_USE_STRING ? 1 : std::max(static_cast<nsAString::size_type>(1), aKeyboardEvent.mKeyValue.Length()); bool isDispatched = false; bool consumed = false; for (size_t i = 0; i < keypressCount; i++) { aStatus = nsEventStatus_eIgnore; if (!DispatchKeyboardEventInternal(eKeyPress, aKeyboardEvent, aStatus, aDispatchTo, i)) { // The widget must have been gone. break; } isDispatched = true; if (!consumed) { consumed = (aStatus == nsEventStatus_eConsumeNoDefault); } } // If one of the keypress event was consumed, return ConsumeNoDefault. if (consumed) { aStatus = nsEventStatus_eConsumeNoDefault; } return isDispatched; }