Bug 1342245 - Add support for accessibility.force_disabled=-1 (force enabled) on Windows. r=aklotz
authorJim Mathies <jmathies@mozilla.com>
Fri, 24 Feb 2017 08:58:40 -0600
changeset 350134 ccbe98d0a36165342b5a3798eb092001ae745c83
parent 350133 b21231a525e96e6dffd44fd65c265d31b888fd95
child 350135 5a2921ee62c220bf9235971fda74a45e81911a1f
push id31568
push userkwierso@gmail.com
push dateTue, 28 Mar 2017 20:31:07 +0000
treeherdermozilla-central@272ce6c25721 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1342245
milestone55.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 1342245 - Add support for accessibility.force_disabled=-1 (force enabled) on Windows. r=aklotz MozReview-Commit-ID: 7cl6AI5ZFs9
widget/windows/WinMessages.h
widget/windows/nsWindow.cpp
--- a/widget/windows/WinMessages.h
+++ b/widget/windows/WinMessages.h
@@ -10,16 +10,18 @@
  * MOZ_WM_* messages
  ****************************************************************************/
 
 // A magic APP message that can be sent to quit, sort of like a
 // QUERYENDSESSION/ENDSESSION, but without the query.
 #define MOZ_WM_APP_QUIT                   (WM_APP+0x0300)
 // Used as a "tracer" event to probe event loop latency.
 #define MOZ_WM_TRACE                      (WM_APP+0x0301)
+// accessibility priming
+#define MOZ_WM_STARTA11Y                  (WM_APP+0x0302)
 // Our internal message for WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL and
 // WM_HSCROLL
 #define MOZ_WM_MOUSEVWHEEL                (WM_APP+0x0310)
 #define MOZ_WM_MOUSEHWHEEL                (WM_APP+0x0311)
 #define MOZ_WM_VSCROLL                    (WM_APP+0x0312)
 #define MOZ_WM_HSCROLL                    (WM_APP+0x0313)
 #define MOZ_WM_MOUSEWHEEL_FIRST           MOZ_WM_MOUSEVWHEEL
 #define MOZ_WM_MOUSEWHEEL_LAST            MOZ_WM_HSCROLL
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -932,16 +932,24 @@ nsWindow::Create(nsIWidget* aParent,
   }
 
   // Query for command button metric data for rendering the titlebar. We
   // only do this once on the first window that has an actual titlebar
   if (ShouldCacheTitleBarInfo(mWindowType, mBorderStyle)) {
     nsUXThemeData::UpdateTitlebarInfo(mWnd);
   }
 
+  static bool a11yPrimed = false;
+  if (!a11yPrimed &&
+      mWindowType == eWindowType_toplevel) {
+    a11yPrimed = true;
+    if (Preferences::GetInt("accessibility.force_disabled", 0) == -1) {
+      ::PostMessage(mWnd, MOZ_WM_STARTA11Y, 0, 0);
+    }
+  }
   return NS_OK;
 }
 
 // Close this nsWindow
 void nsWindow::Destroy()
 {
   // WM_DESTROY has already fired, avoid calling it twice
   if (mOnDestroyCalled)
@@ -5044,16 +5052,21 @@ nsWindow::ProcessMessage(UINT msg, WPARA
         bool abortQuit;
         cancelQuit->GetData(&abortQuit);
         sCanQuit = abortQuit ? TRI_FALSE : TRI_TRUE;
       }
       *aRetValue = sCanQuit ? TRUE : FALSE;
       result = true;
       break;
 
+    case MOZ_WM_STARTA11Y:
+      (void*)GetAccessible();
+      result = true;
+      break;
+
     case WM_ENDSESSION:
     case MOZ_WM_APP_QUIT:
       if (msg == MOZ_WM_APP_QUIT || (wParam == TRUE && sCanQuit == TRI_TRUE))
       {
         // Let's fake a shutdown sequence without actually closing windows etc.
         // to avoid Windows killing us in the middle. A proper shutdown would
         // require having a chance to pump some messages. Unfortunately
         // Windows won't let us do that. Bug 212316.