2012-06-06 17:26:45 -07:00
|
|
|
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
2012-12-01 16:58:25 -08:00
|
|
|
#include "Platform.h"
|
2015-05-29 10:42:23 -07:00
|
|
|
#include "ProxyAccessible.h"
|
2012-06-06 17:26:45 -07:00
|
|
|
|
|
|
|
#include "nsAppShell.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2012-06-19 16:19:13 -07:00
|
|
|
// Mac a11y whitelisting
|
2012-06-06 17:26:45 -07:00
|
|
|
static bool sA11yShouldBeEnabled = false;
|
|
|
|
|
|
|
|
bool
|
|
|
|
ShouldA11yBeEnabled()
|
|
|
|
{
|
2012-06-19 16:19:13 -07:00
|
|
|
EPlatformDisabledState disabledState = PlatformDisabledState();
|
|
|
|
return (disabledState == ePlatformIsForceEnabled) || ((disabledState == ePlatformIsEnabled) && sA11yShouldBeEnabled);
|
2012-06-06 17:26:45 -07:00
|
|
|
}
|
|
|
|
|
2012-12-01 16:58:25 -08:00
|
|
|
void
|
|
|
|
PlatformInit()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PlatformShutdown()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-03-07 13:35:19 -08:00
|
|
|
void
|
2015-05-29 10:42:23 -07:00
|
|
|
ProxyCreated(ProxyAccessible* aProxy, uint32_t)
|
2014-03-07 13:35:19 -08:00
|
|
|
{
|
2015-05-29 10:42:23 -07:00
|
|
|
// Pass in dummy state for now as retrieving proxy state requires IPC.
|
|
|
|
Class type = GetTypeFromRole(aProxy->Role());
|
|
|
|
uintptr_t accWrap = reinterpret_cast<uintptr_t>(aProxy) | IS_PROXY;
|
|
|
|
mozAccessible* mozWrapper = [[type alloc] initWithAccessible:accWrap];
|
|
|
|
aProxy->SetWrapper(reinterpret_cast<uintptr_t>(mozWrapper));
|
2014-03-07 13:35:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-05-29 10:42:23 -07:00
|
|
|
ProxyDestroyed(ProxyAccessible* aProxy)
|
2014-03-07 13:35:19 -08:00
|
|
|
{
|
2015-05-29 10:42:23 -07:00
|
|
|
mozAccessible* wrapper =
|
|
|
|
reinterpret_cast<mozAccessible*>(aProxy->GetWrapper());
|
|
|
|
[wrapper expire];
|
|
|
|
[wrapper release];
|
|
|
|
aProxy->SetWrapper(0);
|
2014-03-07 13:35:19 -08:00
|
|
|
}
|
2014-09-30 07:00:26 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
ProxyEvent(ProxyAccessible*, uint32_t)
|
|
|
|
{
|
|
|
|
}
|
2015-05-13 11:21:23 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
ProxyStateChangeEvent(ProxyAccessible*, uint64_t, bool)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset)
|
|
|
|
{
|
|
|
|
}
|
2012-06-06 17:26:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@interface GeckoNSApplication(a11y)
|
|
|
|
-(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation GeckoNSApplication(a11y)
|
|
|
|
|
|
|
|
-(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute
|
|
|
|
{
|
|
|
|
if ([attribute isEqualToString:@"AXEnhancedUserInterface"])
|
|
|
|
mozilla::a11y::sA11yShouldBeEnabled = ([value intValue] == 1);
|
|
|
|
|
|
|
|
return [super accessibilitySetValue:value forAttribute:attribute];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|