Bug 490287 - slider of audio/video element hasn't accessible name, r=marcoz, davidb, dolske, l10n, mconor, sr=neil

This commit is contained in:
Alexander Surkov 2009-05-14 13:29:33 +08:00
Родитель c9c3595543
Коммит 6e14bc27a5
6 изменённых файлов: 96 добавлений и 5 удалений

Просмотреть файл

@ -72,6 +72,7 @@ XPIDLSRCS = \
nsIAccessibleText.idl \
nsIAccessibleValue.idl \
nsIAccessibleImage.idl \
nsIXBLAccessible.idl \
$(NULL)
ifdef MOZ_XUL

Просмотреть файл

@ -0,0 +1,53 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alexander Surkov <surkov.alexander@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
/**
* XBL controls can implement this interface to provide own implementation of
* accessible properties.
*/
[scriptable, uuid(3716eb86-166b-445b-a94a-9b522fee96e6)]
interface nsIXBLAccessible : nsISupports
{
/**
* Return accessible name.
*/
readonly attribute DOMString accessibleName;
};

Просмотреть файл

@ -43,6 +43,7 @@
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleHyperText.h"
#include "nsIXBLAccessible.h"
#include "nsAccessibleTreeWalker.h"
#include "nsIDOMElement.h"
@ -283,6 +284,13 @@ nsAccessible::GetName(nsAString& aName)
if (!aName.IsEmpty())
return NS_OK;
nsCOMPtr<nsIXBLAccessible> xblAccessible(do_QueryInterface(mDOMNode));
if (xblAccessible) {
nsresult rv = xblAccessible->GetAccessibleName(aName);
if (!aName.IsEmpty())
return NS_OK;
}
nsresult rv = GetNameInternal(aName);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -67,10 +67,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
role: ROLE_PROGRESSBAR
},
{ // slider of progress bar
role: ROLE_SLIDER
role: ROLE_SLIDER,
name: "0:00 of 0:01 elapsed"
},
{ // duration label
role: ROLE_LABEL
{ // duration label, role="presentation"
role: ROLE_NOTHING
},
{ // mute button
role: ROLE_PUSHBUTTON,

Просмотреть файл

@ -78,7 +78,24 @@
<binding id="suppressChangeEvent"
extends="chrome://global/content/bindings/scale.xml#scale">
<implementation>
<implementation implements="nsIXBLAccessible">
<!-- nsIXBLAccessible -->
<property name="accessibleName" readonly="true">
<getter>
if (this.type != "scrubber")
return "";
var currTime = this.thumb.timeLabel.getAttribute("value");
var totalTime = this.durationValue;
return this.scrubberNameFormat.replace(/#1/, currTime).
replace(/#2/, totalTime);
</getter>
</property>
<!-- Public -->
<field name="scrubberNameFormat">"&scrubberScale.nameFormat;"</field>
<field name="durationValue">""</field>
<field name="thumb">null</field>
<field name="type">null</field>
@ -159,7 +176,7 @@
<scale class="scrubber" movetoclick="true"/>
</stack>
<vbox class="durationBox">
<label class="durationLabel"/>
<label class="durationLabel" role="presentation"/>
</vbox>
<button class="muteButton"
mutelabel="&muteButton.muteLabel;"
@ -498,6 +515,10 @@
}
this.durationLabel.setAttribute("value", timeString);
// "durationValue" property is used by scale binding to
// generate accessible name.
this.scrubber.durationValue = timeString;
// If the duration is over an hour, thumb should show h:mm:ss instead of mm:ss
this.scrubberThumb.showHours = (duration >= 3600000);

Просмотреть файл

@ -3,3 +3,10 @@
<!ENTITY muteButton.muteLabel "Mute">
<!ENTITY muteButton.unmuteLabel "Unmute">
<!--
Localization note: the #1 string is the current media position, and the #2
string is the total duration. For example, when at the 5 minute mark in a 6
hour long video, #1 would be "5:00" and #2 would be "6:00:00", result string
would be "5:00 of 6:00:00 elapsed".
-->
<!ENTITY scrubberScale.nameFormat "#1 of #2 elapsed">