Merge inbound to m-c.

This commit is contained in:
Ryan VanderMeulen 2013-11-19 20:43:15 -05:00
commit 73463a4880
359 changed files with 4397 additions and 3198 deletions

View File

@ -18,4 +18,6 @@
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Australis landing.
Bug 934646 needs a clobber -- the icon resources previously copied
into $OBJDIR/mobile/android/base/res will conflict with those in
$BRANDING_DIRECTORY/res.

View File

@ -5,11 +5,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "InterfaceInitFuncs.h"
#include "mozilla/Likely.h"
#include "AccessibleWrap.h"
#include "nsMai.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Likely.h"
using namespace mozilla;
using namespace mozilla::a11y;
extern "C" {
@ -21,18 +24,13 @@ getCurrentValueCB(AtkValue *obj, GValue *value)
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accValue));
if (!accValue)
return;
memset (value, 0, sizeof (GValue));
double accValue = accWrap->CurValue();
if (IsNaN(accValue))
return;
memset (value, 0, sizeof (GValue));
double accDouble;
if (NS_FAILED(accValue->GetCurrentValue(&accDouble)))
return;
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, accDouble);
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, accValue);
}
static void
@ -42,18 +40,13 @@ getMaximumValueCB(AtkValue *obj, GValue *value)
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accValue));
if (!accValue)
return;
memset(value, 0, sizeof (GValue));
double accValue = accWrap->MaxValue();
if (IsNaN(accValue))
return;
memset (value, 0, sizeof (GValue));
double accDouble;
if (NS_FAILED(accValue->GetMaximumValue(&accDouble)))
return;
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, accDouble);
g_value_init(value, G_TYPE_DOUBLE);
g_value_set_double(value, accValue);
}
static void
@ -63,18 +56,13 @@ getMinimumValueCB(AtkValue *obj, GValue *value)
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accValue));
if (!accValue)
return;
memset(value, 0, sizeof (GValue));
double accValue = accWrap->MinValue();
if (IsNaN(accValue))
return;
memset (value, 0, sizeof (GValue));
double accDouble;
if (NS_FAILED(accValue->GetMinimumValue(&accDouble)))
return;
g_value_init (value, G_TYPE_DOUBLE);
g_value_set_double (value, accDouble);
g_value_init(value, G_TYPE_DOUBLE);
g_value_set_double(value, accValue);
}
static void
@ -84,18 +72,13 @@ getMinimumIncrementCB(AtkValue *obj, GValue *minimumIncrement)
if (!accWrap)
return;
nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accValue));
if (!accValue)
return;
memset(minimumIncrement, 0, sizeof (GValue));
double accValue = accWrap->Step();
if (IsNaN(accValue))
accValue = 0; // zero if the minimum increment is undefined
memset (minimumIncrement, 0, sizeof (GValue));
double accDouble;
if (NS_FAILED(accValue->GetMinimumIncrement(&accDouble)))
return;
g_value_init (minimumIncrement, G_TYPE_DOUBLE);
g_value_set_double (minimumIncrement, accDouble);
g_value_init(minimumIncrement, G_TYPE_DOUBLE);
g_value_set_double(minimumIncrement, accValue);
}
static gboolean
@ -105,13 +88,8 @@ setCurrentValueCB(AtkValue *obj, const GValue *value)
if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleValue> accValue;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
getter_AddRefs(accValue));
NS_ENSURE_TRUE(accValue, FALSE);
double accDouble =g_value_get_double (value);
return !NS_FAILED(accValue->SetCurrentValue(accDouble));
double accValue =g_value_get_double(value);
return accWrap->SetCurValue(accValue);
}
}

View File

@ -78,6 +78,7 @@
#endif
#include "mozilla/Assertions.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/unused.h"
#include "mozilla/Preferences.h"
@ -1672,61 +1673,53 @@ Accessible::Value(nsString& aValue)
}
}
// nsIAccessibleValue
NS_IMETHODIMP
Accessible::GetMaximumValue(double *aMaximumValue)
double
Accessible::MaxValue() const
{
return GetAttrValue(nsGkAtoms::aria_valuemax, aMaximumValue);
return AttrNumericValue(nsGkAtoms::aria_valuemax);
}
NS_IMETHODIMP
Accessible::GetMinimumValue(double *aMinimumValue)
double
Accessible::MinValue() const
{
return GetAttrValue(nsGkAtoms::aria_valuemin, aMinimumValue);
return AttrNumericValue(nsGkAtoms::aria_valuemin);
}
NS_IMETHODIMP
Accessible::GetMinimumIncrement(double *aMinIncrement)
double
Accessible::Step() const
{
NS_ENSURE_ARG_POINTER(aMinIncrement);
*aMinIncrement = 0;
// No mimimum increment in dynamic content spec right now
return NS_OK_NO_ARIA_VALUE;
return UnspecifiedNaN(); // no mimimum increment (step) in ARIA.
}
NS_IMETHODIMP
Accessible::GetCurrentValue(double *aValue)
double
Accessible::CurValue() const
{
return GetAttrValue(nsGkAtoms::aria_valuenow, aValue);
return AttrNumericValue(nsGkAtoms::aria_valuenow);
}
NS_IMETHODIMP
Accessible::SetCurrentValue(double aValue)
bool
Accessible::SetCurValue(double aValue)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue)
return NS_OK_NO_ARIA_VALUE;
return false;
const uint32_t kValueCannotChange = states::READONLY | states::UNAVAILABLE;
if (State() & kValueCannotChange)
return NS_ERROR_FAILURE;
return false;
double minValue = 0;
if (NS_SUCCEEDED(GetMinimumValue(&minValue)) && aValue < minValue)
return NS_ERROR_INVALID_ARG;
double checkValue = MinValue();
if (!IsNaN(checkValue) && aValue < checkValue)
return false;
double maxValue = 0;
if (NS_SUCCEEDED(GetMaximumValue(&maxValue)) && aValue > maxValue)
return NS_ERROR_INVALID_ARG;
checkValue = MaxValue();
if (!IsNaN(checkValue) && aValue > checkValue)
return false;
nsAutoString newValue;
newValue.AppendFloat(aValue);
return mContent->SetAttr(kNameSpaceID_None,
nsGkAtoms::aria_valuenow, newValue, true);
nsAutoString strValue;
strValue.AppendFloat(aValue);
return NS_SUCCEEDED(
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::aria_valuenow, strValue, true));
}
/* void setName (in DOMString name); */
@ -3116,31 +3109,19 @@ Accessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
return nullptr;
}
nsresult
Accessible::GetAttrValue(nsIAtom *aProperty, double *aValue)
double
Accessible::AttrNumericValue(nsIAtom* aAttr) const
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
if (IsDefunct())
return NS_ERROR_FAILURE; // Node already shut down
if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue)
return NS_OK_NO_ARIA_VALUE;
if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue)
return UnspecifiedNaN();
nsAutoString attrValue;
mContent->GetAttr(kNameSpaceID_None, aProperty, attrValue);
// Return zero value if there is no attribute or its value is empty.
if (attrValue.IsEmpty())
return NS_OK;
if (!mContent->GetAttr(kNameSpaceID_None, aAttr, attrValue))
return UnspecifiedNaN();
nsresult error = NS_OK;
double value = attrValue.ToDouble(&error);
if (NS_SUCCEEDED(error))
*aValue = value;
return NS_OK;
return NS_FAILED(error) ? UnspecifiedNaN() : value;
}
uint32_t

View File

@ -13,9 +13,9 @@
#include "nsIAccessible.h"
#include "nsIAccessibleHyperLink.h"
#include "nsIAccessibleValue.h"
#include "nsIAccessibleStates.h"
#include "xpcAccessibleSelectable.h"
#include "xpcAccessibleValue.h"
#include "nsIContent.h"
#include "nsString.h"
@ -105,7 +105,7 @@ typedef nsRefPtrHashtable<nsPtrHashKey<const void>, Accessible>
class Accessible : public nsIAccessible,
public nsIAccessibleHyperLink,
public xpcAccessibleSelectable,
public nsIAccessibleValue
public xpcAccessibleValue
{
public:
Accessible(nsIContent* aContent, DocAccessible* aDoc);
@ -116,7 +116,6 @@ public:
NS_DECL_NSIACCESSIBLE
NS_DECL_NSIACCESSIBLEHYPERLINK
NS_DECL_NSIACCESSIBLEVALUE
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSIBLE_IMPL_IID)
//////////////////////////////////////////////////////////////////////////////
@ -688,6 +687,15 @@ public:
*/
virtual bool UnselectAll();
//////////////////////////////////////////////////////////////////////////////
// Value (numeric value interface)
virtual double MaxValue() const;
virtual double MinValue() const;
virtual double CurValue() const;
virtual double Step() const;
virtual bool SetCurValue(double aValue);
//////////////////////////////////////////////////////////////////////////////
// Widgets
@ -911,14 +919,12 @@ protected:
nsIContent* GetAtomicRegion() const;
/**
* Get numeric value of the given ARIA attribute.
* Return numeric value of the given ARIA attribute, NaN if not applicable.
*
* @param aAriaProperty - the ARIA property we're using
* @param aValue - value of the attribute
*
* @return - NS_OK_NO_ARIA_VALUE if there is no setted ARIA attribute
* @param aARIAProperty [in] the ARIA property we're using
* @return a numeric value
*/
nsresult GetAttrValue(nsIAtom *aAriaProperty, double *aValue);
double AttrNumericValue(nsIAtom* aARIAAttr) const;
/**
* Return the action rule based on ARIA enum constants EActionRule

View File

@ -8,6 +8,7 @@
#include "FormControlAccessible.h"
#include "Role.h"
#include "mozilla/FloatingPoint.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULControlElement.h"
@ -82,14 +83,12 @@ ProgressMeterAccessible<Max>::Value(nsString& aValue)
if (!aValue.IsEmpty())
return;
double maxValue = 0;
nsresult rv = GetMaximumValue(&maxValue);
if (NS_FAILED(rv) || maxValue == 0)
double maxValue = MaxValue();
if (IsNaN(maxValue) || maxValue == 0)
return;
double curValue = 0;
GetCurrentValue(&curValue);
if (NS_FAILED(rv))
double curValue = CurValue();
if (IsNaN(curValue))
return;
// Treat the current value bigger than maximum as 100%.
@ -101,77 +100,62 @@ ProgressMeterAccessible<Max>::Value(nsString& aValue)
}
template<int Max>
NS_IMETHODIMP
ProgressMeterAccessible<Max>::GetMaximumValue(double* aMaximumValue)
double
ProgressMeterAccessible<Max>::MaxValue() const
{
nsresult rv = LeafAccessible::GetMaximumValue(aMaximumValue);
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
double value = LeafAccessible::MaxValue();
if (!IsNaN(value))
return value;
nsAutoString value;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, value)) {
nsAutoString strValue;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, strValue)) {
nsresult result = NS_OK;
*aMaximumValue = value.ToDouble(&result);
return result;
value = strValue.ToDouble(&result);
if (NS_SUCCEEDED(result))
return value;
}
*aMaximumValue = Max;
return NS_OK;
return Max;
}
template<int Max>
NS_IMETHODIMP
ProgressMeterAccessible<Max>::GetMinimumValue(double* aMinimumValue)
double
ProgressMeterAccessible<Max>::MinValue() const
{
nsresult rv = LeafAccessible::GetMinimumValue(aMinimumValue);
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
*aMinimumValue = 0;
return NS_OK;
double value = LeafAccessible::MinValue();
return IsNaN(value) ? 0 : value;
}
template<int Max>
NS_IMETHODIMP
ProgressMeterAccessible<Max>::GetMinimumIncrement(double* aMinimumIncrement)
double
ProgressMeterAccessible<Max>::Step() const
{
nsresult rv = LeafAccessible::GetMinimumIncrement(aMinimumIncrement);
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
*aMinimumIncrement = 0;
return NS_OK;
double value = LeafAccessible::Step();
return IsNaN(value) ? 0 : value;
}
template<int Max>
NS_IMETHODIMP
ProgressMeterAccessible<Max>::GetCurrentValue(double* aCurrentValue)
double
ProgressMeterAccessible<Max>::CurValue() const
{
nsresult rv = LeafAccessible::GetCurrentValue(aCurrentValue);
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
double value = LeafAccessible::CurValue();
if (!IsNaN(value))
return value;
nsAutoString attrValue;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
// Return zero value if there is no attribute or its value is empty.
if (attrValue.IsEmpty())
return NS_OK;
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue))
return UnspecifiedNaN();
nsresult error = NS_OK;
double value = attrValue.ToDouble(&error);
if (NS_FAILED(error))
return NS_OK; // Zero value because of wrong markup.
*aCurrentValue = value;
return NS_OK;
value = attrValue.ToDouble(&error);
return NS_FAILED(error) ? UnspecifiedNaN() : value;
}
template<int Max>
NS_IMETHODIMP
ProgressMeterAccessible<Max>::SetCurrentValue(double aValue)
bool
ProgressMeterAccessible<Max>::SetCurValue(double aValue)
{
return NS_ERROR_FAILURE; // Progress meters are readonly.
return false; // progress meters are readonly.
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -28,13 +28,19 @@ public:
}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEVALUE
// Accessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual uint64_t NativeState();
// Value
virtual double MaxValue() const MOZ_OVERRIDE;
virtual double MinValue() const MOZ_OVERRIDE;
virtual double CurValue() const MOZ_OVERRIDE;
virtual double Step() const MOZ_OVERRIDE;
virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
// Widgets
virtual bool IsWidget() const;
};

View File

@ -27,6 +27,7 @@
#include "nsIServiceManager.h"
#include "nsITextControlFrame.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -545,9 +546,6 @@ HTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent)
// HTMLRangeAccessible
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(HTMLRangeAccessible, LeafAccessible,
nsIAccessibleValue)
role
HTMLRangeAccessible::NativeRole()
{
@ -570,58 +568,53 @@ HTMLRangeAccessible::Value(nsString& aValue)
HTMLInputElement::FromContent(mContent)->GetValue(aValue);
}
NS_IMETHODIMP
HTMLRangeAccessible::GetMaximumValue(double* aMaximumValue)
double
HTMLRangeAccessible::MaxValue() const
{
nsresult rv = LeafAccessible::GetMaximumValue(aMaximumValue);
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
double value = LeafAccessible::MaxValue();
if (!IsNaN(value))
return value;
*aMaximumValue = HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
return NS_OK;
return HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
}
NS_IMETHODIMP
HTMLRangeAccessible::GetMinimumValue(double* aMinimumValue)
double
HTMLRangeAccessible::MinValue() const
{
nsresult rv = LeafAccessible::GetMinimumValue(aMinimumValue);
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
double value = LeafAccessible::MinValue();
if (!IsNaN(value))
return value;
*aMinimumValue = HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
return NS_OK;
return HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
}
NS_IMETHODIMP
HTMLRangeAccessible::GetMinimumIncrement(double* aMinimumIncrement)
double
HTMLRangeAccessible::Step() const
{
nsresult rv = LeafAccessible::GetMinimumIncrement(aMinimumIncrement);
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
double value = LeafAccessible::Step();
if (!IsNaN(value))
return value;
*aMinimumIncrement = HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
return NS_OK;
return HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
}
NS_IMETHODIMP
HTMLRangeAccessible::GetCurrentValue(double* aCurrentValue)
double
HTMLRangeAccessible::CurValue() const
{
nsresult rv = LeafAccessible::GetCurrentValue(aCurrentValue);
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
double value = LeafAccessible::CurValue();
if (!IsNaN(value))
return value;
*aCurrentValue = HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
return NS_OK;
return HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
}
NS_IMETHODIMP
HTMLRangeAccessible::SetCurrentValue(double aValue)
bool
HTMLRangeAccessible::SetCurValue(double aValue)
{
ErrorResult er;
HTMLInputElement::FromContent(mContent)->SetValueAsNumber(aValue, er);
return er.ErrorCode();
return !er.Failed();
}

View File

@ -172,13 +172,17 @@ public:
mStateFlags |= eHasNumericValue;
}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEVALUE
// Accessible
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
// Value
virtual double MaxValue() const MOZ_OVERRIDE;
virtual double MinValue() const MOZ_OVERRIDE;
virtual double CurValue() const MOZ_OVERRIDE;
virtual double Step() const MOZ_OVERRIDE;
virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
// Widgets
virtual bool IsWidget() const;
};

View File

@ -86,7 +86,7 @@ this.AccessFu = {
Cu.import('resource://gre/modules/accessibility/TouchAdapter.jsm');
Cu.import('resource://gre/modules/accessibility/Presentation.jsm');
Logger.info('enable');
Logger.info('Enabled');
for each (let mm in Utils.AllMessageManagers) {
this._addMessageListeners(mm);
@ -145,7 +145,7 @@ this.AccessFu = {
this._enabled = false;
Logger.info('disable');
Logger.info('Disabled');
Utils.win.document.removeChild(this.stylesheet.get());
@ -524,9 +524,8 @@ var Output = {
for (let action of aActions) {
let window = Utils.win;
Logger.info('tts.' + action.method,
'"' + action.data + '"',
JSON.stringify(action.options));
Logger.debug('tts.' + action.method, '"' + action.data + '"',
JSON.stringify(action.options));
if (!action.options.enqueue && this.webspeechEnabled) {
window.speechSynthesis.cancel();
@ -715,8 +714,8 @@ var Input = {
_handleGesture: function _handleGesture(aGesture) {
let gestureName = aGesture.type + aGesture.touches.length;
Logger.info('Gesture', aGesture.type,
'(fingers: ' + aGesture.touches.length + ')');
Logger.debug('Gesture', aGesture.type,
'(fingers: ' + aGesture.touches.length + ')');
switch (gestureName) {
case 'dwell1':

View File

@ -0,0 +1,39 @@
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
this.EXPORTED_SYMBOLS = ['Roles', 'Events', 'Relations', 'Filters'];
function ConstantsMap (aObject, aPrefix) {
let offset = aPrefix.length;
for (var name in aObject) {
if (name.indexOf(aPrefix) === 0) {
this[name.slice(offset)] = aObject[name];
}
}
}
XPCOMUtils.defineLazyGetter(
this, 'Roles',
function() {
return new ConstantsMap(Ci.nsIAccessibleRole, 'ROLE_');
});
XPCOMUtils.defineLazyGetter(
this, 'Events',
function() {
return new ConstantsMap(Ci.nsIAccessibleEvent, 'EVENT_');
});
XPCOMUtils.defineLazyGetter(
this, 'Relations',
function() {
return new ConstantsMap(Ci.nsIAccessibleRelation, 'RELATION_');
});
XPCOMUtils.defineLazyGetter(
this, 'Filters',
function() {
return new ConstantsMap(Ci.nsIAccessibleTraversalRule, 'FILTER_');
});

View File

@ -7,21 +7,6 @@
const Ci = Components.interfaces;
const Cu = Components.utils;
const EVENT_VIRTUALCURSOR_CHANGED = Ci.nsIAccessibleEvent.EVENT_VIRTUALCURSOR_CHANGED;
const EVENT_STATE_CHANGE = Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE;
const EVENT_SCROLLING_START = Ci.nsIAccessibleEvent.EVENT_SCROLLING_START;
const EVENT_TEXT_CARET_MOVED = Ci.nsIAccessibleEvent.EVENT_TEXT_CARET_MOVED;
const EVENT_TEXT_INSERTED = Ci.nsIAccessibleEvent.EVENT_TEXT_INSERTED;
const EVENT_TEXT_REMOVED = Ci.nsIAccessibleEvent.EVENT_TEXT_REMOVED;
const EVENT_FOCUS = Ci.nsIAccessibleEvent.EVENT_FOCUS;
const EVENT_SHOW = Ci.nsIAccessibleEvent.EVENT_SHOW;
const EVENT_HIDE = Ci.nsIAccessibleEvent.EVENT_HIDE;
const ROLE_INTERNAL_FRAME = Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME;
const ROLE_DOCUMENT = Ci.nsIAccessibleRole.ROLE_DOCUMENT;
const ROLE_CHROME_WINDOW = Ci.nsIAccessibleRole.ROLE_CHROME_WINDOW;
const ROLE_TEXT_LEAF = Ci.nsIAccessibleRole.ROLE_TEXT_LEAF;
const TEXT_NODE = 3;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
@ -35,6 +20,10 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Presentation',
'resource://gre/modules/accessibility/Presentation.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'TraversalRules',
'resource://gre/modules/accessibility/TraversalRules.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Events',
'resource://gre/modules/accessibility/Constants.jsm');
this.EXPORTED_SYMBOLS = ['EventManager'];
@ -57,7 +46,7 @@ this.EventManager.prototype = {
start: function start() {
try {
if (!this._started) {
Logger.info('EventManager.start', Utils.MozBuildApp);
Logger.debug('EventManager.start');
this._started = true;
@ -84,7 +73,7 @@ this.EventManager.prototype = {
if (!this._started) {
return;
}
Logger.info('EventManager.stop', Utils.MozBuildApp);
Logger.debug('EventManager.stop');
AccessibilityEventObserver.removeListener(this);
try {
this.webProgress.removeProgressListener(this);
@ -144,7 +133,7 @@ this.EventManager.prototype = {
// Don't bother with non-content events in firefox.
if (Utils.MozBuildApp == 'browser' &&
aEvent.eventType != EVENT_VIRTUALCURSOR_CHANGED &&
aEvent.eventType != Events.VIRTUALCURSOR_CHANGED &&
// XXX Bug 442005 results in DocAccessible::getDocType returning
// NS_ERROR_FAILURE. Checking for aEvent.accessibleDocument.docType ==
// 'window' does not currently work.
@ -154,12 +143,12 @@ this.EventManager.prototype = {
}
switch (aEvent.eventType) {
case EVENT_VIRTUALCURSOR_CHANGED:
case Events.VIRTUALCURSOR_CHANGED:
{
let pivot = aEvent.accessible.
QueryInterface(Ci.nsIAccessibleDocument).virtualCursor;
let position = pivot.position;
if (position && position.role == ROLE_INTERNAL_FRAME)
if (position && position.role == Roles.INTERNAL_FRAME)
break;
let event = aEvent.
QueryInterface(Ci.nsIAccessibleVirtualCursorChangeEvent);
@ -174,7 +163,7 @@ this.EventManager.prototype = {
break;
}
case EVENT_STATE_CHANGE:
case Events.STATE_CHANGE:
{
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
if (event.state == Ci.nsIAccessibleStates.STATE_CHECKED &&
@ -191,13 +180,13 @@ this.EventManager.prototype = {
}
break;
}
case EVENT_SCROLLING_START:
case Events.SCROLLING_START:
{
let vc = Utils.getVirtualCursor(aEvent.accessibleDocument);
vc.moveNext(TraversalRules.Simple, aEvent.accessible, true);
break;
}
case EVENT_TEXT_CARET_MOVED:
case Events.TEXT_CARET_MOVED:
{
let acc = aEvent.accessible;
let characterCount = acc.
@ -233,7 +222,7 @@ this.EventManager.prototype = {
this.editState = editState;
break;
}
case EVENT_SHOW:
case Events.SHOW:
{
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['additions', 'all']);
@ -242,14 +231,14 @@ this.EventManager.prototype = {
break;
}
// Show for text is handled by the EVENT_TEXT_INSERTED handler.
if (aEvent.accessible.role === ROLE_TEXT_LEAF) {
if (aEvent.accessible.role === Roles.TEXT_LEAF) {
break;
}
this._dequeueLiveEvent(EVENT_HIDE, liveRegion);
this._dequeueLiveEvent(Events.HIDE, liveRegion);
this.present(Presentation.liveRegion(liveRegion, isPolite, false));
break;
}
case EVENT_HIDE:
case Events.HIDE:
{
let {liveRegion, isPolite} = this._handleLiveRegion(
aEvent.QueryInterface(Ci.nsIAccessibleHideEvent),
@ -259,14 +248,14 @@ this.EventManager.prototype = {
break;
}
// Hide for text is handled by the EVENT_TEXT_REMOVED handler.
if (aEvent.accessible.role === ROLE_TEXT_LEAF) {
if (aEvent.accessible.role === Roles.TEXT_LEAF) {
break;
}
this._queueLiveEvent(EVENT_HIDE, liveRegion, isPolite);
this._queueLiveEvent(Events.HIDE, liveRegion, isPolite);
break;
}
case EVENT_TEXT_INSERTED:
case EVENT_TEXT_REMOVED:
case Events.TEXT_INSERTED:
case Events.TEXT_REMOVED:
{
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['text', 'all']);
@ -277,12 +266,12 @@ this.EventManager.prototype = {
}
break;
}
case EVENT_FOCUS:
case Events.FOCUS:
{
// Put vc where the focus is at
let acc = aEvent.accessible;
let doc = aEvent.accessibleDocument;
if (acc.role != ROLE_DOCUMENT && doc.role != ROLE_CHROME_WINDOW) {
if (acc.role != Roles.DOCUMENT && doc.role != Roles.CHROME_WINDOW) {
let vc = Utils.getVirtualCursor(doc);
vc.moveNext(TraversalRules.Simple, acc, true);
}
@ -314,11 +303,11 @@ this.EventManager.prototype = {
return;
}
if (aLiveRegion) {
if (aEvent.eventType === EVENT_TEXT_REMOVED) {
this._queueLiveEvent(EVENT_TEXT_REMOVED, aLiveRegion, aIsPolite,
if (aEvent.eventType === Events.TEXT_REMOVED) {
this._queueLiveEvent(Events.TEXT_REMOVED, aLiveRegion, aIsPolite,
modifiedText);
} else {
this._dequeueLiveEvent(EVENT_TEXT_REMOVED, aLiveRegion);
this._dequeueLiveEvent(Events.TEXT_REMOVED, aLiveRegion);
this.present(Presentation.liveRegion(aLiveRegion, aIsPolite, false,
modifiedText));
}

View File

@ -1,19 +1,3 @@
# 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/.
INSTALL_TARGETS += ACCESSFU
ACCESSFU_FILES := \
AccessFu.jsm \
EventManager.jsm \
jar.mn \
Makefile.in \
OutputGenerator.jsm \
Presentation.jsm \
TouchAdapter.jsm \
TraversalRules.jsm \
Utils.jsm \
$(NULL)
ACCESSFU_DEST = $(FINAL_TARGET)/modules/accessibility

View File

@ -18,10 +18,6 @@ const NAME_FROM_SUBTREE_RULE = 0x10;
const OUTPUT_DESC_FIRST = 0;
const OUTPUT_DESC_LAST = 1;
const ROLE_LISTITEM = Ci.nsIAccessibleRole.ROLE_LISTITEM;
const ROLE_STATICTEXT = Ci.nsIAccessibleRole.ROLE_STATICTEXT;
const ROLE_LINK = Ci.nsIAccessibleRole.ROLE_LINK;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Utils',
'resource://gre/modules/accessibility/Utils.jsm');
@ -31,6 +27,8 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Logger',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PluralForm',
'resource://gre/modules/PluralForm.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
var gStringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
getService(Ci.nsIStringBundleService).
@ -697,8 +695,8 @@ this.BrailleGenerator = {
let braille = this.objectOutputFunctions._generateBaseOutput.apply(this, arguments);
if (aAccessible.indexInParent === 1 &&
aAccessible.parent.role == ROLE_LISTITEM &&
aAccessible.previousSibling.role == ROLE_STATICTEXT) {
aAccessible.parent.role == Roles.LISTITEM &&
aAccessible.previousSibling.role == Roles.STATICTEXT) {
if (aAccessible.parent.parent && aAccessible.parent.parent.DOMNode &&
aAccessible.parent.parent.DOMNode.nodeName == 'UL') {
braille.unshift('*');
@ -755,7 +753,7 @@ this.BrailleGenerator = {
statictext: function statictext(aAccessible, aRoleStr, aStates, aFlags) {
// Since we customize the list bullet's output, we add the static
// text from the first node in each listitem, so skip it here.
if (aAccessible.parent.role == ROLE_LISTITEM) {
if (aAccessible.parent.role == Roles.LISTITEM) {
return [];
}
@ -788,7 +786,7 @@ this.BrailleGenerator = {
},
_getContextStart: function _getContextStart(aContext) {
if (aContext.accessible.parent.role == ROLE_LINK) {
if (aContext.accessible.parent.role == Roles.LINK) {
return [aContext.accessible.parent];
}

View File

@ -46,7 +46,7 @@ this.TouchAdapter = {
SYNTH_ID: -1,
start: function TouchAdapter_start() {
Logger.info('TouchAdapter.start');
Logger.debug('TouchAdapter.start');
this._touchPoints = {};
this._dwellTimeout = 0;
@ -64,7 +64,7 @@ this.TouchAdapter = {
},
stop: function TouchAdapter_stop() {
Logger.info('TouchAdapter.stop');
Logger.debug('TouchAdapter.stop');
let target = Utils.win;

View File

@ -9,61 +9,24 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
const FILTER_IGNORE = Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
const FILTER_MATCH = Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
const FILTER_IGNORE_SUBTREE = Ci.nsIAccessibleTraversalRule.FILTER_IGNORE_SUBTREE;
const ROLE_MENUITEM = Ci.nsIAccessibleRole.ROLE_MENUITEM;
const ROLE_LINK = Ci.nsIAccessibleRole.ROLE_LINK;
const ROLE_PAGETAB = Ci.nsIAccessibleRole.ROLE_PAGETAB;
const ROLE_GRAPHIC = Ci.nsIAccessibleRole.ROLE_GRAPHIC;
const ROLE_STATICTEXT = Ci.nsIAccessibleRole.ROLE_STATICTEXT;
const ROLE_TEXT_LEAF = Ci.nsIAccessibleRole.ROLE_TEXT_LEAF;
const ROLE_PUSHBUTTON = Ci.nsIAccessibleRole.ROLE_PUSHBUTTON;
const ROLE_SPINBUTTON = Ci.nsIAccessibleRole.ROLE_SPINBUTTON;
const ROLE_CHECKBUTTON = Ci.nsIAccessibleRole.ROLE_CHECKBUTTON;
const ROLE_RADIOBUTTON = Ci.nsIAccessibleRole.ROLE_RADIOBUTTON;
const ROLE_COMBOBOX = Ci.nsIAccessibleRole.ROLE_COMBOBOX;
const ROLE_PROGRESSBAR = Ci.nsIAccessibleRole.ROLE_PROGRESSBAR;
const ROLE_BUTTONDROPDOWN = Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN;
const ROLE_BUTTONMENU = Ci.nsIAccessibleRole.ROLE_BUTTONMENU;
const ROLE_CHECK_MENU_ITEM = Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM;
const ROLE_PASSWORD_TEXT = Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT;
const ROLE_RADIO_MENU_ITEM = Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM;
const ROLE_TOGGLE_BUTTON = Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON;
const ROLE_KEY = Ci.nsIAccessibleRole.ROLE_KEY;
const ROLE_ENTRY = Ci.nsIAccessibleRole.ROLE_ENTRY;
const ROLE_LIST = Ci.nsIAccessibleRole.ROLE_LIST;
const ROLE_DEFINITION_LIST = Ci.nsIAccessibleRole.ROLE_DEFINITION_LIST;
const ROLE_LISTITEM = Ci.nsIAccessibleRole.ROLE_LISTITEM;
const ROLE_BUTTONDROPDOWNGRID = Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID;
const ROLE_LISTBOX = Ci.nsIAccessibleRole.ROLE_LISTBOX;
const ROLE_OPTION = Ci.nsIAccessibleRole.ROLE_OPTION;
const ROLE_SLIDER = Ci.nsIAccessibleRole.ROLE_SLIDER;
const ROLE_HEADING = Ci.nsIAccessibleRole.ROLE_HEADING;
const ROLE_HEADER = Ci.nsIAccessibleRole.ROLE_HEADER;
const ROLE_TERM = Ci.nsIAccessibleRole.ROLE_TERM;
const ROLE_SEPARATOR = Ci.nsIAccessibleRole.ROLE_SEPARATOR;
const ROLE_TABLE = Ci.nsIAccessibleRole.ROLE_TABLE;
const ROLE_INTERNAL_FRAME = Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME;
const ROLE_PARAGRAPH = Ci.nsIAccessibleRole.ROLE_PARAGRAPH;
const ROLE_SECTION = Ci.nsIAccessibleRole.ROLE_SECTION;
const ROLE_LABEL = Ci.nsIAccessibleRole.ROLE_LABEL;
this.EXPORTED_SYMBOLS = ['TraversalRules'];
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Filters',
'resource://gre/modules/accessibility/Constants.jsm');
let gSkipEmptyImages = new PrefCache('accessibility.accessfu.skip_empty_images');
function BaseTraversalRule(aRoles, aMatchFunc) {
this._explicitMatchRoles = new Set(aRoles);
this._matchRoles = aRoles;
if (aRoles.indexOf(ROLE_LABEL) < 0) {
this._matchRoles.push(ROLE_LABEL);
if (aRoles.indexOf(Roles.LABEL) < 0) {
this._matchRoles.push(Roles.LABEL);
}
this._matchFunc = aMatchFunc || function (acc) { return FILTER_MATCH; };
this._matchFunc = aMatchFunc || function (acc) { return Filters.MATCH; };
}
BaseTraversalRule.prototype = {
@ -80,20 +43,20 @@ BaseTraversalRule.prototype = {
match: function BaseTraversalRule_match(aAccessible)
{
let role = aAccessible.role;
if (role == ROLE_INTERNAL_FRAME) {
if (role == Roles.INTERNAL_FRAME) {
return (Utils.getMessageManager(aAccessible.DOMNode)) ?
FILTER_MATCH | FILTER_IGNORE_SUBTREE : FILTER_IGNORE;
Filters.MATCH | Filters.IGNORE_SUBTREE : Filters.IGNORE;
}
let matchResult = this._explicitMatchRoles.has(role) ?
this._matchFunc(aAccessible) : FILTER_IGNORE;
this._matchFunc(aAccessible) : Filters.IGNORE;
// If we are on a label that nests a checkbox/radio we should land on it.
// It is a bigger touch target, and it reduces clutter.
if (role == ROLE_LABEL && !(matchResult & FILTER_IGNORE_SUBTREE)) {
if (role == Roles.LABEL && !(matchResult & Filters.IGNORE_SUBTREE)) {
let control = Utils.getEmbeddedControl(aAccessible);
if (control && this._explicitMatchRoles.has(control.role)) {
matchResult = this._matchFunc(control) | FILTER_IGNORE_SUBTREE;
matchResult = this._matchFunc(control) | Filters.IGNORE_SUBTREE;
}
}
@ -104,32 +67,32 @@ BaseTraversalRule.prototype = {
};
var gSimpleTraversalRoles =
[ROLE_MENUITEM,
ROLE_LINK,
ROLE_PAGETAB,
ROLE_GRAPHIC,
ROLE_STATICTEXT,
ROLE_TEXT_LEAF,
ROLE_PUSHBUTTON,
ROLE_CHECKBUTTON,
ROLE_RADIOBUTTON,
ROLE_COMBOBOX,
ROLE_PROGRESSBAR,
ROLE_BUTTONDROPDOWN,
ROLE_BUTTONMENU,
ROLE_CHECK_MENU_ITEM,
ROLE_PASSWORD_TEXT,
ROLE_RADIO_MENU_ITEM,
ROLE_TOGGLE_BUTTON,
ROLE_ENTRY,
ROLE_KEY,
ROLE_HEADER,
ROLE_HEADING,
ROLE_SLIDER,
ROLE_SPINBUTTON,
ROLE_OPTION,
[Roles.MENUITEM,
Roles.LINK,
Roles.PAGETAB,
Roles.GRAPHIC,
Roles.STATICTEXT,
Roles.TEXT_LEAF,
Roles.PUSHBUTTON,
Roles.CHECKBUTTON,
Roles.RADIOBUTTON,
Roles.COMBOBOX,
Roles.PROGRESSBAR,
Roles.BUTTONDROPDOWN,
Roles.BUTTONMENU,
Roles.CHECK_MENU_ITEM,
Roles.PASSWORD_TEXT,
Roles.RADIO_MENU_ITEM,
Roles.TOGGLE_BUTTON,
Roles.ENTRY,
Roles.KEY,
Roles.HEADER,
Roles.HEADING,
Roles.SLIDER,
Roles.SPINBUTTON,
Roles.OPTION,
// Used for traversing in to child OOP frames.
ROLE_INTERNAL_FRAME];
Roles.INTERNAL_FRAME];
this.TraversalRules = {
Simple: new BaseTraversalRule(
@ -146,47 +109,47 @@ this.TraversalRules = {
}
switch (aAccessible.role) {
case ROLE_COMBOBOX:
case Roles.COMBOBOX:
// We don't want to ignore the subtree because this is often
// where the list box hangs out.
return FILTER_MATCH;
case ROLE_TEXT_LEAF:
return Filters.MATCH;
case Roles.TEXT_LEAF:
{
// Nameless text leaves are boring, skip them.
let name = aAccessible.name;
if (name && name.trim())
return FILTER_MATCH;
return Filters.MATCH;
else
return FILTER_IGNORE;
return Filters.IGNORE;
}
case ROLE_STATICTEXT:
case Roles.STATICTEXT:
{
let parent = aAccessible.parent;
// Ignore prefix static text in list items. They are typically bullets or numbers.
if (parent.childCount > 1 && aAccessible.indexInParent == 0 &&
parent.role == ROLE_LISTITEM)
return FILTER_IGNORE;
parent.role == Roles.LISTITEM)
return Filters.IGNORE;
return FILTER_MATCH;
return Filters.MATCH;
}
case ROLE_GRAPHIC:
case Roles.GRAPHIC:
return TraversalRules._shouldSkipImage(aAccessible);
case ROLE_LINK:
case ROLE_HEADER:
case ROLE_HEADING:
case Roles.LINK:
case Roles.HEADER:
case Roles.HEADING:
return hasZeroOrSingleChildDescendants() ?
(FILTER_MATCH | FILTER_IGNORE_SUBTREE) : (FILTER_IGNORE);
(Filters.MATCH | Filters.IGNORE_SUBTREE) : (Filters.IGNORE);
default:
// Ignore the subtree, if there is one. So that we don't land on
// the same content that was already presented by its parent.
return FILTER_MATCH |
FILTER_IGNORE_SUBTREE;
return Filters.MATCH |
Filters.IGNORE_SUBTREE;
}
}
),
Anchor: new BaseTraversalRule(
[ROLE_LINK],
[Roles.LINK],
function Anchor_match(aAccessible)
{
// We want to ignore links, only focus named anchors.
@ -194,67 +157,67 @@ this.TraversalRules = {
let extraState = {};
aAccessible.getState(state, extraState);
if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) {
return FILTER_IGNORE;
return Filters.IGNORE;
} else {
return FILTER_MATCH;
return Filters.MATCH;
}
}),
Button: new BaseTraversalRule(
[ROLE_PUSHBUTTON,
ROLE_SPINBUTTON,
ROLE_TOGGLE_BUTTON,
ROLE_BUTTONDROPDOWN,
ROLE_BUTTONDROPDOWNGRID]),
[Roles.PUSHBUTTON,
Roles.SPINBUTTON,
Roles.TOGGLE_BUTTON,
Roles.BUTTONDROPDOWN,
Roles.BUTTONDROPDOWNGRID]),
Combobox: new BaseTraversalRule(
[ROLE_COMBOBOX,
ROLE_LISTBOX]),
[Roles.COMBOBOX,
Roles.LISTBOX]),
Landmark: new BaseTraversalRule(
[],
function Landmark_match(aAccessible) {
return Utils.getLandmarkName(aAccessible) ? FILTER_MATCH :
FILTER_IGNORE;
return Utils.getLandmarkName(aAccessible) ? Filters.MATCH :
Filters.IGNORE;
}
),
Entry: new BaseTraversalRule(
[ROLE_ENTRY,
ROLE_PASSWORD_TEXT]),
[Roles.ENTRY,
Roles.PASSWORD_TEXT]),
FormElement: new BaseTraversalRule(
[ROLE_PUSHBUTTON,
ROLE_SPINBUTTON,
ROLE_TOGGLE_BUTTON,
ROLE_BUTTONDROPDOWN,
ROLE_BUTTONDROPDOWNGRID,
ROLE_COMBOBOX,
ROLE_LISTBOX,
ROLE_ENTRY,
ROLE_PASSWORD_TEXT,
ROLE_PAGETAB,
ROLE_RADIOBUTTON,
ROLE_RADIO_MENU_ITEM,
ROLE_SLIDER,
ROLE_CHECKBUTTON,
ROLE_CHECK_MENU_ITEM]),
[Roles.PUSHBUTTON,
Roles.SPINBUTTON,
Roles.TOGGLE_BUTTON,
Roles.BUTTONDROPDOWN,
Roles.BUTTONDROPDOWNGRID,
Roles.COMBOBOX,
Roles.LISTBOX,
Roles.ENTRY,
Roles.PASSWORD_TEXT,
Roles.PAGETAB,
Roles.RADIOBUTTON,
Roles.RADIO_MENU_ITEM,
Roles.SLIDER,
Roles.CHECKBUTTON,
Roles.CHECK_MENU_ITEM]),
Graphic: new BaseTraversalRule(
[ROLE_GRAPHIC],
[Roles.GRAPHIC],
function Graphic_match(aAccessible) {
return TraversalRules._shouldSkipImage(aAccessible);
}),
Heading: new BaseTraversalRule(
[ROLE_HEADING]),
[Roles.HEADING]),
ListItem: new BaseTraversalRule(
[ROLE_LISTITEM,
ROLE_TERM]),
[Roles.LISTITEM,
Roles.TERM]),
Link: new BaseTraversalRule(
[ROLE_LINK],
[Roles.LINK],
function Link_match(aAccessible)
{
// We want to ignore anchors, only focus real links.
@ -262,50 +225,50 @@ this.TraversalRules = {
let extraState = {};
aAccessible.getState(state, extraState);
if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) {
return FILTER_MATCH;
return Filters.MATCH;
} else {
return FILTER_IGNORE;
return Filters.IGNORE;
}
}),
List: new BaseTraversalRule(
[ROLE_LIST,
ROLE_DEFINITION_LIST]),
[Roles.LIST,
Roles.DEFINITION_LIST]),
PageTab: new BaseTraversalRule(
[ROLE_PAGETAB]),
[Roles.PAGETAB]),
Paragraph: new BaseTraversalRule(
[ROLE_PARAGRAPH,
ROLE_SECTION],
[Roles.PARAGRAPH,
Roles.SECTION],
function Paragraph_match(aAccessible) {
for (let child = aAccessible.firstChild; child; child = child.nextSibling) {
if (child.role === ROLE_TEXT_LEAF) {
return FILTER_MATCH | FILTER_IGNORE_SUBTREE;
if (child.role === Roles.TEXT_LEAF) {
return Filters.MATCH | Filters.IGNORE_SUBTREE;
}
}
return FILTER_IGNORE;
return Filters.IGNORE;
}),
RadioButton: new BaseTraversalRule(
[ROLE_RADIOBUTTON,
ROLE_RADIO_MENU_ITEM]),
[Roles.RADIOBUTTON,
Roles.RADIO_MENU_ITEM]),
Separator: new BaseTraversalRule(
[ROLE_SEPARATOR]),
[Roles.SEPARATOR]),
Table: new BaseTraversalRule(
[ROLE_TABLE]),
[Roles.TABLE]),
Checkbox: new BaseTraversalRule(
[ROLE_CHECKBUTTON,
ROLE_CHECK_MENU_ITEM]),
[Roles.CHECKBUTTON,
Roles.CHECK_MENU_ITEM]),
_shouldSkipImage: function _shouldSkipImage(aAccessible) {
if (gSkipEmptyImages.value && aAccessible.name === '') {
return FILTER_IGNORE;
return Filters.IGNORE;
}
return FILTER_MATCH;
return Filters.MATCH;
}
};

View File

@ -8,19 +8,17 @@ const Cu = Components.utils;
const Cc = Components.classes;
const Ci = Components.interfaces;
const EVENT_STATE_CHANGE = Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE;
const ROLE_CELL = Ci.nsIAccessibleRole.ROLE_CELL;
const ROLE_COLUMNHEADER = Ci.nsIAccessibleRole.ROLE_COLUMNHEADER;
const ROLE_ROWHEADER = Ci.nsIAccessibleRole.ROLE_ROWHEADER;
const RELATION_LABEL_FOR = Ci.nsIAccessibleRelation.RELATION_LABEL_FOR;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, 'Services',
'resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Rect',
'resource://gre/modules/Geometry.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Events',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Relations',
'resource://gre/modules/accessibility/Constants.jsm');
this.EXPORTED_SYMBOLS = ['Utils', 'Logger', 'PivotContext', 'PrefCache'];
@ -297,7 +295,7 @@ this.Utils = {
getEmbeddedControl: function getEmbeddedControl(aLabel) {
if (aLabel) {
let relation = aLabel.getRelationByType(RELATION_LABEL_FOR);
let relation = aLabel.getRelationByType(Relations.LABEL_FOR);
for (let i = 0; i < relation.targetsCount; i++) {
let target = relation.getTarget(i);
if (target.parent === aLabel) {
@ -399,7 +397,7 @@ this.Logger = {
eventToString: function eventToString(aEvent) {
let str = Utils.AccRetrieval.getStringEventType(aEvent.eventType);
if (aEvent.eventType == EVENT_STATE_CHANGE) {
if (aEvent.eventType == Events.STATE_CHANGE) {
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
let stateStrings = event.isExtraState ?
Utils.AccRetrieval.getStringStates(0, event.state) :
@ -633,7 +631,7 @@ PivotContext.prototype = {
if (!aAccessible) {
return null;
}
if ([ROLE_CELL, ROLE_COLUMNHEADER, ROLE_ROWHEADER].indexOf(
if ([Roles.CELL, Roles.COLUMNHEADER, Roles.ROWHEADER].indexOf(
aAccessible.role) < 0) {
return null;
}
@ -694,12 +692,12 @@ PivotContext.prototype = {
cellInfo.columnHeaders = [];
if (cellInfo.columnChanged && cellInfo.current.role !==
ROLE_COLUMNHEADER) {
Roles.COLUMNHEADER) {
cellInfo.columnHeaders = [headers for (headers of getHeaders(
cellInfo.current.columnHeaderCells))];
}
cellInfo.rowHeaders = [];
if (cellInfo.rowChanged && cellInfo.current.role === ROLE_CELL) {
if (cellInfo.rowChanged && cellInfo.current.role === Roles.CELL) {
cellInfo.rowHeaders = [headers for (headers of getHeaders(
cellInfo.current.rowHeaderCells))];
}

View File

@ -5,9 +5,6 @@
let Ci = Components.interfaces;
let Cu = Components.utils;
const ROLE_ENTRY = Ci.nsIAccessibleRole.ROLE_ENTRY;
const ROLE_INTERNAL_FRAME = Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME;
const MOVEMENT_GRANULARITY_CHARACTER = 1;
const MOVEMENT_GRANULARITY_WORD = 2;
const MOVEMENT_GRANULARITY_PARAGRAPH = 8;
@ -25,6 +22,8 @@ XPCOMUtils.defineLazyModuleGetter(this, 'EventManager',
'resource://gre/modules/accessibility/EventManager.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'ObjectWrapper',
'resource://gre/modules/ObjectWrapper.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
Logger.debug('content-script.js');
@ -137,7 +136,7 @@ function forwardToParent(aMessage) {
function forwardToChild(aMessage, aListener, aVCPosition) {
let acc = aVCPosition || Utils.getVirtualCursor(content.document).position;
if (!Utils.isAliveAndVisible(acc) || acc.role != ROLE_INTERNAL_FRAME) {
if (!Utils.isAliveAndVisible(acc) || acc.role != Roles.INTERNAL_FRAME) {
return false;
}
@ -165,7 +164,7 @@ function activateCurrent(aMessage) {
Logger.debug('activateCurrent');
function activateAccessible(aAccessible) {
if (aMessage.json.activateIfKey &&
aAccessible.role != Ci.nsIAccessibleRole.ROLE_KEY) {
aAccessible.role != Roles.KEY) {
// Only activate keys, don't do anything on other objects.
return;
}
@ -219,7 +218,7 @@ function activateCurrent(aMessage) {
}
let focusedAcc = Utils.AccRetrieval.getAccessibleFor(content.document.activeElement);
if (focusedAcc && focusedAcc.role === ROLE_ENTRY) {
if (focusedAcc && focusedAcc.role === Roles.ENTRY) {
moveCaretTo(focusedAcc, aMessage.json.offset);
return;
}

View File

@ -3,3 +3,16 @@
# 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/.
JS_MODULES_PATH = 'modules/accessibility'
EXTRA_JS_MODULES += [
'AccessFu.jsm',
'Constants.jsm',
'EventManager.jsm',
'OutputGenerator.jsm',
'Presentation.jsm',
'TouchAdapter.jsm',
'TraversalRules.jsm',
'Utils.jsm'
]

View File

@ -13,6 +13,8 @@
#include "Accessible-inl.h"
#include "IUnknownImpl.h"
#include "mozilla/FloatingPoint.h"
using namespace mozilla::a11y;
// IUnknown
@ -55,10 +57,9 @@ ia2AccessibleValue::get_currentValue(VARIANT* aCurrentValue)
if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
double currentValue = 0;
nsresult rv = valueAcc->GetCurrentValue(&currentValue);
if (NS_FAILED(rv))
return GetHRESULT(rv);
double currentValue = valueAcc->CurValue();
if (IsNaN(currentValue))
return S_FALSE;
aCurrentValue->vt = VT_R8;
aCurrentValue->dblVal = currentValue;
@ -79,8 +80,7 @@ ia2AccessibleValue::setCurrentValue(VARIANT aValue)
if (aValue.vt != VT_R8)
return E_INVALIDARG;
nsresult rv = valueAcc->SetCurrentValue(aValue.dblVal);
return GetHRESULT(rv);
return valueAcc->SetCurValue(aValue.dblVal) ? S_OK : E_FAIL;
A11Y_TRYBLOCK_END
}
@ -99,10 +99,9 @@ ia2AccessibleValue::get_maximumValue(VARIANT* aMaximumValue)
if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
double maximumValue = 0;
nsresult rv = valueAcc->GetMaximumValue(&maximumValue);
if (NS_FAILED(rv))
return GetHRESULT(rv);
double maximumValue = valueAcc->MaxValue();
if (IsNaN(maximumValue))
return S_FALSE;
aMaximumValue->vt = VT_R8;
aMaximumValue->dblVal = maximumValue;
@ -125,10 +124,9 @@ ia2AccessibleValue::get_minimumValue(VARIANT* aMinimumValue)
if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
double minimumValue = 0;
nsresult rv = valueAcc->GetMinimumValue(&minimumValue);
if (NS_FAILED(rv))
return GetHRESULT(rv);
double minimumValue = valueAcc->MinValue();
if (IsNaN(minimumValue))
return S_FALSE;
aMinimumValue->vt = VT_R8;
aMinimumValue->dblVal = minimumValue;

View File

@ -7,6 +7,7 @@
EXPORTS += [
'xpcAccessibleHyperText.h',
'xpcAccessibleSelectable.h',
'xpcAccessibleValue.h',
]
UNIFIED_SOURCES += [
@ -15,6 +16,7 @@ UNIFIED_SOURCES += [
'xpcAccessibleSelectable.cpp',
'xpcAccessibleTable.cpp',
'xpcAccessibleTableCell.cpp',
'xpcAccessibleValue.cpp',
]
GENERATED_SOURCES += [

View File

@ -0,0 +1,90 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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 "xpcAccessibleValue.h"
#include "Accessible.h"
using namespace mozilla;
using namespace mozilla::a11y;
NS_IMETHODIMP
xpcAccessibleValue::GetMaximumValue(double* aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
double value = acc->MaxValue();
if (!IsNaN(value))
*aValue = value;
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleValue::GetMinimumValue(double* aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
double value = acc->MinValue();
if (!IsNaN(value))
*aValue = value;
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleValue::GetCurrentValue(double* aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
double value = acc->CurValue();
if (!IsNaN(value))
*aValue = value;
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleValue::SetCurrentValue(double aValue)
{
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
acc->SetCurValue(aValue);
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleValue::GetMinimumIncrement(double* aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
double value = acc->Step();
if (!IsNaN(value))
*aValue = value;
return NS_OK;
}

View File

@ -0,0 +1,35 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_a11y_xpcAccessibleValue_h_
#define mozilla_a11y_xpcAccessibleValue_h_
#include "nsIAccessibleValue.h"
namespace mozilla {
namespace a11y {
class xpcAccessibleValue : public nsIAccessibleValue
{
public:
NS_IMETHOD GetMaximumValue(double* aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetMinimumValue(double* aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetCurrentValue(double* aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD SetCurrentValue(double aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetMinimumIncrement(double* aMinIncrement) MOZ_FINAL MOZ_OVERRIDE;
private:
xpcAccessibleValue() { }
friend class Accessible;
xpcAccessibleValue(const xpcAccessibleValue&) MOZ_DELETE;
xpcAccessibleValue& operator =(const xpcAccessibleValue&) MOZ_DELETE;
};
} // namespace a11y
} // namespace mozilla
#endif

View File

@ -11,6 +11,7 @@
#include "nsIFrame.h"
#include "mozilla/dom/Element.h"
#include "mozilla/FloatingPoint.h"
using namespace mozilla::a11y;
@ -25,12 +26,6 @@ XULSliderAccessible::
mStateFlags |= eHasNumericValue;
}
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED1(XULSliderAccessible,
AccessibleWrap,
nsIAccessibleValue)
// Accessible
role
@ -99,64 +94,39 @@ XULSliderAccessible::DoAction(uint8_t aIndex)
return NS_OK;
}
// nsIAccessibleValue
NS_IMETHODIMP
XULSliderAccessible::GetMaximumValue(double* aValue)
double
XULSliderAccessible::MaxValue() const
{
nsresult rv = AccessibleWrap::GetMaximumValue(aValue);
// ARIA redefined maximum value.
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
return GetSliderAttr(nsGkAtoms::maxpos, aValue);
double value = AccessibleWrap::MaxValue();
return IsNaN(value) ? GetSliderAttr(nsGkAtoms::maxpos) : value;
}
NS_IMETHODIMP
XULSliderAccessible::GetMinimumValue(double* aValue)
double
XULSliderAccessible::MinValue() const
{
nsresult rv = AccessibleWrap::GetMinimumValue(aValue);
// ARIA redefined minmum value.
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
return GetSliderAttr(nsGkAtoms::minpos, aValue);
double value = AccessibleWrap::MinValue();
return IsNaN(value) ? GetSliderAttr(nsGkAtoms::minpos) : value;
}
NS_IMETHODIMP
XULSliderAccessible::GetMinimumIncrement(double* aValue)
double
XULSliderAccessible::Step() const
{
nsresult rv = AccessibleWrap::GetMinimumIncrement(aValue);
// ARIA redefined minimum increment value.
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
return GetSliderAttr(nsGkAtoms::increment, aValue);
double value = AccessibleWrap::Step();
return IsNaN(value) ? GetSliderAttr(nsGkAtoms::increment) : value;
}
NS_IMETHODIMP
XULSliderAccessible::GetCurrentValue(double* aValue)
double
XULSliderAccessible::CurValue() const
{
nsresult rv = AccessibleWrap::GetCurrentValue(aValue);
// ARIA redefined current value.
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
return GetSliderAttr(nsGkAtoms::curpos, aValue);
double value = AccessibleWrap::CurValue();
return IsNaN(value) ? GetSliderAttr(nsGkAtoms::curpos) : value;
}
NS_IMETHODIMP
XULSliderAccessible::SetCurrentValue(double aValue)
bool
XULSliderAccessible::SetCurValue(double aValue)
{
nsresult rv = AccessibleWrap::SetCurrentValue(aValue);
// ARIA redefined current value.
if (rv != NS_OK_NO_ARIA_VALUE)
return rv;
if (AccessibleWrap::SetCurValue(aValue))
return true;
return SetSliderAttr(nsGkAtoms::curpos, aValue);
}
@ -184,7 +154,7 @@ XULSliderAccessible::GetSliderElement() const
}
nsresult
XULSliderAccessible::GetSliderAttr(nsIAtom* aName, nsAString& aValue)
XULSliderAccessible::GetSliderAttr(nsIAtom* aName, nsAString& aValue) const
{
aValue.Truncate();
@ -211,35 +181,26 @@ XULSliderAccessible::SetSliderAttr(nsIAtom* aName, const nsAString& aValue)
return NS_OK;
}
nsresult
XULSliderAccessible::GetSliderAttr(nsIAtom* aName, double* aValue)
double
XULSliderAccessible::GetSliderAttr(nsIAtom* aName) const
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
nsAutoString attrValue;
nsresult rv = GetSliderAttr(aName, attrValue);
NS_ENSURE_SUCCESS(rv, rv);
// Return zero value if there is no attribute or its value is empty.
if (attrValue.IsEmpty())
return NS_OK;
if (NS_FAILED(rv))
return UnspecifiedNaN();
nsresult error = NS_OK;
double value = attrValue.ToDouble(&error);
if (NS_SUCCEEDED(error))
*aValue = value;
return NS_OK;
return NS_FAILED(error) ? UnspecifiedNaN() : value;
}
nsresult
bool
XULSliderAccessible::SetSliderAttr(nsIAtom* aName, double aValue)
{
nsAutoString value;
value.AppendFloat(aValue);
return SetSliderAttr(aName, value);
return NS_SUCCEEDED(SetSliderAttr(aName, value));
}

View File

@ -21,16 +21,10 @@ class XULSliderAccessible : public AccessibleWrap
public:
XULSliderAccessible(nsIContent* aContent, DocAccessible* aDoc);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName);
NS_IMETHOD DoAction(uint8_t aIndex);
// nsIAccessibleValue
NS_DECL_NSIACCESSIBLEVALUE
// Accessible
virtual void Value(nsString& aValue);
virtual a11y::role NativeRole();
@ -38,6 +32,13 @@ public:
virtual bool NativelyUnavailable() const;
virtual bool CanHaveAnonChildren();
// Value
virtual double MaxValue() const MOZ_OVERRIDE;
virtual double MinValue() const MOZ_OVERRIDE;
virtual double CurValue() const MOZ_OVERRIDE;
virtual double Step() const MOZ_OVERRIDE;
virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
// ActionAccessible
virtual uint8_t ActionCount();
@ -47,11 +48,11 @@ protected:
*/
nsIContent* GetSliderElement() const;
nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue);
nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue) const;
nsresult SetSliderAttr(nsIAtom *aName, const nsAString& aValue);
nsresult GetSliderAttr(nsIAtom *aName, double *aValue);
nsresult SetSliderAttr(nsIAtom *aName, double aValue);
double GetSliderAttr(nsIAtom *aName) const;
bool SetSliderAttr(nsIAtom *aName, double aValue);
private:
mutable nsCOMPtr<nsIContent> mSliderNode;

View File

@ -92,6 +92,7 @@ var AccessFuTest = {
finish: function AccessFuTest_finish() {
// Disable the console service logging.
Logger.test = false;
Logger.logLevel = Logger.INFO;
AccessFu.doneCallback = function doneCallback() {
// This is being called once AccessFu has been shut down.
// Detach AccessFu from everything it attached itself to.
@ -136,6 +137,7 @@ var AccessFuTest = {
AccessFu.readyCallback = function readyCallback() {
// Enable logging to the console service.
Logger.test = true;
Logger.logLevel = Logger.DEBUG;
// This is being called once accessibility has been turned on.
if (AccessFuTest._waitForExplicitFinish) {

View File

@ -21,7 +21,7 @@
function doTest()
{
// HTML5 progress element tests
testValue("pr_indeterminate", "0%", 0, 0, 1, 0);
testValue("pr_indeterminate", "", 0, 0, 1, 0);
testValue("pr_zero", "0%", 0, 0, 1, 0);
testValue("pr_zeropointfive", "50%", 0.5, 0, 1, 0);
testValue("pr_one", "100%", 1, 0, 1, 0);

View File

@ -21,7 +21,7 @@
// progressmeter
testValue("pm1", "50%", 50, 0, 100, 0);
testValue("pm2", "50%", 500, 0, 1000, 0);
testValue("pm3", "0%", 0, 0, 100, 0);
testValue("pm3", "", 0, 0, 100, 0);
// scale
testValue("sc1", "500", 500, 0, 1000, 10);

View File

@ -471,7 +471,7 @@ class Automation(object):
os.unlink(pwfilePath)
return 0
def environment(self, env = None, xrePath = None, crashreporter = True):
def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False):
if xrePath == None:
xrePath = self.DIST_BIN
if env == None:
@ -490,7 +490,7 @@ class Automation(object):
elif self.IS_WIN32:
env["PATH"] = env["PATH"] + ";" + str(ldLibraryPath)
if crashreporter:
if crashreporter and not debugger:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'
else:

View File

@ -402,7 +402,7 @@ def systemMemory():
"""
return int(os.popen("free").readlines()[1].split()[1])
def environment(xrePath, env=None, crashreporter=True):
def environment(xrePath, env=None, crashreporter=True, debugger=False):
"""populate OS environment variables for mochitest"""
env = os.environ.copy() if env is None else env
@ -430,7 +430,7 @@ def environment(xrePath, env=None, crashreporter=True):
env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1'
env['NS_TRACE_MALLOC_DISABLE_STACKS'] = '1'
if crashreporter:
if crashreporter and not debugger:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'
else:

View File

@ -35,6 +35,8 @@ SEARCH_PATHS = [
'python/which',
'build/pymake',
'config',
'dom/bindings',
'dom/bindings/parser',
'other-licenses/ply',
'xpcom/idl-parser',
'testing',
@ -60,6 +62,7 @@ SEARCH_PATHS = [
# Individual files providing mach commands.
MACH_MODULES = [
'addon-sdk/mach_commands.py',
'dom/bindings/mach_commands.py',
'layout/tools/reftest/mach_commands.py',
'python/mach_commands.py',
'python/mach/mach/commands/commandinfo.py',

View File

@ -48,7 +48,7 @@ class RemoteAutomation(Automation):
self._remoteLog = logfile
# Set up what we need for the remote environment
def environment(self, env = None, xrePath = None, crashreporter = True):
def environment(self, env=None, xrePath=None, crashreporter=True, debugger=False):
# Because we are running remote, we don't want to mimic the local env
# so no copying of os.environ
if env is None:
@ -56,11 +56,11 @@ class RemoteAutomation(Automation):
# Except for the mochitest results table hiding option, which isn't
# passed to runtestsremote.py as an actual option, but through the
# MOZ_CRASHREPORTER_DISABLE environment variable.
# MOZ_HIDE_RESULTS_TABLE environment variable.
if 'MOZ_HIDE_RESULTS_TABLE' in os.environ:
env['MOZ_HIDE_RESULTS_TABLE'] = os.environ['MOZ_HIDE_RESULTS_TABLE']
if crashreporter:
if crashreporter and not debugger:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'
else:

View File

@ -3,7 +3,3 @@
# 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/.
ANDROID_RESFILES = [
'res/values/strings.xml',
]

View File

@ -3,11 +3,3 @@
# 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/.
ANDROID_RESFILES = [
'res/drawable-hdpi/icon.png',
'res/drawable-ldpi/icon.png',
'res/drawable-mdpi/icon.png',
'res/layout/main.xml',
'res/values/strings.xml',
]

View File

@ -3,11 +3,3 @@
# 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/.
ANDROID_RESFILES = [
'res/drawable-hdpi/icon.png',
'res/drawable-ldpi/icon.png',
'res/drawable-mdpi/icon.png',
'res/layout/main.xml',
'res/values/strings.xml',
]

View File

@ -3,13 +3,3 @@
# 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/.
ANDROID_RESFILES = [
'res/drawable/ateamlogo.png',
'res/drawable/ic_stat_first.png',
'res/drawable/ic_stat_neterror.png',
'res/drawable/ic_stat_warning.png',
'res/drawable/icon.png',
'res/layout/main.xml',
'res/values/strings.xml',
]

View File

@ -3,14 +3,3 @@
# 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/.
ANDROID_RESFILES = [
'res/drawable-hdpi/ateamlogo.png',
'res/drawable-hdpi/icon.png',
'res/drawable-ldpi/ateamlogo.png',
'res/drawable-ldpi/icon.png',
'res/drawable-mdpi/ateamlogo.png',
'res/drawable-mdpi/icon.png',
'res/layout/main.xml',
'res/values/strings.xml',
]

View File

@ -35,7 +35,7 @@ endif
# responsibility between Makefile.in and mozbuild files.
_MOZBUILD_EXTERNAL_VARIABLES := \
ANDROID_GENERATED_RESFILES \
ANDROID_RESFILES \
ANDROID_RES_DIRS \
CMSRCS \
CMMSRCS \
CPP_UNIT_TESTS \
@ -73,6 +73,7 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
$(NULL)
_DEPRECATED_VARIABLES := \
ANDROID_RESFILES \
MOCHITEST_FILES_PARTS \
MOCHITEST_BROWSER_FILES_PARTS \
SHORT_LIBNAME \
@ -477,9 +478,9 @@ OS_INCLUDES += $(MOZ_JPEG_CFLAGS) $(MOZ_PNG_CFLAGS) $(MOZ_ZLIB_CFLAGS)
# NSPR_CFLAGS and NSS_CFLAGS must appear ahead of OS_INCLUDES to avoid Linux
# builds wrongly picking up system NSPR/NSS header files.
INCLUDES = \
$(LOCAL_INCLUDES) \
-I$(srcdir) \
-I. \
$(LOCAL_INCLUDES) \
-I$(DIST)/include \
$(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include) \
$(NSPR_CFLAGS) $(NSS_CFLAGS) \

View File

@ -7,29 +7,6 @@
ifndef INCLUDED_JAVA_BUILD_MK #{
ifdef ANDROID_RESFILES #{
ifndef IGNORE_ANDROID_RESFILES #{
res-dep := .deps-copy-java-res
GENERATED_DIRS += res
GARBAGE += $(res-dep)
export:: $(res-dep)
res-dep-preqs := \
$(addprefix $(srcdir)/,$(ANDROID_RESFILES)) \
$(call mkdir_deps,res) \
$(if $(IS_LANGUAGE_REPACK),FORCE) \
$(NULL)
# nop-build: only copy res/ files when needed
$(res-dep): $(res-dep-preqs)
$(call copy_dir,$(srcdir)/res,$(CURDIR)/res)
@$(TOUCH) $@
endif #} IGNORE_ANDROID_RESFILES
endif #} ANDROID_RESFILES
ifdef JAVAFILES #{
GENERATED_DIRS += classes
@ -39,7 +16,8 @@ endif #} JAVAFILES
ifdef ANDROID_APK_NAME #{
_ANDROID_RES_FLAG := -S $(or $(ANDROID_RES_DIR),res)
android_res_dirs := $(addprefix $(srcdir)/,$(or $(ANDROID_RES_DIRS),res))
_ANDROID_RES_FLAG := $(addprefix -S ,$(android_res_dirs))
_ANDROID_ASSETS_FLAG := $(addprefix -A ,$(ANDROID_ASSETS_DIR))
GENERATED_DIRS += classes
@ -57,7 +35,11 @@ classes.dex: $(JAVAFILES)
R.java: .aapt.deps
$(ANDROID_APK_NAME).ap_: .aapt.deps
.aapt.deps: AndroidManifest.xml $(wildcard $(ANDROID_RES_DIR)) $(wildcard $(ANDROID_ASSETS_DIR))
# This uses the fact that Android resource directories list all
# resource files one subdirectory below the parent resource directory.
android_res_files := $(wildcard $(addsuffix /*,$(wildcard $(addsuffix /*,$(android_res_dirs)))))
.aapt.deps: AndroidManifest.xml $(android_res_files) $(wildcard $(ANDROID_ASSETS_DIR))
$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar $(_ANDROID_RES_FLAG) $(_ANDROID_ASSETS_FLAG) \
-J ${@D} \
-F $(ANDROID_APK_NAME).ap_

View File

@ -129,11 +129,24 @@ class MockedOpen(object):
def __enter__(self):
import __builtin__
self.open = __builtin__.open
self._orig_path_exists = os.path.exists
__builtin__.open = self
os.path.exists = self._wrapped_exists
def __exit__(self, type, value, traceback):
import __builtin__
__builtin__.open = self.open
os.path.exists = self._orig_path_exists
def _wrapped_exists(self, p):
if p in self.files:
return True
abspath = os.path.abspath(p)
if abspath in self.files:
return True
return self._orig_path_exists(p)
def main(*args):
unittest.main(testRunner=MozTestRunner(),*args)

View File

@ -15,8 +15,15 @@ class TestMozUnit(unittest.TestCase):
with os.fdopen(fd, 'w') as file:
file.write('foobar');
self.assertFalse(os.path.exists('file1'))
self.assertFalse(os.path.exists('file2'))
with MockedOpen({'file1': 'content1',
'file2': 'content2'}):
self.assertTrue(os.path.exists('file1'))
self.assertTrue(os.path.exists('file2'))
self.assertFalse(os.path.exists('foo/file1'))
# Check the contents of the files given at MockedOpen creation.
self.assertEqual(open('file1', 'r').read(), 'content1')
self.assertEqual(open('file2', 'r').read(), 'content2')
@ -24,6 +31,7 @@ class TestMozUnit(unittest.TestCase):
# Check that overwriting these files alters their content.
with open('file1', 'w') as file:
file.write('foo')
self.assertTrue(os.path.exists('file1'))
self.assertEqual(open('file1', 'r').read(), 'foo')
# ... but not until the file is closed.
@ -38,13 +46,17 @@ class TestMozUnit(unittest.TestCase):
file.write('bar')
self.assertEqual(open('file1', 'r').read(), 'foobar')
self.assertFalse(os.path.exists('file3'))
# Opening a non-existing file ought to fail.
self.assertRaises(IOError, open, 'file3', 'r')
self.assertFalse(os.path.exists('file3'))
# Check that writing a new file does create the file.
with open('file3', 'w') as file:
file.write('baz')
self.assertEqual(open('file3', 'r').read(), 'baz')
self.assertTrue(os.path.exists('file3'))
# Check the content of the file created outside MockedOpen.
self.assertEqual(open(path, 'r').read(), 'foobar')

View File

@ -220,7 +220,7 @@
namespace mozilla {
typedef mozilla::dom::Element Element;
using mozilla::dom::Element;
/**
* Returns true if aElement is one of the elements whose text content should not

View File

@ -67,7 +67,7 @@ EXPORTS.mozilla.dom += [
'TreeWalker.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'Attr.cpp',
'ChildIterator.cpp',
'Comment.cpp',
@ -94,12 +94,10 @@ SOURCES += [
'nsContentList.cpp',
'nsContentPolicy.cpp',
'nsContentSink.cpp',
'nsContentUtils.cpp',
'nsCopySupport.cpp',
'nsCrossSiteListenerProxy.cpp',
'nsCSPService.cpp',
'nsDataDocumentContentPolicy.cpp',
'nsDocument.cpp',
'nsDocumentEncoder.cpp',
'nsDOMAttributeMap.cpp',
'nsDOMBlobBuilder.cpp',
@ -130,9 +128,7 @@ SOURCES += [
'nsNameSpaceManager.cpp',
'nsNoDataProtocolContentPolicy.cpp',
'nsNodeInfo.cpp',
'nsNodeInfoManager.cpp',
'nsNodeUtils.cpp',
'nsObjectLoadingContent.cpp',
'nsPlainTextSerializer.cpp',
'nsPropertyTable.cpp',
'nsRange.cpp',
@ -159,6 +155,18 @@ SOURCES += [
'WebSocket.cpp',
]
# These files cannot be built in unified mode because they use FORCE_PR_LOG
SOURCES += [
'nsDocument.cpp',
'nsNodeInfoManager.cpp',
]
# These files cannot be built in unified mode because of OS X headers.
SOURCES += [
'nsContentUtils.cpp',
'nsObjectLoadingContent.cpp',
]
EXTRA_COMPONENTS += [
'contentAreaDropListener.js',
'contentAreaDropListener.manifest',

View File

@ -22,7 +22,7 @@
#include "nsContentUtils.h"
#include "nsStyleUtil.h"
namespace css = mozilla::css;
using namespace mozilla;
using namespace mozilla::dom;
//----------------------------------------------------------------------

View File

@ -116,6 +116,10 @@ protected:
void WakeLockUpdate();
nsCOMPtr<nsIDOMMozWakeLock> mScreenWakeLock;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -57,9 +57,9 @@ HTMLBRElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLBRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
nsCSSValue* clear = aData->ValueForClear();

View File

@ -46,6 +46,10 @@ public:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -348,8 +348,9 @@ HTMLBodyElement::UnbindFromTree(bool aDeep, bool aNullParent)
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}
static
void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
void
HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
// When display if first asked for, go ahead and get our colors set up.

View File

@ -136,6 +136,10 @@ protected:
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
nsRefPtr<BodyRule> mContentStyleRule;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -62,8 +62,9 @@ HTMLDivElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
void
HTMLDivElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);

View File

@ -60,6 +60,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -53,9 +53,9 @@ HTMLFontElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLFontElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
// face: string list

View File

@ -56,6 +56,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -81,9 +81,9 @@ HTMLFrameElement::ParseAttribute(int32_t aNamespaceID,
aValue, aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapScrollingAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);

View File

@ -99,6 +99,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -32,19 +32,19 @@ NS_IMPL_STRING_ATTR(HTMLHRElement, Size, size)
NS_IMPL_STRING_ATTR(HTMLHRElement, Width, width)
NS_IMPL_STRING_ATTR(HTMLHRElement, Color, color)
static const nsAttrValue::EnumTable kAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ 0 }
};
bool
HTMLHRElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
static const nsAttrValue::EnumTable kAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ 0 }
};
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue);
@ -64,9 +64,9 @@ HTMLHRElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
bool noshade = false;

View File

@ -73,6 +73,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -50,8 +50,9 @@ HTMLHeadingElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
void
HTMLHeadingElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);

View File

@ -43,6 +43,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace mozilla

View File

@ -106,9 +106,9 @@ HTMLIFrameElement::ParseAttribute(int32_t aNamespaceID,
aValue, aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLIFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Border)) {
// frameborder: 0 | 1 (| NO | YES in quirks mode)

View File

@ -174,6 +174,10 @@ protected:
virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -232,9 +232,9 @@ HTMLImageElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLImageElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);

View File

@ -190,6 +190,10 @@ protected:
// This is a weak reference that this element and the HTMLFormElement
// cooperate in maintaining.
HTMLFormElement* mForm;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -4456,9 +4456,9 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLInputElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
if (value && value->Type() == nsAttrValue::eEnum &&
@ -6822,3 +6822,5 @@ HTMLInputElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aScope)
} // namespace dom
} // namespace mozilla
#undef NS_ORIGINAL_CHECKED_VALUE

View File

@ -1219,6 +1219,8 @@ protected:
bool mProgressTimerIsActive : 1;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
/**
* Returns true if this input's type will fire a DOM "change" event when it

View File

@ -69,9 +69,9 @@ HTMLLIElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLLIElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(List)) {
nsCSSValue* listStyleType = aData->ValueForListStyleType();

View File

@ -59,6 +59,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -21,16 +21,6 @@ HTMLLegendElement::~HTMLLegendElement()
NS_IMPL_ELEMENT_CLONE(HTMLLegendElement)
// this contains center, because IE4 does
static const nsAttrValue::EnumTable kAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ "bottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },
{ 0 }
};
nsIContent*
HTMLLegendElement::GetFieldSet()
{
@ -49,6 +39,16 @@ HTMLLegendElement::ParseAttribute(int32_t aNamespaceID,
const nsAString& aValue,
nsAttrValue& aResult)
{
// this contains center, because IE4 does
static const nsAttrValue::EnumTable kAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "center", NS_STYLE_TEXT_ALIGN_CENTER },
{ "bottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },
{ 0 }
};
if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
return aResult.ParseEnumValue(aValue, kAlignTable, false);
}

View File

@ -490,3 +490,5 @@ HTMLMenuItemElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aScope)
} // namespace dom
} // namespace mozilla
#undef NS_ORIGINAL_CHECKED_VALUE

View File

@ -366,9 +366,9 @@ HTMLObjectElement::ParseAttribute(int32_t aNamespaceID,
aValue, aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
nsRuleData *aData)
void
HTMLObjectElement::MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
nsRuleData *aData)
{
nsGenericHTMLFormElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLFormElement::MapImageBorderAttributeInto(aAttributes, aData);

View File

@ -239,6 +239,9 @@ private:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
bool mIsDoneAddingChildren;
};

View File

@ -41,8 +41,9 @@ HTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
void
HTMLParagraphElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);

View File

@ -50,6 +50,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -47,9 +47,9 @@ HTMLPreElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLPreElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
nsCSSValue* width = aData->ValueForWidth();

View File

@ -54,6 +54,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -1426,9 +1426,9 @@ HTMLSelectElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLSelectElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLFormElementWithState::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aData);

View File

@ -647,6 +647,10 @@ protected:
* The live list of selected options.
*/
nsRefPtr<nsContentList> mSelectedOptions;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -89,8 +89,9 @@ HTMLSharedListElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
void
HTMLSharedListElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(List)) {
nsCSSValue* listStyleType = aData->ValueForListStyleType();

View File

@ -79,6 +79,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -260,9 +260,9 @@ MapAttributesIntoRuleExceptHidden(const nsMappedAttributes *aAttributes,
nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(aAttributes, aData);
}
static void
MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
nsRuleData *aData)
void
HTMLSharedObjectElement::MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
nsRuleData *aData)
{
MapAttributesIntoRuleBase(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);

View File

@ -223,6 +223,9 @@ private:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -55,8 +55,9 @@ HTMLTableCaptionElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static
void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
void
HTMLTableCaptionElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(TableBorder)) {
nsCSSValue* captionSide = aData->ValueForCaptionSide();

View File

@ -49,6 +49,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -435,9 +435,9 @@ HTMLTableCellElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static
void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLTableCellElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
// width: value

View File

@ -162,6 +162,10 @@ protected:
HTMLTableElement* GetTable() const;
HTMLTableRowElement* GetRow() const;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -62,8 +62,9 @@ HTMLTableColElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static
void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
void
HTMLTableColElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Table)) {
nsCSSValue *span = aData->ValueForSpan();

View File

@ -82,6 +82,10 @@ public:
protected:
virtual JSObject* WrapNode(JSContext *aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -701,9 +701,9 @@ HTMLTableElement::ParseAttribute(int32_t aNamespaceID,
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
// XXX Bug 211636: This function is used by a single style rule
// that's used to match two different type of elements -- tables, and

View File

@ -222,6 +222,10 @@ protected:
nsMappedAttributes *mTableInheritedAttributes;
void BuildInheritedAttributes();
void ReleaseInheritedAttributes();
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -261,8 +261,9 @@ HTMLTableRowElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static
void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
void
HTMLTableRowElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
// height: value

View File

@ -96,6 +96,10 @@ protected:
HTMLTableSectionElement* GetSection() const;
HTMLTableElement* GetTable() const;
nsRefPtr<nsContentList> mCells;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -161,8 +161,9 @@ HTMLTableSectionElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static
void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
void
HTMLTableSectionElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) {
// height: value

View File

@ -77,6 +77,10 @@ protected:
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
nsRefPtr<nsContentList> mRows;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -400,9 +400,9 @@ HTMLTextAreaElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLTextAreaElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLFormElementWithState::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aData);

View File

@ -356,6 +356,10 @@ protected:
* @return whether the current value is the empty string.
*/
bool IsValueEmpty() const;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
};
} // namespace dom

View File

@ -102,9 +102,9 @@ HTMLVideoElement::ParseAttribute(int32_t aNamespaceID,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
void
HTMLVideoElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);

View File

@ -75,7 +75,7 @@ EXPORTS.mozilla.dom += [
'ValidityState.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'HTMLAnchorElement.cpp',
'HTMLAreaElement.cpp',
'HTMLAudioElement.cpp',

View File

@ -1182,24 +1182,6 @@ nsGenericHTMLElement::GetPresContext()
return nullptr;
}
static const nsAttrValue::EnumTable kAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },
{ "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE },
{ "bottom", NS_STYLE_VERTICAL_ALIGN_BASELINE },
{ "center", NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE },
{ "baseline", NS_STYLE_VERTICAL_ALIGN_BASELINE },
{ "texttop", NS_STYLE_VERTICAL_ALIGN_TEXT_TOP },
{ "absmiddle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
{ "abscenter", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
{ "absbottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },
{ 0 }
};
static const nsAttrValue::EnumTable kDivAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_MOZ_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_MOZ_RIGHT },
@ -1240,6 +1222,24 @@ bool
nsGenericHTMLElement::ParseAlignValue(const nsAString& aString,
nsAttrValue& aResult)
{
static const nsAttrValue::EnumTable kAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_RIGHT },
{ "top", NS_STYLE_VERTICAL_ALIGN_TOP },
{ "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE },
{ "bottom", NS_STYLE_VERTICAL_ALIGN_BASELINE },
{ "center", NS_STYLE_VERTICAL_ALIGN_MIDDLE_WITH_BASELINE },
{ "baseline", NS_STYLE_VERTICAL_ALIGN_BASELINE },
{ "texttop", NS_STYLE_VERTICAL_ALIGN_TEXT_TOP },
{ "absmiddle", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
{ "abscenter", NS_STYLE_VERTICAL_ALIGN_MIDDLE },
{ "absbottom", NS_STYLE_VERTICAL_ALIGN_BOTTOM },
{ 0 }
};
return aResult.ParseEnumValue(aString, kAlignTable, false);
}

View File

@ -13,7 +13,7 @@ EXPORTS.mozilla.dom += [
'ImageDocument.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'HTMLAllCollection.cpp',
'ImageDocument.cpp',
'MediaDocument.cpp',

View File

@ -476,7 +476,7 @@ DecoderTraits::CreateDecoder(const nsACString& aType, MediaDecoderOwner* aOwner)
// AMR audio is enabled for MMS, but we are discouraging Web and App
// developers from using AMR, thus we only allow AMR to be played on WebApps.
if (aType.EqualsASCII("audio/amr")) {
HTMLMediaElement* element = aOwner->GetMediaElement();
dom::HTMLMediaElement* element = aOwner->GetMediaElement();
if (!element) {
return nullptr;
}

View File

@ -570,7 +570,7 @@ nsresult MediaDecoder::Play()
* (and can be -1 if aValue is before aRanges.Start(0)).
*/
static bool
IsInRanges(TimeRanges& aRanges, double aValue, int32_t& aIntervalIndex)
IsInRanges(dom::TimeRanges& aRanges, double aValue, int32_t& aIntervalIndex)
{
uint32_t length;
aRanges.GetLength(&length);
@ -598,7 +598,7 @@ nsresult MediaDecoder::Seek(double aTime)
NS_ABORT_IF_FALSE(aTime >= 0.0, "Cannot seek to a negative value.");
TimeRanges seekable;
dom::TimeRanges seekable;
nsresult res;
uint32_t length = 0;
res = GetSeekable(&seekable);
@ -1326,7 +1326,7 @@ bool MediaDecoder::IsMediaSeekable()
return mMediaSeekable;
}
nsresult MediaDecoder::GetSeekable(TimeRanges* aSeekable)
nsresult MediaDecoder::GetSeekable(dom::TimeRanges* aSeekable)
{
double initialTime = 0.0;
@ -1492,7 +1492,7 @@ void MediaDecoder::Invalidate()
// Constructs the time ranges representing what segments of the media
// are buffered and playable.
nsresult MediaDecoder::GetBuffered(TimeRanges* aBuffered) {
nsresult MediaDecoder::GetBuffered(dom::TimeRanges* aBuffered) {
if (mDecoderStateMachine) {
return mDecoderStateMachine->GetBuffered(aBuffered);
}

Some files were not shown because too many files have changed in this diff Show More