Merge m-c to b2g-inbound.

This commit is contained in:
Ryan VanderMeulen 2013-11-19 22:28:07 -05:00
commit b2cb8fb7e9
396 changed files with 5034 additions and 3415 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,19 +1,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
INSTALL_TARGETS += ACCESSFU
ACCESSFU_FILES := \
AccessFu.jsm \
EventManager.jsm \
jar.mn \
Makefile.in \
OutputGenerator.jsm \
Presentation.jsm \
TouchAdapter.jsm \
TraversalRules.jsm \
Utils.jsm \
$(NULL)
ACCESSFU_DEST = $(FINAL_TARGET)/modules/accessibility

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,3 +3,16 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JS_MODULES_PATH = 'modules/accessibility'
EXTRA_JS_MODULES += [
'AccessFu.jsm',
'Constants.jsm',
'EventManager.jsm',
'OutputGenerator.jsm',
'Presentation.jsm',
'TouchAdapter.jsm',
'TraversalRules.jsm',
'Utils.jsm'
]

View File

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

View File

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

View File

@ -0,0 +1,90 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "xpcAccessibleValue.h"
#include "Accessible.h"
using namespace mozilla;
using namespace mozilla::a11y;
NS_IMETHODIMP
xpcAccessibleValue::GetMaximumValue(double* aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
double value = acc->MaxValue();
if (!IsNaN(value))
*aValue = value;
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleValue::GetMinimumValue(double* aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
double value = acc->MinValue();
if (!IsNaN(value))
*aValue = value;
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleValue::GetCurrentValue(double* aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
double value = acc->CurValue();
if (!IsNaN(value))
*aValue = value;
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleValue::SetCurrentValue(double aValue)
{
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
acc->SetCurValue(aValue);
return NS_OK;
}
NS_IMETHODIMP
xpcAccessibleValue::GetMinimumIncrement(double* aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = 0;
Accessible* acc = static_cast<Accessible*>(this);
if (acc->IsDefunct())
return NS_ERROR_FAILURE;
double value = acc->Step();
if (!IsNaN(value))
*aValue = value;
return NS_OK;
}

View File

@ -0,0 +1,35 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_xpcAccessibleValue_h_
#define mozilla_a11y_xpcAccessibleValue_h_
#include "nsIAccessibleValue.h"
namespace mozilla {
namespace a11y {
class xpcAccessibleValue : public nsIAccessibleValue
{
public:
NS_IMETHOD GetMaximumValue(double* aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetMinimumValue(double* aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetCurrentValue(double* aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD SetCurrentValue(double aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetMinimumIncrement(double* aMinIncrement) MOZ_FINAL MOZ_OVERRIDE;
private:
xpcAccessibleValue() { }
friend class Accessible;
xpcAccessibleValue(const xpcAccessibleValue&) MOZ_DELETE;
xpcAccessibleValue& operator =(const xpcAccessibleValue&) MOZ_DELETE;
};
} // namespace a11y
} // namespace mozilla
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6338,14 +6338,21 @@ var gIdentityHandler = {
let nsIWebProgressListener = Ci.nsIWebProgressListener;
// For some URIs like data: we can't get a host and so can't do
// anything useful here. Chrome URIs however get special treatment.
// anything useful here.
let unknown = false;
try {
uri.host;
} catch (e) { unknown = true; }
if ((uri.scheme == "chrome" || uri.scheme == "about") &&
uri.spec !== "about:blank") {
// Chrome URIs however get special treatment. Some chrome URIs are
// whitelisted to provide a positive security signal to the user.
let chromeWhitelist = ["about:addons", "about:app-manager", "about:config",
"about:crashes", "about:healthreport", "about:home",
"about:newaddon", "about:permissions", "about:preferences",
"about:privatebrowsing", "about:sessionstore",
"about:support", "about:welcomeback"];
let lowercaseSpec = uri.spec.toLowerCase();
if (chromeWhitelist.some(function(whitelistedSpec) lowercaseSpec.startsWith(whitelistedSpec))) {
this.setMode(this.IDENTITY_MODE_CHROMEUI);
} else if (unknown) {
this.setMode(this.IDENTITY_MODE_UNKNOWN);

View File

@ -61,14 +61,16 @@ function test_blank() {
function test_chrome() {
let oldTab = gBrowser.selectedTab;
// Since users aren't likely to type in full chrome URLs, we won't show
// the positive security indicator on it, but we will show it on about:addons.
loadNewTab("chrome://mozapps/content/extensions/extensions.xul", function(aNewTab) {
is(getIdentityMode(), "chromeUI", "Identity should be chrome");
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = oldTab;
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.selectedTab = aNewTab;
is(getIdentityMode(), "chromeUI", "Identity should be chrome");
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
gBrowser.removeTab(aNewTab);

View File

@ -359,6 +359,12 @@ let CustomizableUIInternal = {
this.beginBatchUpdate();
// Restore nav-bar visibility since it may have been hidden
// through a migration path (bug 938980) or an add-on.
if (aArea == CustomizableUI.AREA_NAVBAR) {
aAreaNode.collapsed = false;
}
let currentNode = container.firstChild;
let placementsToRemove = new Set();
for (let id of aPlacements) {
@ -1078,19 +1084,23 @@ let CustomizableUIInternal = {
/*
* If people put things in the panel which need more than single-click interaction,
* we don't want to close it. Right now we check for text inputs and menu buttons.
* Anything else we should take care of?
* We also check for being outside of any toolbaritem/toolbarbutton, ie on a blank
* part of the menu.
*/
_isOnInteractiveElement: function(aEvent) {
let target = aEvent.originalTarget;
let panel = aEvent.currentTarget;
let panel = this._getPanelForNode(aEvent.currentTarget);
let inInput = false;
let inMenu = false;
while (!inInput && !inMenu && target != aEvent.currentTarget) {
inInput = target.localName == "input";
let inItem = false;
while (!inInput && !inMenu && !inItem && target != panel) {
let tagName = target.localName;
inInput = tagName == "input";
inMenu = target.type == "menu";
inItem = tagName == "toolbaritem" || tagName == "toolbarbutton";
target = target.parentNode;
}
return inMenu || inInput;
return inMenu || inInput || !inItem;
},
hidePanelForNode: function(aNode) {

View File

@ -35,4 +35,5 @@ skip-if = true
# Because this test is about the menubar, it can't be run on mac
skip-if = os == "mac"
[browser_938980_navbar_collapsed.js]
[browser_panel_toggle.js]

View File

@ -0,0 +1,26 @@
/* 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/. */
let gTests = [
{
desc: "Customization reset should restore visibility to default-visible toolbars.",
setup: null,
run: function() {
let navbar = document.getElementById("nav-bar");
is(navbar.collapsed, false, "Test should start with navbar visible");
navbar.collapsed = true;
is(navbar.collapsed, true, "navbar should be hidden now");
yield resetCustomization();
is(navbar.collapsed, false, "Customization reset should restore visibility to the navbar");
},
teardown: null
},
];
function test() {
waitForExplicitFinish();
runTests(gTests);
}

View File

@ -549,7 +549,7 @@ nsBrowserContentHandler.prototype = {
}
var overridePage = "";
var haveUpdateSession = false;
var willRestoreSession = false;
try {
// Read the old value of homepage_override.mstone before
// needHomepageOverride updates it, so that we can later add it to the
@ -568,11 +568,15 @@ nsBrowserContentHandler.prototype = {
overridePage = Services.urlFormatter.formatURLPref("startup.homepage_welcome_url");
break;
case OVERRIDE_NEW_MSTONE:
// Check whether we have a session to restore. If we do, we assume
// that this is an "update" session.
// Check whether we will restore a session. If we will, we assume
// that this is an "update" session. This does not take crashes
// into account because that requires waiting for the session file
// to be read. If a crash occurs after updating, before restarting,
// we may open the startPage in addition to restoring the session.
var ss = Components.classes["@mozilla.org/browser/sessionstartup;1"]
.getService(Components.interfaces.nsISessionStartup);
haveUpdateSession = ss.doRestore();
willRestoreSession = ss.isAutomaticRestoreEnabled();
overridePage = Services.urlFormatter.formatURLPref("startup.homepage_override_url");
if (prefb.prefHasUserValue("app.update.postupdate"))
overridePage = getPostUpdateOverridePage(overridePage);
@ -600,7 +604,7 @@ nsBrowserContentHandler.prototype = {
startPage = "";
// Only show the startPage if we're not restoring an update session.
if (overridePage && startPage && !haveUpdateSession)
if (overridePage && startPage && !willRestoreSession)
return overridePage + "|" + startPage;
return overridePage || startPage || "about:blank";

View File

@ -10,7 +10,7 @@
* - and allows to restore everything into one window.
*/
[scriptable, uuid(51f4b9f0-f3d2-11e2-bb62-2c24dd830245)]
[scriptable, uuid(6c79d4c1-f071-4c5c-a7fb-676adb144584)]
interface nsISessionStartup: nsISupports
{
/**
@ -23,12 +23,18 @@ interface nsISessionStartup: nsISupports
readonly attribute jsval state;
/**
* Determines whether there is a pending session restore and makes sure that
* we're initialized before returning. If we're not yet this will read the
* session file synchronously.
* Determines whether there is a pending session restore. Should only be
* called after initialization has completed.
*/
boolean doRestore();
/**
* Determines whether automatic session restoration is enabled for this
* launch of the browser. This does not include crash restoration, and will
* return false if restoration will only be caused by a crash.
*/
boolean isAutomaticRestoreEnabled();
/**
* Returns whether we will restore a session that ends up replacing the
* homepage. The browser uses this to not start loading the homepage if

View File

@ -38,16 +38,10 @@ Cu.import("resource://gre/modules/AsyncShutdown.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "Telemetry",
"@mozilla.org/base/telemetry;1", "nsITelemetry");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
this.SessionFile = {
/**
@ -56,15 +50,6 @@ this.SessionFile = {
read: function () {
return SessionFileInternal.read();
},
/**
* Read the contents of the session file, synchronously.
*/
syncRead: function () {
Deprecated.warning(
"syncRead is deprecated and will be removed in a future version",
"https://bugzilla.mozilla.org/show_bug.cgi?id=532150")
return SessionFileInternal.syncRead();
},
/**
* Write the contents of the session file, asynchronously.
*/
@ -161,60 +146,6 @@ let SessionFileInternal = {
*/
_isClosed: false,
/**
* Utility function to safely read a file synchronously.
* @param aPath
* A path to read the file from.
* @returns string if successful, undefined otherwise.
*/
readAuxSync: function (aPath) {
let text;
try {
let file = new FileUtils.File(aPath);
let chan = NetUtil.newChannel(file);
let stream = chan.open();
text = NetUtil.readInputStreamToString(stream, stream.available(),
{charset: "utf-8"});
} catch (e if e.result == Components.results.NS_ERROR_FILE_NOT_FOUND) {
// Ignore exceptions about non-existent files.
} catch (ex) {
// Any other error.
Cu.reportError(ex);
} finally {
return text;
}
},
/**
* Read the sessionstore file synchronously.
*
* This function is meant to serve as a fallback in case of race
* between a synchronous usage of the API and asynchronous
* initialization.
*
* In case if sessionstore.js file does not exist or is corrupted (something
* happened between backup and write), attempt to read the sessionstore.bak
* instead.
*/
syncRead: function () {
// Start measuring the duration of the synchronous read.
TelemetryStopwatch.start("FX_SESSION_RESTORE_SYNC_READ_FILE_MS");
// First read the sessionstore.js.
let text = this.readAuxSync(this.path);
if (typeof text === "undefined") {
// If sessionstore.js does not exist or is corrupted, read sessionstore.bak.
text = this.readAuxSync(this.backupPath);
}
// Finish the telemetry probe and return an empty string.
TelemetryStopwatch.finish("FX_SESSION_RESTORE_SYNC_READ_FILE_MS");
text = text || "";
// The worker needs to know the initial state read from
// disk so that writeLoadStateOnceAfterStartup() works.
SessionWorker.post("setInitialState", [text]);
return text;
},
read: function () {
return SessionWorker.post("read").then(msg => {
this._recordTelemetry(msg.telemetry);

View File

@ -73,30 +73,6 @@ let Agent = {
// The path to sessionstore.bak
backupPath: OS.Path.join(OS.Constants.Path.profileDir, "sessionstore.bak"),
/**
* This method is only intended to be called by SessionFile.syncRead() and
* can be removed when we're not supporting synchronous SessionStore
* initialization anymore. When sessionstore.js is read from disk
* synchronously the state string must be supplied to the worker manually by
* calling this method.
*/
setInitialState: function (aState) {
// SessionFile.syncRead() should not be called after startup has finished.
// Thus we also don't support any setInitialState() calls after we already
// wrote the loadState to disk.
if (this.hasWrittenLoadStateOnce) {
throw new Error("writeLoadStateOnceAfterStartup() must only be called once.");
}
// Initial state might have been filled by read() already but yet we might
// be called by SessionFile.syncRead() before SessionStore.jsm had a chance
// to call writeLoadStateOnceAfterStartup(). It's safe to ignore
// setInitialState() calls if this happens.
if (!this.initialState) {
this.initialState = aState;
}
},
/**
* Read the session from disk.
* In case sessionstore.js does not exist, attempt to read sessionstore.bak.

View File

@ -48,6 +48,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "SessionFile",
const STATE_RUNNING_STR = "running";
// 'browser.startup.page' preference value to resume the previous session.
const BROWSER_STARTUP_RESUME_SESSION = 3;
function debug(aMsg) {
aMsg = ("SessionStartup: " + aMsg).replace(/\S{80}/g, "$&\n");
Services.console.logStringMessage(aMsg);
@ -138,7 +141,7 @@ SessionStartup.prototype = {
let doResumeSessionOnce = Services.prefs.getBoolPref("browser.sessionstore.resume_session_once");
let doResumeSession = doResumeSessionOnce ||
Services.prefs.getIntPref("browser.startup.page") == 3;
Services.prefs.getIntPref("browser.startup.page") == BROWSER_STARTUP_RESUME_SESSION;
// If this is a normal restore then throw away any previous session
if (!doResumeSessionOnce)
@ -226,9 +229,9 @@ SessionStartup.prototype = {
},
/**
* Determines whether there is a pending session restore and makes sure that
* we're initialized before returning. If we're not yet this will read the
* session file synchronously.
* Determines whether there is a pending session restore. Should only be
* called after initialization has completed.
* @throws Error if initialization is not complete yet.
* @returns bool
*/
doRestore: function sss_doRestore() {
@ -236,6 +239,18 @@ SessionStartup.prototype = {
return this._willRestore();
},
/**
* Determines whether automatic session restoration is enabled for this
* launch of the browser. This does not include crash restoration. In
* particular, if session restore is configured to restore only in case of
* crash, this method returns false.
* @returns bool
*/
isAutomaticRestoreEnabled: function () {
return Services.prefs.getBoolPref("browser.sessionstore.resume_session_once") ||
Services.prefs.getIntPref("browser.startup.page") == BROWSER_STARTUP_RESUME_SESSION;
},
/**
* Determines whether there is a pending session restore.
* @returns bool
@ -275,20 +290,12 @@ SessionStartup.prototype = {
return this._sessionType;
},
// Ensure that initialization is complete.
// If initialization is not complete yet, fall back to a synchronous
// initialization and kill ongoing asynchronous initialization
// Ensure that initialization is complete. If initialization is not complete
// yet, something is attempting to use the old synchronous initialization,
// throw an error.
_ensureInitialized: function sss__ensureInitialized() {
try {
if (this._initialized) {
// Initialization is complete, nothing else to do
return;
}
let contents = SessionFile.syncRead();
this._onSessionFileRead(contents);
} catch(ex) {
debug("ensureInitialized: could not read session " + ex + ", " + ex.stack);
throw ex;
if (!this._initialized) {
throw new Error("Session Store is not initialized.");
}
},

View File

@ -104,11 +104,6 @@ function testReadBackup() {
let ssDataRead = yield SessionFile.read();
is(ssDataRead, gSSData, "SessionFile.read read sessionstore.js correctly.");
// Read sessionstore.js with SessionFile.syncRead.
ssDataRead = SessionFile.syncRead();
is(ssDataRead, gSSData,
"SessionFile.syncRead read sessionstore.js correctly.");
// Remove sessionstore.js to test fallback onto sessionstore.bak.
yield OS.File.remove(path);
ssExists = yield OS.File.exists(path);
@ -119,11 +114,6 @@ function testReadBackup() {
is(ssDataRead, gSSBakData,
"SessionFile.read read sessionstore.bak correctly.");
// Read sessionstore.bak with SessionFile.syncRead.
ssDataRead = SessionFile.syncRead();
is(ssDataRead, gSSBakData,
"SessionFile.syncRead read sessionstore.bak correctly.");
nextTest(testBackupUnchanged);
}

View File

@ -1,15 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test nsISessionStartup.sessionType in the following scenario:
// - no sessionstore.js;
// - the session store has not been loaded yet, so we have to trigger
// synchronous fallback
function run_test() {
do_get_profile();
let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
getService(Ci.nsISessionStartup);
do_check_eq(startup.sessionType, Ci.nsISessionStartup.NO_SESSION);
}

View File

@ -1,17 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test nsISessionStartup.sessionType in the following scenario:
// - valid sessionstore.js;
// - the session store has not been loaded yet, so we have to trigger
// synchronous fallback
function run_test() {
let profd = do_get_profile();
let source = do_get_file("data/sessionstore_valid.js");
source.copyTo(profd, "sessionstore.js");
let startup = Cc["@mozilla.org/browser/sessionstartup;1"].
getService(Ci.nsISessionStartup);
do_check_eq(startup.sessionType, Ci.nsISessionStartup.DEFER_SESSION);
}

View File

@ -6,7 +6,5 @@ support-files = data/sessionstore_valid.js
[test_backup.js]
[test_backup_once.js]
[test_startup_nosession_sync.js]
[test_startup_nosession_async.js]
[test_startup_session_sync.js]
[test_startup_session_async.js]

View File

@ -118,6 +118,10 @@ function test()
{
waitForExplicitFinish();
// Reset the startup page pref since it may have been set by other tests
// and we will assume it is default.
Services.prefs.clearUserPref('browser.startup.page');
if (gPrefService.prefHasUserValue(PREF_MSTONE)) {
gOriginalMStone = gPrefService.getCharPref(PREF_MSTONE);
}

View File

@ -1516,6 +1516,7 @@ WatchExpressionsView.prototype = Heritage.extend(WidgetMethods, {
case e.DOM_VK_RETURN:
case e.DOM_VK_ENTER:
case e.DOM_VK_ESCAPE:
e.stopPropagation();
DebuggerView.editor.focus();
return;
}

View File

@ -67,6 +67,7 @@ function Toolbox(target, selectedTool, hostType, hostOptions) {
this._toolRegistered = this._toolRegistered.bind(this);
this._toolUnregistered = this._toolUnregistered.bind(this);
this._refreshHostTitle = this._refreshHostTitle.bind(this);
this._splitConsoleOnKeypress = this._splitConsoleOnKeypress.bind(this)
this.destroy = this.destroy.bind(this);
this._target.on("close", this.destroy);
@ -229,11 +230,55 @@ Toolbox.prototype = {
}, true);
},
_splitConsoleOnKeypress: function(e) {
if (e.keyCode === e.DOM_VK_ESCAPE) {
this.toggleSplitConsole();
}
},
_addToolSwitchingKeys: function() {
let nextKey = this.doc.getElementById("toolbox-next-tool-key");
nextKey.addEventListener("command", this.selectNextTool.bind(this), true);
let prevKey = this.doc.getElementById("toolbox-previous-tool-key");
prevKey.addEventListener("command", this.selectPreviousTool.bind(this), true);
// Split console uses keypress instead of command so the event can be
// cancelled with stopPropagation on the keypress, and not preventDefault.
this.doc.addEventListener("keypress", this._splitConsoleOnKeypress, false);
},
/**
* Make sure that the console is showing up properly based on all the
* possible conditions.
* 1) If the console tab is selected, then regardless of split state
* it should take up the full height of the deck, and we should
* hide the deck and splitter.
* 2) If the console tab is not selected and it is split, then we should
* show the splitter, deck, and console.
* 3) If the console tab is not selected and it is *not* split,
* then we should hide the console and splitter, and show the deck
* at full height.
*/
_refreshConsoleDisplay: function() {
let deck = this.doc.getElementById("toolbox-deck");
let webconsolePanel = this.doc.getElementById("toolbox-panel-webconsole");
let splitter = this.doc.getElementById("toolbox-console-splitter");
let openedConsolePanel = this.currentToolId === "webconsole";
if (openedConsolePanel) {
deck.setAttribute("collapsed", "true");
splitter.setAttribute("hidden", "true");
webconsolePanel.removeAttribute("collapsed");
} else {
deck.removeAttribute("collapsed");
if (this._splitConsole) {
webconsolePanel.removeAttribute("collapsed");
splitter.removeAttribute("hidden");
} else {
webconsolePanel.setAttribute("collapsed", "true");
splitter.setAttribute("hidden", "true");
}
}
},
/**
@ -502,8 +547,11 @@ Toolbox.prototype = {
}
let vbox = this.doc.createElement("vbox");
vbox.className = "toolbox-panel " + toolDefinition.bgTheme;
vbox.id = "toolbox-panel-" + id;
// There is already a container for the webconsole frame.
if (!this.doc.getElementById("toolbox-panel-" + id)) {
vbox.id = "toolbox-panel-" + id;
}
// If there is no tab yet, or the ordinal to be added is the largest one.
if (tabs.childNodes.length == 0 ||
@ -613,7 +661,6 @@ Toolbox.prototype = {
let tab = this.doc.getElementById("toolbox-tab-" + id);
tab.setAttribute("selected", "true");
if (this.currentToolId == id) {
// re-focus tool to get key events again
this.focusTool(id);
@ -656,6 +703,7 @@ Toolbox.prototype = {
deck.selectedIndex = index;
this.currentToolId = id;
this._refreshConsoleDisplay();
if (id != "options") {
Services.prefs.setCharPref(this._prefs.LAST_TOOL, id);
}
@ -680,6 +728,27 @@ Toolbox.prototype = {
iframe.focus();
},
/**
* Toggles the split state of the webconsole. If the webconsole panel
* is already selected, then this command is ignored.
*/
toggleSplitConsole: function() {
let openedConsolePanel = this.currentToolId === "webconsole";
// Don't allow changes when console is open, since it could be confusing
if (!openedConsolePanel) {
this._splitConsole = !this._splitConsole;
this._refreshConsoleDisplay();
this.emit("split-console");
if (this._splitConsole) {
this.loadTool("webconsole").then(() => {
this.focusTool("webconsole");
});
}
}
},
/**
* Loads the tool next to the currently selected tool.
*/
@ -789,7 +858,7 @@ Toolbox.prototype = {
iframe.swapFrameLoaders(this.frame);
this._host.off("window-closed", this.destroy);
this._host.destroy();
this.destroyHost();
this._host = newHost;
@ -876,6 +945,17 @@ Toolbox.prototype = {
return this.doc.getElementById("toolbox-notificationbox");
},
/**
* Destroy the current host, and remove event listeners from its frame.
*
* @return {promise} to be resolved when the host is destroyed.
*/
destroyHost: function() {
this.doc.removeEventListener("keypress",
this._splitConsoleOnKeypress, false);
return this._host.destroy();
},
/**
* Remove all UI elements, detach from target and clear up
*/
@ -917,7 +997,7 @@ Toolbox.prototype = {
container.removeChild(container.firstChild);
}
outstanding.push(this._host.destroy());
outstanding.push(this.destroyHost());
this._telemetry.destroy();

View File

@ -74,7 +74,10 @@
</hbox>
#endif
</toolbar>
<deck id="toolbox-deck" flex="1">
</deck>
<vbox flex="1">
<deck id="toolbox-deck" flex="1" minheight="75" />
<splitter id="toolbox-console-splitter" class="devtools-horizontal-splitter" hidden="true" />
<box minheight="75" flex="1" id="toolbox-panel-webconsole" collapsed="true" />
</vbox>
</notificationbox>
</window>

View File

@ -172,6 +172,9 @@ function Tooltip(doc, options) {
this._onKeyPress = event => {
this.emit("keypress", event.keyCode);
if (this.options.get("closeOnKeys").indexOf(event.keyCode) !== -1) {
if (!this.panel.hidden) {
event.stopPropagation();
}
this.hide();
}
};

View File

@ -30,5 +30,4 @@ support-files =
[browser_bug731721_debugger_stepping.js]
[browser_bug744021_next_prev_bracket_jump.js]
[browser_codemirror.js]
skip-if = os == "linux"
[browser_sourceeditor_initialization.js]
[browser_sourceeditor_initialization.js]

View File

@ -8,6 +8,7 @@ const HOST = 'mochi.test:8888';
const URI = "http://" + HOST + "/browser/browser/devtools/sourceeditor/test/codemirror.html";
function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
let tab = gBrowser.addTab();

View File

@ -236,6 +236,7 @@ skip-if = os == "linux"
[browser_webconsole_output_order.js]
[browser_webconsole_property_provider.js]
[browser_webconsole_scratchpad_panel_link.js]
[browser_webconsole_split.js]
[browser_webconsole_view_source.js]
[browser_webconsole_reflow.js]
[browser_webconsole_log_file_filter.js]

View File

@ -0,0 +1,238 @@
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
function test()
{
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
let Toolbox = devtools.Toolbox;
let toolbox;
addTab("data:text/html;charset=utf-8,Web Console test for splitting");
browser.addEventListener("load", function onLoad() {
browser.removeEventListener("load", onLoad, true);
testConsoleLoadOnDifferentPanel()
}, true);
function testConsoleLoadOnDifferentPanel()
{
info("About to check console loads even when non-webconsole panel is open");
openPanel("inspector").then(() => {
toolbox.on("webconsole-ready", () => {
ok(true, "Webconsole has been triggered as loaded while another tool is active");
testKeyboardShortcuts();
});
// Opens split console.
toolbox.toggleSplitConsole();
});
}
function testKeyboardShortcuts()
{
info("About to check that panel responds to ESCAPE keyboard shortcut");
toolbox.once("split-console", () => {
ok(true, "Split console has been triggered via ESCAPE keypress");
checkAllTools();
});
// Closes split console.
EventUtils.sendKey("ESCAPE", toolbox.frame.contentWindow);
}
function checkAllTools()
{
info("About to check split console with each panel individually.");
Task.spawn(function() {
yield openAndCheckPanel("jsdebugger");
yield openAndCheckPanel("inspector");
yield openAndCheckPanel("styleeditor");
yield openAndCheckPanel("jsprofiler");
yield openAndCheckPanel("netmonitor");
yield checkWebconsolePanelOpened();
testBottomHost();
});
}
function getCurrentUIState()
{
let win = toolbox.doc.defaultView;
let deck = toolbox.doc.getElementById("toolbox-deck");
let webconsolePanel = toolbox.doc.getElementById("toolbox-panel-webconsole");
let splitter = toolbox.doc.getElementById("toolbox-console-splitter");
let containerHeight = parseFloat(win.getComputedStyle(deck.parentNode).getPropertyValue("height"));
let deckHeight = parseFloat(win.getComputedStyle(deck).getPropertyValue("height"));
let webconsoleHeight = parseFloat(win.getComputedStyle(webconsolePanel).getPropertyValue("height"));
let splitterVisibility = !splitter.getAttribute("hidden");
let openedConsolePanel = toolbox.currentToolId === "webconsole";
return {
deckHeight: deckHeight,
containerHeight: containerHeight,
webconsoleHeight: webconsoleHeight,
splitterVisibility: splitterVisibility,
openedConsolePanel: openedConsolePanel
};
}
function checkWebconsolePanelOpened()
{
info("About to check special cases when webconsole panel is open.");
let deferred = promise.defer();
// Start with console split, so we can test for transition to main panel.
toolbox.toggleSplitConsole();
let currentUIState = getCurrentUIState();
ok (currentUIState.splitterVisibility, "Splitter is visible when console is split");
ok (currentUIState.deckHeight > 0, "Deck has a height > 0 when console is split");
ok (currentUIState.webconsoleHeight > 0, "Web console has a height > 0 when console is split");
ok (!currentUIState.openedConsolePanel, "The console panel is not the current tool");
openPanel("webconsole").then(() => {
let currentUIState = getCurrentUIState();
ok (!currentUIState.splitterVisibility, "Splitter is hidden when console is opened.");
is (currentUIState.deckHeight, 0, "Deck has a height == 0 when console is opened.");
is (currentUIState.webconsoleHeight, currentUIState.containerHeight, "Web console is full height.");
ok (currentUIState.openedConsolePanel, "The console panel is the current tool");
// Make sure splitting console does nothing while webconsole is opened
toolbox.toggleSplitConsole();
let currentUIState = getCurrentUIState();
ok (!currentUIState.splitterVisibility, "Splitter is hidden when console is opened.");
is (currentUIState.deckHeight, 0, "Deck has a height == 0 when console is opened.");
is (currentUIState.webconsoleHeight, currentUIState.containerHeight, "Web console is full height.");
ok (currentUIState.openedConsolePanel, "The console panel is the current tool");
// Make sure that split state is saved after opening another panel
openPanel("inspector").then(() => {
let currentUIState = getCurrentUIState();
ok (currentUIState.splitterVisibility, "Splitter is visible when console is split");
ok (currentUIState.deckHeight > 0, "Deck has a height > 0 when console is split");
ok (currentUIState.webconsoleHeight > 0, "Web console has a height > 0 when console is split");
ok (!currentUIState.openedConsolePanel, "The console panel is not the current tool");
toolbox.toggleSplitConsole();
deferred.resolve();
});
});
return deferred.promise;
}
function openPanel(toolId, callback)
{
let deferred = promise.defer();
let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, toolId).then(function(box) {
toolbox = box;
deferred.resolve();
}).then(null, console.error);
return deferred.promise;
}
function openAndCheckPanel(toolId)
{
let deferred = promise.defer();
openPanel(toolId).then(() => {
info ("Checking toolbox for " + toolId);
checkToolboxUI(toolbox.getCurrentPanel());
deferred.resolve();
});
return deferred.promise;
}
function checkToolboxUI()
{
let currentUIState = getCurrentUIState();
ok (!currentUIState.splitterVisibility, "Splitter is hidden by default");
is (currentUIState.deckHeight, currentUIState.containerHeight, "Deck has a height > 0 by default");
is (currentUIState.webconsoleHeight, 0, "Web console is collapsed by default");
ok (!currentUIState.openedConsolePanel, "The console panel is not the current tool");
toolbox.toggleSplitConsole();
let currentUIState = getCurrentUIState();
ok (currentUIState.splitterVisibility, "Splitter is visible when console is split");
ok (currentUIState.deckHeight > 0, "Deck has a height > 0 when console is split");
ok (currentUIState.webconsoleHeight > 0, "Web console has a height > 0 when console is split");
is (currentUIState.deckHeight + currentUIState.webconsoleHeight,
currentUIState.containerHeight,
"Everything adds up to container height");
ok (!currentUIState.openedConsolePanel, "The console panel is not the current tool");
toolbox.toggleSplitConsole();
let currentUIState = getCurrentUIState();
ok (!currentUIState.splitterVisibility, "Splitter is hidden after toggling");
is (currentUIState.deckHeight, currentUIState.containerHeight, "Deck has a height > 0 after toggling");
is (currentUIState.webconsoleHeight, 0, "Web console is collapsed after toggling");
ok (!currentUIState.openedConsolePanel, "The console panel is not the current tool");
}
function testBottomHost()
{
checkHostType(Toolbox.HostType.BOTTOM);
checkToolboxUI();
toolbox.switchHost(Toolbox.HostType.SIDE).then(testSidebarHost);
}
function testSidebarHost()
{
checkHostType(Toolbox.HostType.SIDE);
checkToolboxUI();
toolbox.switchHost(Toolbox.HostType.WINDOW).then(testWindowHost);
}
function testWindowHost()
{
checkHostType(Toolbox.HostType.WINDOW);
checkToolboxUI();
testDestroy();
}
function checkHostType(hostType)
{
is(toolbox.hostType, hostType, "host type is " + hostType);
let pref = Services.prefs.getCharPref("devtools.toolbox.host");
is(pref, hostType, "host pref is " + hostType);
}
function testDestroy()
{
toolbox.destroy().then(function() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target).then(finish);
});
}
function finish()
{
toolbox = null;
finishTest();
}
}

View File

@ -306,4 +306,54 @@
</handler>
</handlers>
</binding>
<binding id="line-wrap-label" extends="chrome://global/content/bindings/text.xml#text-label">
<implementation>
<constructor>
<![CDATA[
if (this.hasAttribute("value")) {
this.textContent = this.getAttribute("value");
this.removeAttribute("value");
}
]]>
</constructor>
<property name="value">
<getter>
<![CDATA[
return this.textContent;
]]>
</getter>
<setter>
<![CDATA[
return (this.textContent = val);
]]>
</setter>
</property>
</implementation>
</binding>
<binding id="line-wrap-text-link" extends="chrome://global/content/bindings/text.xml#text-link">
<implementation>
<constructor>
<![CDATA[
if (this.hasAttribute("value")) {
this.textContent = this.getAttribute("value");
this.removeAttribute("value");
}
]]>
</constructor>
<property name="value">
<getter>
<![CDATA[
return this.textContent;
]]>
</getter>
<setter>
<![CDATA[
return (this.textContent = val);
]]>
</setter>
</property>
</implementation>
</binding>
</bindings>

View File

@ -540,6 +540,8 @@
<property name="matchCount" readonly="true" onget="return this.input.controller.matchCount;"/>
<property name="popupOpen" readonly="true" onget="return !this.hidden"/>
<property name="overrideValue" readonly="true" onget="return null;"/>
<!-- Alias of popupOpen, for compatibility with global/content/bindings/autocomplete.xml -->
<property name="mPopupOpen" readonly="true" onget="return this.popupOpen"/>
<property name="selectedItem">
<getter>

View File

@ -29,19 +29,22 @@ appbar {
flyoutpanel {
-moz-binding: url('chrome://browser/content/bindings/flyoutpanel.xml#flyoutpanelBinding');
}
cssthrobber {
-moz-binding: url('chrome://browser/content/bindings/cssthrobber.xml#cssthrobberBinding');
}
label[linewrap] {
-moz-binding: url("chrome://browser/content/bindings/bindings.xml#line-wrap-label");
}
label[linewrap].text-link, label[onclick][linewrap] {
-moz-binding: url("chrome://browser/content/bindings/bindings.xml#line-wrap-text-link");
}
settings {
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#settings");
}
setting {
display: none;
}
autoscroller {
-moz-binding: url('chrome://browser/content/bindings/popup.xml#element-popup');
}

View File

@ -239,6 +239,7 @@
autocompletepopup="urlbar-autocomplete"
completeselectedindex="true"
placeholder="&urlbar.emptytext;"
tabscrolling="true"
onclick="SelectionHelperUI.urlbarClick();"/>
<toolbarbutton id="go-button" class="urlbar-button"
@ -371,12 +372,10 @@
oncommand="Appbar.dispatchContextualAction('clear')"/>
</toolbar>
</appbar>
<autoscroller class="autoscroller" id="autoscrollerid"/>
<flyoutpanel id="about-flyoutpanel" class="flyout-narrow" headertext="&aboutHeader.title;">
<label id="about-product-label" value="&aboutHeader.product.label;"/>
<label value="&aboutHeader.company.label;"/>
<label id="about-product-label" linewrap="true" value="&aboutHeader.product.label;"/>
<label value="&aboutHeader.company.label;" linewrap="true"/>
#expand <label id="about-version-label">__MOZ_APP_VERSION__</label>
<vbox id="updateBox">
#ifdef MOZ_UPDATER
@ -411,26 +410,24 @@
<label>&update.otherInstanceHandlingUpdates;</label>
</hbox>
<hbox id="manualUpdate" align="center">
<label>&update.manual.start;</label><label id="manualLink" class="text-link"/><label>&update.manual.end;</label>
<label>&update.manual.start;</label><label id="manualLink" linewrap="true" class="text-link"/><label>&update.manual.end;</label>
</hbox>
</deck>
#endif
</vbox>
#if MOZ_UPDATE_CHANNEL != release
#ifdef MOZ_UPDATER
<description class="text-blurb" id="currentChannelText">&channel.description.start;<label id="currentChannel"/>&channel.description.end;</description>
<description class="text-blurb" id="currentChannelText">&channel.description.start;<label id="currentChannel" linewrap="true"/>&channel.description.end;</description>
#endif
#endif
<label id="about-policy-label"
linewrap="true"
onclick="FlyoutPanelsUI.AboutFlyoutPanel.onPolicyClick(event);"
class="text-link" value="&aboutHeader.policy.label;"/>
<spacer class="flyoutpanel-hack"/>
</flyoutpanel>
#ifdef MOZ_SERVICES_SYNC
<flyoutpanel id="sync-flyoutpanel" class="flyout-narrow" headertext="&sync.flyout.title;">
<vbox id="sync-presetup-container" collapsed="true">
<description>&sync.flyout.presetup.description1;</description>
<separator />
@ -440,11 +437,11 @@
<image src="chrome://browser/skin/images/plus-34.png" />
<separator />
<label value="&sync.flyout.presetup.setup.label;"
linewrap="true"
class="text-link" />
<spacer flex="1" />
</hbox>
</vbox>
<vbox id="sync-setup-container" collapsed="true">
<description>&sync.flyout.setup.description1;</description>
<description>&sync.flyout.setup.description2;</description>

View File

@ -117,6 +117,7 @@ gTests.push({
gEdit.openPopup();
gEdit.closePopup();
}
yield waitForCondition(() => gEdit.popup._searches.itemCount);
let numSearches = gEdit.popup._searches.itemCount;
function getEngineItem() {
@ -124,11 +125,11 @@ gTests.push({
}
yield addMockSearchDefault();
ok(gEdit.popup._searches.itemCount == numSearches + 1, "added search engine count");
is(gEdit.popup._searches.itemCount, numSearches + 1, "added search engine count");
ok(getEngineItem(), "added search engine item");
yield removeMockSearchDefault();
ok(gEdit.popup._searches.itemCount == numSearches, "normal search engine count");
is(gEdit.popup._searches.itemCount, numSearches, "normal search engine count");
ok(!getEngineItem(), "added search engine item");
}
});
@ -337,6 +338,12 @@ gTests.push({
EventUtils.synthesizeKey("VK_DOWN", {}, window);
is(gEdit.popup._searches.selectedIndex, 0, "key select search: first search selected");
EventUtils.synthesizeKey("VK_TAB", {}, window);
is(gEdit.popup._searches.selectedIndex, 1, "tab key: second search selected");
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true }, window);
is(gEdit.popup._searches.selectedIndex, 0, "shift-tab: first search selected");
}
});

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ANDROID_RESFILES = [
'res/values/strings.xml',
]

View File

@ -3,11 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ANDROID_RESFILES = [
'res/drawable-hdpi/icon.png',
'res/drawable-ldpi/icon.png',
'res/drawable-mdpi/icon.png',
'res/layout/main.xml',
'res/values/strings.xml',
]

View File

@ -3,11 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ANDROID_RESFILES = [
'res/drawable-hdpi/icon.png',
'res/drawable-ldpi/icon.png',
'res/drawable-mdpi/icon.png',
'res/layout/main.xml',
'res/values/strings.xml',
]

View File

@ -3,13 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ANDROID_RESFILES = [
'res/drawable/ateamlogo.png',
'res/drawable/ic_stat_first.png',
'res/drawable/ic_stat_neterror.png',
'res/drawable/ic_stat_warning.png',
'res/drawable/icon.png',
'res/layout/main.xml',
'res/values/strings.xml',
]

View File

@ -3,14 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ANDROID_RESFILES = [
'res/drawable-hdpi/ateamlogo.png',
'res/drawable-hdpi/icon.png',
'res/drawable-ldpi/ateamlogo.png',
'res/drawable-ldpi/icon.png',
'res/drawable-mdpi/ateamlogo.png',
'res/drawable-mdpi/icon.png',
'res/layout/main.xml',
'res/values/strings.xml',
]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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