зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1119133 Implement TextEventDispatcher::EndInputTransaction() for ensuring TextEventDispatcher forgets the link with TextInputProcessor r=smaug
This commit is contained in:
Родитель
18469c2ba5
Коммит
87e3205abe
|
@ -186,7 +186,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);
|
||||
|
|
|
@ -83,6 +83,26 @@ TextEventDispatcher::BeginInputTransactionInternal(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
TextEventDispatcher::EndInputTransaction(TextEventDispatcherListener* aListener)
|
||||
{
|
||||
if (NS_WARN_IF(IsComposing()) || NS_WARN_IF(IsDispatchingEvent())) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<TextEventDispatcherListener> listener = do_QueryReferent(mListener);
|
||||
if (NS_WARN_IF(!listener)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(listener != aListener)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mListener = nullptr;
|
||||
listener->OnRemovedFrom(this);
|
||||
}
|
||||
|
||||
void
|
||||
TextEventDispatcher::OnDestroyWidget()
|
||||
{
|
||||
|
|
|
@ -59,6 +59,14 @@ public:
|
|||
nsresult BeginInputTransactionForTests(
|
||||
TextEventDispatcherListener* aListener);
|
||||
|
||||
/**
|
||||
* EndInputTransaction() should be called when the listener stops using
|
||||
* the TextEventDispatcher.
|
||||
*
|
||||
* @param aListener The listener using the TextEventDispatcher instance.
|
||||
*/
|
||||
void EndInputTransaction(TextEventDispatcherListener* aListener);
|
||||
|
||||
/**
|
||||
* OnDestroyWidget() is called when mWidget is being destroyed.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче