mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1112212 - Add may-have flags for key event and input event listeners; r=smaug
This commit is contained in:
parent
3a859201f0
commit
3e6ccc7c35
@ -101,6 +101,8 @@ EventListenerManager::EventListenerManager(EventTarget* aTarget)
|
||||
, mMayHaveScrollWheelEventListener(false)
|
||||
, mMayHaveMouseEnterLeaveEventListener(false)
|
||||
, mMayHavePointerEnterLeaveEventListener(false)
|
||||
, mMayHaveKeyEventListener(false)
|
||||
, mMayHaveInputOrCompositionEventListener(false)
|
||||
, mClearingListeners(false)
|
||||
, mIsMainThreadELM(NS_IsMainThread())
|
||||
, mNoListenerForEvent(0)
|
||||
@ -386,7 +388,21 @@ EventListenerManager::AddEventListenerInternal(
|
||||
window->SetHasGamepadEventListener();
|
||||
}
|
||||
#endif
|
||||
} else if (aTypeAtom == nsGkAtoms::onkeydown ||
|
||||
aTypeAtom == nsGkAtoms::onkeypress ||
|
||||
aTypeAtom == nsGkAtoms::onkeyup) {
|
||||
if (!aFlags.mInSystemGroup) {
|
||||
mMayHaveKeyEventListener = true;
|
||||
}
|
||||
} else if (aTypeAtom == nsGkAtoms::oncompositionend ||
|
||||
aTypeAtom == nsGkAtoms::oncompositionstart ||
|
||||
aTypeAtom == nsGkAtoms::oncompositionupdate ||
|
||||
aTypeAtom == nsGkAtoms::oninput) {
|
||||
if (!aFlags.mInSystemGroup) {
|
||||
mMayHaveInputOrCompositionEventListener = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (aTypeAtom && mTarget) {
|
||||
mTarget->EventListenerAdded(aTypeAtom);
|
||||
}
|
||||
|
@ -403,6 +403,19 @@ public:
|
||||
bool MayHaveMouseEnterLeaveEventListener() { return mMayHaveMouseEnterLeaveEventListener; }
|
||||
bool MayHavePointerEnterLeaveEventListener() { return mMayHavePointerEnterLeaveEventListener; }
|
||||
|
||||
/**
|
||||
* Returns true if there may be a key event listener (keydown, keypress,
|
||||
* or keyup) registered, or false if there definitely isn't.
|
||||
*/
|
||||
bool MayHaveKeyEventListener() { return mMayHaveKeyEventListener; }
|
||||
|
||||
/**
|
||||
* Returns true if there may be an advanced input event listener (input,
|
||||
* compositionstart, compositionupdate, or compositionend) registered,
|
||||
* or false if there definitely isn't.
|
||||
*/
|
||||
bool MayHaveInputOrCompositionEventListener() { return mMayHaveInputOrCompositionEventListener; }
|
||||
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
uint32_t ListenerCount() const
|
||||
@ -553,9 +566,11 @@ protected:
|
||||
uint32_t mMayHaveScrollWheelEventListener : 1;
|
||||
uint32_t mMayHaveMouseEnterLeaveEventListener : 1;
|
||||
uint32_t mMayHavePointerEnterLeaveEventListener : 1;
|
||||
uint32_t mMayHaveKeyEventListener : 1;
|
||||
uint32_t mMayHaveInputOrCompositionEventListener : 1;
|
||||
uint32_t mClearingListeners : 1;
|
||||
uint32_t mIsMainThreadELM : 1;
|
||||
uint32_t mNoListenerForEvent : 23;
|
||||
uint32_t mNoListenerForEvent : 20;
|
||||
|
||||
nsAutoTObserverArray<Listener, 2> mListeners;
|
||||
dom::EventTarget* mTarget; // WEAK
|
||||
|
Loading…
Reference in New Issue
Block a user