Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
authorNeil Deakin <neil@mozilla.com>
Wed, 15 Aug 2012 14:52:37 -0400
changeset 102821 92fdc7bd7f5fbd1304b701c4f7d36efdb3943e37
parent 102820 1fdb203e1e04e02974cc1d4581628d1b8280ccf7
child 102822 e389f7bcd86d14ba2d9f35d4f9a3b0111448a385
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerstrevsaunders
bugs743975
milestone17.0a1
Bug 743975 - remove accessibility events from widget, replace with a nsBaseWidget::GetAccessible method, r=trevsaunders
content/events/src/nsDOMEvent.cpp
layout/base/nsPresShell.cpp
widget/cocoa/nsChildView.mm
widget/gtk2/nsWindow.cpp
widget/gtk2/nsWindow.h
widget/nsEvent.h
widget/nsGUIEvent.h
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
widget/xpwidgets/nsBaseWidget.cpp
widget/xpwidgets/nsBaseWidget.h
xpfe/appshell/src/nsWebShellWindow.cpp
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -787,24 +787,16 @@ nsDOMEvent::DuplicatePrivateData()
       mutationEvent->mRelatedNode = oldMutationEvent->mRelatedNode;
       mutationEvent->mAttrName = oldMutationEvent->mAttrName;
       mutationEvent->mPrevAttrValue = oldMutationEvent->mPrevAttrValue;
       mutationEvent->mNewAttrValue = oldMutationEvent->mNewAttrValue;
       mutationEvent->mAttrChange = oldMutationEvent->mAttrChange;
       newEvent = mutationEvent;
       break;
     }
-#ifdef ACCESSIBILITY
-    case NS_ACCESSIBLE_EVENT:
-    {
-      newEvent = new nsAccessibleEvent(false, msg, nullptr);
-      isInputEvent = true;
-      break;
-    }
-#endif
     case NS_FORM_EVENT:
     {
       newEvent = new nsFormEvent(false, msg);
       break;
     }
     case NS_FOCUS_EVENT:
     {
       nsFocusEvent* newFocusEvent = new nsFocusEvent(false, msg);
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -5657,26 +5657,16 @@ PresShell::HandleEvent(nsIFrame        *
   if (mIsDestroying ||
       (sDisableNonTestMouseEvents && NS_IS_MOUSE_EVENT(aEvent) &&
        !(aEvent->flags & NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT))) {
     return NS_OK;
   }
 
   RecordMouseLocation(aEvent);
 
-#ifdef ACCESSIBILITY
-  if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT) {
-    NS_TIME_FUNCTION_MIN(1.0);
-
-    // Accessibility events come through OS requests and not from scripts,
-    // so it is safe to handle here
-    return HandleEventInternal(aEvent, aEventStatus);
-  }
-#endif
-
   if (!nsContentUtils::IsSafeToRunScript())
     return NS_OK;
 
   NS_TIME_FUNCTION_MIN(1.0);
 
   nsIContent* capturingContent =
     NS_IS_MOUSE_EVENT(aEvent) || aEvent->eventStructType == NS_WHEEL_EVENT ?
       GetCapturingContent() : nullptr;
@@ -6286,42 +6276,16 @@ static bool CanHandleContextMenuEvent(ns
   return true;
 }
 
 nsresult
 PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
 {
   NS_TIME_FUNCTION_MIN(1.0);
 
-#ifdef ACCESSIBILITY
-  if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT)
-  {
-    nsAccessibleEvent *accEvent = static_cast<nsAccessibleEvent*>(aEvent);
-    accEvent->mAccessible = nullptr;
-
-    nsCOMPtr<nsIAccessibilityService> accService =
-      do_GetService("@mozilla.org/accessibilityService;1");
-    if (accService) {
-      nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
-      if (!container) {
-        // This presshell is not active. This often happens when a
-        // preshell is being held onto for fastback.
-        return NS_OK;
-      }
-
-      // Accessible creation might be not safe so we make sure it's not created
-      // at unsafe times.
-      accEvent->mAccessible =
-        accService->GetRootDocumentAccessible(this, nsContentUtils::IsSafeToRunScript());
-
-      return NS_OK;
-    }
-  }
-#endif
-
   nsRefPtr<nsEventStateManager> manager = mPresContext->EventStateManager();
   nsresult rv = NS_OK;
 
   if (!NS_EVENT_NEEDS_FRAME(aEvent) || GetCurrentEventFrame()) {
     bool touchIsNew = false;
     bool isHandlingUserInput = false;
 
     // XXX How about IME events and input events for plugins?
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1920,26 +1920,22 @@ nsChildView::GetDocumentAccessible()
 
   Accessible *docAccessible = nullptr;
   if (mAccessible) {
     CallQueryReferent(mAccessible.get(), &docAccessible);
     return docAccessible;
   }
 
   // need to fetch the accessible anew, because it has gone away.
-  nsEventStatus status;
-  nsAccessibleEvent event(true, NS_GETACCESSIBLE, this);
-  DispatchEvent(&event, status);
-
   // cache the accessible in our weak ptr
-  mAccessible =
-    do_GetWeakReference(static_cast<nsIAccessible*>(event.mAccessible));
-
-  NS_IF_ADDREF(event.mAccessible);
-  return event.mAccessible;
+  Accessible* acc = GetAccessible();
+  mAccessible = do_GetWeakReference(static_cast<nsIAccessible *>(acc));
+
+  NS_IF_ADDREF(acc);
+  return acc;
 }
 #endif
 
 #pragma mark -
 
 @implementation ChildView
 
 // globalDragPboard is non-null during native drag sessions that did not originate
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -5823,55 +5823,42 @@ is_parent_grab_leave(GdkEventCrossing *a
 }
 
 #ifdef ACCESSIBILITY
 void
 nsWindow::CreateRootAccessible()
 {
     if (mIsTopLevel && !mRootAccessible) {
         LOG(("nsWindow:: Create Toplevel Accessibility\n"));
-        Accessible* acc = DispatchAccessibleEvent();
-
-        if (acc) {
-            mRootAccessible = acc;
-        }
-    }
-}
-
-Accessible*
-nsWindow::DispatchAccessibleEvent()
-{
-    nsAccessibleEvent event(true, NS_GETACCESSIBLE, this);
-
-    nsEventStatus status;
-    DispatchEvent(&event, status);
-
-    return event.mAccessible;
+        mRootAccessible = GetAccessible();
+    }
 }
 
 void
 nsWindow::DispatchEventToRootAccessible(PRUint32 aEventType)
 {
     if (!a11y::ShouldA11yBeEnabled()) {
         return;
     }
 
     nsCOMPtr<nsIAccessibilityService> accService =
         do_GetService("@mozilla.org/accessibilityService;1");
     if (!accService) {
         return;
     }
 
     // Get the root document accessible and fire event to it.
-    Accessible* acc = DispatchAccessibleEvent();
+    Accessible *acc = GetAccessible();
     if (acc) {
         accService->FireAccessibleEvent(aEventType, acc);
     }
 }
 
+// XXXndeakin what is all this for? Accessibility should be receiving these
+// notifications of gtk the same as other platforms.
 void
 nsWindow::DispatchActivateEventAccessible(void)
 {
     DispatchEventToRootAccessible(nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE);
 }
 
 void
 nsWindow::DispatchDeactivateEventAccessible(void)
--- a/widget/gtk2/nsWindow.h
+++ b/widget/gtk2/nsWindow.h
@@ -379,22 +379,16 @@ private:
     nsRefPtr<Accessible> mRootAccessible;
 
     /**
      * Request to create the accessible for this window if it is top level.
      */
     void                CreateRootAccessible();
 
     /**
-     * Generate the NS_GETACCESSIBLE event to get accessible for this window
-     * and return it.
-     */
-    Accessible       *DispatchAccessibleEvent();
-
-    /**
      * Dispatch accessible event for the top level window accessible.
      *
      * @param  aEventType  [in] the accessible event type to dispatch
      */
     void                DispatchEventToRootAccessible(PRUint32 aEventType);
 
     /**
      * Dispatch accessible window activate event for the top level window
--- a/widget/nsEvent.h
+++ b/widget/nsEvent.h
@@ -54,19 +54,16 @@ class nsZLevelEvent;
 class nsPaintEvent;
 class nsScrollbarEvent;
 class nsScrollPortEvent;
 class nsScrollAreaEvent;
 class nsInputEvent;
 class nsMouseEvent_base;
 class nsMouseEvent;
 class nsDragEvent;
-#ifdef ACCESSIBILITY
-class nsAccessibleEvent;
-#endif
 class nsKeyEvent;
 class nsTextEvent;
 class nsCompositionEvent;
 class nsMouseScrollEvent;
 class nsGestureNotifyEvent;
 class nsQueryContentEvent;
 class nsFocusEvent;
 class nsSelectionEvent;
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -34,19 +34,16 @@ namespace dom {
   class PBrowserParent;
   class PBrowserChild;
 }
 namespace plugins {
   class PPluginInstanceChild;
 }
 }
 
-#ifdef ACCESSIBILITY
-class Accessible;
-#endif
 class nsRenderingContext;
 class nsIMenuItem;
 class nsIContent;
 class nsIURI;
 class nsHashKey;
 
 /**
  * Event Struct Types
@@ -62,17 +59,16 @@ class nsHashKey;
 #define NS_KEY_EVENT                       9
 #define NS_MOUSE_EVENT                    10
 #define NS_SCRIPT_ERROR_EVENT             12
 #define NS_TEXT_EVENT                     13
 #define NS_COMPOSITION_EVENT              14
 #define NS_MOUSE_SCROLL_EVENT             16
 #define NS_SCROLLPORT_EVENT               18
 #define NS_MUTATION_EVENT                 19 // |nsMutationEvent| in content
-#define NS_ACCESSIBLE_EVENT               20
 #define NS_FORM_EVENT                     21
 #define NS_FOCUS_EVENT                    22
 #define NS_POPUP_EVENT                    23
 #define NS_COMMAND_EVENT                  24
 #define NS_SCROLLAREA_EVENT               25
 #define NS_TRANSITION_EVENT               26
 #define NS_ANIMATION_EVENT                27
 
@@ -291,20 +287,16 @@ class nsHashKey;
 
 #define NS_SCROLLPORT_START           1700
 #define NS_SCROLLPORT_UNDERFLOW       (NS_SCROLLPORT_START)
 #define NS_SCROLLPORT_OVERFLOW        (NS_SCROLLPORT_START+1)
 #define NS_SCROLLPORT_OVERFLOWCHANGED (NS_SCROLLPORT_START+2)
 
 // Mutation events defined elsewhere starting at 1800
 
-// accessible events
-#define NS_ACCESSIBLE_START           1900
-#define NS_GETACCESSIBLE              (NS_ACCESSIBLE_START)
-
 #define NS_USER_DEFINED_EVENT         2000
  
 // composition events
 #define NS_COMPOSITION_EVENT_START    2200
 #define NS_COMPOSITION_START          (NS_COMPOSITION_EVENT_START)
 #define NS_COMPOSITION_END            (NS_COMPOSITION_EVENT_START + 1)
 #define NS_COMPOSITION_UPDATE         (NS_COMPOSITION_EVENT_START + 2)
 
@@ -1028,34 +1020,16 @@ public:
       flags |= NS_EVENT_FLAG_CANT_CANCEL;
     }
   }
 
   nsCOMPtr<nsIDOMDataTransfer> dataTransfer;
   bool userCancelled;
 };
 
-#ifdef ACCESSIBILITY
-/**
- * Accessible event
- */
-
-class nsAccessibleEvent : public nsInputEvent
-{
-public:
-  nsAccessibleEvent(bool isTrusted, PRUint32 msg, nsIWidget *w)
-    : nsInputEvent(isTrusted, msg, w, NS_ACCESSIBLE_EVENT),
-      mAccessible(nullptr)
-  {
-  }
-
-  Accessible *mAccessible;
-};
-#endif
-
 /**
  * Keyboard event
  */
 
 struct nsAlternativeCharCode {
   nsAlternativeCharCode(PRUint32 aUnshiftedCharCode,
                         PRUint32 aShiftedCharCode) :
     mUnshiftedCharCode(aUnshiftedCharCode), mShiftedCharCode(aShiftedCharCode)
@@ -1793,17 +1767,16 @@ enum nsDragDropEventStatus {
   /// The event is exit
   nsDragDropEventStatus_eDragExited, 
   /// The event is drop
   nsDragDropEventStatus_eDrop  
 };
 
 #define NS_IS_INPUT_EVENT(evnt) \
        (((evnt)->eventStructType == NS_INPUT_EVENT) || \
-        ((evnt)->eventStructType == NS_ACCESSIBLE_EVENT) || \
         ((evnt)->eventStructType == NS_MOUSE_EVENT) || \
         ((evnt)->eventStructType == NS_KEY_EVENT) || \
         ((evnt)->eventStructType == NS_TEXT_EVENT) || \
         ((evnt)->eventStructType == NS_TOUCH_EVENT) || \
         ((evnt)->eventStructType == NS_DRAG_EVENT) || \
         ((evnt)->eventStructType == NS_MOUSE_SCROLL_EVENT) || \
         ((evnt)->eventStructType == NS_MOZTOUCH_EVENT) || \
         ((evnt)->eventStructType == NS_SIMPLE_GESTURE_EVENT))
@@ -1935,18 +1908,17 @@ enum {
  * position or not.  When it should be handled there (e.g., the mouse events),
  * this returns TRUE.
  */
 inline bool NS_IsEventUsingCoordinates(nsEvent* aEvent)
 {
   return !NS_IS_KEY_EVENT(aEvent) && !NS_IS_IME_RELATED_EVENT(aEvent) &&
          !NS_IS_CONTEXT_MENU_KEY(aEvent) && !NS_IS_ACTIVATION_EVENT(aEvent) &&
          !NS_IS_PLUGIN_EVENT(aEvent) &&
-         !NS_IS_CONTENT_COMMAND_EVENT(aEvent) &&
-         aEvent->eventStructType != NS_ACCESSIBLE_EVENT;
+         !NS_IS_CONTENT_COMMAND_EVENT(aEvent);
 }
 
 /**
  * Whether the event should be handled by the focused DOM window in the
  * same top level window's or not.  E.g., key events, IME related events
  * (including the query content events, they are used in IME transaction)
  * should be handled by the (last) focused window rather than the dispatched
  * window.
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -3944,37 +3944,16 @@ bool nsWindow::DispatchMouseEvent(PRUint
     // the context menu key code in nsEventListenerManager::HandleEvent()
     // released it already.
     return result;
   }
 
   return result;
 }
 
-// Deal with accessibile event
-#ifdef ACCESSIBILITY
-Accessible*
-nsWindow::DispatchAccessibleEvent(PRUint32 aEventType)
-{
-  if (nullptr == mEventCallback) {
-    return nullptr;
-  }
-
-  nsAccessibleEvent event(true, aEventType, this);
-  InitEvent(event, nullptr);
-
-  ModifierKeyState modifierKeyState;
-  modifierKeyState.InitInputEvent(event);
-
-  DispatchWindowEvent(&event);
-
-  return event.mAccessible;
-}
-#endif
-
 bool nsWindow::DispatchFocusToTopLevelWindow(PRUint32 aEventType)
 {
   if (aEventType == NS_ACTIVATE)
     sJustGotActivate = false;
   sJustGotDeactivate = false;
 
   // retrive the toplevel window or dialog
   HWND curWnd = mWnd;
@@ -7408,26 +7387,25 @@ bool nsWindow::AssociateDefaultIMC(bool 
   NS_ASSERTION(ret, "ImmAssociateContextEx failed to disassociate the IMC");
   return ret != FALSE;
 }
 
 #ifdef ACCESSIBILITY
 
 #ifdef DEBUG_WMGETOBJECT
 #define NS_LOG_WMGETOBJECT_WNDACC(aWnd)                                        \
-  Accessible* acc = aWnd ?                                                   \
-    aWnd->DispatchAccessibleEvent(NS_GETACCESSIBLE) : nullptr;                  \
+  Accessible* acc = aWnd ? aWind->GetAccessible() : nullptr;                   \
   PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("     acc: %p", acc));                   \
   if (acc) {                                                                   \
     nsAutoString name;                                                         \
     acc->GetName(name);                                                        \
     PR_LOG(gWindowsLog, PR_LOG_ALWAYS,                                         \
            (", accname: %s", NS_ConvertUTF16toUTF8(name).get()));              \
     nsCOMPtr<nsIAccessibleDocument> doc = do_QueryObject(acc);                 \
-    void *hwnd = nullptr;                                                       \
+    void *hwnd = nullptr;                                                      \
     doc->GetWindowHandle(&hwnd);                                               \
     PR_LOG(gWindowsLog, PR_LOG_ALWAYS, (", acc hwnd: %d", hwnd));              \
   }
 
 #define NS_LOG_WMGETOBJECT_THISWND                                             \
 {                                                                              \
   PR_LOG(gWindowsLog, PR_LOG_ALWAYS,                                           \
          ("\n*******Get Doc Accessible*******\nOrig Window: "));               \
@@ -7461,17 +7439,17 @@ nsWindow::GetRootAccessible()
 
   if (mInDtor || mOnDestroyCalled || mWindowType == eWindowType_invisible) {
     return nullptr;
   }
 
   NS_LOG_WMGETOBJECT_THISWND
   NS_LOG_WMGETOBJECT_WND("This Window", mWnd);
 
-  return DispatchAccessibleEvent(NS_GETACCESSIBLE);
+  return GetAccessible();
 }
 #endif
 
 /**************************************************************
  **************************************************************
  **
  ** BLOCK: Transparency
  **
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -201,17 +201,16 @@ public:
   bool                    DispatchPluginEvent(UINT aMessage,
                                               WPARAM aWParam,
                                               LPARAM aLParam,
                                               bool aDispatchPendingEvents);
 
   void                    SuppressBlurEvents(bool aSuppress); // Called from nsFilePicker
   bool                    BlurEventsSuppressed();
 #ifdef ACCESSIBILITY
-  Accessible* DispatchAccessibleEvent(PRUint32 aEventType);
   Accessible* GetRootAccessible();
 #endif // ACCESSIBILITY
 
   /**
    * Window utilities
    */
   nsWindow*               GetTopLevelWindow(bool aStopOnDialogOrPopup);
   HWND                    GetWindowHandle() { return mWnd; }
--- a/widget/xpwidgets/nsBaseWidget.cpp
+++ b/widget/xpwidgets/nsBaseWidget.cpp
@@ -17,25 +17,31 @@
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsISimpleEnumerator.h"
 #include "nsIContent.h"
 #include "nsIServiceManager.h"
 #include "mozilla/Preferences.h"
 #include "BasicLayers.h"
 #include "LayerManagerOGL.h"
 #include "nsIXULRuntime.h"
+#include "nsIXULWindow.h"
+#include "nsIDocShell.h"
 #include "nsView.h"
 #include "nsIViewManager.h"
 #include "nsEventStateManager.h"
 #include "nsIGfxInfo.h"
 #include "npapi.h"
 #include "base/thread.h"
 #include "prenv.h"
 #include "mozilla/Attributes.h"
 
+#ifdef ACCESSIBILITY
+#include "nsAccessibilityService.h"
+#endif
+
 #ifdef DEBUG
 #include "nsIObserver.h"
 
 static void debug_RegisterPrefCallbacks();
 
 static bool debug_InSecureKeyboardInputMode = false;
 #endif
 
@@ -1334,49 +1340,93 @@ void nsBaseWidget::SetSizeConstraints(co
   // probably in the middle of a reflow.
 }
 
 const widget::SizeConstraints& nsBaseWidget::GetSizeConstraints() const
 {
   return mSizeConstraints;
 }
 
-static nsIPresShell* GetPresShell(nsIWidget* aWidget)
+// If clientData is non-null, then get the presShell from either the window
+// or the view. Otherwise, assume that this is a widget attached to a view.
+static nsIPresShell* GetPresShell(nsIWidget* aWidget, void* clientData)
 {
-  nsIView* view = nsView::GetViewFor(aWidget);
-  return view ? view->GetViewManager()->GetPresShell() : nullptr;
+  nsCOMPtr<nsIXULWindow> window(do_QueryInterface(static_cast<nsISupports *>(clientData)));
+  if (window) {
+    nsCOMPtr<nsIDocShell> docShell;
+    window->GetDocShell(getter_AddRefs(docShell));
+    if (docShell) {
+      nsCOMPtr<nsIPresShell> presShell;
+      docShell->GetPresShell(getter_AddRefs(presShell));
+      return presShell.get();
+    }
+  }
+  else {
+    nsIView* view = nsView::GetViewFor(aWidget);
+    if (view) {
+      return view->GetViewManager()->GetPresShell();
+    }
+  }
+ 
+  return nullptr;
 }
 
 void
 nsBaseWidget::NotifySizeMoveDone()
 {
-  nsIPresShell* presShell = GetPresShell(this);
+  nsIPresShell* presShell = GetPresShell(this, nullptr);
   if (presShell) {
     presShell->WindowSizeMoveDone();
   }
 }
 
 void
 nsBaseWidget::NotifySysColorChanged()
 {
-  nsIPresShell* presShell = GetPresShell(this);
+  nsIPresShell* presShell = GetPresShell(this, nullptr);
   if (presShell) {
     presShell->SysColorChanged();
   }
 }
 
 void
 nsBaseWidget::NotifyThemeChanged()
 {
-  nsIPresShell* presShell = GetPresShell(this);
+  nsIPresShell* presShell = GetPresShell(this, nullptr);
   if (presShell) {
     presShell->ThemeChanged();
   }
 }
 
+#ifdef ACCESSIBILITY
+
+Accessible*
+nsBaseWidget::GetAccessible()
+{
+  nsIPresShell* presShell = GetPresShell(this, mClientData);
+  NS_ENSURE_TRUE(presShell, nullptr);
+
+  // If container is null then the presshell is not active. This often happens
+  // when a preshell is being held onto for fastback.
+  nsPresContext* presContext = presShell->GetPresContext();
+  nsCOMPtr<nsISupports> container = presContext->GetContainer();
+  NS_ENSURE_TRUE(container, nullptr);
+
+  // Accessible creation might be not safe so use IsSafeToRunScript to
+  // make sure it's not created at unsafe times.
+  nsCOMPtr<nsIAccessibilityService> accService = services::GetAccessibilityService();
+  if (accService) {
+    return accService->GetRootDocumentAccessible(presShell, nsContentUtils::IsSafeToRunScript());
+  }
+
+  return nullptr;
+}
+
+#endif
+
 #ifdef DEBUG
 //////////////////////////////////////////////////////////////
 //
 // Convert a GUI event message code to a string.
 // Makes it a lot easier to debug events.
 //
 // See gtk/nsWidget.cpp and windows/nsWindow.cpp
 // for a DebugPrintEvent() function that uses
--- a/widget/xpwidgets/nsBaseWidget.h
+++ b/widget/xpwidgets/nsBaseWidget.h
@@ -14,16 +14,20 @@
 #include "nsCOMPtr.h"
 #include "nsGUIEvent.h"
 #include "nsAutoPtr.h"
 #include "nsIRollupListener.h"
 class nsIContent;
 class nsAutoRollup;
 class gfxContext;
 
+#ifdef ACCESSIBILITY
+class Accessible;
+#endif
+
 namespace mozilla {
 namespace layers {
 class BasicLayerManager;
 class CompositorChild;
 class CompositorParent;
 }
 }
 
@@ -162,16 +166,21 @@ public:
 
   void NotifySizeMoveDone();
 
   // Should be called by derived implementations to notify on system color and
   // theme changes.
   void NotifySysColorChanged();
   void NotifyThemeChanged();
 
+#ifdef ACCESSIBILITY
+  // Get the accessible for the window.
+  Accessible* GetAccessible();
+#endif
+
   nsPopupLevel PopupLevel() { return mPopupLevel; }
 
   virtual nsIntSize       ClientToWindowSize(const nsIntSize& aClientSize)
   {
     return aClientSize;
   }
 
   // return true if this is a popup widget with a native titlebar
--- a/xpfe/appshell/src/nsWebShellWindow.cpp
+++ b/xpfe/appshell/src/nsWebShellWindow.cpp
@@ -423,24 +423,16 @@ nsWebShellWindow::HandleEvent(nsGUIEvent
 
         nsCOMPtr<nsIDOMWindow> window = do_GetInterface(docShell);
         nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
         if (fm && window)
           fm->WindowLowered(window);
         break;
       }
       
-      case NS_GETACCESSIBLE: {
-        nsCOMPtr<nsIPresShell> presShell;
-        docShell->GetPresShell(getter_AddRefs(presShell));
-        if (presShell) {
-          presShell->HandleEventWithTarget(aEvent, nullptr, nullptr, &result);
-        }
-        break;
-      }
       default:
         break;
 
     }
   }
   return result;
 }