зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1479042 - Add Android announcement event plumbing. r=yzen
Depends on D21610 Differential Revision: https://phabricator.services.mozilla.com/D21611 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4baf60220e
Коммит
6d8e53ccd1
|
@ -169,6 +169,12 @@ nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
|
|||
event->MaxScrollY());
|
||||
break;
|
||||
}
|
||||
case nsIAccessibleEvent::EVENT_ANNOUNCEMENT: {
|
||||
AccAnnouncementEvent* event = downcast_accEvent(aEvent);
|
||||
sessionAcc->SendAnnouncementEvent(accessible, event->Announcement(),
|
||||
event->Priority());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -158,6 +158,18 @@ void a11y::ProxyScrollingEvent(ProxyAccessible* aTarget, uint32_t aEventType,
|
|||
}
|
||||
}
|
||||
|
||||
void a11y::ProxyAnnouncementEvent(ProxyAccessible* aTarget,
|
||||
const nsString& aAnnouncement,
|
||||
uint16_t aPriority) {
|
||||
SessionAccessibility* sessionAcc =
|
||||
SessionAccessibility::GetInstanceFor(aTarget);
|
||||
|
||||
if (sessionAcc) {
|
||||
sessionAcc->SendAnnouncementEvent(WrapperFor(aTarget), aAnnouncement,
|
||||
aPriority);
|
||||
}
|
||||
}
|
||||
|
||||
void a11y::ProxyBatch(ProxyAccessible* aDocument, const uint64_t aBatchType,
|
||||
const nsTArray<ProxyAccessible*>& aAccessibles,
|
||||
const nsTArray<BatchData>& aData) {
|
||||
|
|
|
@ -322,6 +322,20 @@ void SessionAccessibility::SendSelectedEvent(AccessibleWrap* aAccessible,
|
|||
aAccessible->VirtualViewID(), aAccessible->AndroidClass(), eventInfo);
|
||||
}
|
||||
|
||||
void SessionAccessibility::SendAnnouncementEvent(AccessibleWrap* aAccessible,
|
||||
const nsString& aAnnouncement,
|
||||
uint16_t aPriority) {
|
||||
GECKOBUNDLE_START(eventInfo);
|
||||
GECKOBUNDLE_PUT(eventInfo, "text", jni::StringParam(aAnnouncement));
|
||||
GECKOBUNDLE_FINISH(eventInfo);
|
||||
|
||||
// Announcements should have the root as their source, so we ignore the
|
||||
// accessible of the event.
|
||||
mSessionAccessibility->SendEvent(
|
||||
java::sdk::AccessibilityEvent::TYPE_ANNOUNCEMENT, AccessibleWrap::kNoID,
|
||||
java::SessionAccessibility::CLASSNAME_WEBVIEW, eventInfo);
|
||||
}
|
||||
|
||||
void SessionAccessibility::ReplaceViewportCache(
|
||||
const nsTArray<AccessibleWrap*>& aAccessibles,
|
||||
const nsTArray<BatchData>& aData) {
|
||||
|
|
|
@ -96,6 +96,8 @@ class SessionAccessibility final
|
|||
void SendClickedEvent(AccessibleWrap* aAccessible, bool aChecked);
|
||||
void SendWindowContentChangedEvent();
|
||||
void SendWindowStateChangedEvent(AccessibleWrap* aAccessible);
|
||||
void SendAnnouncementEvent(AccessibleWrap* aAccessible,
|
||||
const nsString& aAnnouncement, uint16_t aPriority);
|
||||
|
||||
// Cache methods
|
||||
void ReplaceViewportCache(
|
||||
|
|
|
@ -122,6 +122,9 @@ void ProxyScrollingEvent(ProxyAccessible* aTarget, uint32_t aEventType,
|
|||
uint32_t aScrollX, uint32_t aScrollY,
|
||||
uint32_t aMaxScrollX, uint32_t aMaxScrollY);
|
||||
|
||||
void ProxyAnnouncementEvent(ProxyAccessible* aTarget,
|
||||
const nsString& aAnnouncement, uint16_t aPriority);
|
||||
|
||||
class BatchData;
|
||||
|
||||
void ProxyBatch(ProxyAccessible* aDocument, const uint64_t aBatchType,
|
||||
|
|
|
@ -442,8 +442,9 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvAnnouncementEvent(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
// XXX: A future patch will add platform support for this event type.
|
||||
// Right now, we just need to support XPC for testing.
|
||||
# if defined(ANDROID)
|
||||
ProxyAnnouncementEvent(target, aAnnouncement, aPriority);
|
||||
# endif
|
||||
|
||||
if (!nsCoreUtils::AccEventObserversExist()) {
|
||||
return IPC_OK();
|
||||
|
|
Загрузка…
Ссылка в новой задаче