mirror of https://github.com/roytam1/UXP.git
382 changed files with 36 additions and 22824 deletions
@ -1,22 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/ |
||||
/* 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/. */
|
||||
|
||||
#ifndef MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H |
||||
#define MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H |
||||
|
||||
#include "ARIAGridAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
typedef class ARIAGridAccessible ARIAGridAccessibleWrap; |
||||
typedef class ARIAGridCellAccessible ARIAGridCellAccessibleWrap; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
@ -1,103 +0,0 @@
|
||||
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
/* For documentation of the accessibility architecture,
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/ |
||||
|
||||
#ifndef _AccessibleWrap_H_ |
||||
#define _AccessibleWrap_H_ |
||||
|
||||
#include <objc/objc.h> |
||||
|
||||
#include "Accessible.h" |
||||
#include "States.h" |
||||
|
||||
#include "nsCOMPtr.h" |
||||
|
||||
#include "nsTArray.h" |
||||
|
||||
#if defined(__OBJC__) |
||||
@class mozAccessible; |
||||
#endif |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
class AccessibleWrap : public Accessible |
||||
{ |
||||
public: // construction, destruction
|
||||
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); |
||||
virtual ~AccessibleWrap(); |
||||
|
||||
/**
|
||||
* Get the native Obj-C object (mozAccessible). |
||||
*/ |
||||
virtual void GetNativeInterface(void** aOutAccessible) override; |
||||
|
||||
/**
|
||||
* The objective-c |Class| type that this accessible's native object |
||||
* should be instantied with. used on runtime to determine the |
||||
* right type for this accessible's associated native object. |
||||
*/ |
||||
virtual Class GetNativeType (); |
||||
|
||||
virtual void Shutdown () override; |
||||
|
||||
virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) override; |
||||
virtual bool RemoveChild(Accessible* aAccessible) override; |
||||
|
||||
virtual nsresult HandleAccEvent(AccEvent* aEvent) override; |
||||
|
||||
protected: |
||||
|
||||
/**
|
||||
* Return true if the parent doesn't have children to expose to AT. |
||||
*/ |
||||
bool AncestorIsFlat(); |
||||
|
||||
/**
|
||||
* Get the native object. Create it if needed. |
||||
*/ |
||||
#if defined(__OBJC__) |
||||
mozAccessible* GetNativeObject(); |
||||
#else |
||||
id GetNativeObject(); |
||||
#endif |
||||
|
||||
private: |
||||
|
||||
/**
|
||||
* Our native object. Private because its creation is done lazily. |
||||
* Don't access it directly. Ever. Unless you are GetNativeObject() or |
||||
* Shutdown() |
||||
*/ |
||||
#if defined(__OBJC__) |
||||
// if we are in Objective-C, we use the actual Obj-C class.
|
||||
mozAccessible* mNativeObject; |
||||
#else |
||||
id mNativeObject; |
||||
#endif |
||||
|
||||
/**
|
||||
* We have created our native. This does not mean there is one. |
||||
* This can never go back to false. |
||||
* We need it because checking whether we need a native object cost time. |
||||
*/ |
||||
bool mNativeInited; |
||||
}; |
||||
|
||||
#if defined(__OBJC__) |
||||
void FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType); |
||||
#else |
||||
void FireNativeEvent(id aNativeAcc, uint32_t aEventType); |
||||
#endif |
||||
|
||||
Class GetTypeFromRole(roles::Role aRole); |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
@ -1,256 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */ |
||||
|
||||
#include "DocAccessible.h" |
||||
#include "nsObjCExceptions.h" |
||||
|
||||
#include "Accessible-inl.h" |
||||
#include "nsAccUtils.h" |
||||
#include "Role.h" |
||||
|
||||
#import "mozAccessible.h" |
||||
#import "mozActionElements.h" |
||||
#import "mozHTMLAccessible.h" |
||||
#import "mozTableAccessible.h" |
||||
#import "mozTextAccessible.h" |
||||
|
||||
using namespace mozilla; |
||||
using namespace mozilla::a11y; |
||||
|
||||
AccessibleWrap:: |
||||
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : |
||||
Accessible(aContent, aDoc), mNativeObject(nil), |
||||
mNativeInited(false) |
||||
{ |
||||
} |
||||
|
||||
AccessibleWrap::~AccessibleWrap() |
||||
{ |
||||
} |
||||
|
||||
mozAccessible* |
||||
AccessibleWrap::GetNativeObject() |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; |
||||
|
||||
if (!mNativeInited && !mNativeObject && !IsDefunct() && !AncestorIsFlat()) { |
||||
uintptr_t accWrap = reinterpret_cast<uintptr_t>(this); |
||||
mNativeObject = [[GetNativeType() alloc] initWithAccessible:accWrap]; |
||||
} |
||||
|
||||
mNativeInited = true; |
||||
|
||||
return mNativeObject; |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL; |
||||
} |
||||
|
||||
void |
||||
AccessibleWrap::GetNativeInterface(void** aOutInterface) |
||||
{ |
||||
*aOutInterface = static_cast<void*>(GetNativeObject()); |
||||
} |
||||
|
||||
// overridden in subclasses to create the right kind of object. by default we create a generic |
||||
// 'mozAccessible' node. |
||||
Class |
||||
AccessibleWrap::GetNativeType () |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; |
||||
|
||||
if (IsXULTabpanels()) |
||||
return [mozPaneAccessible class]; |
||||
|
||||
if (IsTable()) |
||||
return [mozTableAccessible class]; |
||||
|
||||
if (IsTableRow()) |
||||
return [mozTableRowAccessible class]; |
||||
|
||||
if (IsTableCell()) |
||||
return [mozTableCellAccessible class]; |
||||
|
||||
return GetTypeFromRole(Role()); |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL; |
||||
} |
||||
|
||||
// this method is very important. it is fired when an accessible object "dies". after this point |
||||
// the object might still be around (because some 3rd party still has a ref to it), but it is |
||||
// in fact 'dead'. |
||||
void |
||||
AccessibleWrap::Shutdown () |
||||
{ |
||||
// this ensure we will not try to re-create the native object. |
||||
mNativeInited = true; |
||||
|
||||
// we really intend to access the member directly. |
||||
if (mNativeObject) { |
||||
[mNativeObject expire]; |
||||
[mNativeObject release]; |
||||
mNativeObject = nil; |
||||
} |
||||
|
||||
Accessible::Shutdown(); |
||||
} |
||||
|
||||
nsresult |
||||
AccessibleWrap::HandleAccEvent(AccEvent* aEvent) |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |
||||
|
||||
nsresult rv = Accessible::HandleAccEvent(aEvent); |
||||
NS_ENSURE_SUCCESS(rv, rv); |
||||
|
||||
if (IPCAccessibilityActive()) { |
||||
return NS_OK; |
||||
} |
||||
|
||||
uint32_t eventType = aEvent->GetEventType(); |
||||
|
||||
// ignore everything but focus-changed, value-changed, caret, selection |
||||
// and document load complete events for now. |
||||
if (eventType != nsIAccessibleEvent::EVENT_FOCUS && |
||||
eventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE && |
||||
eventType != nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE && |
||||
eventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED && |
||||
eventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED && |
||||
eventType != nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE) |
||||
return NS_OK; |
||||
|
||||
Accessible* accessible = aEvent->GetAccessible(); |
||||
NS_ENSURE_STATE(accessible); |
||||
|
||||
mozAccessible *nativeAcc = nil; |
||||
accessible->GetNativeInterface((void**)&nativeAcc); |
||||
if (!nativeAcc) |
||||
return NS_ERROR_FAILURE; |
||||
|
||||
FireNativeEvent(nativeAcc, eventType); |
||||
|
||||
return NS_OK; |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |
||||
} |
||||
|
||||
bool |
||||
AccessibleWrap::InsertChildAt(uint32_t aIdx, Accessible* aAccessible) |
||||
{ |
||||
bool inserted = Accessible::InsertChildAt(aIdx, aAccessible); |
||||
if (inserted && mNativeObject) |
||||
[mNativeObject appendChild:aAccessible]; |
||||
|
||||
return inserted; |
||||
} |
||||
|
||||
bool |
||||
AccessibleWrap::RemoveChild(Accessible* aAccessible) |
||||
{ |
||||
bool removed = Accessible::RemoveChild(aAccessible); |
||||
|
||||
if (removed && mNativeObject) |
||||
[mNativeObject invalidateChildren]; |
||||
|
||||
return removed; |
||||
} |
||||
|
||||
//////////////////////////////////////////////////////////////////////////////// |
||||
// AccessibleWrap protected |
||||
|
||||
bool |
||||
AccessibleWrap::AncestorIsFlat() |
||||
{ |
||||
// We don't create a native object if we're child of a "flat" accessible; |
||||
// for example, on OS X buttons shouldn't have any children, because that |
||||
// makes the OS confused. |
||||
// |
||||
// To maintain a scripting environment where the XPCOM accessible hierarchy |
||||
// look the same on all platforms, we still let the C++ objects be created |
||||
// though. |
||||
|
||||
Accessible* parent = Parent(); |
||||
while (parent) { |
||||
if (nsAccUtils::MustPrune(parent)) |
||||
return true; |
||||
|
||||
parent = parent->Parent(); |
||||
} |
||||
// no parent was flat |
||||
return false; |
||||
} |
||||
|
||||
void |
||||
a11y::FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType) |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK; |
||||
|
||||
switch (aEventType) { |
||||
case nsIAccessibleEvent::EVENT_FOCUS: |
||||
[aNativeAcc didReceiveFocus]; |
||||
break; |
||||
case nsIAccessibleEvent::EVENT_VALUE_CHANGE: |
||||
case nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE: |
||||
[aNativeAcc valueDidChange]; |
||||
break; |
||||
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED: |
||||
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED: |
||||
[aNativeAcc selectedTextDidChange]; |
||||
break; |
||||
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE: |
||||
[aNativeAcc documentLoadComplete]; |
||||
break; |
||||
} |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK; |
||||
} |
||||
|
||||
Class |
||||
a11y::GetTypeFromRole(roles::Role aRole) |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; |
||||
|
||||
switch (aRole) { |
||||
case roles::COMBOBOX: |
||||
case roles::PUSHBUTTON: |
||||
case roles::SPLITBUTTON: |
||||
case roles::TOGGLE_BUTTON: |
||||
{ |
||||
return [mozButtonAccessible class]; |
||||
} |
||||
|
||||
case roles::PAGETAB: |
||||
return [mozButtonAccessible class]; |
||||
|
||||
case roles::CHECKBUTTON: |
||||
return [mozCheckboxAccessible class]; |
||||
|
||||
case roles::HEADING: |
||||
return [mozHeadingAccessible class]; |
||||
|
||||
case roles::PAGETABLIST: |
||||
return [mozTabsAccessible class]; |
||||
|
||||
case roles::ENTRY: |
||||
case roles::STATICTEXT: |
||||
case roles::CAPTION: |
||||
case roles::ACCEL_LABEL: |
||||
case roles::PASSWORD_TEXT: |
||||
// normal textfield (static or editable) |
||||
return [mozTextAccessible class]; |
||||
|
||||
case roles::TEXT_LEAF: |
||||
return [mozTextLeafAccessible class]; |
||||
|
||||
case roles::LINK: |
||||
return [mozLinkAccessible class]; |
||||
|
||||
default: |
||||
return [mozAccessible class]; |
||||
} |
||||
|
||||
return nil; |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL; |
||||
} |
@ -1,22 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
||||
/* vim:expandtab:shiftwidth=4:tabstop=4:
|
||||
*/ |
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_a11y_ApplicationAccessibleWrap_h__ |
||||
#define mozilla_a11y_ApplicationAccessibleWrap_h__ |
||||
|
||||
#include "ApplicationAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
typedef ApplicationAccessible ApplicationAccessibleWrap; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
||||
|
@ -1,25 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_a11y_DocAccessibleWrap_h__ |
||||
#define mozilla_a11y_DocAccessibleWrap_h__ |
||||
|
||||
#include "DocAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
class DocAccessibleWrap : public DocAccessible |
||||
{ |
||||
public: |
||||
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell); |
||||
virtual ~DocAccessibleWrap(); |
||||
|
||||
}; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
@ -1,21 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
||||
* 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/. */ |
||||
|
||||
#include "DocAccessibleWrap.h" |
||||
|
||||
#import "mozAccessible.h" |
||||
|
||||
using namespace mozilla::a11y; |
||||
|
||||
DocAccessibleWrap:: |
||||
DocAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) : |
||||
DocAccessible(aDocument, aPresShell) |
||||
{ |
||||
} |
||||
|
||||
DocAccessibleWrap::~DocAccessibleWrap() |
||||
{ |
||||
} |
||||
|
@ -1,24 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/ |
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_a11y_HTMLTableAccessibleWrap_h__ |
||||
#define mozilla_a11y_HTMLTableAccessibleWrap_h__ |
||||
|
||||
#include "HTMLTableAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
typedef class HTMLTableAccessible HTMLTableAccessibleWrap; |
||||
typedef class HTMLTableCellAccessible HTMLTableCellAccessibleWrap; |
||||
typedef class HTMLTableHeaderCellAccessible HTMLTableHeaderCellAccessibleWrap; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
||||
|
@ -1,20 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_a11y_HyperTextAccessibleWrap_h__ |
||||
#define mozilla_a11y_HyperTextAccessibleWrap_h__ |
||||
|
||||
#include "HyperTextAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
typedef class HyperTextAccessible HyperTextAccessibleWrap; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
||||
|
@ -1,22 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
||||
*/ |
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_a11y_ImageAccessibleWrap_h__ |
||||
#define mozilla_a11y_ImageAccessibleWrap_h__ |
||||
|
||||
#include "ImageAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
typedef class ImageAccessible ImageAccessibleWrap; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
||||
|
@ -1,26 +0,0 @@
|
||||
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
#ifndef _MacUtils_H_ |
||||
#define _MacUtils_H_ |
||||
|
||||
@class NSString; |
||||
class nsString; |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
namespace utils { |
||||
|
||||
/**
|
||||
* Get a localized string from the string bundle. |
||||
* Return nil if not found. |
||||
*/ |
||||
NSString* LocalizedString(const nsString& aString); |
||||
|
||||
} |
||||
} |
||||
} |
||||
|
||||
#endif |
@ -1,32 +0,0 @@
|
||||
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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 "MacUtils.h" |
||||
|
||||
#include "Accessible.h" |
||||
|
||||
#include "nsCocoaUtils.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
namespace utils { |
||||
|
||||
/** |
||||
* Get a localized string from the a11y string bundle. |
||||
* Return nil if not found. |
||||
*/ |
||||
NSString* |
||||
LocalizedString(const nsString& aString) |
||||
{ |
||||
nsString text; |
||||
|
||||
Accessible::TranslateString(aString, text); |
||||
|
||||
return text.IsEmpty() ? nil : nsCocoaUtils::ToNSString(text); |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
@ -1,174 +0,0 @@
|
||||
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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> |
||||
|
||||
#include "Platform.h" |
||||
#include "ProxyAccessible.h" |
||||
#include "DocAccessibleParent.h" |
||||
#include "mozTableAccessible.h" |
||||
|
||||
#include "nsAppShell.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
// Mac a11y whitelisting |
||||
static bool sA11yShouldBeEnabled = false; |
||||
|
||||
bool |
||||
ShouldA11yBeEnabled() |
||||
{ |
||||
EPlatformDisabledState disabledState = PlatformDisabledState(); |
||||
return (disabledState == ePlatformIsForceEnabled) || ((disabledState == ePlatformIsEnabled) && sA11yShouldBeEnabled); |
||||
} |
||||
|
||||
void |
||||
PlatformInit() |
||||
{ |
||||
} |
||||
|
||||
void |
||||
PlatformShutdown() |
||||
{ |
||||
} |
||||
|
||||
void |
||||
ProxyCreated(ProxyAccessible* aProxy, uint32_t) |
||||
{ |
||||
// Pass in dummy state for now as retrieving proxy state requires IPC. |
||||
// Note that we can use ProxyAccessible::IsTable* functions here because they |
||||
// do not use IPC calls but that might change after bug 1210477. |
||||
Class type; |
||||
if (aProxy->IsTable()) |
||||
type = [mozTableAccessible class]; |
||||
else if (aProxy->IsTableRow()) |
||||
type = [mozTableRowAccessible class]; |
||||
else if (aProxy->IsTableCell()) |
||||
type = [mozTableCellAccessible class]; |
||||
else |
||||
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)); |
||||
|
||||
mozAccessible* nativeParent = nullptr; |
||||
if (aProxy->IsDoc() && aProxy->AsDoc()->IsTopLevel()) { |
||||
// If proxy is top level, the parent we need to invalidate the children of |
||||
// will be a non-remote accessible. |
||||
Accessible* outerDoc = aProxy->OuterDocOfRemoteBrowser(); |
||||
if (outerDoc) { |
||||
nativeParent = GetNativeFromGeckoAccessible(outerDoc); |
||||
} |
||||
} else { |
||||
// Non-top level proxies need proxy parents' children invalidated. |
||||
ProxyAccessible* parent = aProxy->Parent(); |
||||
nativeParent = GetNativeFromProxy(parent); |
||||
NS_ASSERTION(parent, "a non-top-level proxy is missing a parent?"); |
||||
} |
||||
|
||||
if (nativeParent) { |
||||
[nativeParent invalidateChildren]; |
||||
} |
||||
} |
||||
|
||||
void |
||||
ProxyDestroyed(ProxyAccessible* aProxy) |
||||
{ |
||||
mozAccessible* nativeParent = nil; |
||||
if (aProxy->IsDoc() && aProxy->AsDoc()->IsTopLevel()) { |
||||
// Invalidate native parent in parent process's children on proxy destruction |
||||
Accessible* outerDoc = aProxy->OuterDocOfRemoteBrowser(); |
||||
if (outerDoc) { |
||||
nativeParent = GetNativeFromGeckoAccessible(outerDoc); |
||||
} |
||||
} else { |
||||
if (!aProxy->Document()->IsShutdown()) { |
||||
// Only do if the document has not been shut down, else parent will return |
||||
// garbage since we don't shut down children from top down. |
||||
ProxyAccessible* parent = aProxy->Parent(); |
||||
// Invalidate proxy parent's children. |
||||
if (parent) { |
||||
nativeParent = GetNativeFromProxy(parent); |
||||
} |
||||
} |
||||
} |
||||
|
||||
mozAccessible* wrapper = GetNativeFromProxy(aProxy); |
||||
[wrapper expire]; |
||||
[wrapper release]; |
||||
aProxy->SetWrapper(0); |
||||
|
||||
if (nativeParent) { |
||||
[nativeParent invalidateChildren]; |
||||
} |
||||
} |
||||
|
||||
void |
||||
ProxyEvent(ProxyAccessible* aProxy, uint32_t aEventType) |
||||
{ |
||||
// ignore everything but focus-changed, value-changed, caret and selection |
||||
// events for now. |
||||
if (aEventType != nsIAccessibleEvent::EVENT_FOCUS && |
||||
aEventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE && |
||||
aEventType != nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE && |
||||
aEventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED && |
||||
aEventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED) |
||||
return; |
||||
|
||||
mozAccessible* wrapper = GetNativeFromProxy(aProxy); |
||||
if (wrapper) |
||||
FireNativeEvent(wrapper, aEventType); |
||||
} |
||||
|
||||
void |
||||
ProxyStateChangeEvent(ProxyAccessible* aProxy, uint64_t, bool) |
||||
{ |
||||
// mac doesn't care about state change events |
||||
} |
||||
|
||||
void |
||||
ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset) |
||||
{ |
||||
mozAccessible* wrapper = GetNativeFromProxy(aTarget); |
||||
if (wrapper) |
||||
[wrapper selectedTextDidChange]; |
||||
} |
||||
|
||||
void |
||||
ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t, |
||||
bool, bool) |
||||
{ |
||||
} |
||||
|
||||
void |
||||
ProxyShowHideEvent(ProxyAccessible*, ProxyAccessible*, bool, bool) |
||||
{ |
||||
} |
||||
|
||||
void |
||||
ProxySelectionEvent(ProxyAccessible*, ProxyAccessible*, uint32_t) |
||||
{ |
||||
} |
||||
} // namespace a11y |
||||
} // namespace mozilla |
||||
|
||||
@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 |
||||
|
@ -1,34 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
/* For documentation of the accessibility architecture,
|
||||
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
|
||||
*/ |
||||
|
||||
#ifndef mozilla_a11y_RootAccessibleWrap_h__ |
||||
#define mozilla_a11y_RootAccessibleWrap_h__ |
||||
|
||||
#include "RootAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
class RootAccessibleWrap : public RootAccessible |
||||
{ |
||||
public: |
||||
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell); |
||||
virtual ~RootAccessibleWrap(); |
||||
|
||||
Class GetNativeType (); |
||||
|
||||
// let's our native accessible get in touch with the
|
||||
// native cocoa view that is our accessible parent.
|
||||
void GetNativeWidget (void **aOutView); |
||||
}; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */ |
||||
|
||||
#include "RootAccessibleWrap.h" |
||||
|
||||
#include "mozDocAccessible.h" |
||||
|
||||
#include "nsCOMPtr.h" |
||||
#include "nsObjCExceptions.h" |
||||
#include "nsIFrame.h" |
||||
#include "nsView.h" |
||||
#include "nsIWidget.h" |
||||
|
||||
using namespace mozilla::a11y; |
||||
|
||||
RootAccessibleWrap:: |
||||
RootAccessibleWrap(nsIDocument* aDocument, nsIPresShell* aPresShell) : |
||||
RootAccessible(aDocument, aPresShell) |
||||
{ |
||||
} |
||||
|
||||
RootAccessibleWrap::~RootAccessibleWrap() |
||||
{ |
||||
} |
||||
|
||||
Class |
||||
RootAccessibleWrap::GetNativeType() |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; |
||||
|
||||
return [mozRootAccessible class]; |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL; |
||||
} |
||||
|
||||
void |
||||
RootAccessibleWrap::GetNativeWidget(void** aOutView) |
||||
{ |
||||
nsIFrame *frame = GetFrame(); |
||||
if (frame) { |
||||
nsView *view = frame->GetView(); |
||||
if (view) { |
||||
nsIWidget *widget = view->GetWidget(); |
||||
if (widget) { |
||||
*aOutView = (void**)widget->GetNativeData (NS_NATIVE_WIDGET); |
||||
NS_ASSERTION (*aOutView, |
||||
"Couldn't get the native NSView parent we need to connect the accessibility hierarchy!"); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,19 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_a11y_TextLeafAccessibleWrap_h__ |
||||
#define mozilla_a11y_TextLeafAccessibleWrap_h__ |
||||
|
||||
#include "TextLeafAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
typedef class TextLeafAccessible TextLeafAccessibleWrap; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
@ -1,20 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_a11y_XULListboxAccessibleWrap_h__ |
||||
#define mozilla_a11y_XULListboxAccessibleWrap_h__ |
||||
|
||||
#include "XULListboxAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
typedef class XULListboxAccessible XULListboxAccessibleWrap; |
||||
typedef class XULListCellAccessible XULListCellAccessibleWrap; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
@ -1,19 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_a11y_XULMenuAccessibleWrap_h__ |
||||
#define mozilla_a11y_XULMenuAccessibleWrap_h__ |
||||
|
||||
#include "XULMenuAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
typedef class XULMenuitemAccessible XULMenuitemAccessibleWrap; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
@ -1,20 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_a11y_XULTreeGridAccessibleWrap_h__ |
||||
#define mozilla_a11y_XULTreeGridAccessibleWrap_h__ |
||||
|
||||
#include "XULTreeGridAccessible.h" |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
typedef class XULTreeGridAccessible XULTreeGridAccessibleWrap; |
||||
typedef class XULTreeGridCellAccessible XULTreeGridCellAccessibleWrap; |
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif |
@ -1,44 +0,0 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- |
||||
# 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/. |
||||
|
||||
EXPORTS += [ |
||||
'mozAccessibleProtocol.h', |
||||
] |
||||
|
||||
EXPORTS.mozilla.a11y += [ |
||||
'AccessibleWrap.h', |
||||
'HyperTextAccessibleWrap.h', |
||||
] |
||||
|
||||
SOURCES += [ |
||||
'AccessibleWrap.mm', |
||||
'DocAccessibleWrap.mm', |
||||
'MacUtils.mm', |
||||
'mozAccessible.mm', |
||||
'mozActionElements.mm', |
||||
'mozDocAccessible.mm', |
||||
'mozHTMLAccessible.mm', |
||||
'mozTableAccessible.mm', |
||||
'mozTextAccessible.mm', |
||||
'Platform.mm', |
||||
'RootAccessibleWrap.mm', |
||||
] |
||||
|
||||
LOCAL_INCLUDES += [ |
||||
'/accessible/base', |
||||
'/accessible/generic', |
||||
'/accessible/html', |
||||
'/accessible/ipc', |
||||
'/accessible/ipc/other', |
||||
'/accessible/xul', |
||||
'/layout/generic', |
||||
'/layout/xul', |
||||
'/widget', |
||||
'/widget/cocoa', |
||||
] |
||||
|
||||
FINAL_LIBRARY = 'xul' |
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild') |
@ -1,181 +0,0 @@
|
||||
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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/. */
|
||||
|
||||
#include "AccessibleWrap.h" |
||||
#include "ProxyAccessible.h" |
||||
|
||||
#import <Cocoa/Cocoa.h> |
||||
|
||||
#import "mozAccessibleProtocol.h" |
||||
|
||||
@class mozRootAccessible; |
||||
|
||||
/**
|
||||
* All mozAccessibles are either abstract objects (that correspond to XUL |
||||
* widgets, HTML frames, etc) or are attached to a certain view; for example |
||||
* a document view. When we hand an object off to an AT, we always want |
||||
* to give it the represented view, in the latter case. |
||||
*/ |
||||
|
||||
namespace mozilla { |
||||
namespace a11y { |
||||
|
||||
inline id <mozAccessible> |
||||
GetObjectOrRepresentedView(id <mozAccessible> aObject) |
||||
{ |
||||
return [aObject hasRepresentedView] ? [aObject representedView] : aObject; |
||||
} |
||||
|
||||
inline mozAccessible* |
||||
GetNativeFromGeckoAccessible(Accessible* aAccessible) |
||||
{ |
||||
mozAccessible* native = nil; |
||||
aAccessible->GetNativeInterface((void**)&native); |
||||
return native; |
||||
} |
||||
|
||||
inline mozAccessible* |
||||
GetNativeFromProxy(const ProxyAccessible* aProxy) |
||||
{ |
||||
return reinterpret_cast<mozAccessible*>(aProxy->GetWrapper()); |
||||
} |
||||
|
||||
} // a11y
|
||||
} // mozilla
|
||||
|
||||
// This is OR'd with the Accessible owner to indicate the wrap-ee is a proxy.
|
||||
static const uintptr_t IS_PROXY = 1; |
||||
|
||||
@interface mozAccessible : NSObject <mozAccessible> |
||||
{ |
||||
/**
|
||||
* Weak reference; it owns us. |
||||
*/ |
||||
uintptr_t mGeckoAccessible; |
||||
|
||||
/**
|
||||
* Strong ref to array of children |
||||
*/ |
||||
NSMutableArray* mChildren; |
||||
|
||||
/**
|
||||
* Weak reference to the parent |
||||
*/ |
||||
mozAccessible* mParent; |
||||
|
||||
/**
|
||||
* The role of our gecko accessible. |
||||
*/ |
||||
mozilla::a11y::role mRole; |
||||
} |
||||
|
||||
// return the Accessible for this mozAccessible if it exists.
|
||||
- (mozilla::a11y::AccessibleWrap*)getGeckoAccessible; |
||||
|
||||
// return the ProxyAccessible for this mozAccessible if it exists.
|
||||
- (mozilla::a11y::ProxyAccessible*)getProxyAccessible; |
||||
|
||||
// inits with the gecko owner.
|
||||
- (id)initWithAccessible:(uintptr_t)aGeckoObj; |
||||
|
||||
// our accessible parent (AXParent)
|
||||
- (id <mozAccessible>)parent; |
||||
|
||||
// a lazy cache of our accessible children (AXChildren). updated
|
||||
- (NSArray*)children; |
||||
|
||||
// returns the size of this accessible.
|
||||
- (NSValue*)size; |
||||
|
||||
// returns the position, in cocoa coordinates.
|
||||
- (NSValue*)position; |
||||
|
||||
// can be overridden to report another role name.
|
||||
- (NSString*)role; |
||||
|
||||
// a subrole is a more specialized variant of the role. for example,
|
||||
// the role might be "textfield", while the subrole is "password textfield".
|
||||
- (NSString*)subrole; |
||||
|
||||
// Return the role description, as there are a few exceptions.
|
||||
- (NSString*)roleDescription; |
||||
|
||||
// returns the native window we're inside.
|
||||
- (NSWindow*)window; |
||||
|
||||
// the value of this element.
|
||||
- (id)value; |
||||
|
||||
// name that is associated with this accessible (for buttons, etc)
|
||||
- (NSString*)title; |
||||
|
||||
// the accessible description (help text) of this particular instance.
|
||||
- (NSString*)help; |
||||
|
||||
- (BOOL)isEnabled; |
||||
|
||||
// information about focus.
|
||||
- (BOOL)isFocused; |
||||
- (BOOL)canBeFocused; |
||||
|
||||
// returns NO if for some reason we were unable to focus the element.
|
||||
- (BOOL)focus; |
||||
|
||||
// notifications sent out to listening accessible providers.
|
||||
- (void)didReceiveFocus; |
||||
- (void)valueDidChange; |
||||
- (void)selectedTextDidChange; |
||||
- (void)documentLoadComplete; |
||||
|
||||
// internal method to retrieve a child at a given index.
|
||||
- (id)childAt:(uint32_t)i; |
||||
|
||||
#pragma mark - |
||||
|
||||
// invalidates and removes all our children from our cached array.
|
||||
- (void)invalidateChildren; |
||||
|
||||
/**
|
||||
* Append a child if they are already cached. |
||||
*/ |
||||
- (void)appendChild:(mozilla::a11y::Accessible*)aAccessible; |
||||
|
||||
// makes ourselves "expired". after this point, we might be around if someone
|
||||
// has retained us (e.g., a third-party), but we really contain no information.
|
||||
- (void)expire; |
||||
- (BOOL)isExpired; |
||||
|
||||
#ifdef DEBUG |
||||
- (void)printHierarchy; |
||||
- (void)printHierarchyWithLevel:(unsigned)numSpaces; |
||||
|
||||
- (void)sanityCheckChildren; |
||||
- (void)sanityCheckChildren:(NSArray*)theChildren; |
||||
#endif |
||||
|
||||
// ---- NSAccessibility methods ---- //
|
||||
|
||||
// whether to skip this element when traversing the accessibility
|
||||
// hierarchy.
|
||||
- (BOOL)accessibilityIsIgnored; |
||||
|
||||
// called by third-parties to determine the deepest child element under the mouse
|
||||
- (id)accessibilityHitTest:(NSPoint)point; |
||||
|
||||
// returns the deepest unignored focused accessible element
|
||||
- (id)accessibilityFocusedUIElement; |
||||
|
||||
// a mozAccessible needs to at least provide links to its parent and
|
||||
// children.
|
||||
- (NSArray*)accessibilityAttributeNames; |
||||
|
||||
// value for the specified attribute
|
||||
- (id)accessibilityAttributeValue:(NSString*)attribute; |
||||
|
||||
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute; |
||||
- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute; |
||||
|
||||
@end |
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,69 +0,0 @@
|
||||
/* -*- Mode: Objective-C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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> |
||||
|
||||
#import "mozView.h" |
||||
|
||||
/* This protocol's primary use is so widget/cocoa can talk back to us
|
||||
properly. |
||||
|
||||
ChildView owns the topmost mozRootAccessible, and needs to take care of setting up |
||||
that parent/child relationship. |
||||
|
||||
This protocol is thus used to make sure it knows it's talking to us, and not |
||||
just some random |id|. |
||||
*/ |
||||
|
||||
@protocol mozAccessible |
||||
|
||||
// returns whether this accessible is the root accessible. there is one
|
||||
// root accessible per window.
|
||||
- (BOOL)isRoot; |
||||
|
||||
// some mozAccessibles implement accessibility support in place of another object. for example,
|
||||
// ChildView gets its support from us.
|
||||
//
|
||||
// instead of returning a mozAccessible to the OS when it wants an object, we need to pass the view we represent, so the
|
||||
// OS doesn't get confused and think we return some random object.
|
||||
- (BOOL)hasRepresentedView; |
||||
- (id)representedView; |
||||
|
||||
#ifdef DEBUG |
||||
// debug utility that will print the native accessibility tree, starting
|
||||
// at this node.
|
||||
- (void)printHierarchy; |
||||
#endif |
||||
|
||||
/*** general ***/ |
||||
|
||||
// returns the accessible at the specified point.
|
||||
- (id)accessibilityHitTest:(NSPoint)point; |
||||
|
||||
// whether this element is flagged as ignored.
|
||||
- (BOOL)accessibilityIsIgnored; |
||||
|
||||
// currently focused UI element (possibly a child accessible)
|
||||
- (id)accessibilityFocusedUIElement; |
||||
|
||||
/*** attributes ***/ |
||||
|
||||
// all supported attributes
|
||||
- (NSArray*)accessibilityAttributeNames; |
||||
|
||||
// value for given attribute.
|
||||
- (id)accessibilityAttributeValue:(NSString*)attribute; |
||||
|
||||
// whether a particular attribute can be modified
|
||||
- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute; |
||||
|
||||
/*** actions ***/ |
||||
|
||||
- (NSArray*)accessibilityActionNames; |
||||
- (NSString*)accessibilityActionDescription:(NSString*)action; |
||||
- (void)accessibilityPerformAction:(NSString*)action; |
||||
|
||||
@end |
||||
|
@ -1,37 +0,0 @@
|
||||
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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> |
||||
#import "mozAccessible.h" |
||||
|
||||
/* Simple subclasses for things like checkboxes, buttons, etc. */ |
||||
|
||||
@interface mozButtonAccessible : mozAccessible |
||||
{ |
||||
} |
||||
- (BOOL)hasPopup; |
||||
- (void)click; |
||||
- (BOOL)isTab; |
||||
@end |
||||
|
||||
@interface mozCheckboxAccessible : mozButtonAccessible |
||||
// returns one of the constants defined in CheckboxValue
|
||||
- (int)isChecked; |
||||
@end |
||||
|
||||
/* Class for tabs - not individual tabs */ |
||||
@interface mozTabsAccessible : mozAccessible |
||||
{ |
||||
NSMutableArray* mTabs; |
||||
} |
||||
-(id)tabs; |
||||
@end |
||||
|
||||
/**
|
||||
* Accessible for a PANE |
||||
*/ |
||||
@interface mozPaneAccessible : mozAccessible |
||||
|
||||
@end |
@ -1,340 +0,0 @@
|
||||
/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
||||
/* 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 "mozActionElements.h" |
||||
|
||||
#import "MacUtils.h" |
||||
#include "Accessible-inl.h" |
||||
#include "DocAccessible.h" |
||||
#include "XULTabAccessible.h" |
||||
|
||||
#include "nsDeckFrame.h" |
||||
#include "nsObjCExceptions.h" |
||||
|
||||
using namespace mozilla::a11y; |
||||
|
||||
enum CheckboxValue { |
||||
// these constants correspond to the values in the OS |
||||
kUnchecked = 0, |
||||
kChecked = 1, |
||||
kMixed = 2 |
||||
}; |
||||
|
||||
@implementation mozButtonAccessible |
||||
|
||||
- (NSArray*)accessibilityAttributeNames |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; |
||||
|
||||
static NSArray *attributes = nil; |
||||
if (!attributes) { |
||||
attributes = [[NSArray alloc] initWithObjects:NSAccessibilityParentAttribute, // required |
||||
NSAccessibilityRoleAttribute, // required |
||||
NSAccessibilityRoleDescriptionAttribute, |
||||
NSAccessibilityPositionAttribute, // required |
||||
NSAccessibilitySizeAttribute, // required |
||||
NSAccessibilityWindowAttribute, // required |
||||
NSAccessibilityPositionAttribute, // required |
||||
NSAccessibilityTopLevelUIElementAttribute, // required |
||||
NSAccessibilityHelpAttribute, |
||||
NSAccessibilityEnabledAttribute, // required |
||||
NSAccessibilityFocusedAttribute, // required |
||||
NSAccessibilityTitleAttribute, // required |
||||
NSAccessibilityChildrenAttribute, |
||||
NSAccessibilityDescriptionAttribute, |
||||
#if DEBUG |
||||
@"AXMozDescription", |
||||
#endif |
||||
nil]; |
||||
} |
||||
return attributes; |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL; |
||||
} |
||||
|
||||
- (id)accessibilityAttributeValue:(NSString *)attribute |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; |
||||
|
||||
if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) { |
||||
if ([self hasPopup]) |
||||
return [self children]; |
||||
return nil; |
||||
} |
||||
|
||||
if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) { |
||||
if ([self isTab]) |
||||
return utils::LocalizedString(NS_LITERAL_STRING("tab")); |
||||
|
||||
return NSAccessibilityRoleDescription([self role], nil); |
||||
} |
||||
|
||||
return [super accessibilityAttributeValue:attribute]; |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL; |
||||
} |
||||
|
||||
- (BOOL)accessibilityIsIgnored |
||||
{ |
||||
return ![self getGeckoAccessible] && ![self getProxyAccessible]; |
||||
} |
||||
|
||||
- (NSArray*)accessibilityActionNames |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; |
||||
|
||||
if ([self isEnabled]) { |
||||
if ([self hasPopup]) |
||||
return [NSArray arrayWithObjects:NSAccessibilityPressAction, |
||||
NSAccessibilityShowMenuAction, |
||||
nil]; |
||||
return [NSArray arrayWithObject:NSAccessibilityPressAction]; |
||||
} |
||||
return nil; |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL; |
||||
} |
||||
|
||||
- (NSString*)accessibilityActionDescription:(NSString*)action |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; |
||||
|
||||
if ([action isEqualToString:NSAccessibilityPressAction]) { |
||||
if ([self isTab]) |
||||
return utils::LocalizedString(NS_LITERAL_STRING("switch")); |
||||
|
||||
return @"press button"; // XXX: localize this later? |
||||
} |
||||
|
||||
if ([self hasPopup]) { |
||||
if ([action isEqualToString:NSAccessibilityShowMenuAction]) |
||||
return @"show menu"; |
||||
} |
||||
|
||||
return nil; |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL; |
||||
} |
||||
|
||||
- (void)accessibilityPerformAction:(NSString*)action |
||||
{ |
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK; |
||||
|
||||
if ([self isEnabled] && [action isEqualToString:NSAccessibilityPressAction]) { |
||||
// TODO: this should bring up the menu, but currently doesn't. |
||||
// once msaa and atk have merged better, they will implement |
||||
// the action needed to show the menu. |
||||
[self click]; |
||||
} |
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK; |
||||
} |
||||
|
||||
- (void)click |
||||
{ |
||||
// both buttons and checkboxes have only one action. we should really stop using arbitrary |
||||
// arrays with actions, and define constants for these actions. |
||||
if (AccessibleWrap* accWrap = [self getGeckoAccessible]) |
||||