Bug 835591: Disable cross-process IME when it's not used. r=roc
authorChris Jones <jones.chris.g@gmail.com>
Mon, 28 Jan 2013 15:56:28 -0800
changeset 130041 6cefdfbf3abd239f7be19f8f6788a60a28cc6c1a
parent 130040 89390ab031282a6422f34543ac84d2852bccbc8a
child 130042 126481a3ca242bb5f116d197dd2b56d2ce37081f
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs835591
milestone21.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 835591: Disable cross-process IME when it's not used. r=roc
widget/xpwidgets/PuppetWidget.cpp
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -52,17 +52,21 @@ IsPopup(const nsWidgetInitData* aInitDat
   return aInitData && aInitData->mWindowType == eWindowType_popup;
 }
 
 static bool
 MightNeedIMEFocus(const nsWidgetInitData* aInitData)
 {
   // In the puppet-widget world, popup widgets are just dummies and
   // shouldn't try to mess with IME state.
+#ifdef MOZ_CROSS_PROCESS_IME
   return !IsPopup(aInitData);
+#else
+  return false;
+#endif
 }
 
 
 // Arbitrary, fungible.
 const size_t PuppetWidget::kMaxDimension = 4000;
 
 NS_IMPL_ISUPPORTS_INHERITED1(PuppetWidget, nsBaseWidget,
                              nsISupportsWeakReference)
@@ -330,16 +334,20 @@ gfxASurface*
 PuppetWidget::GetThebesSurface()
 {
   return mSurface;
 }
 
 nsresult
 PuppetWidget::IMEEndComposition(bool aCancel)
 {
+#ifndef MOZ_CROSS_PROCESS_IME
+  return NS_OK;
+#endif
+
   nsEventStatus status;
   nsTextEvent textEvent(true, NS_TEXT_TEXT, this);
   InitEvent(textEvent, nullptr);
   textEvent.seqno = mIMELastReceivedSeqno;
   // SendEndIMEComposition is always called since ResetInputState
   // should always be called even if we aren't composing something.
   if (!mTabChild ||
       !mTabChild->SendEndIMEComposition(aCancel, &textEvent.theText)) {
@@ -369,47 +377,59 @@ PuppetWidget::CancelComposition()
 {
   return IMEEndComposition(true);
 }
 
 NS_IMETHODIMP_(void)
 PuppetWidget::SetInputContext(const InputContext& aContext,
                               const InputContextAction& aAction)
 {
+#ifndef MOZ_CROSS_PROCESS_IME
+  return;
+#endif
+
   if (!mTabChild) {
     return;
   }
   mTabChild->SendSetInputContext(
     static_cast<int32_t>(aContext.mIMEState.mEnabled),
     static_cast<int32_t>(aContext.mIMEState.mOpen),
     aContext.mHTMLInputType,
     aContext.mHTMLInputInputmode,
     aContext.mActionHint,
     static_cast<int32_t>(aAction.mCause),
     static_cast<int32_t>(aAction.mFocusChange));
 }
 
 NS_IMETHODIMP_(InputContext)
 PuppetWidget::GetInputContext()
 {
+#ifndef MOZ_CROSS_PROCESS_IME
+  return InputContext();
+#endif
+
   InputContext context;
   if (mTabChild) {
     int32_t enabled, open;
     intptr_t nativeIMEContext;
     mTabChild->SendGetInputContext(&enabled, &open, &nativeIMEContext);
     context.mIMEState.mEnabled = static_cast<IMEState::Enabled>(enabled);
     context.mIMEState.mOpen = static_cast<IMEState::Open>(open);
     context.mNativeIMEContext = reinterpret_cast<void*>(nativeIMEContext);
   }
   return context;
 }
 
 NS_IMETHODIMP
 PuppetWidget::OnIMEFocusChange(bool aFocus)
 {
+#ifndef MOZ_CROSS_PROCESS_IME
+  return NS_OK;
+#endif
+
   if (!mTabChild)
     return NS_ERROR_FAILURE;
 
   if (aFocus) {
     nsEventStatus status;
     nsQueryContentEvent queryEvent(true, NS_QUERY_TEXT_CONTENT, this);
     InitEvent(queryEvent, nullptr);
     // Query entire content
@@ -444,16 +464,20 @@ nsIMEUpdatePreference
 PuppetWidget::GetIMEUpdatePreference()
 {
   return mIMEPreference;
 }
 
 NS_IMETHODIMP
 PuppetWidget::OnIMETextChange(uint32_t aStart, uint32_t aEnd, uint32_t aNewEnd)
 {
+#ifndef MOZ_CROSS_PROCESS_IME
+  return NS_OK;
+#endif
+
   if (!mTabChild)
     return NS_ERROR_FAILURE;
 
   if (mIMEPreference.mWantHints) {
     nsEventStatus status;
     nsQueryContentEvent queryEvent(true, NS_QUERY_TEXT_CONTENT, this);
     InitEvent(queryEvent, nullptr);
     queryEvent.InitForQueryTextContent(0, UINT32_MAX);
@@ -467,16 +491,20 @@ PuppetWidget::OnIMETextChange(uint32_t a
     mTabChild->SendNotifyIMETextChange(aStart, aEnd, aNewEnd);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PuppetWidget::OnIMESelectionChange(void)
 {
+#ifndef MOZ_CROSS_PROCESS_IME
+  return NS_OK;
+#endif
+
   if (!mTabChild)
     return NS_ERROR_FAILURE;
 
   if (mIMEPreference.mWantUpdates) {
     nsEventStatus status;
     nsQueryContentEvent queryEvent(true, NS_QUERY_SELECTED_TEXT, this);
     InitEvent(queryEvent, nullptr);
     DispatchEvent(&queryEvent, status);