зеркало из https://github.com/mozilla/pjs.git
Bug 699243 - Instantiate a11y if Android a11y is turned on [r=blassey]
This commit is contained in:
Родитель
d0b554364e
Коммит
cd4dabe6f9
|
@ -84,6 +84,10 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
|
|||
static gfxIntSize gAndroidBounds;
|
||||
static gfxIntSize gAndroidScreenBounds;
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
bool nsWindow::sAccessibilityEnabled = false;
|
||||
#endif
|
||||
|
||||
class ContentCreationNotifier;
|
||||
static nsCOMPtr<ContentCreationNotifier> gContentCreationNotifier;
|
||||
// A helper class to send updates when content processes
|
||||
|
@ -177,6 +181,9 @@ nsWindow::nsWindow() :
|
|||
mIsVisible(false),
|
||||
mParent(nsnull),
|
||||
mFocus(nsnull),
|
||||
#ifdef ACCESSIBILITY
|
||||
mRootAccessible(nsnull),
|
||||
#endif
|
||||
mIMEComposing(false)
|
||||
{
|
||||
}
|
||||
|
@ -188,6 +195,11 @@ nsWindow::~nsWindow()
|
|||
if (top->mFocus == this)
|
||||
top->mFocus = nsnull;
|
||||
ALOG("nsWindow %p destructor", (void*)this);
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
if (mRootAccessible)
|
||||
mRootAccessible = nsnull;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -375,6 +387,19 @@ nsWindow::Show(bool aState)
|
|||
nsAppShell::gAppShell->PostEvent(new AndroidGeckoEvent(-1, -1, -1, -1));
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
static bool sAccessibilityChecked = false;
|
||||
|
||||
if (!sAccessibilityChecked) {
|
||||
sAccessibilityChecked = true;
|
||||
sAccessibilityEnabled =
|
||||
AndroidBridge::Bridge()->GetAccessibilityEnabled();
|
||||
}
|
||||
|
||||
if (aState && sAccessibilityEnabled)
|
||||
CreateRootAccessible();
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ANDROID_WIDGET
|
||||
DumpWindows();
|
||||
#endif
|
||||
|
@ -382,6 +407,32 @@ nsWindow::Show(bool aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
void
|
||||
nsWindow::CreateRootAccessible()
|
||||
{
|
||||
if (IsTopLevel() && !mRootAccessible) {
|
||||
ALOG(("nsWindow:: Create Toplevel Accessibility\n"));
|
||||
nsAccessible *acc = DispatchAccessibleEvent();
|
||||
|
||||
if (acc) {
|
||||
mRootAccessible = acc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsWindow::DispatchAccessibleEvent()
|
||||
{
|
||||
nsAccessibleEvent event(true, NS_GETACCESSIBLE, this);
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
|
||||
return event.mAccessible;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::SetModal(bool aState)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,10 @@
|
|||
|
||||
#include "nsTArray.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsAccessible.h"
|
||||
#endif
|
||||
|
||||
class gfxASurface;
|
||||
class nsIdleService;
|
||||
|
||||
|
@ -168,6 +172,9 @@ public:
|
|||
gfxASurface* GetThebesSurface();
|
||||
|
||||
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
||||
#ifdef ACCESSIBILITY
|
||||
static bool sAccessibilityEnabled;
|
||||
#endif
|
||||
protected:
|
||||
void BringToFront();
|
||||
nsWindow *FindTopLevel();
|
||||
|
@ -213,6 +220,21 @@ private:
|
|||
void DispatchGestureEvent(PRUint32 msg, PRUint32 direction, double delta,
|
||||
const nsIntPoint &refPoint, PRUint64 time);
|
||||
void HandleSpecialKey(mozilla::AndroidGeckoEvent *ae);
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
nsRefPtr<nsAccessible> 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.
|
||||
*/
|
||||
nsAccessible *DispatchAccessibleEvent();
|
||||
#endif // ACCESSIBILITY
|
||||
};
|
||||
|
||||
#endif /* NSWINDOW_H_ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче