Bug 665632: Remove Add/RemoveEventListenerByIID from satchel. r=dolske
authorJonas Sicking <jonas@sicking.cc>
Mon, 27 Jun 2011 16:34:56 -0700
changeset 72402 383e60bc9089d677a74ec6b8fa1557c81d656b04
parent 72401 347d715650f6e33f70abcd36155b60257d7ddf18
child 72411 10a8acc05eba022f38383453497a9425de984075
push id159
push usereakhgari@mozilla.com
push dateTue, 16 Aug 2011 17:53:11 +0000
treeherdermozilla-beta@8786e3e49240 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs665632
milestone7.0a1
first release with
nightly linux32
383e60bc9089 / 7.0a1 / 20110628030753 / files
nightly linux64
383e60bc9089 / 7.0a1 / 20110628030753 / files
nightly mac
383e60bc9089 / 7.0a1 / 20110628030753 / files
nightly win32
383e60bc9089 / 7.0a1 / 20110628030753 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 665632: Remove Add/RemoveEventListenerByIID from satchel. r=dolske
toolkit/components/satchel/nsFormFillController.cpp
toolkit/components/satchel/nsFormFillController.h
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -49,17 +49,16 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsPIDOMWindow.h"
 #include "nsIWebNavigation.h"
 #include "nsIContentViewer.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIPrivateDOMEvent.h"
-#include "nsIDOMCompositionListener.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIFormControl.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIPresShell.h"
 #include "nsIFrame.h"
 #include "nsRect.h"
@@ -68,33 +67,22 @@
 #include "nsIDOMMouseEvent.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsToolkitCompsCID.h"
 #include "nsEmbedCID.h"
 #include "nsIDOMNSEditableElement.h"
 #include "nsIDOMNSEvent.h"
 #include "mozilla/dom/Element.h"
 
-NS_INTERFACE_MAP_BEGIN(nsFormFillController)
-  NS_INTERFACE_MAP_ENTRY(nsIFormFillController)
-  NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteInput)
-  NS_INTERFACE_MAP_ENTRY(nsIAutoCompleteSearch)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMFocusListener)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMKeyListener)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMFormListener)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMCompositionListener)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMContextMenuListener)
-  NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFormFillController)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMFocusListener)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_ADDREF(nsFormFillController)
-NS_IMPL_RELEASE(nsFormFillController)
+NS_IMPL_ISUPPORTS5(nsFormFillController,
+                   nsIFormFillController,
+                   nsIAutoCompleteInput,
+                   nsIAutoCompleteSearch,
+                   nsIDOMEventListener,
+                   nsIMutationObserver)
 
 nsFormFillController::nsFormFillController() :
   mTimeout(50),
   mMinResultsForPopup(1),
   mMaxRows(0),
   mDisableAutoComplete(PR_FALSE), 
   mCompleteDefaultIndex(PR_FALSE),
   mCompleteSelectedIndex(PR_FALSE),
@@ -678,23 +666,54 @@ nsFormFillController::StopSearch()
 }
 
 ////////////////////////////////////////////////////////////////////////
 //// nsIDOMEventListener
 
 NS_IMETHODIMP
 nsFormFillController::HandleEvent(nsIDOMEvent* aEvent)
 {
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
   nsAutoString type;
   aEvent->GetType(type);
 
+  if (type.EqualsLiteral("focus")) {
+    return Focus(aEvent);
+  }
+  if (type.EqualsLiteral("mousedown")) {
+    return MouseDown(aEvent);
+  }
+  if (type.EqualsLiteral("keypress")) {
+    return KeyPress(aEvent);
+  }
+  if (type.EqualsLiteral("input")) {
+    return (!mSuppressOnInput && mController && mFocusedInput) ?
+           mController->HandleText() : NS_OK;
+  }
+  if (type.EqualsLiteral("blur")) {
+    if (mFocusedInput)
+      StopControllingInput();
+    return NS_OK;
+  }
+  if (type.EqualsLiteral("compositionstart")) {
+    NS_ASSERTION(mController, "should have a controller!");
+    if (mController && mFocusedInput)
+      mController->HandleStartComposition();
+    return NS_OK;
+  }
+  if (type.EqualsLiteral("compositionend")) {
+    NS_ASSERTION(mController, "should have a controller!");
+    if (mController && mFocusedInput)
+      mController->HandleEndComposition();
+    return NS_OK;
+  }
+  if (type.EqualsLiteral("contextmenu")) {
+    if (mFocusedPopup)
+      mFocusedPopup->ClosePopup();
+    return NS_OK;
+  }
   if (type.EqualsLiteral("pagehide")) {
     nsCOMPtr<nsIDOMEventTarget> target;
     aEvent->GetTarget(getter_AddRefs(target));
 
     nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(target);
     if (!domDoc)
       return NS_OK;
 
@@ -722,27 +741,19 @@ nsFormFillController::RemoveForDOMDocume
   nsCOMPtr<nsIDOMDocument> elementDoc;
   element->GetOwnerDocument(getter_AddRefs(elementDoc));
   if (elementDoc == domDoc)
     return PL_DHASH_REMOVE;
 
   return PL_DHASH_NEXT;
 }
 
-
-////////////////////////////////////////////////////////////////////////
-//// nsIDOMFocusListener
-
-NS_IMETHODIMP
+nsresult
 nsFormFillController::Focus(nsIDOMEvent* aEvent)
 {
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
   nsCOMPtr<nsIDOMEventTarget> target;
   aEvent->GetTarget(getter_AddRefs(target));
   
   nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(target);
   if (!input)
     return NS_OK;
 
   PRBool isReadOnly = PR_FALSE;
@@ -785,59 +796,19 @@ nsFormFillController::IsInputAutoComplet
         form->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
       autoCompleteOff = autocomplete.LowerCaseEqualsLiteral("off");
     }
   }
 
   return autoCompleteOff;
 }
 
-NS_IMETHODIMP
-nsFormFillController::Blur(nsIDOMEvent* aEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
-  if (mFocusedInput)
-    StopControllingInput();
-  
-  return NS_OK;
-}
-
-////////////////////////////////////////////////////////////////////////
-//// nsIDOMKeyListener
-
-NS_IMETHODIMP
-nsFormFillController::KeyDown(nsIDOMEvent* aEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
-  return NS_OK;
-} 
-
-NS_IMETHODIMP
-nsFormFillController::KeyUp(nsIDOMEvent* aEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
+nsresult
 nsFormFillController::KeyPress(nsIDOMEvent* aEvent)
 {
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
   NS_ASSERTION(mController, "should have a controller!");
   if (!mFocusedInput || !mController)
     return NS_OK;
 
   nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
   if (!keyEvent)
     return NS_ERROR_FAILURE;
 
@@ -898,127 +869,25 @@ nsFormFillController::KeyPress(nsIDOMEve
   
   if (cancel) {
     aEvent->PreventDefault();
   }
   
   return NS_OK;
 }
 
-////////////////////////////////////////////////////////////////////////
-//// nsIDOMCompositionListener
-
-NS_IMETHODIMP
-nsFormFillController::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aCompositionEvent))
-    return NS_OK;
-
-  NS_ASSERTION(mController, "should have a controller!");
-
-  if (mController && mFocusedInput)
-    mController->HandleStartComposition();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFormFillController::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aCompositionEvent))
-    return NS_OK;
-
-  NS_ASSERTION(mController, "should have a controller!");
-
-  if (mController && mFocusedInput)
-    mController->HandleEndComposition();
-
-  return NS_OK;
-}
-
-////////////////////////////////////////////////////////////////////////
-//// nsIDOMFormListener
-
-NS_IMETHODIMP
-nsFormFillController::Submit(nsIDOMEvent* aEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
-  if (mFocusedInput)
-    StopControllingInput();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFormFillController::Reset(nsIDOMEvent* aEvent)
+nsresult
+nsFormFillController::MouseDown(nsIDOMEvent* aEvent)
 {
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFormFillController::Change(nsIDOMEvent* aEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFormFillController::Select(nsIDOMEvent* aEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFormFillController::Input(nsIDOMEvent* aEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aEvent))
-    return NS_OK;
-
-  if (mSuppressOnInput || !mController || !mFocusedInput)
-    return NS_OK;
-
-  return mController->HandleText();
-}
-
-////////////////////////////////////////////////////////////////////////
-//// nsIDOMMouseListener
-
-NS_IMETHODIMP
-nsFormFillController::MouseDown(nsIDOMEvent* aMouseEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aMouseEvent))
-    return NS_OK;
-
-  if (!mFocusedInput)
-    return NS_OK;
-
-  nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));
+  nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aEvent));
   if (!mouseEvent)
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIDOMEventTarget> target;
-  aMouseEvent->GetTarget(getter_AddRefs(target));
+  aEvent->GetTarget(getter_AddRefs(target));
   nsCOMPtr<nsIDOMHTMLInputElement> targetInput = do_QueryInterface(target);
   if (!targetInput)
     return NS_OK;
 
   PRUint16 button;
   mouseEvent->GetButton(&button);
   if (button != 0)
     return NS_OK;
@@ -1044,80 +913,16 @@ nsFormFillController::MouseDown(nsIDOMEv
     // because it doesn't display the popup if the input is blank.
     PRBool cancel = PR_FALSE;
     mController->HandleKeyNavigation(nsIDOMKeyEvent::DOM_VK_DOWN, &cancel);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsFormFillController::MouseUp(nsIDOMEvent* aMouseEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aMouseEvent))
-    return NS_OK;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFormFillController::MouseClick(nsIDOMEvent* aMouseEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aMouseEvent))
-    return NS_OK;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFormFillController::MouseDblClick(nsIDOMEvent* aMouseEvent)
-{ 
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aMouseEvent))
-    return NS_OK;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFormFillController::MouseOver(nsIDOMEvent* aMouseEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aMouseEvent))
-    return NS_OK;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFormFillController::MouseOut(nsIDOMEvent* aMouseEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aMouseEvent))
-    return NS_OK;
-
-  return NS_OK;
-}
-
-////////////////////////////////////////////////////////////////////////
-//// nsIDOMContextMenuListener
-NS_IMETHODIMP
-nsFormFillController::ContextMenu(nsIDOMEvent* aContextMenuEvent)
-{
-  // Drop untrusted events from content
-  if (!IsEventTrusted(aContextMenuEvent))
-    return NS_OK;
-
-  if (mFocusedPopup)
-    mFocusedPopup->ClosePopup();
-  return NS_OK;
-}
-
 ////////////////////////////////////////////////////////////////////////
 //// nsFormFillController
 
 void
 nsFormFillController::AddWindowListeners(nsIDOMWindow *aWindow)
 {
   if (!aWindow)
     return;
@@ -1125,51 +930,32 @@ nsFormFillController::AddWindowListeners
   nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aWindow));
   nsIDOMEventTarget* target = nsnull;
   if (privateDOMWindow)
     target = privateDOMWindow->GetChromeEventHandler();
 
   if (!target)
     return;
 
-  target->AddEventListener(NS_LITERAL_STRING("focus"),
-                           static_cast<nsIDOMFocusListener *>(this),
-                           PR_TRUE);
-
-  target->AddEventListener(NS_LITERAL_STRING("blur"),
-                           static_cast<nsIDOMFocusListener *>(this),
-                           PR_TRUE);
-
-  target->AddEventListener(NS_LITERAL_STRING("pagehide"),
-                           static_cast<nsIDOMFocusListener *>(this),
-                           PR_TRUE);
-
-  target->AddEventListener(NS_LITERAL_STRING("mousedown"),
-                           static_cast<nsIDOMMouseListener *>(this),
-                           PR_TRUE);
-
-  target->AddEventListener(NS_LITERAL_STRING("click"),
-                           static_cast<nsIDOMMouseListener *>(this),
-                           PR_TRUE);
-
-  target->AddEventListener(NS_LITERAL_STRING("input"),
-                           static_cast<nsIDOMFormListener *>(this),
-                           PR_TRUE);
-
-  target->AddEventListener(NS_LITERAL_STRING("compositionstart"),
-                           static_cast<nsIDOMCompositionListener *>(this),
-                           PR_TRUE);
-
-  target->AddEventListener(NS_LITERAL_STRING("compositionend"),
-                           static_cast<nsIDOMCompositionListener *>(this),
-                           PR_TRUE);
-
-  target->AddEventListener(NS_LITERAL_STRING("contextmenu"),
-                           static_cast<nsIDOMContextMenuListener *>(this),
-                           PR_TRUE);
+  target->AddEventListener(NS_LITERAL_STRING("focus"), this,
+                           PR_TRUE, PR_FALSE);
+  target->AddEventListener(NS_LITERAL_STRING("blur"), this,
+                           PR_TRUE, PR_FALSE);
+  target->AddEventListener(NS_LITERAL_STRING("pagehide"), this,
+                           PR_TRUE, PR_FALSE);
+  target->AddEventListener(NS_LITERAL_STRING("mousedown"), this,
+                           PR_TRUE, PR_FALSE);
+  target->AddEventListener(NS_LITERAL_STRING("input"), this,
+                           PR_TRUE, PR_FALSE);
+  target->AddEventListener(NS_LITERAL_STRING("compositionstart"), this,
+                           PR_TRUE, PR_FALSE);
+  target->AddEventListener(NS_LITERAL_STRING("compositionend"), this,
+                           PR_TRUE, PR_FALSE);
+  target->AddEventListener(NS_LITERAL_STRING("contextmenu"), this,
+                           PR_TRUE, PR_FALSE);
 
   // Note that any additional listeners added should ensure that they ignore
   // untrusted events, which might be sent by content that's up to no good.
 }
 
 void
 nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
 {
@@ -1185,77 +971,48 @@ nsFormFillController::RemoveWindowListen
   nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aWindow));
   nsIDOMEventTarget* target = nsnull;
   if (privateDOMWindow)
     target = privateDOMWindow->GetChromeEventHandler();
   
   if (!target)
     return;
 
-  target->RemoveEventListener(NS_LITERAL_STRING("focus"),
-                              static_cast<nsIDOMFocusListener *>(this),
-                              PR_TRUE);
-
-  target->RemoveEventListener(NS_LITERAL_STRING("blur"),
-                              static_cast<nsIDOMFocusListener *>(this),
-                              PR_TRUE);
-
-  target->RemoveEventListener(NS_LITERAL_STRING("pagehide"),
-                              static_cast<nsIDOMFocusListener *>(this),
-                              PR_TRUE);
-
-  target->RemoveEventListener(NS_LITERAL_STRING("mousedown"),
-                              static_cast<nsIDOMMouseListener *>(this),
+  target->RemoveEventListener(NS_LITERAL_STRING("focus"), this, PR_TRUE);
+  target->RemoveEventListener(NS_LITERAL_STRING("blur"), this, PR_TRUE);
+  target->RemoveEventListener(NS_LITERAL_STRING("pagehide"), this, PR_TRUE);
+  target->RemoveEventListener(NS_LITERAL_STRING("mousedown"), this, PR_TRUE);
+  target->RemoveEventListener(NS_LITERAL_STRING("input"), this, PR_TRUE);
+  target->RemoveEventListener(NS_LITERAL_STRING("compositionstart"), this,
                               PR_TRUE);
-
-  target->RemoveEventListener(NS_LITERAL_STRING("click"),
-                              static_cast<nsIDOMMouseListener *>(this),
-                              PR_TRUE);
-
-  target->RemoveEventListener(NS_LITERAL_STRING("input"),
-                              static_cast<nsIDOMFormListener *>(this),
+  target->RemoveEventListener(NS_LITERAL_STRING("compositionend"), this,
                               PR_TRUE);
-
-  target->RemoveEventListener(NS_LITERAL_STRING("compositionstart"),
-                              static_cast<nsIDOMCompositionListener *>(this),
-                              PR_TRUE);
-
-  target->RemoveEventListener(NS_LITERAL_STRING("compositionend"),
-                              static_cast<nsIDOMCompositionListener *>(this),
-                              PR_TRUE);
-
-  target->RemoveEventListener(NS_LITERAL_STRING("contextmenu"),
-                              static_cast<nsIDOMContextMenuListener *>(this),
-                              PR_TRUE);
+  target->RemoveEventListener(NS_LITERAL_STRING("contextmenu"), this, PR_TRUE);
 }
 
 void
 nsFormFillController::AddKeyListener(nsIDOMHTMLInputElement *aInput)
 {
   if (!aInput)
     return;
 
-    nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aInput);
+  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aInput);
 
-    target->AddEventListener(NS_LITERAL_STRING("keypress"),
-                             static_cast<nsIDOMKeyListener *>(this),
-                             PR_TRUE);
-  }
+  target->AddEventListener(NS_LITERAL_STRING("keypress"), this,
+                           PR_TRUE, PR_FALSE);
+}
 
 void
 nsFormFillController::RemoveKeyListener()
 {
   if (!mFocusedInput)
     return;
 
-    nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mFocusedInput);
-
-    target->RemoveEventListener(NS_LITERAL_STRING("keypress"),
-                                static_cast<nsIDOMKeyListener *>(this),
-                                PR_TRUE);
+  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mFocusedInput);
+  target->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, PR_TRUE);
 }
 
 void
 nsFormFillController::StartControllingInput(nsIDOMHTMLInputElement *aInput)
 {
   // Make sure we're not still attached to an input
   StopControllingInput(); 
 
@@ -1352,31 +1109,16 @@ nsFormFillController::GetIndexOfDocShell
   if (parentItem) {
     nsCOMPtr<nsIDocShell> parentShell = do_QueryInterface(parentItem);
     return GetIndexOfDocShell(parentShell);
   }
     
   return -1;
 }
 
-PRBool
-nsFormFillController::IsEventTrusted(nsIDOMEvent *aEvent)
-{
-  nsresult rv;
-
-  nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aEvent);
-  if (!nsevent)
-    return PR_FALSE;
-
-  PRBool isTrusted;
-  rv = nsevent->GetIsTrusted(&isTrusted);
-  NS_ENSURE_SUCCESS(rv, PR_FALSE);
-  return isTrusted;
-}
-
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormFillController)
 
 NS_DEFINE_NAMED_CID(NS_FORMFILLCONTROLLER_CID);
 
 static const mozilla::Module::CIDEntry kSatchelCIDs[] = {
   { &kNS_FORMFILLCONTROLLER_CID, false, NULL, nsFormFillControllerConstructor },
   { NULL }
 };
--- a/toolkit/components/satchel/nsFormFillController.h
+++ b/toolkit/components/satchel/nsFormFillController.h
@@ -40,82 +40,45 @@
 #ifndef __nsFormFillController__
 #define __nsFormFillController__
 
 #include "nsIFormFillController.h"
 #include "nsIAutoCompleteInput.h"
 #include "nsIAutoCompleteSearch.h"
 #include "nsIAutoCompleteController.h"
 #include "nsIAutoCompletePopup.h"
-#include "nsIDOMFocusListener.h"
-#include "nsIDOMKeyListener.h"
-#include "nsIDOMCompositionListener.h"
-#include "nsIDOMFormListener.h"
-#include "nsIDOMMouseListener.h"
-#include "nsIDOMContextMenuListener.h"
+#include "nsIDOMEventListener.h"
 #include "nsCOMPtr.h"
 #include "nsISupportsArray.h"
 #include "nsDataHashtable.h"
 #include "nsIDocShell.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsILoginManager.h"
 #include "nsIMutationObserver.h"
 
 class nsFormHistory;
 
 class nsFormFillController : public nsIFormFillController,
                              public nsIAutoCompleteInput,
                              public nsIAutoCompleteSearch,
-                             public nsIDOMFocusListener,
-                             public nsIDOMKeyListener,
-                             public nsIDOMCompositionListener,
-                             public nsIDOMFormListener,
-                             public nsIDOMMouseListener,
-                             public nsIDOMContextMenuListener,
+                             public nsIDOMEventListener,
                              public nsIMutationObserver
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIFORMFILLCONTROLLER
   NS_DECL_NSIAUTOCOMPLETESEARCH
   NS_DECL_NSIAUTOCOMPLETEINPUT
   NS_DECL_NSIDOMEVENTLISTENER
   NS_DECL_NSIMUTATIONOBSERVER
 
-  // nsIDOMFocusListener
-  NS_IMETHOD Focus(nsIDOMEvent* aEvent);
-  NS_IMETHOD Blur(nsIDOMEvent* aEvent);
-
-  // nsIDOMKeyListener
-  NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent);
-  NS_IMETHOD KeyUp(nsIDOMEvent* aKeyEvent);
-  NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent);
-
-  // nsIDOMCompositionListener
-  NS_IMETHOD HandleStartComposition(nsIDOMEvent* aCompositionEvent);
-  NS_IMETHOD HandleEndComposition(nsIDOMEvent* aCompositionEvent);
-
-  // nsIDOMFormListener
-  NS_IMETHOD Submit(nsIDOMEvent* aEvent);
-  NS_IMETHOD Reset(nsIDOMEvent* aEvent);
-  NS_IMETHOD Change(nsIDOMEvent* aEvent);
-  NS_IMETHOD Select(nsIDOMEvent* aEvent);
-  NS_IMETHOD Input(nsIDOMEvent* aEvent);
-
-  // nsIDOMMouseListener
-  NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent);
-  NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent);
-  NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent);
-  NS_IMETHOD MouseDblClick(nsIDOMEvent* aMouseEvent);
-  NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent);
-  NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent);
-
-  // nsIDOMContextMenuListener
-  NS_IMETHOD ContextMenu(nsIDOMEvent* aContextMenuEvent);
+  nsresult Focus(nsIDOMEvent* aEvent);
+  nsresult KeyPress(nsIDOMEvent* aKeyEvent);
+  nsresult MouseDown(nsIDOMEvent* aMouseEvent);
 
   nsFormFillController();
   virtual ~nsFormFillController();
 
 protected:
   void AddWindowListeners(nsIDOMWindow *aWindow);
   void RemoveWindowListeners(nsIDOMWindow *aWindow);