author | Masayuki Nakano <masayuki@d-toybox.com> |
Wed, 22 Jul 2015 14:15:06 +0900 | |
changeset 287387 | d75fd3b93ae8be1e704f3d24cc4100f8d93973da |
parent 287386 | 2ab28c08a7744aeeddbd2255dbc7d2a87c21106e |
child 287388 | 0a0292a63ef041a3655638cc5e0204946c523813 |
push id | 934 |
push user | raliiev@mozilla.com |
push date | Mon, 26 Oct 2015 12:58:05 +0000 |
treeherder | mozilla-release@05704e35c1d0 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smaug |
bugs | 1184986 |
milestone | 42.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -2088,17 +2088,17 @@ TabParent::RecvNotifyIMEPositionChange(c return true; } mContentCache.AssignContent(aContentCache, &aIMENotification); const nsIMEUpdatePreference updatePreference = widget->GetIMEUpdatePreference(); if (updatePreference.WantPositionChanged()) { - IMEStateManager::NotifyIME(aIMENotification, widget, true); + mContentCache.MaybeNotifyIME(widget, aIMENotification); } return true; } bool TabParent::RecvOnEventNeedingAckReceived(const uint32_t& aMessage) { // This is called when the child process receives WidgetCompositionEvent or
--- a/widget/ContentCache.cpp +++ b/widget/ContentCache.cpp @@ -969,16 +969,19 @@ ContentCacheInParent::MaybeNotifyIME(nsI switch (aNotification.mMessage) { case NOTIFY_IME_OF_SELECTION_CHANGE: mPendingSelectionChange.MergeWith(aNotification); break; case NOTIFY_IME_OF_TEXT_CHANGE: mPendingTextChange.MergeWith(aNotification); break; + case NOTIFY_IME_OF_POSITION_CHANGE: + mPendingLayoutChange.MergeWith(aNotification); + break; case NOTIFY_IME_OF_COMPOSITION_UPDATE: mPendingCompositionUpdate.MergeWith(aNotification); break; default: MOZ_CRASH("Unsupported notification"); break; } } @@ -1008,29 +1011,40 @@ ContentCacheInParent::FlushPendingNotifi if (mPendingSelectionChange.HasNotification()) { IMENotification notification(mPendingSelectionChange); if (!aWidget->Destroyed()) { mPendingSelectionChange.Clear(); IMEStateManager::NotifyIME(notification, aWidget, true); } } + // Layout change notification should be notified after selection change + // notification because IME may want to query position of new caret position. + if (mPendingLayoutChange.HasNotification()) { + IMENotification notification(mPendingLayoutChange); + if (!aWidget->Destroyed()) { + mPendingLayoutChange.Clear(); + IMEStateManager::NotifyIME(notification, aWidget, true); + } + } + // Finally, send composition update notification because it notifies IME of // finishing handling whole sending events. if (mPendingCompositionUpdate.HasNotification()) { IMENotification notification(mPendingCompositionUpdate); if (!aWidget->Destroyed()) { mPendingCompositionUpdate.Clear(); IMEStateManager::NotifyIME(notification, aWidget, true); } } if (!--mPendingEventsNeedingAck && !aWidget->Destroyed() && (mPendingTextChange.HasNotification() || mPendingSelectionChange.HasNotification() || + mPendingLayoutChange.HasNotification() || mPendingCompositionUpdate.HasNotification())) { FlushPendingNotifications(aWidget); } } /***************************************************************************** * mozilla::ContentCache::TextRectArray *****************************************************************************/
--- a/widget/ContentCache.h +++ b/widget/ContentCache.h @@ -348,16 +348,17 @@ public: * and flush it later. */ void MaybeNotifyIME(nsIWidget* aWidget, const IMENotification& aNotification); private: IMENotification mPendingSelectionChange; IMENotification mPendingTextChange; + IMENotification mPendingLayoutChange; IMENotification mPendingCompositionUpdate; // This is commit string which is caused by our request. nsString mCommitStringByRequest; // Start offset of the composition string. uint32_t mCompositionStart; // Count of composition events during requesting commit or cancel the // composition.
--- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -719,18 +719,19 @@ struct IMENotification final mSelectionChangeData.mCausedBySelectionEvent && aNotification.mSelectionChangeData.mCausedBySelectionEvent; } break; case NOTIFY_IME_OF_TEXT_CHANGE: MOZ_ASSERT(aNotification.mMessage == NOTIFY_IME_OF_TEXT_CHANGE); mTextChangeData += aNotification.mTextChangeData; break; + case NOTIFY_IME_OF_POSITION_CHANGE: case NOTIFY_IME_OF_COMPOSITION_UPDATE: - MOZ_ASSERT(aNotification.mMessage == NOTIFY_IME_OF_COMPOSITION_UPDATE); + MOZ_ASSERT(aNotification.mMessage == mMessage); break; default: MOZ_CRASH("Merging notification isn't supported"); break; } } IMEMessage mMessage;