Bug 960877 - Part 2. Remove mWantHints from nsIMEUpdatePreference. r=masayuki
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 29 Jan 2014 18:32:35 +0900
changeset 181755 9f52cf83ac724e32691e34b34579d7c8bb2f83a7
parent 181754 68444ba6d0a0a1149f4903ba1510f1f80e6ba0a0
child 181756 40db7da176c2165af7e34340c39970f81e00460d
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs960877
milestone29.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 960877 - Part 2. Remove mWantHints from nsIMEUpdatePreference. r=masayuki
dom/ipc/PBrowser.ipdl
dom/ipc/TabParent.cpp
widget/android/nsWindow.cpp
widget/cocoa/nsChildView.mm
widget/nsGUIEventIPC.h
widget/nsIWidget.h
widget/windows/nsTextStore.cpp
widget/xpwidgets/PuppetWidget.cpp
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -147,17 +147,16 @@ parent:
      *  seqno        Current seqno value on the content side
      *  anchor       Offset where the selection started
      *  focus        Offset where the caret is
      */
     NotifyIMESelection(uint32_t seqno, uint32_t anchor, uint32_t focus);
 
     /**
      * Notifies chrome to refresh its text cache 
-     * Only called when NotifyIMEFocus returns PR_TRUE for mWantHints
      *
      *  text         The entire content of the text field
      */
     NotifyIMETextHint(nsString text);
 
     /**
      * Instructs chrome to end any pending composition
      *
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1014,17 +1014,16 @@ TabParent::RecvHideTooltip()
 bool
 TabParent::RecvNotifyIMEFocus(const bool& aFocus,
                               nsIMEUpdatePreference* aPreference,
                               uint32_t* aSeqno)
 {
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) {
     aPreference->mWantUpdates = nsIMEUpdatePreference::NOTIFY_NOTHING;
-    aPreference->mWantHints = false;
     return true;
   }
 
   *aSeqno = mIMESeqno;
   mIMETabParent = aFocus ? this : nullptr;
   mIMESelectionAnchor = 0;
   mIMESelectionFocus = 0;
   widget->NotifyIME(aFocus ? NOTIFY_IME_OF_FOCUS : NOTIFY_IME_OF_BLUR);
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2343,17 +2343,17 @@ nsWindow::NotifyIMEOfTextChange(uint32_t
     return NS_OK;
 }
 
 nsIMEUpdatePreference
 nsWindow::GetIMEUpdatePreference()
 {
     int8_t notifications = (nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE |
                             nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE);
-    return nsIMEUpdatePreference(notifications, true);
+    return nsIMEUpdatePreference(notifications);
 }
 
 void
 nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect)
 {
     JNIEnv *env = GetJNIForThread();
 
     AutoLocalJNIFrame jniFrame(env);
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1967,18 +1967,17 @@ nsChildView::GetInputContext()
     mInputContext.mNativeIMEContext = this;
   }
   return mInputContext;
 }
 
 nsIMEUpdatePreference
 nsChildView::GetIMEUpdatePreference()
 {
-  return nsIMEUpdatePreference(nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE,
-                               false);
+  return nsIMEUpdatePreference(nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE);
 }
 
 NS_IMETHODIMP nsChildView::GetToggledKeyState(uint32_t aKeyCode,
                                               bool* aLEDState)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   NS_ENSURE_ARG_POINTER(aLEDState);
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -517,23 +517,21 @@ struct ParamTraits<mozilla::WidgetSelect
 template<>
 struct ParamTraits<nsIMEUpdatePreference>
 {
   typedef nsIMEUpdatePreference paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, aParam.mWantUpdates);
-    WriteParam(aMsg, aParam.mWantHints);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
-    return ReadParam(aMsg, aIter, &aResult->mWantUpdates) &&
-           ReadParam(aMsg, aIter, &aResult->mWantHints);
+    return ReadParam(aMsg, aIter, &aResult->mWantUpdates);
   }
 };
 
 template<>
 struct ParamTraits<mozilla::WidgetPluginEvent>
 {
   typedef mozilla::WidgetPluginEvent paramType;
 
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -211,42 +211,35 @@ enum nsTopLevelWidgetZPlacement { // for
  * and/or nsIWidget::NotifyIME(NOTIFY_IME_OF_SELECTION_CHANGE).
  * Please note that the text change observing cost is very expensive especially
  * on an HTML editor has focus.
  * If the IME implementation on a particular platform doesn't care about
  * NotifyIMEOfTextChange() and/or NotifyIME(NOTIFY_IME_OF_SELECTION_CHANGE),
  * they should set mWantUpdates to NOTIFY_NOTHING to avoid the cost.
  * If the IME implementation needs notifications even while our process is
  * deactive, it should also set NOTIFY_DURING_DEACTIVE.
- *
- * If mWantHints is true, PuppetWidget will forward the content of text fields
- * to the chrome process to be cached. This way we return the cached content
- * during query events. (see comments in bug 583976). This only makes sense
- * for IME implementations that do use query events, otherwise there's a
- * significant overhead. Platforms that don't use query events should set
- * mWantHints to false.
  */
 struct nsIMEUpdatePreference {
 
   typedef uint8_t Notifications;
 
   enum
   {
     NOTIFY_NOTHING           = 0x00,
     NOTIFY_SELECTION_CHANGE  = 0x01,
     NOTIFY_TEXT_CHANGE       = 0x02,
     NOTIFY_DURING_DEACTIVE   = 0x80
   };
 
   nsIMEUpdatePreference()
-    : mWantUpdates(NOTIFY_NOTHING), mWantHints(false)
+    : mWantUpdates(NOTIFY_NOTHING)
   {
   }
-  nsIMEUpdatePreference(Notifications aWantUpdates, bool aWantHints)
-    : mWantUpdates(aWantUpdates), mWantHints(aWantHints)
+  nsIMEUpdatePreference(Notifications aWantUpdates)
+    : mWantUpdates(aWantUpdates)
   {
   }
 
   bool WantSelectionChange() const
   {
     return !!(mWantUpdates & NOTIFY_SELECTION_CHANGE);
   }
 
@@ -256,17 +249,16 @@ struct nsIMEUpdatePreference {
   }
 
   bool WantDuringDeactive() const
   {
     return !!(mWantUpdates & NOTIFY_DURING_DEACTIVE);
   }
 
   Notifications mWantUpdates;
-  bool mWantHints;
 };
 
 
 /* 
  * Contains IMEStatus plus information about the current 
  * input context that the IME can use as hints if desired.
  */
 
--- a/widget/windows/nsTextStore.cpp
+++ b/widget/windows/nsTextStore.cpp
@@ -3058,17 +3058,17 @@ nsTextStore::GetIMEUpdatePreference()
     nsRefPtr<ITfDocumentMgr> docMgr;
     sTsfThreadMgr->GetFocus(getter_AddRefs(docMgr));
     if (docMgr == sTsfTextStore->mDocumentMgr) {
       notifications = (nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE |
                        nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE |
                        nsIMEUpdatePreference::NOTIFY_DURING_DEACTIVE);
     }
   }
-  return nsIMEUpdatePreference(notifications, false);
+  return nsIMEUpdatePreference(notifications);
 }
 
 nsresult
 nsTextStore::OnTextChangeInternal(uint32_t aStart,
                                   uint32_t aOldEnd,
                                   uint32_t aNewEnd)
 {
   PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -460,24 +460,22 @@ PuppetWidget::NotifyIMEOfFocusChange(boo
     }
   } else {
     // Might not have been committed composition yet
     IMEEndComposition(false);
   }
 
   uint32_t chromeSeqno;
   mIMEPreference.mWantUpdates = nsIMEUpdatePreference::NOTIFY_NOTHING;
-  mIMEPreference.mWantHints = false;
   if (!mTabChild->SendNotifyIMEFocus(aFocus, &mIMEPreference, &chromeSeqno))
     return NS_ERROR_FAILURE;
 
   if (aFocus) {
-    if ((mIMEPreference.mWantUpdates &
-           nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE) &&
-        mIMEPreference.mWantHints) {
+    if (mIMEPreference.mWantUpdates &
+          nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE) {
       NotifyIMEOfSelectionChange(); // Update selection
     }
   } else {
     mIMELastBlurSeqno = chromeSeqno;
   }
   return NS_OK;
 }
 
@@ -527,26 +525,24 @@ PuppetWidget::NotifyIMEOfTextChange(uint
 {
 #ifndef MOZ_CROSS_PROCESS_IME
   return NS_OK;
 #endif
 
   if (!mTabChild)
     return NS_ERROR_FAILURE;
 
-  if (mIMEPreference.mWantHints) {
-    nsEventStatus status;
-    WidgetQueryContentEvent queryEvent(true, NS_QUERY_TEXT_CONTENT, this);
-    InitEvent(queryEvent, nullptr);
-    queryEvent.InitForQueryTextContent(0, UINT32_MAX);
-    DispatchEvent(&queryEvent, status);
+  nsEventStatus status;
+  WidgetQueryContentEvent queryEvent(true, NS_QUERY_TEXT_CONTENT, this);
+  InitEvent(queryEvent, nullptr);
+  queryEvent.InitForQueryTextContent(0, UINT32_MAX);
+  DispatchEvent(&queryEvent, status);
 
-    if (queryEvent.mSucceeded) {
-      mTabChild->SendNotifyIMETextHint(queryEvent.mReply.mString);
-    }
+  if (queryEvent.mSucceeded) {
+    mTabChild->SendNotifyIMETextHint(queryEvent.mReply.mString);
   }
   if (mIMEPreference.mWantUpdates & nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE) {
     mTabChild->SendNotifyIMETextChange(aStart, aEnd, aNewEnd);
   }
   return NS_OK;
 }
 
 nsresult