Bug 805357 part.2 Get rid of NS_SUCCESS_IME_NO_UPDATES since OnIMEFocusChange(false) is always called r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 31 Oct 2012 08:22:23 +0900
changeset 111967 f38bee8c58b9df639ed829ad6b4fdb6444be66da
parent 111966 4a4fd71c32521e09e1b8ae70bc6840becd631873
child 111968 7546a81c1c389b20cd572b453adf9b9b01029fc9
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersroc
bugs805357
milestone19.0a1
Bug 805357 part.2 Get rid of NS_SUCCESS_IME_NO_UPDATES since OnIMEFocusChange(false) is always called r=roc
content/events/src/nsIMEStateManager.cpp
dom/ipc/TabParent.cpp
widget/nsIWidget.h
widget/xpwidgets/PuppetWidget.cpp
xpcom/base/ErrorList.h
--- a/content/events/src/nsIMEStateManager.cpp
+++ b/content/events/src/nsIMEStateManager.cpp
@@ -55,18 +55,17 @@ public:
   NS_DECL_NSISELECTIONLISTENER
   NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
   nsresult Init(nsIWidget* aWidget,
                 nsPresContext* aPresContext,
-                nsINode* aNode,
-                bool aWantUpdates);
+                nsINode* aNode);
   void     Destroy(void);
   bool     IsManaging(nsPresContext* aPresContext, nsIContent* aContent);
 
   nsCOMPtr<nsIWidget>            mWidget;
   nsCOMPtr<nsISelection>         mSel;
   nsCOMPtr<nsIContent>           mRootContent;
   nsCOMPtr<nsINode>              mEditableNode;
   bool                           mDestroying;
@@ -670,25 +669,20 @@ nsIMEStateManager::NotifyIME(Notificatio
 nsTextStateManager::nsTextStateManager()
 {
   mDestroying = false;
 }
 
 nsresult
 nsTextStateManager::Init(nsIWidget* aWidget,
                          nsPresContext* aPresContext,
-                         nsINode* aNode,
-                         bool aWantUpdates)
+                         nsINode* aNode)
 {
   mWidget = aWidget;
   MOZ_ASSERT(mWidget);
-  if (!aWantUpdates) {
-    mEditableNode = aNode;
-    return NS_OK;
-  }
 
   nsIPresShell* presShell = aPresContext->PresShell();
 
   // get selection and root content
   nsCOMPtr<nsISelectionController> selCon;
   if (aNode->IsNodeOfType(nsINode::eCONTENT)) {
     nsIFrame* frame = static_cast<nsIContent*>(aNode)->GetPrimaryFrame();
     NS_ENSURE_TRUE(frame, NS_ERROR_UNEXPECTED);
@@ -1007,27 +1001,24 @@ nsIMEStateManager::CreateTextStateManage
     return;
   }
 
   nsresult rv = widget->OnIMEFocusChange(true);
   if (rv == NS_ERROR_NOT_IMPLEMENTED)
     return;
   NS_ENSURE_SUCCESS_VOID(rv);
 
-  bool wantUpdates = rv != NS_SUCCESS_IME_NO_UPDATES;
-
   // OnIMEFocusChange may cause focus and sTextStateObserver to change
   // In that case return and keep the current sTextStateObserver
   NS_ENSURE_TRUE_VOID(!sTextStateObserver);
 
   sTextStateObserver = new nsTextStateManager();
   NS_ENSURE_TRUE_VOID(sTextStateObserver);
   NS_ADDREF(sTextStateObserver);
-  rv = sTextStateObserver->Init(widget, sPresContext,
-                                editableNode, wantUpdates);
+  rv = sTextStateObserver->Init(widget, sPresContext, editableNode);
   if (NS_SUCCEEDED(rv)) {
     return;
   }
 
   sTextStateObserver->mDestroying = true;
   sTextStateObserver->Destroy();
   NS_RELEASE(sTextStateObserver);
   widget->OnIMEFocusChange(false);
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -520,17 +520,17 @@ TabParent::RecvNotifyIMEFocus(const bool
 
   *aSeqno = mIMESeqno;
   mIMETabParent = aFocus ? this : nullptr;
   mIMESelectionAnchor = 0;
   mIMESelectionFocus = 0;
   nsresult rv = widget->OnIMEFocusChange(aFocus);
 
   if (aFocus) {
-    if (NS_SUCCEEDED(rv) && rv != NS_SUCCESS_IME_NO_UPDATES) {
+    if (NS_SUCCEEDED(rv)) {
       *aPreference = widget->GetIMEUpdatePreference();
     } else {
       aPreference->mWantUpdates = false;
       aPreference->mWantHints = false;
     }
   } else {
     mIMECacheText.Truncate(0);
   }
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1489,20 +1489,17 @@ class nsIWidget : public nsISupports {
 
     /*
      * An editable node (i.e. input/textarea/design mode document)
      *  is receiving or giving up focus
      * aFocus is true if node is receiving focus
      * aFocus is false if node is giving up focus (blur)
      *
      * If this returns NS_ERROR_*, OnIMETextChange and OnIMESelectionChange
-     * and OnIMEFocusChange(false) will be never called.
-     *
-     * If this returns NS_SUCCESS_IME_NO_UPDATES, OnIMEFocusChange(false)
-     * will be called but OnIMETextChange and OnIMESelectionChange will NOT.
+     * will be never called.
      */
     NS_IMETHOD OnIMEFocusChange(bool aFocus) = 0;
 
     /*
      * Text content of the focused node has changed
      * aStart is the starting offset of the change
      * aOldEnd is the ending offset of the change
      * aNewEnd is the caret offset after the change
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -417,17 +417,17 @@ PuppetWidget::OnIMEFocusChange(bool aFoc
   mIMEPreference.mWantUpdates = false;
   mIMEPreference.mWantHints = false;
   if (!mTabChild->SendNotifyIMEFocus(aFocus, &mIMEPreference, &chromeSeqno))
     return NS_ERROR_FAILURE;
 
   if (aFocus) {
     if (!mIMEPreference.mWantUpdates && !mIMEPreference.mWantHints)
       // call OnIMEFocusChange on blur but no other updates
-      return NS_SUCCESS_IME_NO_UPDATES;
+      return NS_ERROR_NOT_IMPLEMENTED;
     OnIMESelectionChange(); // Update selection
   } else {
     mIMELastBlurSeqno = chromeSeqno;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/xpcom/base/ErrorList.h
+++ b/xpcom/base/ErrorList.h
@@ -160,26 +160,16 @@
   /* requested resolution/quality mode not supported by printer */
   ERROR(NS_ERROR_GFX_PRINTER_RESOLUTION_NOT_SUPPORTED,    FAILURE(34)),
   /* Font cmap is strangely structured - avoid this font! */
   ERROR(NS_ERROR_GFX_CMAP_MALFORMED,                      FAILURE(51)),
 #undef MODULE
 
 
   /* ======================================================================= */
-  /* 4: NS_ERROR_MODULE_WIDGET */
-  /* ======================================================================= */
-#define MODULE NS_ERROR_MODULE_WIDGET
-  /* nsIWidget::OnIMEFocusChange should be called during blur, but other
-   * OnIME*Change methods should not be called */
-  ERROR(NS_SUCCESS_IME_NO_UPDATES,  SUCCESS(1)),
-#undef MODULE
-
-
-  /* ======================================================================= */
   /* 6: NS_ERROR_MODULE_NETWORK */
   /* ======================================================================= */
 #define MODULE NS_ERROR_MODULE_NETWORK
   /* General async request error codes:
    *
    * These error codes are commonly passed through callback methods to indicate
    * the status of some requested async request.
    *