зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1379448 - ContentCacheInParent::FlushPendingNotifications() should do nothing if aWidget is nullptr r=m_kato
Due to the fix of bug 1376424, ContentCacheInParent::FlushPendingNotifications() may be called when aWidget is nullptr. In this case, it doesn't need to do anything. So, it should ignore the call. MozReview-Commit-ID: Fj3J76v6Xuk --HG-- extra : rebase_source : 18c722628a3ae8fa50beca3908d5e732cec404d9
This commit is contained in:
Родитель
728dbbc41f
Коммит
f303a1f631
|
@ -1351,28 +1351,34 @@ ContentCacheInParent::FlushPendingNotifications(nsIWidget* aWidget)
|
|||
{
|
||||
MOZ_ASSERT(!mPendingEventsNeedingAck);
|
||||
|
||||
// If the TabParent's widget has already gone, this can do nothing since
|
||||
// widget is necessary to notify IME of something.
|
||||
if (!aWidget) {
|
||||
return;
|
||||
}
|
||||
|
||||
// New notifications which are notified during flushing pending notifications
|
||||
// should be merged again.
|
||||
mPendingEventsNeedingAck++;
|
||||
|
||||
nsCOMPtr<nsIWidget> kungFuDeathGrip(aWidget);
|
||||
nsCOMPtr<nsIWidget> widget = aWidget;
|
||||
|
||||
// First, text change notification should be sent because selection change
|
||||
// notification notifies IME of current selection range in the latest content.
|
||||
// So, IME may need the latest content before that.
|
||||
if (mPendingTextChange.HasNotification()) {
|
||||
IMENotification notification(mPendingTextChange);
|
||||
if (!aWidget->Destroyed()) {
|
||||
if (!widget->Destroyed()) {
|
||||
mPendingTextChange.Clear();
|
||||
IMEStateManager::NotifyIME(notification, aWidget, &mTabParent);
|
||||
IMEStateManager::NotifyIME(notification, widget, &mTabParent);
|
||||
}
|
||||
}
|
||||
|
||||
if (mPendingSelectionChange.HasNotification()) {
|
||||
IMENotification notification(mPendingSelectionChange);
|
||||
if (!aWidget->Destroyed()) {
|
||||
if (!widget->Destroyed()) {
|
||||
mPendingSelectionChange.Clear();
|
||||
IMEStateManager::NotifyIME(notification, aWidget, &mTabParent);
|
||||
IMEStateManager::NotifyIME(notification, widget, &mTabParent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1380,9 +1386,9 @@ ContentCacheInParent::FlushPendingNotifications(nsIWidget* aWidget)
|
|||
// notification because IME may want to query position of new caret position.
|
||||
if (mPendingLayoutChange.HasNotification()) {
|
||||
IMENotification notification(mPendingLayoutChange);
|
||||
if (!aWidget->Destroyed()) {
|
||||
if (!widget->Destroyed()) {
|
||||
mPendingLayoutChange.Clear();
|
||||
IMEStateManager::NotifyIME(notification, aWidget, &mTabParent);
|
||||
IMEStateManager::NotifyIME(notification, widget, &mTabParent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1390,18 +1396,18 @@ ContentCacheInParent::FlushPendingNotifications(nsIWidget* aWidget)
|
|||
// finishing handling whole sending events.
|
||||
if (mPendingCompositionUpdate.HasNotification()) {
|
||||
IMENotification notification(mPendingCompositionUpdate);
|
||||
if (!aWidget->Destroyed()) {
|
||||
if (!widget->Destroyed()) {
|
||||
mPendingCompositionUpdate.Clear();
|
||||
IMEStateManager::NotifyIME(notification, aWidget, &mTabParent);
|
||||
IMEStateManager::NotifyIME(notification, widget, &mTabParent);
|
||||
}
|
||||
}
|
||||
|
||||
if (!--mPendingEventsNeedingAck && !aWidget->Destroyed() &&
|
||||
if (!--mPendingEventsNeedingAck && !widget->Destroyed() &&
|
||||
(mPendingTextChange.HasNotification() ||
|
||||
mPendingSelectionChange.HasNotification() ||
|
||||
mPendingLayoutChange.HasNotification() ||
|
||||
mPendingCompositionUpdate.HasNotification())) {
|
||||
FlushPendingNotifications(aWidget);
|
||||
FlushPendingNotifications(widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче