Skip to content

Commit

Permalink
Merge autoland to mozilla-central a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dgluca committed Mar 28, 2020
2 parents d413b29 + 0752c5d commit a1dbbd8
Show file tree
Hide file tree
Showing 396 changed files with 10,634 additions and 7,575 deletions.
5 changes: 4 additions & 1 deletion .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ tasks:
$if: "tasks_for == 'action'"
then: very-low
else: lowest # tasks_for == 'hg-push'
retries: 5
retries:
$if: "tasks_for == 'hg-push'"
then: 0
else: 5

payload:
env:
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/ARIAMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ static const nsRoleMapEntry sLandmarkRoleMap = {
eNoAction, eNoLiveAttr, kGenericAccType, kNoReqStates};

nsRoleMapEntry aria::gEmptyRoleMap = {
nsGkAtoms::_empty, roles::NOTHING, kUseMapRole, eNoValue,
nsGkAtoms::_empty, roles::TEXT_CONTAINER, kUseMapRole, eNoValue,
eNoAction, eNoLiveAttr, kGenericAccType, kNoReqStates};

/**
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/RoleMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ ROLE(DETAILS,
ROLE(SUMMARY,
"summary",
ATK_ROLE_PUSH_BUTTON,
NSAccessibilityGroupRole,
NSAccessibilityButtonRole,
ROLE_SYSTEM_PUSHBUTTON,
ROLE_SYSTEM_PUSHBUTTON,
java::SessionAccessibility::CLASSNAME_BUTTON,
Expand Down
3 changes: 3 additions & 0 deletions accessible/interfaces/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows' and CONFIG['COMPILE_ENVIRONMENT']:
DIRS += ['gecko', 'msaa', 'ia2']

if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
XPIDL_SOURCES += ['nsIAccessibleMacInterface.idl']

XPIDL_SOURCES += [
'nsIAccessibilityService.idl',
'nsIAccessible.idl',
Expand Down
5 changes: 5 additions & 0 deletions accessible/interfaces/nsIAccessible.idl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ interface nsIAccessible : nsISupports
*/
readonly attribute nsIPersistentProperties attributes;

/**
* Platform specific interface for accessible
*/
readonly attribute nsISupports nativeInterface;

/**
* Returns grouping information. Used for tree items, list items, tab panel
* labels, radio buttons, etc. Also used for collectons of non-text objects.
Expand Down
40 changes: 40 additions & 0 deletions accessible/interfaces/nsIAccessibleMacInterface.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* -*- 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 "nsISupports.idl"

%{C++
#define NS_ACCESSIBLE_MAC_EVENT_TOPIC "accessible-mac-event"
%}

[scriptable, builtinclass, uuid(9d27cf21-66fc-47dc-8a07-98edb18707b1)]
interface nsIAccessibleMacInterface : nsISupports
{
/**
* List of available attribute names for tthe object.
* Emulates `AXUIElementCopyAttributeNames`.
*/
readonly attribute Array<AString> attributeNames;

/**
* List of available action names for tthe object.
* Emulates `AXUIElementCopyActionNames`.
*/
readonly attribute Array<AString> actionNames;

/**
* Returns the value of an attribute.
* Emulates `AXUIElementCopyAttributeValue`.
*/
[implicit_jscontext]
jsval getAttributeValue(in AString attributeName);

/**
* Requests that the accessibility object perform the specified action.
* Emulatets `AXUIElementPerformAction`.
*/
void performAction(in AString actionName);
};

8 changes: 2 additions & 6 deletions accessible/mac/AccessibleWrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class AccessibleWrap : public Accessible {
virtual nsresult HandleAccEvent(AccEvent* aEvent) override;

protected:
friend class xpcAccessibleMacInterface;

/**
* Return true if the parent doesn't have children to expose to AT.
*/
Expand Down Expand Up @@ -88,12 +90,6 @@ class AccessibleWrap : public Accessible {
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
Expand Down
69 changes: 16 additions & 53 deletions accessible/mac/AccessibleWrap.mm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
}

uint32_t eventType = aEvent->GetEventType();
Accessible* accessible = nullptr;

mozAccessible* nativeAcc = nil;

switch (eventType) {
case nsIAccessibleEvent::EVENT_FOCUS:
Expand All @@ -106,32 +107,35 @@
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
accessible = aEvent->GetAccessible();
if (Accessible* accessible = aEvent->GetAccessible()) {
accessible->GetNativeInterface((void**)&nativeAcc);
if (!nativeAcc) {
return NS_ERROR_FAILURE;
}
}
break;
case nsIAccessibleEvent::EVENT_SELECTION:
case nsIAccessibleEvent::EVENT_SELECTION_ADD:
case nsIAccessibleEvent::EVENT_SELECTION_REMOVE: {
AccSelChangeEvent* selEvent = downcast_accEvent(aEvent);
// The "widget" is the selected widget's container. In OSX
// it is the target of the selection changed event.
accessible = selEvent->Widget();
if (Accessible* accessible = selEvent->Widget()) {
accessible->GetNativeInterface((void**)&nativeAcc);
if (!nativeAcc) {
return NS_ERROR_FAILURE;
}
}
break;
}
default:
break;
}

if (!accessible) {
// Not an event of interest.
return NS_OK;
if (nativeAcc) {
[nativeAcc firePlatformEvent:eventType];
}

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;
Expand Down Expand Up @@ -174,47 +178,6 @@
return false;
}

void a11y::FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;

// Under headless mode we don't have access to a native window, so we skip
// dispatching native events.
if (gfxPlatform::IsHeadless()) {
return;
}

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;
case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
[aNativeAcc menuOpened];
break;
case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
[aNativeAcc menuClosed];
break;
case nsIAccessibleEvent::EVENT_SELECTION:
case nsIAccessibleEvent::EVENT_SELECTION_ADD:
case nsIAccessibleEvent::EVENT_SELECTION_REMOVE: {
[aNativeAcc selectionDidChange];
break;
}
}

NS_OBJC_END_TRY_ABORT_BLOCK;
}

Class a11y::GetTypeFromRole(roles::Role aRole) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;

Expand Down
12 changes: 9 additions & 3 deletions accessible/mac/Platform.mm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ void ProxyEvent(ProxyAccessible* aProxy, uint32_t aEventType) {
return;

mozAccessible* wrapper = GetNativeFromProxy(aProxy);
if (wrapper) FireNativeEvent(wrapper, aEventType);
if (wrapper) {
[wrapper firePlatformEvent:aEventType];
}
}

void ProxyStateChangeEvent(ProxyAccessible* aProxy, uint64_t, bool) {
Expand All @@ -135,7 +137,9 @@ void ProxyStateChangeEvent(ProxyAccessible* aProxy, uint64_t, bool) {

void ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset) {
mozAccessible* wrapper = GetNativeFromProxy(aTarget);
if (wrapper) [wrapper selectedTextDidChange];
if (wrapper) {
[wrapper firePlatformEvent:nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED];
}
}

void ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t, bool, bool) {}
Expand All @@ -144,7 +148,9 @@ void ProxyShowHideEvent(ProxyAccessible*, ProxyAccessible*, bool, bool) {}

void ProxySelectionEvent(ProxyAccessible* aTarget, ProxyAccessible* aWidget, uint32_t aEventType) {
mozAccessible* wrapper = GetNativeFromProxy(aWidget);
if (wrapper) FireNativeEvent(wrapper, aEventType);
if (wrapper) {
[wrapper firePlatformEvent:aEventType];
}
}
} // namespace a11y
} // namespace mozilla
Expand Down
14 changes: 6 additions & 8 deletions accessible/mac/mozAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,12 @@ static const uintptr_t IS_PROXY = 1;
// 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)selectionDidChange;
- (void)documentLoadComplete;
- (void)menuOpened;
- (void)menuClosed;
// Given a gecko accessibility event type, post the relevant
// system accessibility notification.
- (void)firePlatformEvent:(uint32_t)eventType;

// Post the given accessibility system notification
- (void)postNotification:(NSString*)notification;

// internal method to retrieve a child at a given index.
- (id)childAt:(uint32_t)i;
Expand Down
Loading

0 comments on commit a1dbbd8

Please sign in to comment.