Embedding API for Accessibility 编辑

Comments/Questions? Please contact the Mozilla Accessibility Community.

Mozilla needs to move in the direction of accessibility. Here is the W3C's definition of accessibility for a user agent like Mozilla.

In part, being accessible means supporting a built-in accessibility APIs for a platform, such as Microsoft Active Accessibility or ATK for Linux and UNIX desktops.

There are many other pieces, such as preferences to allow the user to change foreground and background colors, and font sizes. Mozilla already supports some of these options. This document lays out what we already have, and what we'll need later, in the embedding API to support accessibility.

Text Zoom on a Per-Window Basis

The nsIDOMWindow::GetTextZoom(float *zoomFactor) and nsIDOMWindow::SetTextZoom(float zoomFactor) methods can be used to set a wide range of text zoom factors on a content window. A zoom factor of 1.0 represents 100%, or normal zoom. For double-sized text, use nsIDOMWindow::SetTextZoom(2.0);

Using Accessibility Preferences

There are a number of prefs related to accessibility. For the most part, an automatic reframe is performed when one of these prefs is changed. A reframe fixes the appearance of the page to match the new prefs, without reloading the document over the network. Be aware that in debug builds, this can cause a great number of assertions (bug 71598)

To use prefs in embedding, use something like the following code:

#include "nsIPref.h";
nsresult rv;

nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
prefs->SetBoolPref("bool.pref.name", PR_TRUE /* or PR_FALSE */);
prefs->SetIntPref("int.pref.name", newValue);
prefs->SetCharPref("string.pref.name", newCharStarValue);

To manually add a pref to your settings, add a line like the following to your prefs.js:

user_pref("accessibility.browsewithcaret", true);

Accessibility Prefs Reference

The following is a description of what accessibility prefs give us (or will give us), for accessibility:

FunctionalityImplementationWorks as of
ImagesSetIntPref("network.image.imageBehavior", behavior); /* behavior: 0=Accept, 1=Accept images from originating server only, 2=no images */Moz 0.8
CookiesSetIntPref("network.cookie.cookieBehavior", behavior); /* behavior: 0=Accept, 1=Accept cookies from originating server only, 2=no cookies */ SetBoolPref("network.cookie.warnAboutCookies", boolWarn);Moz 0.8
FontsSetCharPref("font.name.monospace.x-western", newFontName); SetCharPref("font.name.serif.x-western", newFontName); SetCharPref("font.name.sans-serif.x-western", newFontName); /* For other i18n charsets, change x-western to x-central-euro, x-cyrillic, x-unicode, x-user-def, x-baltic, el, tr, he, ar, th, ja, zh-CN or zh-TW */   SetIntPref("font.size.fixed.x-western", newFontSize); SetIntPref("font.size.variable.x-western", newFontSize); /* For other i18n charsets, change the name as explained above for font face*/   SetCharPref("font.default","serif"); /* or "sans-serif" */   SetIntPref("browser.use_document_fonts", whichFonts); /* whichFonts: 0=no, 1=yes */Moz 0.8
Fonts from Operating system?SetBoolPref("browser.use_system_fonts", useSystemFonts);No
Colors for pageSetCharPref("browser.display.foreground_color", "#abcdef" /* hex color value */); SetCharPref("browser.display.background_color", "#abcdef" /* hex color value */); SetBoolPref("browser.display.use_system_colors", boolSystemColors); SetBoolPref("browser.display.use_document_colors", boolUseAuthorColors); /* Setting use_document_colors also stops background images from loading */Moz 0.8
Link appearanceSetCharPref("browser.anchor_color", "#abcdef" /* hex color value */); SetCharPref("browser.visited_color", "#abcdef" /* hex color value */); SetBoolPref("browser.underline_anchors", boolUnderlineLinks);Moz 0.8
Focus appearanceSetBoolPref("browser.display.use_focus_colors", useFocusColors); SetCharPref("browser.display.focus_background_color", colorString); SetCharPref("browser.display.focus_text_color", colorString); SetCharPref("browser.display.focus_ring_width", numPixels); /* 0-4 */Moz 0.9.2
Text Selection appearanceSetCharPref("browser.selection.background_color", colorString); SetCharPref("browser.selection.foreground_color", colorString); SetCharPref("browser.selection.border", cssBorderStyleString); /* Is a selection border hard to implement? It's a W3C UAAG requirement */ SetBoolPref("browser.selection.use_system_colors", useSystemColors);No
Content Waiting AlertsSetCharPref("alert.audio.mail_waiting", pathToSoundFile); SetCharPref("alert.audio.background_image_waiting", pathToSoundFile); SetCharPref("alert.audio.popup_waiting", pathToSoundFile); SetCharPref("alert.audio.applet_waiting", pathToSoundFile); SetCharPref("alert.audio.script_waiting", pathToSoundFile); SetCharPref("alert.audio.redirect_waiting", pathToSoundFile); SetCharPref("alert.audio.refresh_waiting", pathToSoundFile); SetCharPref("alert.audio.plugin_content_waiting", pathToSoundFile); SetCharPref("alert.audio.video_waiting", pathToSoundFile); SetCharPref("alert.audio.audio_waiting", pathToSoundFile); SetCharPref("alert.audio.timed_event_waiting", pathToSoundFile); /* These alerts will also be mirrored visually, either on the status bar or elsewhere */No
Background imagesSetBoolPref("browser.accept.background_images", acceptBackgroundImages);No
Blinking textSetBoolPref("browser.blink_allowed", acceptBlinkText);No
AnimationsSetCharPref("image.animation_mode", animationMode); animationMode: "normal", "none", "once"Moz 0.8
AppletsSetBoolPref("browser.accept.applets", acceptApplets);No
ScriptsSetBoolPref("browser.accept.scripts", acceptScripts);No
Popup windows// Turn window.open off for particular sites: user_pref("capability.policy.popupsites.sites", "http://www.annoyingsite1.com http://www.popupsite2.com"); user_pref("capability.policy.popupsites.windowinternal.open","noAccess");   // Or turn it off everywhere: user_pref("capability.policy.default.windowinternal.open","noAccess");   // Override popping up new windows on target=anything user_pref("browser.block.target_new_window", true);   // Override popup windows at beginning of new page load (blocks most popup advertisements) user_pref("dom.disable_open_during_load", true);Moz 0.8
Client side redirectsSetBoolPref("browser.accept.redirects", acceptRedirects);No
Content refreshesSetBoolPref("browser.accept.refreshes", acceptRefreshes);No
Plugin contentSetBoolPref("browser.accept.plugin_content.[plugin_name_goes_here]", acceptPluginContent);No
VideoSetBoolPref("browser.accept.video", acceptVideo);No
AudioSetBoolPref("browser.accept.audio", acceptAudio);No
Timed eventsSetBoolPref("browser.accept.timed_events", acceptTimedEvents);No
Timer speedSetIntPref("timer.relative_speed", percent); /* 100 corresponds to normal speed, 200 to double speed */No
Allow cycling in lists and linksSetBoolPref("keyboardnav.allow_cycling", allowCycling);No
Mouse pointer moves with keyboard focusSetBoolPref("keyboardnav.mouse_follows_keyboard_focus", mouseFollows); /* If this pref is set, the mouse pointer will always be move to the 0,0 pixel of the current keyboard focus frame */No
Browse with caretSetBoolPref("accessibility.browsewithcaret", useCaret); /* If this pref is set, the caret will be visible in the text of the browser, allowing the user to cursor around the HTML content as if in a read-only editor */Moz 0.9

Special Content Notifications

The W3C UAAG specifies types of content that must be optional. The intention is for a user to be notified of its existence, and at some point they can choose to load the content. This is a much better alternative than having the user go through a long series of confirm boxes for each new page, for each type of content.

For each preference named "browser.accept.*", there is also an "alert.audio.*" preference, to allow configuration of sound files to go with each type of content. The audio file could be a clip of a human voice saying "You've got video" or even a simple beep. How we expose this through the user interface is another matter.

Accepting Special Content on an Instance Basis

After being notified of special content, the user needs to be able to select specific unloaded content for loading.

One way of doing this is to build up the nsIWebBrowserAccessible interface, so that there is a method to force loading each type of content just for the current page in the current session.

Open Issue: Accessibility Settings per URL

A powerful possibility is that we design an interface for setting certain preferences based on the URL. If we can find a clean way to present it to the user, this would be extremely useful. For example, settings per URL would allow a user to accept scripts from their known benign web pages, but not others. Users may want similarity abilities with applets, background images, style sheets, etc.

We have a permissions system for cookies and images based on URL's. Perhaps it can be extended to store accessibility preferences. This is a UI issue we'll need to settle before we know where to go with the embedding accessibility interface.

 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:46 次

字数:14875

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文