Bug 1455055 part 2. Clean up HandleEvent implementations in layout/xul. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 20 Apr 2018 00:49:29 -0400
changeset 468261 ee04ee4104b6264c8c28aa33bd2cf01ca01f9c25
parent 468260 6567a1d09c3923142b3c151cc6c6896cd4a78276
child 468262 21dc0a5895332067a6ff6e7dba21569c18ea4b55
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1455055
milestone61.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 1455055 part 2. Clean up HandleEvent implementations in layout/xul. r=masayuki They take Event now so we can simplify some things. MozReview-Commit-ID: HUbn7QWqRAQ
layout/xul/nsMenuBarListener.cpp
layout/xul/nsMenuBarListener.h
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsSliderFrame.cpp
layout/xul/nsSliderFrame.h
layout/xul/nsSplitterFrame.cpp
layout/xul/nsXULPopupManager.cpp
layout/xul/nsXULTooltipListener.cpp
layout/xul/nsXULTooltipListener.h
--- a/layout/xul/nsMenuBarListener.cpp
+++ b/layout/xul/nsMenuBarListener.cpp
@@ -187,20 +187,19 @@ nsMenuBarListener::ToggleMenuActiveState
     nsMenuPopupFrame* popupFrame = closemenu->GetPopup();
     if (popupFrame)
       pm->HidePopup(popupFrame->GetContent(), false, false, true, false);
   }
 }
 
 ////////////////////////////////////////////////////////////////////////
 nsresult
-nsMenuBarListener::KeyUp(nsIDOMEvent* aKeyEvent)
+nsMenuBarListener::KeyUp(Event* aKeyEvent)
 {
-  RefPtr<KeyboardEvent> keyEvent =
-    aKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+  RefPtr<KeyboardEvent> keyEvent = aKeyEvent->AsKeyboardEvent();
   if (!keyEvent) {
     return NS_OK;
   }
 
   InitAccessKey();
 
   //handlers shouldn't be triggered by non-trusted events.
   if (!keyEvent->IsTrusted()) {
@@ -252,51 +251,41 @@ nsMenuBarListener::KeyUp(nsIDOMEvent* aK
     }
   }
 
   return NS_OK; // means I am NOT consuming event
 }
 
 ////////////////////////////////////////////////////////////////////////
 nsresult
-nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
+nsMenuBarListener::KeyPress(Event* aKeyEvent)
 {
   // if event has already been handled, bail
-  if (aKeyEvent) {
-    bool eventHandled = false;
-    aKeyEvent->GetDefaultPrevented(&eventHandled);
-    if (eventHandled) {
-      return NS_OK;       // don't consume event
-    }
+  if (!aKeyEvent || aKeyEvent->DefaultPrevented()) {
+    return NS_OK;       // don't consume event
   }
 
   //handlers shouldn't be triggered by non-trusted events.
-  bool trustedEvent = false;
-  if (aKeyEvent) {
-    aKeyEvent->GetIsTrusted(&trustedEvent);
-  }
-
-  if (!trustedEvent) {
+  if (!aKeyEvent->IsTrusted()) {
     return NS_OK;
   }
 
   InitAccessKey();
 
   if (mAccessKey)
   {
     // If accesskey handling was forwarded to a child process, wait for
     // the mozaccesskeynotfound event before handling accesskeys.
     WidgetKeyboardEvent* nativeKeyEvent =
       aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
     if (!nativeKeyEvent) {
       return NS_OK;
     }
 
-    RefPtr<KeyboardEvent> keyEvent =
-      aKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    RefPtr<KeyboardEvent> keyEvent = aKeyEvent->AsKeyboardEvent();
     uint32_t keyCode = keyEvent->KeyCode();
 
     // Cancel the access key flag unless we are pressing the access key.
     if (keyCode != (uint32_t)mAccessKey) {
       mAccessKeyDownCanceled = true;
     }
 
 #ifndef XP_MACOSX
@@ -414,43 +403,37 @@ nsMenuBarListener::GetMenuForKeyEvent(Ke
     // so, we'll know the menu got activated.
     return mMenuBarFrame->FindMenuWithShortcut(aKeyEvent, aPeek);
   }
 
   return nullptr;
 }
 
 void
-nsMenuBarListener::ReserveKeyIfNeeded(nsIDOMEvent* aKeyEvent)
+nsMenuBarListener::ReserveKeyIfNeeded(Event* aKeyEvent)
 {
   WidgetKeyboardEvent* nativeKeyEvent =
     aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
   if (nsContentUtils::ShouldBlockReservedKeys(nativeKeyEvent)) {
     nativeKeyEvent->MarkAsReservedByChrome();
   }
 }
 
 ////////////////////////////////////////////////////////////////////////
 nsresult
-nsMenuBarListener::KeyDown(nsIDOMEvent* aKeyEvent)
+nsMenuBarListener::KeyDown(Event* aKeyEvent)
 {
   InitAccessKey();
 
   //handlers shouldn't be triggered by non-trusted events.
-  bool trustedEvent = false;
-  if (aKeyEvent) {
-    aKeyEvent->GetIsTrusted(&trustedEvent);
-  }
-
-  if (!trustedEvent) {
+  if (!aKeyEvent || !aKeyEvent->IsTrusted()) {
     return NS_OK;
   }
 
-  RefPtr<KeyboardEvent> keyEvent =
-    aKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+  RefPtr<KeyboardEvent> keyEvent = aKeyEvent->AsKeyboardEvent();
   if (!keyEvent) {
     return NS_OK;
   }
 
   uint32_t theChar = keyEvent->KeyCode();
 
   uint16_t eventPhase = keyEvent->EventPhase();
   bool capturing = (eventPhase == nsIDOMEvent::CAPTURING_PHASE);
@@ -459,18 +442,17 @@ nsMenuBarListener::KeyDown(nsIDOMEvent* 
   if (capturing && !mAccessKeyDown && theChar == NS_VK_F10 &&
       (GetModifiersForAccessKey(keyEvent) & ~MODIFIER_CONTROL) == 0) {
     ReserveKeyIfNeeded(aKeyEvent);
   }
 #endif
 
   if (mAccessKey && mAccessKeyFocuses)
   {
-    bool defaultPrevented = false;
-    aKeyEvent->GetDefaultPrevented(&defaultPrevented);
+    bool defaultPrevented = aKeyEvent->DefaultPrevented();
 
     // No other modifiers can be down.
     // Especially CTRL.  CTRL+ALT == AltGR, and we'll fuck up on non-US
     // enhanced 102-key keyboards if we don't check this.
     bool isAccessKeyDownEvent =
       ((theChar == (uint32_t)mAccessKey) &&
        (GetModifiersForAccessKey(keyEvent) & ~mAccessKeyMask) == 0);
 
@@ -507,69 +489,66 @@ nsMenuBarListener::KeyDown(nsIDOMEvent* 
   }
 
   return NS_OK; // means I am NOT consuming event
 }
 
 ////////////////////////////////////////////////////////////////////////
 
 nsresult
-nsMenuBarListener::Blur(nsIDOMEvent* aEvent)
+nsMenuBarListener::Blur(Event* aEvent)
 {
   if (!mMenuBarFrame->IsMenuOpen() && mMenuBarFrame->IsActive()) {
     ToggleMenuActiveState();
     mAccessKeyDown = false;
     mAccessKeyDownCanceled = false;
   }
   return NS_OK; // means I am NOT consuming event
 }
 
 ////////////////////////////////////////////////////////////////////////
 
 nsresult
-nsMenuBarListener::OnWindowDeactivated(nsIDOMEvent* aEvent)
+nsMenuBarListener::OnWindowDeactivated(Event* aEvent)
 {
   // Reset the accesskey state because we cannot receive the keyup event for
   // the pressing accesskey.
   mAccessKeyDown = false;
   mAccessKeyDownCanceled = false;
   return NS_OK; // means I am NOT consuming event
 }
 
 ////////////////////////////////////////////////////////////////////////
 nsresult
-nsMenuBarListener::MouseDown(nsIDOMEvent* aMouseEvent)
+nsMenuBarListener::MouseDown(Event* aMouseEvent)
 {
   // NOTE: MouseDown method listens all phases
 
   // Even if the mousedown event is canceled, it means the user don't want
   // to activate the menu.  Therefore, we need to record it at capturing (or
   // target) phase.
   if (mAccessKeyDown) {
     mAccessKeyDownCanceled = true;
   }
 
-  uint16_t phase = 0;
-  nsresult rv = aMouseEvent->GetEventPhase(&phase);
-  NS_ENSURE_SUCCESS(rv, rv);
   // Don't do anything at capturing phase, any behavior should be cancelable.
-  if (phase == nsIDOMEvent::CAPTURING_PHASE) {
+  if (aMouseEvent->EventPhase() == nsIDOMEvent::CAPTURING_PHASE) {
     return NS_OK;
   }
 
   if (!mMenuBarFrame->IsMenuOpen() && mMenuBarFrame->IsActive())
     ToggleMenuActiveState();
 
   return NS_OK; // means I am NOT consuming event
 }
 
 ////////////////////////////////////////////////////////////////////////
 
 nsresult
-nsMenuBarListener::Fullscreen(nsIDOMEvent* aEvent)
+nsMenuBarListener::Fullscreen(Event* aEvent)
 {
   if (mMenuBarFrame->IsActive()) {
     ToggleMenuActiveState();
   }
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////
--- a/layout/xul/nsMenuBarListener.h
+++ b/layout/xul/nsMenuBarListener.h
@@ -58,23 +58,23 @@ public:
    * IsAccessKeyPressed() returns true if the modifier state of aEvent matches
    * the modifier state of access key.
    */
   static bool IsAccessKeyPressed(mozilla::dom::KeyboardEvent* aEvent);
 
 protected:
   virtual ~nsMenuBarListener();
 
-  nsresult KeyUp(nsIDOMEvent* aMouseEvent);
-  nsresult KeyDown(nsIDOMEvent* aMouseEvent);
-  nsresult KeyPress(nsIDOMEvent* aMouseEvent);
-  nsresult Blur(nsIDOMEvent* aEvent);
-  nsresult OnWindowDeactivated(nsIDOMEvent* aEvent);
-  nsresult MouseDown(nsIDOMEvent* aMouseEvent);
-  nsresult Fullscreen(nsIDOMEvent* aEvent);
+  nsresult KeyUp(mozilla::dom::Event* aMouseEvent);
+  nsresult KeyDown(mozilla::dom::Event* aMouseEvent);
+  nsresult KeyPress(mozilla::dom::Event* aMouseEvent);
+  nsresult Blur(mozilla::dom::Event* aEvent);
+  nsresult OnWindowDeactivated(mozilla::dom::Event* aEvent);
+  nsresult MouseDown(mozilla::dom::Event* aMouseEvent);
+  nsresult Fullscreen(mozilla::dom::Event* aEvent);
 
   static void InitAccessKey();
 
   static mozilla::Modifiers
     GetModifiersForAccessKey(mozilla::dom::KeyboardEvent* event);
 
   /**
    * Given a key event for an Alt+shortcut combination,
@@ -82,17 +82,17 @@ protected:
    * is false, then play a beep and deactivate the menubar on Windows.
    */
   nsMenuFrame* GetMenuForKeyEvent(mozilla::dom::KeyboardEvent* aKeyEvent, bool aPeek);
 
   /**
    * Call MarkAsReservedByChrome if the user's preferences indicate that
    * the key should be chrome-only.
    */
-  void ReserveKeyIfNeeded(nsIDOMEvent* aKeyEvent);
+  void ReserveKeyIfNeeded(mozilla::dom::Event* aKeyEvent);
 
   // This should only be called by the nsMenuBarListener during event dispatch,
   // thus ensuring that this doesn't get destroyed during the process.
   void ToggleMenuActiveState();
 
   bool Destroyed() const { return !mMenuBarFrame; }
 
   // The menu bar object.
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -389,21 +389,19 @@ NS_IMETHODIMP nsXULPopupShownEvent::Run(
   WidgetMouseEvent event(true, eXULPopupShown, nullptr,
                          WidgetMouseEvent::eReal);
   return EventDispatcher::Dispatch(mPopup, mPresContext, &event);
 }
 
 NS_IMETHODIMP nsXULPopupShownEvent::HandleEvent(Event* aEvent)
 {
   nsMenuPopupFrame* popup = do_QueryFrame(mPopup->GetPrimaryFrame());
-  nsCOMPtr<nsIDOMEventTarget> eventTarget;
-  aEvent->GetTarget(getter_AddRefs(eventTarget));
   // Ignore events not targeted at the popup itself (ie targeted at
   // descendants):
-  if (!SameCOMIdentity(mPopup, eventTarget)) {
+  if (mPopup != aEvent->GetTarget()) {
     return NS_OK;
   }
   if (popup) {
     // ResetPopupShownDispatcher will delete the reference to this, so keep
     // another one until Run is finished.
     RefPtr<nsXULPopupShownEvent> event = this;
     // Only call Run if it the dispatcher was assigned. This avoids calling the
     // Run method if the transitionend event fires multiple times.
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -1157,17 +1157,17 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEve
         new AsyncScrollbarDragStarter(shell, widget, dragMetrics));
   }
   if (!waitForRefresh) {
     widget->StartAsyncScrollbarDrag(dragMetrics);
   }
 }
 
 nsresult
-nsSliderFrame::StartDrag(nsIDOMEvent* aEvent)
+nsSliderFrame::StartDrag(Event* aEvent)
 {
 #ifdef DEBUG_SLIDER
   printf("Begin dragging\n");
 #endif
   if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
                                          nsGkAtoms::_true, eCaseMatters))
     return NS_OK;
 
--- a/layout/xul/nsSliderFrame.h
+++ b/layout/xul/nsSliderFrame.h
@@ -88,17 +88,17 @@ public:
   virtual void AppendFrames(ChildListID     aListID,
                             nsFrameList&    aFrameList) override;
   virtual void InsertFrames(ChildListID     aListID,
                             nsIFrame*       aPrevFrame,
                             nsFrameList&    aFrameList) override;
   virtual void RemoveFrame(ChildListID     aListID,
                            nsIFrame*       aOldFrame) override;
 
-  nsresult StartDrag(nsIDOMEvent* aEvent);
+  nsresult StartDrag(mozilla::dom::Event* aEvent);
   nsresult StopDrag();
 
   void StartAPZDrag(mozilla::WidgetGUIEvent* aEvent);
 
   static int32_t GetCurrentPosition(nsIContent* content);
   static int32_t GetMinPosition(nsIContent* content);
   static int32_t GetMaxPosition(nsIContent* content);
   static int32_t GetIncrement(nsIContent* content);
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -65,19 +65,19 @@ public:
   explicit nsSplitterFrameInner(nsSplitterFrame* aSplitter)
   {
     mOuter = aSplitter;
     mPressed = false;
   }
 
   void Disconnect() { mOuter = nullptr; }
 
-  nsresult MouseDown(nsIDOMEvent* aMouseEvent);
-  nsresult MouseUp(nsIDOMEvent* aMouseEvent);
-  nsresult MouseMove(nsIDOMEvent* aMouseEvent);
+  nsresult MouseDown(Event* aMouseEvent);
+  nsresult MouseUp(Event* aMouseEvent);
+  nsresult MouseMove(Event* aMouseEvent);
 
   void MouseDrag(nsPresContext* aPresContext, WidgetGUIEvent* aEvent);
   void MouseUp(nsPresContext* aPresContext, WidgetGUIEvent* aEvent);
 
   void AdjustChildren(nsPresContext* aPresContext);
   void AdjustChildren(nsPresContext* aPresContext, nsSplitterInfo* aChildInfos, int32_t aCount, bool aIsHorizontal);
 
   void AddRemoveSpace(nscoord aDiff,
@@ -579,31 +579,31 @@ nsSplitterFrameInner::HandleEvent(dom::E
       eventType.EqualsLiteral("mouseout"))
     return MouseMove(aEvent);
 
   MOZ_ASSERT_UNREACHABLE("Unexpected eventType");
   return NS_OK;
 }
 
 nsresult
-nsSplitterFrameInner::MouseUp(nsIDOMEvent* aMouseEvent)
+nsSplitterFrameInner::MouseUp(Event* aMouseEvent)
 {
   NS_ENSURE_TRUE(mOuter, NS_OK);
   mPressed = false;
 
   nsIPresShell::SetCapturingContent(nullptr, 0);
 
   return NS_OK;
 }
 
 nsresult
-nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
+nsSplitterFrameInner::MouseDown(Event* aMouseEvent)
 {
   NS_ENSURE_TRUE(mOuter, NS_OK);
-  dom::MouseEvent* mouseEvent = aMouseEvent->InternalDOMEvent()->AsMouseEvent();
+  dom::MouseEvent* mouseEvent = aMouseEvent->AsMouseEvent();
   if (!mouseEvent) {
     return NS_OK;
   }
 
   // only if left button
   if (mouseEvent->Button() != 0)
      return NS_OK;
 
@@ -757,17 +757,17 @@ nsSplitterFrameInner::MouseDown(nsIDOMEv
   //printf("Pressed mDragStart=%d\n",mDragStart);
 
   nsIPresShell::SetCapturingContent(mOuter->GetContent(), CAPTURE_IGNOREALLOWED);
 
   return NS_OK;
 }
 
 nsresult
-nsSplitterFrameInner::MouseMove(nsIDOMEvent* aMouseEvent)
+nsSplitterFrameInner::MouseMove(Event* aMouseEvent)
 {
   NS_ENSURE_TRUE(mOuter, NS_OK);
   if (!mPressed)
     return NS_OK;
 
   if (mDragging)
     return NS_OK;
 
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -2608,18 +2608,17 @@ nsXULPopupManager::IsValidMenuItem(nsICo
     aContent->IsElement() &&
     aContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
                                        nsGkAtoms::_true, eCaseMatters));
 }
 
 nsresult
 nsXULPopupManager::HandleEvent(Event* aEvent)
 {
-  RefPtr<KeyboardEvent> keyEvent =
-    aEvent->InternalDOMEvent()->AsKeyboardEvent();
+  RefPtr<KeyboardEvent> keyEvent = aEvent->AsKeyboardEvent();
   NS_ENSURE_TRUE(keyEvent, NS_ERROR_UNEXPECTED);
 
   //handlers shouldn't be triggered by non-trusted events.
   if (!keyEvent->IsTrusted()) {
     return NS_OK;
   }
 
   nsAutoString eventType;
--- a/layout/xul/nsXULTooltipListener.cpp
+++ b/layout/xul/nsXULTooltipListener.cpp
@@ -70,17 +70,17 @@ nsXULTooltipListener::~nsXULTooltipListe
   // Unregister our pref observer
   Preferences::UnregisterCallback(ToolbarTipsPrefChanged,
                                   "browser.chrome.toolbar_tips");
 }
 
 NS_IMPL_ISUPPORTS(nsXULTooltipListener, nsIDOMEventListener)
 
 void
-nsXULTooltipListener::MouseOut(nsIDOMEvent* aEvent)
+nsXULTooltipListener::MouseOut(Event* aEvent)
 {
   // reset flag so that tooltip will display on the next MouseMove
   mTooltipShownOnce = false;
 
   // if the timer is running and no tooltip is shown, we
   // have to cancel the timer here so that it doesn't
   // show the tooltip if we move the mouse out of the window
   nsCOMPtr<nsIContent> currentTooltip = do_QueryReferent(mCurrentTooltip);
@@ -95,18 +95,17 @@ nsXULTooltipListener::MouseOut(nsIDOMEve
     return;
 #endif
 
 #ifdef MOZ_XUL
   // check to see if the mouse left the targetNode, and if so,
   // hide the tooltip
   if (currentTooltip) {
     // which node did the mouse leave?
-    nsCOMPtr<nsINode> targetNode = do_QueryInterface(
-      aEvent->InternalDOMEvent()->GetTarget());
+    nsCOMPtr<nsINode> targetNode = do_QueryInterface(aEvent->GetTarget());
 
     nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
     if (pm) {
       nsCOMPtr<nsINode> tooltipNode =
         pm->GetLastTriggerTooltipNode(currentTooltip->GetUncomposedDoc());
       if (tooltipNode == targetNode) {
         // if the target node is the current tooltip target node, the mouse
         // left the node the tooltip appeared on, so close the tooltip.
@@ -118,26 +117,26 @@ nsXULTooltipListener::MouseOut(nsIDOMEve
         }
       }
     }
   }
 #endif
 }
 
 void
-nsXULTooltipListener::MouseMove(nsIDOMEvent* aEvent)
+nsXULTooltipListener::MouseMove(Event* aEvent)
 {
   if (!sShowTooltips)
     return;
 
   // stash the coordinates of the event so that we can still get back to it from within the
   // timer callback. On win32, we'll get a MouseMove event even when a popup goes away --
   // even when the mouse doesn't change position! To get around this, we make sure the
   // mouse has really moved before proceeding.
-  MouseEvent* mouseEvent = aEvent->InternalDOMEvent()->AsMouseEvent();
+  MouseEvent* mouseEvent = aEvent->AsMouseEvent();
   if (!mouseEvent) {
     return;
   }
   int32_t newMouseX = mouseEvent->ScreenX(CallerType::System);
   int32_t newMouseY = mouseEvent->ScreenY(CallerType::System);
 
   // filter out false win32 MouseMove event
   if (mMouseScreenX == newMouseX && mMouseScreenY == newMouseY)
@@ -149,35 +148,35 @@ nsXULTooltipListener::MouseMove(nsIDOMEv
 
   if ((currentTooltip) &&
       (abs(mMouseScreenX - newMouseX) <= kTooltipMouseMoveTolerance) &&
       (abs(mMouseScreenY - newMouseY) <= kTooltipMouseMoveTolerance))
     return;
   mMouseScreenX = newMouseX;
   mMouseScreenY = newMouseY;
 
-  nsCOMPtr<nsIContent> sourceContent = do_QueryInterface(
-    aEvent->InternalDOMEvent()->GetCurrentTarget());
+  nsCOMPtr<nsIContent> sourceContent =
+    do_QueryInterface(aEvent->GetCurrentTarget());
   mSourceNode = do_GetWeakReference(sourceContent);
 #ifdef MOZ_XUL
   mIsSourceTree = sourceContent->IsXULElement(nsGkAtoms::treechildren);
   if (mIsSourceTree)
     CheckTreeBodyMove(mouseEvent);
 #endif
 
   // as the mouse moves, we want to make sure we reset the timer to show it,
   // so that the delay is from when the mouse stops moving, not when it enters
   // the node.
   KillTooltipTimer();
 
   // If the mouse moves while the tooltip is up, hide it. If nothing is
   // showing and the tooltip hasn't been displayed since the mouse entered
   // the node, then start the timer to show the tooltip.
   if (!currentTooltip && !mTooltipShownOnce) {
-    nsCOMPtr<EventTarget> eventTarget = aEvent->InternalDOMEvent()->GetTarget();
+    nsCOMPtr<EventTarget> eventTarget = aEvent->GetTarget();
 
     // don't show tooltips attached to elements outside of a menu popup
     // when hovering over an element inside it. The popupsinherittooltip
     // attribute may be used to disable this behaviour, which is useful for
     // large menu hierarchies such as bookmarks.
     if (!sourceContent->IsElement() ||
         !sourceContent->AsElement()->AttrValueIs(kNameSpaceID_None,
                                                  nsGkAtoms::popupsinherittooltip,
--- a/layout/xul/nsXULTooltipListener.h
+++ b/layout/xul/nsXULTooltipListener.h
@@ -18,28 +18,29 @@
 #endif
 #include "nsWeakPtr.h"
 #include "mozilla/Attributes.h"
 
 class nsIContent;
 
 namespace mozilla {
 namespace dom {
+class Event;
 class MouseEvent;
 } // namespace dom
 } // namespace mozilla
 
 class nsXULTooltipListener final : public nsIDOMEventListener
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMEVENTLISTENER
 
-  void MouseOut(nsIDOMEvent* aEvent);
-  void MouseMove(nsIDOMEvent* aEvent);
+  void MouseOut(mozilla::dom::Event* aEvent);
+  void MouseMove(mozilla::dom::Event* aEvent);
 
   void AddTooltipSupport(nsIContent* aNode);
   void RemoveTooltipSupport(nsIContent* aNode);
   static nsXULTooltipListener* GetInstance() {
     if (!sInstance)
       sInstance = new nsXULTooltipListener();
     return sInstance;
   }