Bug 1203381 part.4 IMENotificationSender should keep the order of notifications even when a notification causes another change r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 16 Sep 2015 17:48:24 +0900
changeset 262774 b746528338faee9e02fb8cafbea661387fd848e1
parent 262773 11944d579d682697ed8ec9a3dd721c2280d29c99
child 262775 3a37db144dcd1f23d0d8d87c3f48a7fb94f27fed
push id29381
push userkwierso@gmail.com
push dateWed, 16 Sep 2015 17:53:22 +0000
treeherdermozilla-central@3618c94059d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1203381
milestone43.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
Bug 1203381 part.4 IMENotificationSender should keep the order of notifications even when a notification causes another change r=smaug
dom/events/IMEContentObserver.cpp
--- a/dom/events/IMEContentObserver.cpp
+++ b/dom/events/IMEContentObserver.cpp
@@ -1290,27 +1290,38 @@ IMEContentObserver::IMENotificationSende
     return NS_OK;
   }
 
   if (mIMEContentObserver->mIsTextChangeEventPending) {
     mIMEContentObserver->mIsTextChangeEventPending = false;
     SendTextChange();
   }
 
-  // Be aware, PuppetWidget depends on the order of this. A selection change
-  // notification should not be sent before a text change notification because
-  // PuppetWidget shouldn't query new text content every selection change.
-  if (mIMEContentObserver->mIsSelectionChangeEventPending) {
-    mIMEContentObserver->mIsSelectionChangeEventPending = false;
-    SendSelectionChange();
+  // If a text change notification causes another text change again, we should
+  // notify IME of that before sending a selection change notification.
+  if (!mIMEContentObserver->mIsTextChangeEventPending) {
+    // Be aware, PuppetWidget depends on the order of this. A selection change
+    // notification should not be sent before a text change notification because
+    // PuppetWidget shouldn't query new text content every selection change.
+    if (mIMEContentObserver->mIsSelectionChangeEventPending) {
+      mIMEContentObserver->mIsSelectionChangeEventPending = false;
+      SendSelectionChange();
+    }
   }
 
-  if (mIMEContentObserver->mIsPositionChangeEventPending) {
-    mIMEContentObserver->mIsPositionChangeEventPending = false;
-    SendPositionChange();
+  // If a text change notification causes another text change again or a
+  // selection change notification causes either a text change or another
+  // selection change, we should notify IME of those before sending a position
+  // change notification.
+  if (!mIMEContentObserver->mIsTextChangeEventPending &&
+      !mIMEContentObserver->mIsSelectionChangeEventPending) {
+    if (mIMEContentObserver->mIsPositionChangeEventPending) {
+      mIMEContentObserver->mIsPositionChangeEventPending = false;
+      SendPositionChange();
+    }
   }
 
   // If notifications caused some new change, we should notify them now.
   mIMEContentObserver->mIsFlushingPendingNotifications =
     mIMEContentObserver->NeedsToNotifyIMEOfSomething();
   if (mIMEContentObserver->mIsFlushingPendingNotifications) {
     MOZ_LOG(sIMECOLog, LogLevel::Debug,
       ("IMECO: 0x%p IMEContentObserver::IMENotificationSender::Run(), "