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

View File

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

View File

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

View File

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

View File

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

View File

@ -172,13 +172,17 @@ public:
mStateFlags |= eHasNumericValue; mStateFlags |= eHasNumericValue;
} }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEVALUE
// Accessible // Accessible
virtual void Value(nsString& aValue); virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole(); 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 // Widgets
virtual bool IsWidget() const; 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/TouchAdapter.jsm');
Cu.import('resource://gre/modules/accessibility/Presentation.jsm'); Cu.import('resource://gre/modules/accessibility/Presentation.jsm');
Logger.info('enable'); Logger.info('Enabled');
for each (let mm in Utils.AllMessageManagers) { for each (let mm in Utils.AllMessageManagers) {
this._addMessageListeners(mm); this._addMessageListeners(mm);
@ -145,7 +145,7 @@ this.AccessFu = {
this._enabled = false; this._enabled = false;
Logger.info('disable'); Logger.info('Disabled');
Utils.win.document.removeChild(this.stylesheet.get()); Utils.win.document.removeChild(this.stylesheet.get());
@ -524,9 +524,8 @@ var Output = {
for (let action of aActions) { for (let action of aActions) {
let window = Utils.win; let window = Utils.win;
Logger.info('tts.' + action.method, Logger.debug('tts.' + action.method, '"' + action.data + '"',
'"' + action.data + '"', JSON.stringify(action.options));
JSON.stringify(action.options));
if (!action.options.enqueue && this.webspeechEnabled) { if (!action.options.enqueue && this.webspeechEnabled) {
window.speechSynthesis.cancel(); window.speechSynthesis.cancel();
@ -715,8 +714,8 @@ var Input = {
_handleGesture: function _handleGesture(aGesture) { _handleGesture: function _handleGesture(aGesture) {
let gestureName = aGesture.type + aGesture.touches.length; let gestureName = aGesture.type + aGesture.touches.length;
Logger.info('Gesture', aGesture.type, Logger.debug('Gesture', aGesture.type,
'(fingers: ' + aGesture.touches.length + ')'); '(fingers: ' + aGesture.touches.length + ')');
switch (gestureName) { switch (gestureName) {
case 'dwell1': 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 Ci = Components.interfaces;
const Cu = Components.utils; 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; const TEXT_NODE = 3;
Cu.import('resource://gre/modules/XPCOMUtils.jsm'); Cu.import('resource://gre/modules/XPCOMUtils.jsm');
@ -35,6 +20,10 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Presentation',
'resource://gre/modules/accessibility/Presentation.jsm'); 'resource://gre/modules/accessibility/Presentation.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'TraversalRules', XPCOMUtils.defineLazyModuleGetter(this, 'TraversalRules',
'resource://gre/modules/accessibility/TraversalRules.jsm'); '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']; this.EXPORTED_SYMBOLS = ['EventManager'];
@ -57,7 +46,7 @@ this.EventManager.prototype = {
start: function start() { start: function start() {
try { try {
if (!this._started) { if (!this._started) {
Logger.info('EventManager.start', Utils.MozBuildApp); Logger.debug('EventManager.start');
this._started = true; this._started = true;
@ -84,7 +73,7 @@ this.EventManager.prototype = {
if (!this._started) { if (!this._started) {
return; return;
} }
Logger.info('EventManager.stop', Utils.MozBuildApp); Logger.debug('EventManager.stop');
AccessibilityEventObserver.removeListener(this); AccessibilityEventObserver.removeListener(this);
try { try {
this.webProgress.removeProgressListener(this); this.webProgress.removeProgressListener(this);
@ -144,7 +133,7 @@ this.EventManager.prototype = {
// Don't bother with non-content events in firefox. // Don't bother with non-content events in firefox.
if (Utils.MozBuildApp == 'browser' && if (Utils.MozBuildApp == 'browser' &&
aEvent.eventType != EVENT_VIRTUALCURSOR_CHANGED && aEvent.eventType != Events.VIRTUALCURSOR_CHANGED &&
// XXX Bug 442005 results in DocAccessible::getDocType returning // XXX Bug 442005 results in DocAccessible::getDocType returning
// NS_ERROR_FAILURE. Checking for aEvent.accessibleDocument.docType == // NS_ERROR_FAILURE. Checking for aEvent.accessibleDocument.docType ==
// 'window' does not currently work. // 'window' does not currently work.
@ -154,12 +143,12 @@ this.EventManager.prototype = {
} }
switch (aEvent.eventType) { switch (aEvent.eventType) {
case EVENT_VIRTUALCURSOR_CHANGED: case Events.VIRTUALCURSOR_CHANGED:
{ {
let pivot = aEvent.accessible. let pivot = aEvent.accessible.
QueryInterface(Ci.nsIAccessibleDocument).virtualCursor; QueryInterface(Ci.nsIAccessibleDocument).virtualCursor;
let position = pivot.position; let position = pivot.position;
if (position && position.role == ROLE_INTERNAL_FRAME) if (position && position.role == Roles.INTERNAL_FRAME)
break; break;
let event = aEvent. let event = aEvent.
QueryInterface(Ci.nsIAccessibleVirtualCursorChangeEvent); QueryInterface(Ci.nsIAccessibleVirtualCursorChangeEvent);
@ -174,7 +163,7 @@ this.EventManager.prototype = {
break; break;
} }
case EVENT_STATE_CHANGE: case Events.STATE_CHANGE:
{ {
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent); let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
if (event.state == Ci.nsIAccessibleStates.STATE_CHECKED && if (event.state == Ci.nsIAccessibleStates.STATE_CHECKED &&
@ -191,13 +180,13 @@ this.EventManager.prototype = {
} }
break; break;
} }
case EVENT_SCROLLING_START: case Events.SCROLLING_START:
{ {
let vc = Utils.getVirtualCursor(aEvent.accessibleDocument); let vc = Utils.getVirtualCursor(aEvent.accessibleDocument);
vc.moveNext(TraversalRules.Simple, aEvent.accessible, true); vc.moveNext(TraversalRules.Simple, aEvent.accessible, true);
break; break;
} }
case EVENT_TEXT_CARET_MOVED: case Events.TEXT_CARET_MOVED:
{ {
let acc = aEvent.accessible; let acc = aEvent.accessible;
let characterCount = acc. let characterCount = acc.
@ -233,7 +222,7 @@ this.EventManager.prototype = {
this.editState = editState; this.editState = editState;
break; break;
} }
case EVENT_SHOW: case Events.SHOW:
{ {
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent, let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['additions', 'all']); ['additions', 'all']);
@ -242,14 +231,14 @@ this.EventManager.prototype = {
break; break;
} }
// Show for text is handled by the EVENT_TEXT_INSERTED handler. // 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; break;
} }
this._dequeueLiveEvent(EVENT_HIDE, liveRegion); this._dequeueLiveEvent(Events.HIDE, liveRegion);
this.present(Presentation.liveRegion(liveRegion, isPolite, false)); this.present(Presentation.liveRegion(liveRegion, isPolite, false));
break; break;
} }
case EVENT_HIDE: case Events.HIDE:
{ {
let {liveRegion, isPolite} = this._handleLiveRegion( let {liveRegion, isPolite} = this._handleLiveRegion(
aEvent.QueryInterface(Ci.nsIAccessibleHideEvent), aEvent.QueryInterface(Ci.nsIAccessibleHideEvent),
@ -259,14 +248,14 @@ this.EventManager.prototype = {
break; break;
} }
// Hide for text is handled by the EVENT_TEXT_REMOVED handler. // 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; break;
} }
this._queueLiveEvent(EVENT_HIDE, liveRegion, isPolite); this._queueLiveEvent(Events.HIDE, liveRegion, isPolite);
break; break;
} }
case EVENT_TEXT_INSERTED: case Events.TEXT_INSERTED:
case EVENT_TEXT_REMOVED: case Events.TEXT_REMOVED:
{ {
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent, let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['text', 'all']); ['text', 'all']);
@ -277,12 +266,12 @@ this.EventManager.prototype = {
} }
break; break;
} }
case EVENT_FOCUS: case Events.FOCUS:
{ {
// Put vc where the focus is at // Put vc where the focus is at
let acc = aEvent.accessible; let acc = aEvent.accessible;
let doc = aEvent.accessibleDocument; 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); let vc = Utils.getVirtualCursor(doc);
vc.moveNext(TraversalRules.Simple, acc, true); vc.moveNext(TraversalRules.Simple, acc, true);
} }
@ -314,11 +303,11 @@ this.EventManager.prototype = {
return; return;
} }
if (aLiveRegion) { if (aLiveRegion) {
if (aEvent.eventType === EVENT_TEXT_REMOVED) { if (aEvent.eventType === Events.TEXT_REMOVED) {
this._queueLiveEvent(EVENT_TEXT_REMOVED, aLiveRegion, aIsPolite, this._queueLiveEvent(Events.TEXT_REMOVED, aLiveRegion, aIsPolite,
modifiedText); modifiedText);
} else { } else {
this._dequeueLiveEvent(EVENT_TEXT_REMOVED, aLiveRegion); this._dequeueLiveEvent(Events.TEXT_REMOVED, aLiveRegion);
this.present(Presentation.liveRegion(aLiveRegion, aIsPolite, false, this.present(Presentation.liveRegion(aLiveRegion, aIsPolite, false,
modifiedText)); modifiedText));
} }

View File

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

View File

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

View File

@ -9,61 +9,24 @@ const Ci = Components.interfaces;
const Cu = Components.utils; const Cu = Components.utils;
const Cr = Components.results; 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']; this.EXPORTED_SYMBOLS = ['TraversalRules'];
Cu.import('resource://gre/modules/accessibility/Utils.jsm'); Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import('resource://gre/modules/XPCOMUtils.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'); let gSkipEmptyImages = new PrefCache('accessibility.accessfu.skip_empty_images');
function BaseTraversalRule(aRoles, aMatchFunc) { function BaseTraversalRule(aRoles, aMatchFunc) {
this._explicitMatchRoles = new Set(aRoles); this._explicitMatchRoles = new Set(aRoles);
this._matchRoles = aRoles; this._matchRoles = aRoles;
if (aRoles.indexOf(ROLE_LABEL) < 0) { if (aRoles.indexOf(Roles.LABEL) < 0) {
this._matchRoles.push(ROLE_LABEL); this._matchRoles.push(Roles.LABEL);
} }
this._matchFunc = aMatchFunc || function (acc) { return FILTER_MATCH; }; this._matchFunc = aMatchFunc || function (acc) { return Filters.MATCH; };
} }
BaseTraversalRule.prototype = { BaseTraversalRule.prototype = {
@ -80,20 +43,20 @@ BaseTraversalRule.prototype = {
match: function BaseTraversalRule_match(aAccessible) match: function BaseTraversalRule_match(aAccessible)
{ {
let role = aAccessible.role; let role = aAccessible.role;
if (role == ROLE_INTERNAL_FRAME) { if (role == Roles.INTERNAL_FRAME) {
return (Utils.getMessageManager(aAccessible.DOMNode)) ? 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) ? 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. // 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. // 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); let control = Utils.getEmbeddedControl(aAccessible);
if (control && this._explicitMatchRoles.has(control.role)) { 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 = var gSimpleTraversalRoles =
[ROLE_MENUITEM, [Roles.MENUITEM,
ROLE_LINK, Roles.LINK,
ROLE_PAGETAB, Roles.PAGETAB,
ROLE_GRAPHIC, Roles.GRAPHIC,
ROLE_STATICTEXT, Roles.STATICTEXT,
ROLE_TEXT_LEAF, Roles.TEXT_LEAF,
ROLE_PUSHBUTTON, Roles.PUSHBUTTON,
ROLE_CHECKBUTTON, Roles.CHECKBUTTON,
ROLE_RADIOBUTTON, Roles.RADIOBUTTON,
ROLE_COMBOBOX, Roles.COMBOBOX,
ROLE_PROGRESSBAR, Roles.PROGRESSBAR,
ROLE_BUTTONDROPDOWN, Roles.BUTTONDROPDOWN,
ROLE_BUTTONMENU, Roles.BUTTONMENU,
ROLE_CHECK_MENU_ITEM, Roles.CHECK_MENU_ITEM,
ROLE_PASSWORD_TEXT, Roles.PASSWORD_TEXT,
ROLE_RADIO_MENU_ITEM, Roles.RADIO_MENU_ITEM,
ROLE_TOGGLE_BUTTON, Roles.TOGGLE_BUTTON,
ROLE_ENTRY, Roles.ENTRY,
ROLE_KEY, Roles.KEY,
ROLE_HEADER, Roles.HEADER,
ROLE_HEADING, Roles.HEADING,
ROLE_SLIDER, Roles.SLIDER,
ROLE_SPINBUTTON, Roles.SPINBUTTON,
ROLE_OPTION, Roles.OPTION,
// Used for traversing in to child OOP frames. // Used for traversing in to child OOP frames.
ROLE_INTERNAL_FRAME]; Roles.INTERNAL_FRAME];
this.TraversalRules = { this.TraversalRules = {
Simple: new BaseTraversalRule( Simple: new BaseTraversalRule(
@ -146,47 +109,47 @@ this.TraversalRules = {
} }
switch (aAccessible.role) { switch (aAccessible.role) {
case ROLE_COMBOBOX: case Roles.COMBOBOX:
// We don't want to ignore the subtree because this is often // We don't want to ignore the subtree because this is often
// where the list box hangs out. // where the list box hangs out.
return FILTER_MATCH; return Filters.MATCH;
case ROLE_TEXT_LEAF: case Roles.TEXT_LEAF:
{ {
// Nameless text leaves are boring, skip them. // Nameless text leaves are boring, skip them.
let name = aAccessible.name; let name = aAccessible.name;
if (name && name.trim()) if (name && name.trim())
return FILTER_MATCH; return Filters.MATCH;
else else
return FILTER_IGNORE; return Filters.IGNORE;
} }
case ROLE_STATICTEXT: case Roles.STATICTEXT:
{ {
let parent = aAccessible.parent; let parent = aAccessible.parent;
// Ignore prefix static text in list items. They are typically bullets or numbers. // Ignore prefix static text in list items. They are typically bullets or numbers.
if (parent.childCount > 1 && aAccessible.indexInParent == 0 && if (parent.childCount > 1 && aAccessible.indexInParent == 0 &&
parent.role == ROLE_LISTITEM) parent.role == Roles.LISTITEM)
return FILTER_IGNORE; return Filters.IGNORE;
return FILTER_MATCH; return Filters.MATCH;
} }
case ROLE_GRAPHIC: case Roles.GRAPHIC:
return TraversalRules._shouldSkipImage(aAccessible); return TraversalRules._shouldSkipImage(aAccessible);
case ROLE_LINK: case Roles.LINK:
case ROLE_HEADER: case Roles.HEADER:
case ROLE_HEADING: case Roles.HEADING:
return hasZeroOrSingleChildDescendants() ? return hasZeroOrSingleChildDescendants() ?
(FILTER_MATCH | FILTER_IGNORE_SUBTREE) : (FILTER_IGNORE); (Filters.MATCH | Filters.IGNORE_SUBTREE) : (Filters.IGNORE);
default: default:
// Ignore the subtree, if there is one. So that we don't land on // Ignore the subtree, if there is one. So that we don't land on
// the same content that was already presented by its parent. // the same content that was already presented by its parent.
return FILTER_MATCH | return Filters.MATCH |
FILTER_IGNORE_SUBTREE; Filters.IGNORE_SUBTREE;
} }
} }
), ),
Anchor: new BaseTraversalRule( Anchor: new BaseTraversalRule(
[ROLE_LINK], [Roles.LINK],
function Anchor_match(aAccessible) function Anchor_match(aAccessible)
{ {
// We want to ignore links, only focus named anchors. // We want to ignore links, only focus named anchors.
@ -194,67 +157,67 @@ this.TraversalRules = {
let extraState = {}; let extraState = {};
aAccessible.getState(state, extraState); aAccessible.getState(state, extraState);
if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) { if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) {
return FILTER_IGNORE; return Filters.IGNORE;
} else { } else {
return FILTER_MATCH; return Filters.MATCH;
} }
}), }),
Button: new BaseTraversalRule( Button: new BaseTraversalRule(
[ROLE_PUSHBUTTON, [Roles.PUSHBUTTON,
ROLE_SPINBUTTON, Roles.SPINBUTTON,
ROLE_TOGGLE_BUTTON, Roles.TOGGLE_BUTTON,
ROLE_BUTTONDROPDOWN, Roles.BUTTONDROPDOWN,
ROLE_BUTTONDROPDOWNGRID]), Roles.BUTTONDROPDOWNGRID]),
Combobox: new BaseTraversalRule( Combobox: new BaseTraversalRule(
[ROLE_COMBOBOX, [Roles.COMBOBOX,
ROLE_LISTBOX]), Roles.LISTBOX]),
Landmark: new BaseTraversalRule( Landmark: new BaseTraversalRule(
[], [],
function Landmark_match(aAccessible) { function Landmark_match(aAccessible) {
return Utils.getLandmarkName(aAccessible) ? FILTER_MATCH : return Utils.getLandmarkName(aAccessible) ? Filters.MATCH :
FILTER_IGNORE; Filters.IGNORE;
} }
), ),
Entry: new BaseTraversalRule( Entry: new BaseTraversalRule(
[ROLE_ENTRY, [Roles.ENTRY,
ROLE_PASSWORD_TEXT]), Roles.PASSWORD_TEXT]),
FormElement: new BaseTraversalRule( FormElement: new BaseTraversalRule(
[ROLE_PUSHBUTTON, [Roles.PUSHBUTTON,
ROLE_SPINBUTTON, Roles.SPINBUTTON,
ROLE_TOGGLE_BUTTON, Roles.TOGGLE_BUTTON,
ROLE_BUTTONDROPDOWN, Roles.BUTTONDROPDOWN,
ROLE_BUTTONDROPDOWNGRID, Roles.BUTTONDROPDOWNGRID,
ROLE_COMBOBOX, Roles.COMBOBOX,
ROLE_LISTBOX, Roles.LISTBOX,
ROLE_ENTRY, Roles.ENTRY,
ROLE_PASSWORD_TEXT, Roles.PASSWORD_TEXT,
ROLE_PAGETAB, Roles.PAGETAB,
ROLE_RADIOBUTTON, Roles.RADIOBUTTON,
ROLE_RADIO_MENU_ITEM, Roles.RADIO_MENU_ITEM,
ROLE_SLIDER, Roles.SLIDER,
ROLE_CHECKBUTTON, Roles.CHECKBUTTON,
ROLE_CHECK_MENU_ITEM]), Roles.CHECK_MENU_ITEM]),
Graphic: new BaseTraversalRule( Graphic: new BaseTraversalRule(
[ROLE_GRAPHIC], [Roles.GRAPHIC],
function Graphic_match(aAccessible) { function Graphic_match(aAccessible) {
return TraversalRules._shouldSkipImage(aAccessible); return TraversalRules._shouldSkipImage(aAccessible);
}), }),
Heading: new BaseTraversalRule( Heading: new BaseTraversalRule(
[ROLE_HEADING]), [Roles.HEADING]),
ListItem: new BaseTraversalRule( ListItem: new BaseTraversalRule(
[ROLE_LISTITEM, [Roles.LISTITEM,
ROLE_TERM]), Roles.TERM]),
Link: new BaseTraversalRule( Link: new BaseTraversalRule(
[ROLE_LINK], [Roles.LINK],
function Link_match(aAccessible) function Link_match(aAccessible)
{ {
// We want to ignore anchors, only focus real links. // We want to ignore anchors, only focus real links.
@ -262,50 +225,50 @@ this.TraversalRules = {
let extraState = {}; let extraState = {};
aAccessible.getState(state, extraState); aAccessible.getState(state, extraState);
if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) { if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) {
return FILTER_MATCH; return Filters.MATCH;
} else { } else {
return FILTER_IGNORE; return Filters.IGNORE;
} }
}), }),
List: new BaseTraversalRule( List: new BaseTraversalRule(
[ROLE_LIST, [Roles.LIST,
ROLE_DEFINITION_LIST]), Roles.DEFINITION_LIST]),
PageTab: new BaseTraversalRule( PageTab: new BaseTraversalRule(
[ROLE_PAGETAB]), [Roles.PAGETAB]),
Paragraph: new BaseTraversalRule( Paragraph: new BaseTraversalRule(
[ROLE_PARAGRAPH, [Roles.PARAGRAPH,
ROLE_SECTION], Roles.SECTION],
function Paragraph_match(aAccessible) { function Paragraph_match(aAccessible) {
for (let child = aAccessible.firstChild; child; child = child.nextSibling) { for (let child = aAccessible.firstChild; child; child = child.nextSibling) {
if (child.role === ROLE_TEXT_LEAF) { if (child.role === Roles.TEXT_LEAF) {
return FILTER_MATCH | FILTER_IGNORE_SUBTREE; return Filters.MATCH | Filters.IGNORE_SUBTREE;
} }
} }
return FILTER_IGNORE; return Filters.IGNORE;
}), }),
RadioButton: new BaseTraversalRule( RadioButton: new BaseTraversalRule(
[ROLE_RADIOBUTTON, [Roles.RADIOBUTTON,
ROLE_RADIO_MENU_ITEM]), Roles.RADIO_MENU_ITEM]),
Separator: new BaseTraversalRule( Separator: new BaseTraversalRule(
[ROLE_SEPARATOR]), [Roles.SEPARATOR]),
Table: new BaseTraversalRule( Table: new BaseTraversalRule(
[ROLE_TABLE]), [Roles.TABLE]),
Checkbox: new BaseTraversalRule( Checkbox: new BaseTraversalRule(
[ROLE_CHECKBUTTON, [Roles.CHECKBUTTON,
ROLE_CHECK_MENU_ITEM]), Roles.CHECK_MENU_ITEM]),
_shouldSkipImage: function _shouldSkipImage(aAccessible) { _shouldSkipImage: function _shouldSkipImage(aAccessible) {
if (gSkipEmptyImages.value && aAccessible.name === '') { 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 Cc = Components.classes;
const Ci = Components.interfaces; 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"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, 'Services', XPCOMUtils.defineLazyModuleGetter(this, 'Services',
'resource://gre/modules/Services.jsm'); 'resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Rect', XPCOMUtils.defineLazyModuleGetter(this, 'Rect',
'resource://gre/modules/Geometry.jsm'); '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']; this.EXPORTED_SYMBOLS = ['Utils', 'Logger', 'PivotContext', 'PrefCache'];
@ -297,7 +295,7 @@ this.Utils = {
getEmbeddedControl: function getEmbeddedControl(aLabel) { getEmbeddedControl: function getEmbeddedControl(aLabel) {
if (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++) { for (let i = 0; i < relation.targetsCount; i++) {
let target = relation.getTarget(i); let target = relation.getTarget(i);
if (target.parent === aLabel) { if (target.parent === aLabel) {
@ -399,7 +397,7 @@ this.Logger = {
eventToString: function eventToString(aEvent) { eventToString: function eventToString(aEvent) {
let str = Utils.AccRetrieval.getStringEventType(aEvent.eventType); 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 event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
let stateStrings = event.isExtraState ? let stateStrings = event.isExtraState ?
Utils.AccRetrieval.getStringStates(0, event.state) : Utils.AccRetrieval.getStringStates(0, event.state) :
@ -633,7 +631,7 @@ PivotContext.prototype = {
if (!aAccessible) { if (!aAccessible) {
return null; return null;
} }
if ([ROLE_CELL, ROLE_COLUMNHEADER, ROLE_ROWHEADER].indexOf( if ([Roles.CELL, Roles.COLUMNHEADER, Roles.ROWHEADER].indexOf(
aAccessible.role) < 0) { aAccessible.role) < 0) {
return null; return null;
} }
@ -694,12 +692,12 @@ PivotContext.prototype = {
cellInfo.columnHeaders = []; cellInfo.columnHeaders = [];
if (cellInfo.columnChanged && cellInfo.current.role !== if (cellInfo.columnChanged && cellInfo.current.role !==
ROLE_COLUMNHEADER) { Roles.COLUMNHEADER) {
cellInfo.columnHeaders = [headers for (headers of getHeaders( cellInfo.columnHeaders = [headers for (headers of getHeaders(
cellInfo.current.columnHeaderCells))]; cellInfo.current.columnHeaderCells))];
} }
cellInfo.rowHeaders = []; 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.rowHeaders = [headers for (headers of getHeaders(
cellInfo.current.rowHeaderCells))]; cellInfo.current.rowHeaderCells))];
} }

View File

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

View File

@ -3,3 +3,16 @@
# This Source Code Form is subject to the terms of the Mozilla Public # 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 # 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/. # 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 "Accessible-inl.h"
#include "IUnknownImpl.h" #include "IUnknownImpl.h"
#include "mozilla/FloatingPoint.h"
using namespace mozilla::a11y; using namespace mozilla::a11y;
// IUnknown // IUnknown
@ -55,10 +57,9 @@ ia2AccessibleValue::get_currentValue(VARIANT* aCurrentValue)
if (valueAcc->IsDefunct()) if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
double currentValue = 0; double currentValue = valueAcc->CurValue();
nsresult rv = valueAcc->GetCurrentValue(&currentValue); if (IsNaN(currentValue))
if (NS_FAILED(rv)) return S_FALSE;
return GetHRESULT(rv);
aCurrentValue->vt = VT_R8; aCurrentValue->vt = VT_R8;
aCurrentValue->dblVal = currentValue; aCurrentValue->dblVal = currentValue;
@ -79,8 +80,7 @@ ia2AccessibleValue::setCurrentValue(VARIANT aValue)
if (aValue.vt != VT_R8) if (aValue.vt != VT_R8)
return E_INVALIDARG; return E_INVALIDARG;
nsresult rv = valueAcc->SetCurrentValue(aValue.dblVal); return valueAcc->SetCurValue(aValue.dblVal) ? S_OK : E_FAIL;
return GetHRESULT(rv);
A11Y_TRYBLOCK_END A11Y_TRYBLOCK_END
} }
@ -99,10 +99,9 @@ ia2AccessibleValue::get_maximumValue(VARIANT* aMaximumValue)
if (valueAcc->IsDefunct()) if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
double maximumValue = 0; double maximumValue = valueAcc->MaxValue();
nsresult rv = valueAcc->GetMaximumValue(&maximumValue); if (IsNaN(maximumValue))
if (NS_FAILED(rv)) return S_FALSE;
return GetHRESULT(rv);
aMaximumValue->vt = VT_R8; aMaximumValue->vt = VT_R8;
aMaximumValue->dblVal = maximumValue; aMaximumValue->dblVal = maximumValue;
@ -125,10 +124,9 @@ ia2AccessibleValue::get_minimumValue(VARIANT* aMinimumValue)
if (valueAcc->IsDefunct()) if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
double minimumValue = 0; double minimumValue = valueAcc->MinValue();
nsresult rv = valueAcc->GetMinimumValue(&minimumValue); if (IsNaN(minimumValue))
if (NS_FAILED(rv)) return S_FALSE;
return GetHRESULT(rv);
aMinimumValue->vt = VT_R8; aMinimumValue->vt = VT_R8;
aMinimumValue->dblVal = minimumValue; aMinimumValue->dblVal = minimumValue;

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
function doTest() function doTest()
{ {
// HTML5 progress element tests // 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_zero", "0%", 0, 0, 1, 0);
testValue("pr_zeropointfive", "50%", 0.5, 0, 1, 0); testValue("pr_zeropointfive", "50%", 0.5, 0, 1, 0);
testValue("pr_one", "100%", 1, 0, 1, 0); testValue("pr_one", "100%", 1, 0, 1, 0);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public # 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 # 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/. # 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 # 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 # 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/. # 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 # 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 # 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/. # 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 # 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 # 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/. # 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 # 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 # 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/. # 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. # responsibility between Makefile.in and mozbuild files.
_MOZBUILD_EXTERNAL_VARIABLES := \ _MOZBUILD_EXTERNAL_VARIABLES := \
ANDROID_GENERATED_RESFILES \ ANDROID_GENERATED_RESFILES \
ANDROID_RESFILES \ ANDROID_RES_DIRS \
CMSRCS \ CMSRCS \
CMMSRCS \ CMMSRCS \
CPP_UNIT_TESTS \ CPP_UNIT_TESTS \
@ -73,6 +73,7 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
$(NULL) $(NULL)
_DEPRECATED_VARIABLES := \ _DEPRECATED_VARIABLES := \
ANDROID_RESFILES \
MOCHITEST_FILES_PARTS \ MOCHITEST_FILES_PARTS \
MOCHITEST_BROWSER_FILES_PARTS \ MOCHITEST_BROWSER_FILES_PARTS \
SHORT_LIBNAME \ 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 # NSPR_CFLAGS and NSS_CFLAGS must appear ahead of OS_INCLUDES to avoid Linux
# builds wrongly picking up system NSPR/NSS header files. # builds wrongly picking up system NSPR/NSS header files.
INCLUDES = \ INCLUDES = \
$(LOCAL_INCLUDES) \
-I$(srcdir) \ -I$(srcdir) \
-I. \ -I. \
$(LOCAL_INCLUDES) \
-I$(DIST)/include \ -I$(DIST)/include \
$(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include) \ $(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include) \
$(NSPR_CFLAGS) $(NSS_CFLAGS) \ $(NSPR_CFLAGS) $(NSS_CFLAGS) \

View File

@ -7,29 +7,6 @@
ifndef INCLUDED_JAVA_BUILD_MK #{ 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 #{ ifdef JAVAFILES #{
GENERATED_DIRS += classes GENERATED_DIRS += classes
@ -39,7 +16,8 @@ endif #} JAVAFILES
ifdef ANDROID_APK_NAME #{ 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)) _ANDROID_ASSETS_FLAG := $(addprefix -A ,$(ANDROID_ASSETS_DIR))
GENERATED_DIRS += classes GENERATED_DIRS += classes
@ -57,7 +35,11 @@ classes.dex: $(JAVAFILES)
R.java: .aapt.deps R.java: .aapt.deps
$(ANDROID_APK_NAME).ap_: .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) \ $(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar $(_ANDROID_RES_FLAG) $(_ANDROID_ASSETS_FLAG) \
-J ${@D} \ -J ${@D} \
-F $(ANDROID_APK_NAME).ap_ -F $(ANDROID_APK_NAME).ap_

View File

@ -129,11 +129,24 @@ class MockedOpen(object):
def __enter__(self): def __enter__(self):
import __builtin__ import __builtin__
self.open = __builtin__.open self.open = __builtin__.open
self._orig_path_exists = os.path.exists
__builtin__.open = self __builtin__.open = self
os.path.exists = self._wrapped_exists
def __exit__(self, type, value, traceback): def __exit__(self, type, value, traceback):
import __builtin__ import __builtin__
__builtin__.open = self.open __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): def main(*args):
unittest.main(testRunner=MozTestRunner(),*args) unittest.main(testRunner=MozTestRunner(),*args)

View File

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

View File

@ -220,7 +220,7 @@
namespace mozilla { 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 * 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', 'TreeWalker.h',
] ]
SOURCES += [ UNIFIED_SOURCES += [
'Attr.cpp', 'Attr.cpp',
'ChildIterator.cpp', 'ChildIterator.cpp',
'Comment.cpp', 'Comment.cpp',
@ -94,12 +94,10 @@ SOURCES += [
'nsContentList.cpp', 'nsContentList.cpp',
'nsContentPolicy.cpp', 'nsContentPolicy.cpp',
'nsContentSink.cpp', 'nsContentSink.cpp',
'nsContentUtils.cpp',
'nsCopySupport.cpp', 'nsCopySupport.cpp',
'nsCrossSiteListenerProxy.cpp', 'nsCrossSiteListenerProxy.cpp',
'nsCSPService.cpp', 'nsCSPService.cpp',
'nsDataDocumentContentPolicy.cpp', 'nsDataDocumentContentPolicy.cpp',
'nsDocument.cpp',
'nsDocumentEncoder.cpp', 'nsDocumentEncoder.cpp',
'nsDOMAttributeMap.cpp', 'nsDOMAttributeMap.cpp',
'nsDOMBlobBuilder.cpp', 'nsDOMBlobBuilder.cpp',
@ -130,9 +128,7 @@ SOURCES += [
'nsNameSpaceManager.cpp', 'nsNameSpaceManager.cpp',
'nsNoDataProtocolContentPolicy.cpp', 'nsNoDataProtocolContentPolicy.cpp',
'nsNodeInfo.cpp', 'nsNodeInfo.cpp',
'nsNodeInfoManager.cpp',
'nsNodeUtils.cpp', 'nsNodeUtils.cpp',
'nsObjectLoadingContent.cpp',
'nsPlainTextSerializer.cpp', 'nsPlainTextSerializer.cpp',
'nsPropertyTable.cpp', 'nsPropertyTable.cpp',
'nsRange.cpp', 'nsRange.cpp',
@ -159,6 +155,18 @@ SOURCES += [
'WebSocket.cpp', '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 += [ EXTRA_COMPONENTS += [
'contentAreaDropListener.js', 'contentAreaDropListener.js',
'contentAreaDropListener.manifest', 'contentAreaDropListener.manifest',

View File

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

View File

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

View File

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

View File

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

View File

@ -348,8 +348,9 @@ HTMLBodyElement::UnbindFromTree(bool aDeep, bool aNullParent)
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
} }
static void
void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{ {
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) { if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
// When display if first asked for, go ahead and get our colors set up. // 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; JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
nsRefPtr<BodyRule> mContentStyleRule; nsRefPtr<BodyRule> mContentStyleRule;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
}; };
} // namespace dom } // namespace dom

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -99,6 +99,10 @@ public:
protected: protected:
virtual JSObject* WrapNode(JSContext* aCx, virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE; JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
}; };
} // namespace dom } // 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, Width, width)
NS_IMPL_STRING_ATTR(HTMLHRElement, Color, color) 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 bool
HTMLHRElement::ParseAttribute(int32_t aNamespaceID, HTMLHRElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
const nsAString& aValue, const nsAString& aValue,
nsAttrValue& aResult) 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 (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::width) { if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue); return aResult.ParseSpecialIntValue(aValue);
@ -64,9 +64,9 @@ HTMLHRElement::ParseAttribute(int32_t aNamespaceID,
aResult); aResult);
} }
static void void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes, HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData) nsRuleData* aData)
{ {
bool noshade = false; bool noshade = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1219,6 +1219,8 @@ protected:
bool mProgressTimerIsActive : 1; bool mProgressTimerIsActive : 1;
private: private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData);
/** /**
* Returns true if this input's type will fire a DOM "change" event when it * 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); aResult);
} }
static void void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes, HTMLLIElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
nsRuleData* aData) nsRuleData* aData)
{ {
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(List)) { if (aData->mSIDs & NS_STYLE_INHERIT_BIT(List)) {
nsCSSValue* listStyleType = aData->ValueForListStyleType(); nsCSSValue* listStyleType = aData->ValueForListStyleType();

View File

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

View File

@ -21,16 +21,6 @@ HTMLLegendElement::~HTMLLegendElement()
NS_IMPL_ELEMENT_CLONE(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* nsIContent*
HTMLLegendElement::GetFieldSet() HTMLLegendElement::GetFieldSet()
{ {
@ -49,6 +39,16 @@ HTMLLegendElement::ParseAttribute(int32_t aNamespaceID,
const nsAString& aValue, const nsAString& aValue,
nsAttrValue& aResult) 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) { if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
return aResult.ParseEnumValue(aValue, kAlignTable, false); return aResult.ParseEnumValue(aValue, kAlignTable, false);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1182,24 +1182,6 @@ nsGenericHTMLElement::GetPresContext()
return nullptr; 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[] = { static const nsAttrValue::EnumTable kDivAlignTable[] = {
{ "left", NS_STYLE_TEXT_ALIGN_MOZ_LEFT }, { "left", NS_STYLE_TEXT_ALIGN_MOZ_LEFT },
{ "right", NS_STYLE_TEXT_ALIGN_MOZ_RIGHT }, { "right", NS_STYLE_TEXT_ALIGN_MOZ_RIGHT },
@ -1240,6 +1222,24 @@ bool
nsGenericHTMLElement::ParseAlignValue(const nsAString& aString, nsGenericHTMLElement::ParseAlignValue(const nsAString& aString,
nsAttrValue& aResult) 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); return aResult.ParseEnumValue(aString, kAlignTable, false);
} }

View File

@ -13,7 +13,7 @@ EXPORTS.mozilla.dom += [
'ImageDocument.h', 'ImageDocument.h',
] ]
SOURCES += [ UNIFIED_SOURCES += [
'HTMLAllCollection.cpp', 'HTMLAllCollection.cpp',
'ImageDocument.cpp', 'ImageDocument.cpp',
'MediaDocument.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 // 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. // developers from using AMR, thus we only allow AMR to be played on WebApps.
if (aType.EqualsASCII("audio/amr")) { if (aType.EqualsASCII("audio/amr")) {
HTMLMediaElement* element = aOwner->GetMediaElement(); dom::HTMLMediaElement* element = aOwner->GetMediaElement();
if (!element) { if (!element) {
return nullptr; return nullptr;
} }

View File

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

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