Bug 543398 Drop nsTextEventReply and nsIPrivateCompositionEvent r=smaug, sr=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 10 Apr 2010 18:24:35 +0900
changeset 40645 bd0b0915864b7b8546f8a71d8dc63432ca2fea21
parent 40644 b66b7330b505e53d6dbba0e62a76541a3dde4387
child 40646 31759ae87a88366110cf4cd0825966a38e600c2f
push id12728
push usermasayuki@d-toybox.com
push dateSat, 10 Apr 2010 09:26:00 +0000
treeherdermozilla-central@bd0b0915864b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, roc
bugs543398
milestone1.9.3a5pre
first release with
nightly linux32
bd0b0915864b / 3.7a5pre / 20100410030631 / files
nightly linux64
bd0b0915864b / 3.7a5pre / 20100410030713 / files
nightly mac
bd0b0915864b / 3.7a5pre / 20100410031003 / files
nightly win32
bd0b0915864b / 3.7a5pre / 20100410035858 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 543398 Drop nsTextEventReply and nsIPrivateCompositionEvent r=smaug, sr=roc
content/events/public/Makefile.in
content/events/public/nsIPrivateCompositionEvent.h
content/events/public/nsIPrivateTextEvent.h
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMTextEvent.cpp
content/events/src/nsDOMTextEvent.h
content/events/src/nsDOMUIEvent.cpp
content/events/src/nsDOMUIEvent.h
editor/idl/nsIEditorIMESupport.idl
editor/libeditor/base/nsEditor.cpp
editor/libeditor/base/nsEditor.h
editor/libeditor/base/nsEditorEventListener.cpp
editor/libeditor/text/nsPlaintextEditor.cpp
editor/libeditor/text/nsPlaintextEditor.h
widget/public/nsEvent.h
widget/public/nsGUIEvent.h
widget/src/cocoa/nsChildView.mm
--- a/content/events/public/Makefile.in
+++ b/content/events/public/Makefile.in
@@ -47,17 +47,16 @@ XPIDL_MODULE	= content_events
 
 EXPORTS		= \
 		nsMutationEvent.h \
 		nsIEventListenerManager.h \
 		nsIEventStateManager.h \
 		nsIPrivateDOMEvent.h \
 		nsIPrivateTextEvent.h \
 		nsIPrivateTextRange.h \
-		nsIPrivateCompositionEvent.h \
 		nsPLDOMEvent.h \
 		nsEventDispatcher.h \
 		nsPIDOMEventTarget.h \
 		$(NULL)
 
 XPIDLSRCS	= \
 		nsIEventListenerService.idl \
 		$(NULL)
deleted file mode 100644
--- a/content/events/public/nsIPrivateCompositionEvent.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsIPrivateCompositionEvent_h__
-#define nsIPrivateCompositionEvent_h__
-
-#include "nsEvent.h"
-#include "nsISupports.h"
-
-// {901B82D5-67C0-45ad-86AE-AB9A6BD74111}
-#define NS_IPRIVATECOMPOSITIONEVENT_IID	\
-{ 0x901b82d5, 0x67c0, 0x45ad, \
-{ 0x86, 0xae, 0xab, 0x9a, 0x6b, 0xd7, 0x41, 0x11 } }
-
-class nsIPrivateCompositionEvent : public nsISupports {
-
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRIVATECOMPOSITIONEVENT_IID)
-
-  NS_IMETHOD GetCompositionReply(struct nsTextEventReply** aReply) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateCompositionEvent,
-                              NS_IPRIVATECOMPOSITIONEVENT_IID)
-
-#endif // nsIPrivateCompositionEvent_h__
-
--- a/content/events/public/nsIPrivateTextEvent.h
+++ b/content/events/public/nsIPrivateTextEvent.h
@@ -38,25 +38,24 @@
 #ifndef nsIPrivateTextEvent_h__
 #define nsIPrivateTextEvent_h__
 
 #include "nsEvent.h"
 #include "nsISupports.h"
 #include "nsIPrivateTextRange.h"
 
 #define NS_IPRIVATETEXTEVENT_IID \
-{0xeee4a0f0, 0x7fb0, 0x494c, \
-{0x80, 0xe3, 0x30, 0xd3, 0x08, 0x95, 0x15, 0x2c}}
+{ 0xb6840e02, 0x9e56, 0x49d8, \
+  { 0x84, 0xd, 0x5f, 0xc1, 0xcb, 0x6c, 0xff, 0xb3 } }
 
 class nsIPrivateTextEvent : public nsISupports {
 
 public:
 	NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRIVATETEXTEVENT_IID)
 
 	NS_IMETHOD GetText(nsString& aText) = 0;
 	NS_IMETHOD_(already_AddRefed<nsIPrivateTextRangeList>) GetInputRange() = 0;
-	NS_IMETHOD_(nsTextEventReply*) GetEventReply() = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateTextEvent, NS_IPRIVATETEXTEVENT_IID)
 
 #endif // nsIPrivateTextEvent_h__
 
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -39,17 +39,16 @@
 
 #include "nsCOMPtr.h"
 #include "nsDOMEvent.h"
 #include "nsEventStateManager.h"
 #include "nsIFrame.h"
 #include "nsIContent.h"
 #include "nsIPresShell.h"
 #include "nsIDocument.h"
-#include "nsIPrivateCompositionEvent.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "prmem.h"
 #include "nsGkAtoms.h"
 #include "nsMutationEvent.h"
 #include "nsContentUtils.h"
 #include "nsIURI.h"
--- a/content/events/src/nsDOMTextEvent.cpp
+++ b/content/events/src/nsDOMTextEvent.cpp
@@ -101,24 +101,16 @@ NS_METHOD_(already_AddRefed<nsIPrivateTe
     nsRefPtr<nsPrivateTextRangeList> textRange = mTextRange;
     nsPrivateTextRangeList *textRangePtr = nsnull;
     textRange.swap(textRangePtr);
     return textRangePtr;
   }
   return nsnull;
 }
 
-NS_METHOD_(nsTextEventReply*) nsDOMTextEvent::GetEventReply()
-{
-  if (mEvent->message == NS_TEXT_TEXT) {
-     return &(static_cast<nsTextEvent*>(mEvent)->theReply);
-  }
-  return nsnull;
-}
-
 nsresult NS_NewDOMTextEvent(nsIDOMEvent** aInstancePtrResult,
                             nsPresContext* aPresContext,
                             nsTextEvent *aEvent)
 {
   nsDOMTextEvent* it = new nsDOMTextEvent(aPresContext, aEvent);
   if (nsnull == it) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
--- a/content/events/src/nsDOMTextEvent.h
+++ b/content/events/src/nsDOMTextEvent.h
@@ -52,16 +52,15 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
 
   // Forward to base class
   NS_FORWARD_TO_NSDOMUIEVENT
 
   // nsIPrivateTextEvent interface
   NS_IMETHOD GetText(nsString& aText);
   NS_IMETHOD_(already_AddRefed<nsIPrivateTextRangeList>) GetInputRange();
-  NS_IMETHOD_(nsTextEventReply*) GetEventReply();
   
 protected:
   nsString mText;
   nsRefPtr<nsPrivateTextRangeList> mTextRange;
 };
 
 #endif // nsDOMTextEvent_h__
--- a/content/events/src/nsDOMUIEvent.cpp
+++ b/content/events/src/nsDOMUIEvent.cpp
@@ -114,17 +114,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_ADDREF_INHERITED(nsDOMUIEvent, nsDOMEvent)
 NS_IMPL_RELEASE_INHERITED(nsDOMUIEvent, nsDOMEvent)
 
 DOMCI_DATA(UIEvent, nsDOMUIEvent)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNSUIEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIPrivateCompositionEvent)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(UIEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
 
 nsIntPoint
 nsDOMUIEvent::GetScreenPoint()
 {
   if (!mEvent || 
        (mEvent->eventStructType != NS_MOUSE_EVENT &&
@@ -365,27 +364,16 @@ nsDOMUIEvent::GetIsChar(PRBool* aIsChar)
       *aIsChar = ((nsTextEvent*)mEvent)->isChar;
       return NS_OK;
     default:
       *aIsChar = PR_FALSE;
       return NS_OK;
   }
 }
 
-NS_METHOD nsDOMUIEvent::GetCompositionReply(nsTextEventReply** aReply)
-{
-  if((mEvent->message == NS_COMPOSITION_START))
-  {
-    *aReply = &(static_cast<nsCompositionEvent*>(mEvent)->theReply);
-    return NS_OK;
-  }
-  *aReply = nsnull;
-  return NS_ERROR_FAILURE;
-}
-
 NS_METHOD
 nsDOMUIEvent::DuplicatePrivateData()
 {
   mClientPoint = GetClientPoint();
   mLayerPoint = GetLayerPoint();
   mPagePoint = GetPagePoint();
   // GetScreenPoint converts mEvent->refPoint to right coordinates.
   nsIntPoint screenPoint = GetScreenPoint();
--- a/content/events/src/nsDOMUIEvent.h
+++ b/content/events/src/nsDOMUIEvent.h
@@ -37,42 +37,37 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsDOMUIEvent_h__
 #define nsDOMUIEvent_h__
 
 #include "nsIDOMUIEvent.h"
 #include "nsIDOMNSUIEvent.h"
 #include "nsIDOMAbstractView.h"
-#include "nsIPrivateCompositionEvent.h"
 #include "nsDOMEvent.h"
 
 class nsDOMUIEvent : public nsDOMEvent,
                      public nsIDOMUIEvent,
-                     public nsIDOMNSUIEvent,
-                     public nsIPrivateCompositionEvent
+                     public nsIDOMNSUIEvent
 {
 public:
   nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMUIEvent, nsDOMEvent)
 
   // nsIDOMUIEvent Interface
   NS_DECL_NSIDOMUIEVENT
 
   // nsIDOMNSUIEvent Interface
   NS_DECL_NSIDOMNSUIEVENT
 
   // nsIPrivateDOMEvent interface
   NS_IMETHOD DuplicatePrivateData();
   
-  // nsIPrivateCompositionEvent interface
-  NS_IMETHOD GetCompositionReply(nsTextEventReply** aReply);
-  
   // Forward to nsDOMEvent
   NS_FORWARD_TO_NSDOMEVENT
 
   NS_FORWARD_NSIDOMNSEVENT(nsDOMEvent::)
 protected:
 
   // Internal helper functions
   nsIntPoint GetClientPoint();
--- a/editor/idl/nsIEditorIMESupport.idl
+++ b/editor/idl/nsIEditorIMESupport.idl
@@ -36,41 +36,40 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 #include "domstubs.idl"
 
 %{C++
 class nsIPrivateTextRangeList;
-struct nsTextEventReply;
 %}
 
 [ptr] native nsIPrivateTextRangeListPtr(nsIPrivateTextRangeList);
-[ptr] native nsTextEventReplyPtr(nsTextEventReply);
 
 
-[scriptable, uuid(8093f91d-fe39-4a17-b9db-73468c3a536b)]
+[scriptable, uuid(5cb3f9c9-5ab9-40fd-8ee2-0d1c7abd20dd)]
 
 interface nsIEditorIMESupport : nsISupports
 {
 
 
   /**
-   * beginComposition(nsTextEventReply* aReply) Handles the start of inline input composition.
+   * beginComposition() Handles the start of inline input composition.
    */
 
-  [noscript] void beginComposition(in nsTextEventReplyPtr aReply);
+  [noscript] void beginComposition();
 
   /**
    * setCompositionString() Sets the inline input composition string.
    * beginComposition must be called prior to this.
    */
 
-  [noscript] void setCompositionString(in DOMString aCompositionString, in nsIPrivateTextRangeListPtr aTextRange, in nsTextEventReplyPtr aReply);
+  [noscript] void setCompositionString(in DOMString aCompositionString,
+                                       in nsIPrivateTextRangeListPtr aTextRange);
 
   /**
    * endComposition() Handles the end of inline input composition.
    */
 
   [noscript] void endComposition();
 
   /**
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -1964,95 +1964,27 @@ nsEditor::StopPreservingSelection()
 #pragma mark -
 #pragma mark  nsIEditorIMESupport 
 #pragma mark -
 #endif
 
 //
 // The BeingComposition method is called from the Editor Composition event listeners.
 //
-nsresult
-nsEditor::QueryComposition(nsTextEventReply* aReply)
-{
-  nsCOMPtr<nsISelection> selection;
-  nsCOMPtr<nsISelectionController> selcon = do_QueryReferent(mSelConWeak);
-  if (selcon)
-    selcon->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
-
-  if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
-  nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
-  if (!ps) return NS_ERROR_NOT_INITIALIZED;
-  nsRefPtr<nsCaret> caretP = ps->GetCaret();
-
-  if (caretP) {
-    if (aReply) {
-      caretP->SetCaretDOMSelection(selection);
-
-      // XXX_kin: BEGIN HACK! HACK! HACK!
-      // XXX_kin:
-      // XXX_kin: This is lame! The IME stuff needs caret coordinates
-      // XXX_kin: synchronously, but the editor could be using async
-      // XXX_kin: updates (reflows and paints) for performance reasons.
-      // XXX_kin: In order to give IME what it needs, we have to temporarily
-      // XXX_kin: switch to sync updating during this call so that the
-      // XXX_kin: nsAutoUpdateViewBatch can force sync reflows and paints
-      // XXX_kin: so that we get back accurate caret coordinates.
-
-      PRUint32 flags = 0;
-
-      if (NS_SUCCEEDED(GetFlags(&flags)) &&
-          (flags & nsIPlaintextEditor::eEditorUseAsyncUpdatesMask))
-      {
-        PRBool restoreFlags = PR_FALSE;
-
-        if (NS_SUCCEEDED(SetFlags(flags & (~nsIPlaintextEditor::eEditorUseAsyncUpdatesMask))))
-        {
-           // Scope the viewBatch within this |if| block so that we
-           // force synchronous reflows and paints before restoring
-           // our editor flags below.
-
-           nsAutoUpdateViewBatch viewBatch(this);
-           restoreFlags = PR_TRUE;
-        }
-
-        // Restore the previous set of flags!
-
-        if (restoreFlags)
-          SetFlags(flags);
-      }
-
-
-      // XXX_kin: END HACK! HACK! HACK!
-
-      nsRect rect;
-      nsIFrame* frame = caretP->GetGeometry(selection, &rect);
-      if (!frame)
-        return NS_ERROR_FAILURE;
-      nsPoint nearestWidgetOffset;
-      aReply->mReferenceWidget = frame->GetWindowOffset(nearestWidgetOffset);
-      rect.MoveBy(nearestWidgetOffset);
-      aReply->mCursorPosition =
-        rect.ToOutsidePixels(frame->PresContext()->AppUnitsPerDevPixel());
-    }
-  }
-  return NS_OK;
-}
-
 NS_IMETHODIMP
-nsEditor::BeginComposition(nsTextEventReply* aReply)
+nsEditor::BeginComposition()
 {
 #ifdef DEBUG_tague
   printf("nsEditor::StartComposition\n");
 #endif
-  nsresult ret = QueryComposition(aReply);
   mInIMEMode = PR_TRUE;
   if (mPhonetic)
     mPhonetic->Truncate(0);
 
-  return ret;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsEditor::EndComposition(void)
 {
   if (!mInIMEMode) return NS_OK; // nothing to do
   
   nsresult result = NS_OK;
@@ -2079,17 +2011,18 @@ nsEditor::EndComposition(void)
 
   // notify editor observers of action
   NotifyEditorObservers();
 
   return result;
 }
 
 NS_IMETHODIMP
-nsEditor::SetCompositionString(const nsAString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply)
+nsEditor::SetCompositionString(const nsAString& aCompositionString,
+                               nsIPrivateTextRangeList* aTextRangeList)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsEditor::GetPhonetic(nsAString& aPhonetic)
 {
   if (mPhonetic)
--- a/editor/libeditor/base/nsEditor.h
+++ b/editor/libeditor/base/nsEditor.h
@@ -350,18 +350,16 @@ protected:
   // unregister and release our event listeners
   virtual void RemoveEventListeners();
 
   /**
    * Return true if spellchecking should be enabled for this editor.
    */
   PRBool GetDesiredSpellCheckState();
 
-  nsresult QueryComposition(nsTextEventReply* aReply);
-
 public:
 
   /** All editor operations which alter the doc should be prefaced
    *  with a call to StartOperation, naming the action and direction */
   NS_IMETHOD StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection);
 
   /** All editor operations which alter the doc should be followed
    *  with a call to EndOperation */
--- a/editor/libeditor/base/nsEditorEventListener.cpp
+++ b/editor/libeditor/base/nsEditorEventListener.cpp
@@ -47,17 +47,16 @@
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 #include "nsISelection.h"
 #include "nsISelectionController.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMNSUIEvent.h"
 #include "nsIPrivateTextEvent.h"
-#include "nsIPrivateCompositionEvent.h"
 #include "nsIEditorMailSupport.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsILookAndFeel.h"
 #include "nsPresContext.h"
 #include "nsFocusManager.h"
 
 // Drag & Drop, Clipboard
@@ -439,32 +438,30 @@ nsEditorEventListener::HandleText(nsIDOM
    if (!textEvent) {
       //non-ui event passed in.  bad things.
       return NS_OK;
    }
 
    nsAutoString                      composedText;
    nsresult                          result;
    nsCOMPtr<nsIPrivateTextRangeList> textRangeList;
-   nsTextEventReply*                 textEventReply;
 
    textEvent->GetText(composedText);
    textRangeList = textEvent->GetInputRange();
-   textEventReply = textEvent->GetEventReply();
    nsCOMPtr<nsIEditorIMESupport> imeEditor = do_QueryInterface(mEditor, &result);
    if (imeEditor) {
      PRUint32 flags;
      // if we are readonly or disabled, then do nothing.
      if (NS_SUCCEEDED(mEditor->GetFlags(&flags))) {
        if (flags & nsIPlaintextEditor::eEditorReadonlyMask || 
            flags & nsIPlaintextEditor::eEditorDisabledMask) {
          return NS_OK;
        }
      }
-     result = imeEditor->SetCompositionString(composedText,textRangeList,textEventReply);
+     result = imeEditor->SetCompositionString(composedText, textRangeList);
    }
    return result;
 }
 
 /**
  * Drag event implementation
  */
 
@@ -745,34 +742,23 @@ nsEditorEventListener::CanDrop(nsIDOMDra
 
 /**
  * nsIDOMCompositionListener implementation
  */
 
 NS_IMETHODIMP
 nsEditorEventListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
 {
-  nsCOMPtr<nsIPrivateCompositionEvent> pCompositionEvent = do_QueryInterface(aCompositionEvent);
-  if (!pCompositionEvent) return NS_ERROR_FAILURE;
-
-  nsTextEventReply* eventReply;
-  nsresult rv = pCompositionEvent->GetCompositionReply(&eventReply);
-  if (NS_FAILED(rv)) return rv;
-
-  nsCOMPtr<nsIEditorIMESupport> imeEditor = do_QueryInterface(mEditor);
-  NS_ASSERTION(imeEditor, "The editor doesn't support IME?");
-  return imeEditor->BeginComposition(eventReply);
+  return static_cast<nsEditor*>(mEditor)->BeginComposition();
 }
 
 NS_IMETHODIMP
 nsEditorEventListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
 {
-  nsCOMPtr<nsIEditorIMESupport> imeEditor = do_QueryInterface(mEditor);
-  NS_ASSERTION(imeEditor, "The editor doesn't support IME?");
-  return imeEditor->EndComposition();
+  return static_cast<nsEditor*>(mEditor)->EndComposition();
 }
 
 /**
  * nsIDOMFocusListener implementation
  */
 
 static already_AddRefed<nsIContent>
 FindSelectionRoot(nsIEditor *aEditor, nsIContent *aContent)
--- a/editor/libeditor/text/nsPlaintextEditor.cpp
+++ b/editor/libeditor/text/nsPlaintextEditor.cpp
@@ -862,32 +862,32 @@ NS_IMETHODIMP nsPlaintextEditor::InsertL
     // post-process, always called if WillInsertBreak didn't return cancel==PR_TRUE
     res = mRules->DidDoAction(selection, &ruleInfo, res);
   }
 
   return res;
 }
 
 NS_IMETHODIMP
-nsPlaintextEditor::BeginComposition(nsTextEventReply* aReply)
+nsPlaintextEditor::BeginComposition()
 {
   NS_ENSURE_TRUE(!mInIMEMode, NS_OK);
 
   if(mFlags & nsIPlaintextEditor::eEditorPasswordMask)  {
     if (mRules) {
       nsIEditRules *p = mRules.get();
       nsTextEditRules *textEditRules = static_cast<nsTextEditRules *>(p);
       textEditRules->ResetIMETextPWBuf();
     }
     else  {
       return NS_ERROR_NULL_POINTER;
     }
   }
 
-  return nsEditor::BeginComposition(aReply);
+  return nsEditor::BeginComposition();
 }
 
 NS_IMETHODIMP
 nsPlaintextEditor::GetDocumentIsEmpty(PRBool *aDocumentIsEmpty)
 {
   if (!aDocumentIsEmpty)
     return NS_ERROR_NULL_POINTER;
   
@@ -1555,17 +1555,18 @@ nsPlaintextEditor::GetEmbeddedObjects(ns
 
 #ifdef XP_MAC
 #pragma mark -
 #pragma mark  nsIEditorIMESupport overrides 
 #pragma mark -
 #endif
 
 NS_IMETHODIMP
-nsPlaintextEditor::SetCompositionString(const nsAString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply)
+nsPlaintextEditor::SetCompositionString(const nsAString& aCompositionString,
+                                        nsIPrivateTextRangeList* aTextRangeList)
 {
   if (!aTextRangeList && !aCompositionString.IsEmpty())
   {
     NS_ERROR("aTextRangeList is null but the composition string is not null");
     return NS_ERROR_NULL_POINTER;
   }
 
   nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
@@ -1592,82 +1593,30 @@ nsPlaintextEditor::SetCompositionString(
   //   Some Chinese IMEs for Linux are always composition string and text range
   //   list are empty when listing the Chinese characters. In this case,
   //   we don't need to process composition string too. See bug 271815.
 
   if (!aCompositionString.IsEmpty() || (mIMETextNode && aTextRangeList))
   {
     mIMETextRangeList = aTextRangeList;
 
-    // XXX_kin: BEGIN HACK! HACK! HACK!
-    // XXX_kin:
-    // XXX_kin: This is lame! The IME stuff needs caret coordinates
-    // XXX_kin: synchronously, but the editor could be using async
-    // XXX_kin: updates (reflows and paints) for performance reasons.
-    // XXX_kin: In order to give IME what it needs, we have to temporarily
-    // XXX_kin: switch to sync updating during this call so that the
-    // XXX_kin: nsAutoPlaceHolderBatch can force sync reflows, paints,
-    // XXX_kin: and selection scrolling, so that we get back accurate
-    // XXX_kin: caret coordinates.
+    SetIsIMEComposing(); // We set mIsIMEComposing properly.
 
-    PRUint32 flags = 0;
-    PRBool restoreFlags = PR_FALSE;
+    result = InsertText(aCompositionString);
 
-    if (NS_SUCCEEDED(GetFlags(&flags)) &&
-        (flags & nsIPlaintextEditor::eEditorUseAsyncUpdatesMask))
-    {
-      if (NS_SUCCEEDED(SetFlags(
-          flags & (~nsIPlaintextEditor::eEditorUseAsyncUpdatesMask))))
-        restoreFlags = PR_TRUE;
-    }
-
-    // XXX_kin: END HACK! HACK! HACK!
+    mIMEBufferLength = aCompositionString.Length();
 
-    // we need the nsAutoPlaceHolderBatch destructor called before hitting
-    // GetCaretCoordinates so the states in Frame system sync with content
-    // therefore, we put the nsAutoPlaceHolderBatch into a inner block
-    {
-      nsAutoPlaceHolderBatch batch(this, nsGkAtoms::IMETxnName);
-
-      SetIsIMEComposing(); // We set mIsIMEComposing properly.
-
-      result = InsertText(aCompositionString);
-
-      mIMEBufferLength = aCompositionString.Length();
+    if (caretP)
+      caretP->SetCaretDOMSelection(selection);
 
-      if (caretP)
-        caretP->SetCaretDOMSelection(selection);
-
-      // second part of 23558 fix:
-      if (aCompositionString.IsEmpty())
-        mIMETextNode = nsnull;
-    }
-
-    // XXX_kin: BEGIN HACK! HACK! HACK!
-    // XXX_kin:
-    // XXX_kin: Restore the previous set of flags!
-
-    if (restoreFlags)
-      SetFlags(flags);
-
-    // XXX_kin: END HACK! HACK! HACK!
+    // second part of 23558 fix:
+    if (aCompositionString.IsEmpty())
+      mIMETextNode = nsnull;
   }
 
-  if (caretP)
-  {
-    nsRect rect;
-    nsIFrame* frame = caretP->GetGeometry(selection, &rect);
-    if (!frame)
-      return NS_ERROR_FAILURE;
-    nsPoint nearestWidgetOffset;
-    aReply->mReferenceWidget = frame->GetWindowOffset(nearestWidgetOffset);
-    rect.MoveBy(nearestWidgetOffset);
-    aReply->mCursorPosition =
-       rect.ToOutsidePixels(frame->PresContext()->AppUnitsPerDevPixel());
-  }
 
   return result;
 }
 
 #ifdef XP_MAC
 #pragma mark -
 #pragma mark  nsEditor overrides 
 #pragma mark -
--- a/editor/libeditor/text/nsPlaintextEditor.h
+++ b/editor/libeditor/text/nsPlaintextEditor.h
@@ -84,21 +84,20 @@ public:
   /* ------------ nsIPlaintextEditor methods -------------- */
   NS_DECL_NSIPLAINTEXTEDITOR
 
   /* ------------ nsIEditorMailSupport overrides -------------- */
   NS_DECL_NSIEDITORMAILSUPPORT
 
   /* ------------ nsIEditorIMESupport overrides -------------- */
   NS_IMETHOD SetCompositionString(const nsAString &aCompositionString,
-                                  nsIPrivateTextRangeList *aTextRange,
-                                  nsTextEventReply *aReply);
+                                  nsIPrivateTextRangeList *aTextRange);
 
   /* ------------ Overrides of nsEditor interface methods -------------- */
-  NS_IMETHOD BeginComposition(nsTextEventReply* aReply);
+  NS_IMETHOD BeginComposition();
   NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
                                       const nsAString & aAttribute,
                                       const nsAString & aValue,
                                       PRBool aSuppressTransaction);
   NS_IMETHOD RemoveAttributeOrEquivalent(nsIDOMElement * aElement,
                                          const nsAString & aAttribute,
                                          PRBool aSuppressTransaction);
 
--- a/widget/public/nsEvent.h
+++ b/widget/public/nsEvent.h
@@ -85,11 +85,9 @@ class nsTextEvent;
 class nsCompositionEvent;
 class nsMouseScrollEvent;
 class nsReconversionEvent;
 class nsTooltipEvent;
 class nsMenuEvent;
 class nsSimpleGestureEvent;
 class nsContentCommandEvent;
 
-struct nsTextEventReply;
-
 #endif // nsEvent_h__
--- a/widget/public/nsGUIEvent.h
+++ b/widget/public/nsGUIEvent.h
@@ -993,59 +993,41 @@ struct nsTextRange
   PRUint32 mEndOffset;
   PRUint32 mRangeType;
 
   nsTextRangeStyle mRangeStyle;
 };
 
 typedef nsTextRange* nsTextRangeArray;
 
-// XXX We should drop this struct because the results are provided by query
-// content events now, so, this struct finished the role.
-struct nsTextEventReply
-{
-  nsTextEventReply()
-    : mReferenceWidget(nsnull)
-  {
-  }
-
-  nsIntRect mCursorPosition;
-  nsIWidget* mReferenceWidget;
-};
-
-typedef struct nsTextEventReply nsTextEventReply;
-
 class nsTextEvent : public nsInputEvent
 {
 public:
   nsTextEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
     : nsInputEvent(isTrusted, msg, w, NS_TEXT_EVENT),
       rangeCount(0), rangeArray(nsnull), isChar(PR_FALSE)
   {
   }
 
   nsString          theText;
-  nsTextEventReply  theReply; // OBSOLETE
   PRUint32          rangeCount;
   // Note that the range array may not specify a caret position; in that
   // case there will be no range of type NS_TEXTRANGE_CARETPOSITION in the
   // array.
   nsTextRangeArray  rangeArray;
   PRBool            isChar;
 };
 
 class nsCompositionEvent : public nsInputEvent
 {
 public:
   nsCompositionEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
     : nsInputEvent(isTrusted, msg, w, NS_COMPOSITION_EVENT)
   {
   }
-
-  nsTextEventReply theReply; // OBSOLETE
 };
 
 /* Mouse Scroll Events: Line Scrolling, Pixel Scrolling and Common Event Flows
  *
  * There are two common event flows:
  *  (1) Normal line scrolling:
  *      1. An NS_MOUSE_SCROLL event without kHasPixels is dispatched to Gecko.
  *      2. A DOMMouseScroll event is sent into the DOM.
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -139,17 +139,17 @@ PRBool gUserCancelledDrag = PR_FALSE;
 PRUint32 nsChildView::sLastInputEventCount = 0;
 
 @interface ChildView(Private)
 
 // sets up our view, attaching it to its owning gecko view
 - (id)initWithFrame:(NSRect)inFrame geckoChild:(nsChildView*)inChild;
 
 // sends gecko an ime composition event
-- (nsIntRect) sendCompositionEvent:(PRInt32)aEventType;
+- (void) sendCompositionEvent:(PRInt32)aEventType;
 
 // sends gecko an ime text event
 - (void) sendTextEvent:(PRUnichar*) aBuffer 
                        attributedString:(NSAttributedString*) aString
                        selectedRange:(NSRange)selRange
                        markedRange:(NSRange)markRange
                        doCommit:(BOOL)doCommit;
 
@@ -4411,30 +4411,29 @@ GetUSLayoutCharFromKeyTranslate(UInt32 a
   }
 
   ::ReleaseEvent(cloneEvent);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 #endif // NP_NO_CARBON
 
-- (nsIntRect)sendCompositionEvent:(PRInt32) aEventType
+- (void)sendCompositionEvent:(PRInt32) aEventType
 {
 #ifdef DEBUG_IME
   NSLog(@"****in sendCompositionEvent; type = %d", aEventType);
 #endif
 
   if (!mGeckoChild)
-    return nsIntRect(0, 0, 0, 0);
+    return;
 
   // static void init_composition_event( *aEvent, int aType)
   nsCompositionEvent event(PR_TRUE, aEventType, mGeckoChild);
   event.time = PR_IntervalNow();
   mGeckoChild->DispatchWindowEvent(event);
-  return event.theReply.mCursorPosition;
 }
 
 - (void)sendTextEvent:(PRUnichar*) aBuffer 
                       attributedString:(NSAttributedString*) aString  
                       selectedRange:(NSRange) selRange 
                       markedRange:(NSRange) markRange
                       doCommit:(BOOL) doCommit
 {