NPAPI:NativeAccessibility: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 55: Line 55:
Since accessibility objects are living objects, they cannot be simply serialized over an IPC between the plugin process and the browser process.  Instead, we utilize the AT-SPI registry to coalesce accessibiles from the two processes. Two corresponding objects are involved in this process in ATK, namely <tt>AtkPlug</tt> and <tt>AtkSocket</tt>.  Together, they are used to connect accessibility hierarchies from different processes in a manner that is transparent to ATs.
Since accessibility objects are living objects, they cannot be simply serialized over an IPC between the plugin process and the browser process.  Instead, we utilize the AT-SPI registry to coalesce accessibiles from the two processes. Two corresponding objects are involved in this process in ATK, namely <tt>AtkPlug</tt> and <tt>AtkSocket</tt>.  Together, they are used to connect accessibility hierarchies from different processes in a manner that is transparent to ATs.


In this example, the browser would create an <tt>AtkSocket</tt> object, and place it in the plugin's spot on the accessibility hierarchy.  The plugin's out of process host would then call <tt>NPN_GetValue</tt> with <tt>NPNVNativeAccessibleAtkPlugId</tt> as the <tt>variable</tt> parameter.
In this example, the browser would create an <tt>AtkSocket</tt> object, and place it in the plugin's spot on the accessibility hierarchy in the main process.  The plugin's out of process host would then call <tt>NPN_GetValue</tt> with <tt>NPNVNativeAccessibleAtkPlugId</tt> as the <tt>variable</tt> parameter.


Compatible plugins would return the value of <tt>atk_plug_get_id()</tt> (a <tt>char*</tt>), or <tt>NULL</tt> indicating that they do not provide remote accessibility support.
Compatible plugins would return the value of <tt>atk_plug_get_id()</tt> (a <tt>char*</tt>), or <tt>NULL</tt> indicating that they do not provide remote accessibility support.


A valid return value can be remoted to the main browser process, and used to attach the plug to the socket via <tt>atk_socket_embed()</tt>.  The connection that is established via AT-SPI and atk-bridge should be not only transparent to ATs, but seamless for the browser. Vendors are expected to use <tt>g_object_ref</tt> and <tt>g_object_unref</tt> as normal to manage the lifecycle of plugs and sockets.
A valid return value would be remoted to the main browser process, and used to attach the plug to the socket via <tt>atk_socket_embed()</tt>.  The connection that is established via AT-SPI and atk-bridge in the background should be not only transparent to ATs, but seamless for the browser.
 
Vendors are expected to use <tt>g_object_ref</tt> and <tt>g_object_unref</tt> as normal to manage the lifecycle of plugs and sockets.


A detailed description of the mechanics of this API in the Linux accessibility stack is available on the [http://mail.gnome.org/archives/gnome-accessibility-devel/2009-September/msg00012.html gnome-accessibility-devel] mailing list.   
A detailed description of the mechanics of this API in the Linux accessibility stack is available on the [http://mail.gnome.org/archives/gnome-accessibility-devel/2009-September/msg00012.html gnome-accessibility-devel] mailing list.   


''NOTE'': The proposed addition to ATK is not yet available, and slated for completion in Q1 2010.
''NOTE'': The proposed addition to ATK is not yet available, and slated for completion in Q1 2010.

Revision as of 15:39, 8 October 2009

Status

Under consideration.

Currently stalled due to uncertainty about whether enough browsers will implement when plugins are out-of-process.

Problem Summary

Plugins cannot currently provide accessible information about their contents on Linux platforms. This is Mozilla bug 78414.

Glossary

  • Accessibility - the degree to which a product is accessible by as many people as possible.
  • Assistive Technology (AT) - a piece of software or hardware that connects to the system's accessibility services to provide assistance to the user. This assistance can come in the form of a head tracking system for a user unable to use a mouse, a screen reader for a person with vision impairments, etc.
  • Microsoft Active Accessibility (MSAA) - the standard accessibility API for Windows 95 through Windows XP. Accessible objects in MSAA inherit from the IAccessible interface.
  • Accessibility Toolkit (ATK) - the standard accessibility API on Linux.
  • Document Object Model (DOM) - a in-memory tree representation of the content of a web page.
  • Interprocess Communication (IPC) - a way of communicating betweenthread and process boundaries.

Related Approaches

On Windows, plugins can provide their own accessibility support by responding to the WM_GETOBJECT WinEvent and returning an instance of IAccessible. Firefox (and other browsers) will call this WinEvent on the plugin object and if an IAccessible is returned, register the accessible into the accessibility hierarchy.

API Requirements

  • Plugins should be able to easily provide an accessible implementation (in ATK) to the Browser
  • The Browser should inject the plugin's accessible into its accessible hierarchy
  • The lifetime of the plugin's accessible should be the same as the lifetime of the plugin.
  • Browsers should be able to implement this specification for both in-process as well as out-of-process plugins.

Current Proposal

Specification

NPAPI Native Accessibility Support for Linux

  • Last modified: Oct 8, 2009
  • Author: Brad Taylor, Novell, Inc.
  • Contributors:

Plugins have the need to provide accessibility support to the browser so they can be accessed by assistive technologies like screen readers and testing tools. Most common web browsers already provide an accessible implementation of DOM content, but thus far, can only export a blank (and therefore useless) object when it comes across a plugin.

NOTE: This approach should be extensible to other accessibility frameworks, e.g.: windowless Windows plugins or OS X Accessibility.

In Process Plugins

When a plugin's accessible is requested from an assistive technology, or when the plugin is first created (depending on implementation), the web browser should call the NPN_GetValue method, passing NPNVNativeAccessibleAtk as the variable parameter.

If the plugin sets value to NULL, the browser should use an empty accessible to represent the plugin.

If value is not NULL, the browser should cast it to an AtkObject, and insert the object into the accessibility hierarchy as a child of the plugin's DOM parent.

The plugin's accessible reference should be incremented (via atk_object_ref) right after the call to NPN_GetValue, and decremented (via atk_object_unref) when the plugin is freed. The accessible provided should not be copied to ensure that the plugin can maintain the state of the plugin object.

This accessible does not need to be updated, so the browser may cache the object for the life of the plugin. Plugins that need to regularly remove and re-add their root accessible object should return a container-type object from NPN_GetValue and make their root accessible a child of the container.

Out of Process Plugins

Since accessibility objects are living objects, they cannot be simply serialized over an IPC between the plugin process and the browser process. Instead, we utilize the AT-SPI registry to coalesce accessibiles from the two processes. Two corresponding objects are involved in this process in ATK, namely AtkPlug and AtkSocket. Together, they are used to connect accessibility hierarchies from different processes in a manner that is transparent to ATs.

In this example, the browser would create an AtkSocket object, and place it in the plugin's spot on the accessibility hierarchy in the main process. The plugin's out of process host would then call NPN_GetValue with NPNVNativeAccessibleAtkPlugId as the variable parameter.

Compatible plugins would return the value of atk_plug_get_id() (a char*), or NULL indicating that they do not provide remote accessibility support.

A valid return value would be remoted to the main browser process, and used to attach the plug to the socket via atk_socket_embed(). The connection that is established via AT-SPI and atk-bridge in the background should be not only transparent to ATs, but seamless for the browser.

Vendors are expected to use g_object_ref and g_object_unref as normal to manage the lifecycle of plugs and sockets.

A detailed description of the mechanics of this API in the Linux accessibility stack is available on the gnome-accessibility-devel mailing list.

NOTE: The proposed addition to ATK is not yet available, and slated for completion in Q1 2010.