Merge m-c into maple

This commit is contained in:
Benoit Girard
2012-02-08 16:43:22 -05:00
1574 changed files with 57140 additions and 20750 deletions

View File

@@ -73,3 +73,8 @@ c0983049bcaa9551e5f276d5a77ce154c151e0b0 AURORA_BASE_20110927
54bfd8bf682e295ffd7f22fa921ca343957b6c1c AURORA_BASE_20111108 54bfd8bf682e295ffd7f22fa921ca343957b6c1c AURORA_BASE_20111108
a8506ab2c65480cf2f85f54e203ea746522c62bb AURORA_BASE_20111220 a8506ab2c65480cf2f85f54e203ea746522c62bb AURORA_BASE_20111220
462c726144bc1fb45b61e774f64ac5d61b4e047c UPDATE_PACKAGING_R16 462c726144bc1fb45b61e774f64ac5d61b4e047c UPDATE_PACKAGING_R16
bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
0000000000000000000000000000000000000000 AURORA_BASE_20120131
0000000000000000000000000000000000000000 AURORA_BASE_20120131
bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131

View File

@@ -45,9 +45,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = accessibility MODULE = accessibility
DIRS = public src build DIRS = public src build
ifdef ENABLE_TESTS TEST_DIRS += tests
DIRS += tests
endif
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

View File

@@ -61,11 +61,12 @@ XPIDLSRCS = \
nsIAccessibleDocument.idl \ nsIAccessibleDocument.idl \
nsIAccessibleProvider.idl \ nsIAccessibleProvider.idl \
nsIAccessibleSelectable.idl \ nsIAccessibleSelectable.idl \
nsIAccessNode.idl \ nsIAccessibleCursorable.idl \
nsIAccessibleEvent.idl \ nsIAccessibleEvent.idl \
nsIAccessibleEditableText.idl \ nsIAccessibleEditableText.idl \
nsIAccessibleHyperLink.idl \ nsIAccessibleHyperLink.idl \
nsIAccessibleHyperText.idl \ nsIAccessibleHyperText.idl \
nsIAccessiblePivot.idl \
nsIAccessibleTable.idl \ nsIAccessibleTable.idl \
nsIAccessibleText.idl \ nsIAccessibleText.idl \
nsIAccessibleValue.idl \ nsIAccessibleValue.idl \

View File

@@ -117,7 +117,7 @@ cpp_quote("//")
cpp_quote("//") cpp_quote("//")
cpp_quote("// get_localInterface(/* [out] */ void **localInterface);") cpp_quote("// get_localInterface(/* [out] */ void **localInterface);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=") cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsIAccessNode interface pointer") cpp_quote("// Only available in Gecko's process - casts to an XPCOM nsAccessNode object pointer")
cpp_quote("//") cpp_quote("//")
cpp_quote("//") cpp_quote("//")
cpp_quote("// get_language(/* [out] */ BSTR *htmlText);") cpp_quote("// get_language(/* [out] */ BSTR *htmlText);")

View File

@@ -1,126 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Original Author: Aaron Leventhal (aaronl@netscape.com)
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMNode;
interface nsIAccessibleDocument;
interface nsIDOMCSSPrimitiveValue;
/**
* An interface used by in-process accessibility clients
* to get style, window, markup and other information about
* a DOM node. When accessibility is active in Gecko,
* every DOM node can have one nsIAccessNode for each
* pres shell the DOM node is rendered in.
* The nsIAccessNode implementations are instantiated lazily.
* The nsIAccessNode tree for a given dom window
* has a one to one relationship to the DOM tree.
* If the DOM node for this access node is "accessible",
* then a QueryInterface to nsIAccessible will succeed.
*/
[scriptable, uuid(08bb2c50-1b30-11e1-bddb-0800200c9a66)]
interface nsIAccessNode : nsISupports
{
/**
* The DOM node this nsIAccessNode is associated with.
*/
readonly attribute nsIDOMNode DOMNode;
/**
* The document accessible that this access node resides in.
*/
readonly attribute nsIAccessibleDocument document;
/**
* The root document accessible that this access node resides in.
*/
readonly attribute nsIAccessibleDocument rootDocument;
/**
* The innerHTML for the DOM node
* This is a text string of all the markup inside the DOM
* node, not including the start and end tag for the node.
*/
readonly attribute DOMString innerHTML;
/**
* Makes an object visible on screen.
*
* @param scrollType - defines where the object should be placed on
* the screen (see nsIAccessibleScrollType for
* available constants).
*/
void scrollTo(in unsigned long aScrollType);
/**
* Moves the top left of an object to a specified location.
*
* @param coordinateType - specifies whether the coordinates are relative to
* the screen or the parent object (for available
* constants refer to nsIAccessibleCoordinateType)
* @param aX - defines the x coordinate
* @param aY - defines the y coordinate
*/
void scrollToPoint(in unsigned long aCoordinateType, in long aX, in long aY);
/**
* Retrieve the computed style value for this DOM node, if it is a DOM element.
* Note: the meanings of width, height and other size measurements depend
* on the version of CSS being used. Therefore, for bounds information,
* it is better to use nsIAccessible::accGetBounds.
* @param pseudoElt The pseudo element to retrieve style for, or NULL
* for general computed style information for this node.
* @param propertyName Retrieve the computed style value for this property name,
* for example "border-bottom".
*/
DOMString getComputedStyleValue(in DOMString pseudoElt, in DOMString propertyName);
/**
* The method is similar to getComputedStyleValue() excepting that this one
* returns nsIDOMCSSPrimitiveValue.
*/
nsIDOMCSSPrimitiveValue getComputedStyleCSSValue(in DOMString pseudoElt,
in DOMString propertyName);
/**
* The language for the current DOM node, e.g. en, de, etc.
*/
readonly attribute DOMString language;
};

View File

@@ -43,7 +43,10 @@
#include "nsIArray.idl" #include "nsIArray.idl"
interface nsIPersistentProperties; interface nsIPersistentProperties;
interface nsIDOMCSSPrimitiveValue;
interface nsIDOMDOMStringList; interface nsIDOMDOMStringList;
interface nsIDOMNode;
interface nsIAccessibleDocument;
interface nsIAccessibleRelation; interface nsIAccessibleRelation;
/** /**
@@ -100,6 +103,53 @@ interface nsIAccessible : nsISupports
*/ */
readonly attribute long indexInParent; readonly attribute long indexInParent;
/**
* The innerHTML for the HTML element associated with this accessible if applicable.
* This is a text string of all the markup inside the DOM
* node, not including the start and end tag for the node.
*/
readonly attribute DOMString innerHTML;
/**
* Retrieve the computed style value for this DOM node, if it is a DOM element.
* Note: the meanings of width, height and other size measurements depend
* on the version of CSS being used. Therefore, for bounds information,
* it is better to use nsIAccessible::accGetBounds.
*
* @param pseudoElt [in] The pseudo element to retrieve style for, or NULL
* for general computed style information for this node.
* @param propertyName [in] Retrieve the computed style value for this property name,
* for example "border-bottom".
*/
DOMString getComputedStyleValue(in DOMString pseudoElt, in DOMString propertyName);
/**
* The method is similar to getComputedStyleValue() excepting that this one
* returns nsIDOMCSSPrimitiveValue.
*/
nsIDOMCSSPrimitiveValue getComputedStyleCSSValue(in DOMString pseudoElt,
in DOMString propertyName);
/**
* The DOM node this nsIAccessible is associated with.
*/
readonly attribute nsIDOMNode DOMNode;
/**
* The document accessible that this access node resides in.
*/
readonly attribute nsIAccessibleDocument document;
/**
* The root document accessible that this access node resides in.
*/
readonly attribute nsIAccessibleDocument rootDocument;
/**
* The language for the current DOM node, e.g. en, de, etc.
*/
readonly attribute DOMString language;
/** /**
* Accessible name -- the main text equivalent for this node. The name is * Accessible name -- the main text equivalent for this node. The name is
* specified by ARIA or by native markup. Example of ARIA markup is * specified by ARIA or by native markup. Example of ARIA markup is
@@ -285,6 +335,26 @@ interface nsIAccessible : nsISupports
*/ */
void doAction(in PRUint8 index); void doAction(in PRUint8 index);
/**
* Makes an object visible on screen.
*
* @param scrollType - defines where the object should be placed on
* the screen (see nsIAccessibleScrollType for
* available constants).
*/
void scrollTo(in unsigned long aScrollType);
/**
* Moves the top left of an object to a specified location.
*
* @param coordinateType [in] - specifies whether the coordinates are relative to
* the screen or the parent object (for available
* constants refer to nsIAccessibleCoordinateType)
* @param x [in] - defines the x coordinate
* @param y [in] - defines the y coordinate
*/
void scrollToPoint(in unsigned long coordinateType, in long x, in long y);
/** /**
* Get a pointer to accessibility interface for this node, which is specific * Get a pointer to accessibility interface for this node, which is specific
* to the OS/accessibility toolkit we're running on. * to the OS/accessibility toolkit we're running on.

View File

@@ -0,0 +1,59 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2012
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Eitan Isaacson <eitan@monotonous.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIAccessiblePivot;
/**
* An interface implemented by an accessible object that has an associated
* virtual cursor. Typically, a top-level application or content document.
* A virtual cursor is an implementation of nsIAccessiblePivot that provides an
* exclusive spot in the cursorable's subtree, this could be used to create a
* pseudo-focus or caret browsing experience that is centered around the
* accessibility API.
*/
[scriptable, uuid(5452dea5-d235-496f-8757-3ca016ff49ff)]
interface nsIAccessibleCursorable : nsISupports
{
/**
* The virtual cursor pivot this object manages.
*/
readonly attribute nsIAccessiblePivot virtualCursor;
};

View File

@@ -39,7 +39,6 @@
#include "nsISupports.idl" #include "nsISupports.idl"
interface nsIAccessible; interface nsIAccessible;
interface nsIAccessNode;
interface nsIDOMDocument; interface nsIDOMDocument;
interface nsIDOMNode; interface nsIDOMNode;
interface nsIDOMWindow; interface nsIDOMWindow;
@@ -50,10 +49,9 @@ interface nsIDOMWindow;
* When accessibility is turned on in Gecko, * When accessibility is turned on in Gecko,
* there is an nsIAccessibleDocument for each document * there is an nsIAccessibleDocument for each document
* whether it is XUL, HTML or whatever. * whether it is XUL, HTML or whatever.
* You can QueryInterface to nsIAccessibleDocument from * You can QueryInterface to nsIAccessibleDocument from the nsIAccessible for
* the nsIAccessible or nsIAccessNode for the root node * the root node of a document. You can also get one from
* of a document. You can also get one from * nsIAccessible::GetAccessibleDocument() or
* nsIAccessNode::GetAccessibleDocument() or
* nsIAccessibleEvent::GetAccessibleDocument() * nsIAccessibleEvent::GetAccessibleDocument()
*/ */
[scriptable, uuid(451242bd-8a0c-4198-ae88-c053609a4e5d)] [scriptable, uuid(451242bd-8a0c-4198-ae88-c053609a4e5d)]

View File

@@ -441,10 +441,15 @@ interface nsIAccessibleEvent : nsISupports
*/ */
const unsigned long EVENT_OBJECT_ATTRIBUTE_CHANGED = 0x0055; const unsigned long EVENT_OBJECT_ATTRIBUTE_CHANGED = 0x0055;
/**
* A cursorable's virtual cursor has changed.
*/
const unsigned long EVENT_VIRTUALCURSOR_CHANGED = 0x0056;
/** /**
* Help make sure event map does not get out-of-line. * Help make sure event map does not get out-of-line.
*/ */
const unsigned long EVENT_LAST_ENTRY = 0x0056; const unsigned long EVENT_LAST_ENTRY = 0x0057;
/** /**
* The type of event, based on the enumerated event values * The type of event, based on the enumerated event values

View File

@@ -0,0 +1,221 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Eitan Isaacson <eitan@monotonous.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
typedef short TextBoundaryType;
interface nsIAccessible;
interface nsIAccessibleText;
interface nsIAccessibleTraversalRule;
interface nsIAccessiblePivotObserver;
/**
* The pivot interface encapsulates a reference to a single place in an accessible
* subtree. The pivot is a point or a range in the accessible tree. This interface
* provides traversal methods to move the pivot to next/prev state that complies
* to a given rule.
*/
[scriptable, uuid(689058ae-e301-444f-acb0-b5c2b189f350)]
interface nsIAccessiblePivot : nsISupports
{
const TextBoundaryType CHAR_BOUNDARY = 0;
const TextBoundaryType WORD_BOUNDARY = 1;
const TextBoundaryType LINE_BOUNDARY = 2;
const TextBoundaryType ATTRIBUTE_RANGE_BOUNDARY = 3;
/**
* The accessible the pivot is currently pointed at.
*/
attribute nsIAccessible position;
/**
* The root of the subtree in which the pivot traverses.
*/
readonly attribute nsIAccessible root;
/**
* The start offset of the text range the pivot points at, otherwise -1.
*/
readonly attribute long startOffset;
/**
* The end offset of the text range the pivot points at, otherwise -1.
*/
readonly attribute long endOffset;
/**
* Set the pivot's text range in a text accessible.
*
* @param aTextAccessible [in] the text accessible that contains the desired
* range.
* @param aStartOffset [in] the start offset to set.
* @param aEndOffset [in] the end offset to set.
* @throws NS_ERROR_INVALID_ARG when the offset exceeds the accessible's
* character count.
*/
void setTextRange(in nsIAccessibleText aTextAccessible,
in long aStartOffset, in long aEndOffset);
/**
* Move pivot to next object complying to given traversal rule.
*
* @param aRule [in] traversal rule to use.
* @return true on success, false if there are no new nodes to traverse to.
*/
boolean moveNext(in nsIAccessibleTraversalRule aRule);
/**
* Move pivot to previous object complying to given traversal rule.
*
* @param aRule [in] traversal rule to use.
* @return true on success, false if there are no new nodes to traverse to.
*/
boolean movePrevious(in nsIAccessibleTraversalRule aRule);
/**
* Move pivot to first object in subtree complying to given traversal rule.
*
* @param aRule [in] traversal rule to use.
* @return true on success, false if there are no new nodes to traverse to.
*/
boolean moveFirst(in nsIAccessibleTraversalRule aRule);
/**
* Move pivot to last object in subtree complying to given traversal rule.
*
* @param aRule [in] traversal rule to use.
* @return true on success, false if there are no new nodes to traverse to.
*/
boolean moveLast(in nsIAccessibleTraversalRule aRule);
/**
* Move pivot to next text range.
*
* @param aBoundary [in] type of boundary for next text range, character, word,
* etc.
* @return true on success, false if there are is no more text.
*/
boolean moveNextByText(in TextBoundaryType aBoundary);
/**
* Move pivot to previous text range.
*
* @param aBoundary [in] type of boundary for previous text range, character,
* word, etc.
* @return true on success, false if there are is no more text.
*/
boolean movePreviousByText(in TextBoundaryType aBoundary);
/**
* Add an observer for pivot changes.
*
* @param aObserver [in] the observer object to be notified of pivot changes.
*/
void addObserver(in nsIAccessiblePivotObserver aObserver);
/**
* Remove an observer for pivot changes.
*
* @param aObserver [in] the observer object to remove from being notified.
*/
void removeObserver(in nsIAccessiblePivotObserver aObserver);
};
/**
* An observer interface for pivot changes.
*/
[scriptable, uuid(b6508c5e-c081-467d-835c-613eedf9ee9b)]
interface nsIAccessiblePivotObserver : nsISupports
{
/**
* Called when the pivot changes.
*
* @param aPivot [in] the pivot that has changed.
* @param aOldAccessible [in] the old pivot position before the change, or null.
* @param aOldStart [in] the old start offset, or -1.
* @param aOldEnd [in] the old end offset, or -1.
*/
void onPivotChanged(in nsIAccessiblePivot aPivot,
in nsIAccessible aOldAccessible,
in long aOldStart, in long aOldEnd);
};
[scriptable, uuid(307d98b6-dba9-49cf-ba17-ef8b053044eb)]
interface nsIAccessibleTraversalRule : nsISupports
{
/* Ignore this accessible object */
const unsigned short FILTER_IGNORE = 0x0;
/* Accept this accessible object */
const unsigned short FILTER_MATCH = 0x1;
/* Don't traverse accessibles children */
const unsigned short FILTER_IGNORE_SUBTREE = 0x2;
/* Pre-filters */
const unsigned long PREFILTER_INVISIBLE = 0x00000001;
const unsigned long PREFILTER_OFFSCREEN = 0x00000002;
const unsigned long PREFILTER_NOT_FOCUSABLE = 0x00000004;
/**
* Pre-filter bitfield to filter out obviously ignorable nodes and lighten
* the load on match().
*/
readonly attribute unsigned long preFilter;
/**
* Retrieve a list of roles that the traversal rule should test for. Any node
* with a role not in this list will automatically be ignored. An empty list
* will match all roles. It should be assumed that this method is called once
* at the start of a traversal, so changing the method's return result after
* that would have no affect.
*
* @param aRoles [out] an array of the roles to match.
* @param aCount [out] the length of the array.
*/
void getMatchRoles([array, size_is(aCount)]out unsigned long aRoles,
[retval]out unsigned long aCount);
/**
* Determines if a given accessible is to be accepted in our traversal rule
*
* @param aAccessible [in] accessible to examine.
* @return a bitfield of FILTER_MATCH and FILTER_IGNORE_SUBTREE.
*/
unsigned short match(in nsIAccessible aAccessible);
};

View File

@@ -43,15 +43,12 @@ interface nsIAccessible;
interface nsIWeakReference; interface nsIWeakReference;
interface nsIPresShell; interface nsIPresShell;
interface nsIDOMWindow; interface nsIDOMWindow;
interface nsIAccessNode;
interface nsIDOMDOMStringList; interface nsIDOMDOMStringList;
interface nsIAccessiblePivot;
/** /**
* An interface for in-process accessibility clients * An interface for in-process accessibility clients wishing to get an
* wishing to get an nsIAccessible or nsIAccessNode for * nsIAccessible for a given DOM node. More documentation at:
* a given DOM node.
* More documentation at:
* http://www.mozilla.org/projects/ui/accessibility * http://www.mozilla.org/projects/ui/accessibility
*/ */
[scriptable, uuid(310ce77d-c92b-4761-82e8-77e1a728e8d4)] [scriptable, uuid(310ce77d-c92b-4761-82e8-77e1a728e8d4)]
@@ -112,6 +109,14 @@ interface nsIAccessibleRetrieval : nsISupports
* @return cached accessible for the given DOM node if any * @return cached accessible for the given DOM node if any
*/ */
nsIAccessible getAccessibleFromCache(in nsIDOMNode aNode); nsIAccessible getAccessibleFromCache(in nsIDOMNode aNode);
/**
* Create a new pivot for tracking a position and traversing a subtree.
*
* @param aRoot [in] the accessible root for the pivot
* @return a new pivot
*/
nsIAccessiblePivot createAccessiblePivot(in nsIAccessible aRoot);
}; };

View File

@@ -79,7 +79,7 @@ getDocumentLocaleCB(AtkDocument *aDocument)
return nsnull; return nsnull;
nsAutoString locale; nsAutoString locale;
accWrap->GetLanguage(locale); accWrap->Language(locale);
return locale.IsEmpty() ? nsnull : nsAccessibleWrap::ReturnString(locale); return locale.IsEmpty() ? nsnull : nsAccessibleWrap::ReturnString(locale);
} }

View File

@@ -65,6 +65,7 @@ CPPSRCS = \
nsAccUtils.cpp \ nsAccUtils.cpp \
nsAccessibilityService.cpp \ nsAccessibilityService.cpp \
nsAccessible.cpp \ nsAccessible.cpp \
nsAccessiblePivot.cpp \
nsAccTreeWalker.cpp \ nsAccTreeWalker.cpp \
nsBaseWidgetAccessible.cpp \ nsBaseWidgetAccessible.cpp \
nsEventShell.cpp \ nsEventShell.cpp \

View File

@@ -22,6 +22,7 @@
* *
* Contributor(s): * Contributor(s):
* Trevor Saunders <trev.saunders@gmail.com> (original author) * Trevor Saunders <trev.saunders@gmail.com> (original author)
* Andrzej Skalski <askalski@mozilla.com>
* *
* Alternatively, the contents of this file may be used under the terms of * Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or * either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -47,7 +48,7 @@ namespace a11y {
namespace statistics { namespace statistics {
inline void A11yInitialized() inline void A11yInitialized()
{ Telemetry::Accumulate(Telemetry::A11Y_INSTANTIATED, true); } { Telemetry::Accumulate(Telemetry::A11Y_INSTANTIATED, 1); }
inline void A11yConsumers(PRUint32 aConsumer) inline void A11yConsumers(PRUint32 aConsumer)
{ Telemetry::Accumulate(Telemetry::A11Y_CONSUMERS, aConsumer); } { Telemetry::Accumulate(Telemetry::A11Y_CONSUMERS, aConsumer); }
@@ -56,7 +57,13 @@ namespace statistics {
* Report that ISimpleDOM* has been used. * Report that ISimpleDOM* has been used.
*/ */
inline void ISimpleDOMUsed() inline void ISimpleDOMUsed()
{ Telemetry::Accumulate(Telemetry::ISIMPLE_DOM_USAGE, 1); } {
static bool firstTime = true;
if (firstTime) {
Telemetry::Accumulate(Telemetry::ISIMPLE_DOM_USAGE, 1);
firstTime = false;
}
}
/** /**
* Report that IAccessibleTable has been used. * Report that IAccessibleTable has been used.
@@ -64,6 +71,12 @@ namespace statistics {
inline void IAccessibleTableUsed() inline void IAccessibleTableUsed()
{ Telemetry::Accumulate(Telemetry::IACCESSIBLE_TABLE_USAGE, 1); } { Telemetry::Accumulate(Telemetry::IACCESSIBLE_TABLE_USAGE, 1); }
/**
* Report that XForms accessibility has been instantiated.
*/
inline void XFormsAccessibleUsed()
{ Telemetry::Accumulate(Telemetry::XFORMS_ACCESSIBLE_USED, 1); }
} // namespace statistics } // namespace statistics
} // namespace a11y } // namespace a11y
} // namespace mozilla } // namespace mozilla

View File

@@ -105,7 +105,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
roles::PUSHBUTTON, roles::PUSHBUTTON,
kUseMapRole, kUseMapRole,
eNoValue, eNoValue,
eClickAction, ePressAction,
eNoLiveAttr, eNoLiveAttr,
kNoReqStates, kNoReqStates,
eARIAPressed eARIAPressed
@@ -219,15 +219,6 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
eNoLiveAttr, eNoLiveAttr,
kNoReqStates kNoReqStates
}, },
{
"label",
roles::LABEL,
kUseMapRole,
eNoValue,
eNoAction,
eNoLiveAttr,
kNoReqStates
},
{ {
"link", "link",
roles::LINK, roles::LINK,

View File

@@ -78,6 +78,7 @@ enum EActionRule
eNoAction, eNoAction,
eActivateAction, eActivateAction,
eClickAction, eClickAction,
ePressAction,
eCheckUncheckAction, eCheckUncheckAction,
eExpandAction, eExpandAction,
eJumpAction, eJumpAction,

View File

@@ -40,7 +40,6 @@
#define nsAccUtils_h_ #define nsAccUtils_h_
#include "nsIAccessible.h" #include "nsIAccessible.h"
#include "nsIAccessNode.h"
#include "nsIAccessibleRole.h" #include "nsIAccessibleRole.h"
#include "nsIAccessibleText.h" #include "nsIAccessibleText.h"
#include "nsIAccessibleTable.h" #include "nsIAccessibleTable.h"

View File

@@ -36,37 +36,27 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsDocAccessible.h" #include "nsAccessNode.h"
#include "nsIAccessible.h"
#include "nsAccCache.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsHashtable.h"
#include "nsAccessibilityService.h" #include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsApplicationAccessibleWrap.h" #include "nsApplicationAccessibleWrap.h"
#include "nsCoreUtils.h"
#include "nsRootAccessible.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeItem.h"
#include "nsIDocument.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMWindow.h" #include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsIPrefService.h" #include "nsIInterfaceRequestorUtils.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch.h" #include "nsIPrefBranch.h"
#include "nsPresContext.h" #include "nsIPrefService.h"
#include "nsIPresShell.h" #include "nsIPresShell.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsIStringBundle.h" #include "nsIStringBundle.h"
#include "nsRootAccessible.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
#include "nsIObserverService.h" #include "nsPresContext.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
/* For documentation of the accessibility architecture, /* For documentation of the accessibility architecture,
@@ -89,9 +79,7 @@ nsApplicationAccessible *nsAccessNode::gApplicationAccessible = nsnull;
NS_IMPL_CYCLE_COLLECTION_1(nsAccessNode, mContent) NS_IMPL_CYCLE_COLLECTION_1(nsAccessNode, mContent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccessNode) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccessNode)
NS_INTERFACE_MAP_ENTRY(nsIAccessNode)
NS_INTERFACE_MAP_ENTRY(nsAccessNode) NS_INTERFACE_MAP_ENTRY(nsAccessNode)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessNode)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccessNode) NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccessNode)
@@ -287,126 +275,28 @@ nsAccessNode::IsPrimaryForNode() const
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsIAccessNode void
NS_IMETHODIMP
nsAccessNode::GetDOMNode(nsIDOMNode **aDOMNode)
{
NS_ENSURE_ARG_POINTER(aDOMNode);
*aDOMNode = nsnull;
nsINode *node = GetNode();
if (node)
CallQueryInterface(node, aDOMNode);
return NS_OK;
}
NS_IMETHODIMP
nsAccessNode::GetDocument(nsIAccessibleDocument **aDocument)
{
NS_ENSURE_ARG_POINTER(aDocument);
NS_IF_ADDREF(*aDocument = GetDocAccessible());
return NS_OK;
}
NS_IMETHODIMP
nsAccessNode::GetRootDocument(nsIAccessibleDocument **aRootDocument)
{
NS_ENSURE_ARG_POINTER(aRootDocument);
nsRootAccessible* rootDocument = RootAccessible();
NS_IF_ADDREF(*aRootDocument = rootDocument);
return NS_OK;
}
NS_IMETHODIMP
nsAccessNode::GetInnerHTML(nsAString& aInnerHTML)
{
aInnerHTML.Truncate();
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
NS_ENSURE_TRUE(htmlElement, NS_ERROR_NULL_POINTER);
return htmlElement->GetInnerHTML(aInnerHTML);
}
NS_IMETHODIMP
nsAccessNode::ScrollTo(PRUint32 aScrollType) nsAccessNode::ScrollTo(PRUint32 aScrollType)
{ {
if (IsDefunct()) if (IsDefunct())
return NS_ERROR_FAILURE; return;
nsCOMPtr<nsIPresShell> shell(GetPresShell()); nsCOMPtr<nsIPresShell> shell(GetPresShell());
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); if (!shell)
return;
nsIFrame *frame = GetFrame(); nsIFrame *frame = GetFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); if (!frame)
return;
nsCOMPtr<nsIContent> content = frame->GetContent(); nsIContent* content = frame->GetContent();
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); if (!content)
return;
PRInt16 vPercent, hPercent; PRInt16 vPercent, hPercent;
nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent); nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
return shell->ScrollContentIntoView(content, vPercent, hPercent, shell->ScrollContentIntoView(content, vPercent, hPercent,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN); nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
NS_IMETHODIMP
nsAccessNode::ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY)
{
nsIFrame *frame = GetFrame();
if (!frame)
return NS_ERROR_FAILURE;
nsIntPoint coords;
nsresult rv = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
this, &coords);
NS_ENSURE_SUCCESS(rv, rv);
nsIFrame *parentFrame = frame;
while ((parentFrame = parentFrame->GetParent()))
nsCoreUtils::ScrollFrameToPoint(parentFrame, frame, coords);
return NS_OK;
}
NS_IMETHODIMP
nsAccessNode::GetComputedStyleValue(const nsAString& aPseudoElt,
const nsAString& aPropertyName,
nsAString& aValue)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl =
nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent);
NS_ENSURE_TRUE(styleDecl, NS_ERROR_FAILURE);
return styleDecl->GetPropertyValue(aPropertyName, aValue);
}
NS_IMETHODIMP
nsAccessNode::GetComputedStyleCSSValue(const nsAString& aPseudoElt,
const nsAString& aPropertyName,
nsIDOMCSSPrimitiveValue **aCSSValue)
{
NS_ENSURE_ARG_POINTER(aCSSValue);
*aCSSValue = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl =
nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent);
NS_ENSURE_STATE(styleDecl);
nsCOMPtr<nsIDOMCSSValue> cssValue;
styleDecl->GetPropertyCSSValue(aPropertyName, getter_AddRefs(cssValue));
NS_ENSURE_TRUE(cssValue, NS_ERROR_FAILURE);
return CallQueryInterface(cssValue, aCSSValue);
} }
// nsAccessNode public // nsAccessNode public
@@ -443,20 +333,18 @@ nsAccessNode::GetCurrentFocus()
return focusedNode; return focusedNode;
} }
NS_IMETHODIMP void
nsAccessNode::GetLanguage(nsAString& aLanguage) nsAccessNode::Language(nsAString& aLanguage)
{ {
aLanguage.Truncate(); aLanguage.Truncate();
if (IsDefunct()) if (IsDefunct())
return NS_ERROR_FAILURE; return;
nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage); nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage);
if (aLanguage.IsEmpty()) { // Nothing found, so use document's language if (aLanguage.IsEmpty()) { // Nothing found, so use document's language
mContent->OwnerDoc()->GetHeaderData(nsGkAtoms::headerContentLanguage, mContent->OwnerDoc()->GetHeaderData(nsGkAtoms::headerContentLanguage,
aLanguage); aLanguage);
} }
return NS_OK;
} }

View File

@@ -43,7 +43,6 @@
#ifndef _nsAccessNode_H_ #ifndef _nsAccessNode_H_
#define _nsAccessNode_H_ #define _nsAccessNode_H_
#include "nsIAccessNode.h"
#include "nsIAccessibleTypes.h" #include "nsIAccessibleTypes.h"
#include "a11yGeneric.h" #include "a11yGeneric.h"
@@ -68,15 +67,7 @@ class nsIDocShellTreeItem;
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties" #define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties" #define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
#define NS_ACCESSNODE_IMPL_CID \ class nsAccessNode: public nsISupports
{ /* 2b07e3d7-00b3-4379-aa0b-ea22e2c8ffda */ \
0x2b07e3d7, \
0x00b3, \
0x4379, \
{ 0xaa, 0x0b, 0xea, 0x22, 0xe2, 0xc8, 0xff, 0xda } \
}
class nsAccessNode: public nsIAccessNode
{ {
public: public:
@@ -84,10 +75,7 @@ public:
virtual ~nsAccessNode(); virtual ~nsAccessNode();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsAccessNode, nsIAccessNode) NS_DECL_CYCLE_COLLECTION_CLASS(nsAccessNode)
NS_DECL_NSIACCESSNODE
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSNODE_IMPL_CID)
static void InitXPAccessibility(); static void InitXPAccessibility();
static void ShutdownXPAccessibility(); static void ShutdownXPAccessibility();
@@ -134,18 +122,6 @@ public:
* Return frame for the given access node object. * Return frame for the given access node object.
*/ */
virtual nsIFrame* GetFrame() const; virtual nsIFrame* GetFrame() const;
/**
* Return DOM node associated with this accessible.
*/
already_AddRefed<nsIDOMNode> GetDOMNode() const
{
nsIDOMNode *DOMNode = nsnull;
if (GetNode())
CallQueryInterface(GetNode(), &DOMNode);
return DOMNode;
}
/** /**
* Return DOM node associated with the accessible. * Return DOM node associated with the accessible.
*/ */
@@ -195,6 +171,18 @@ public:
*/ */
virtual bool IsPrimaryForNode() const; virtual bool IsPrimaryForNode() const;
/**
* Return the string bundle
*/
static nsIStringBundle* GetStringBundle()
{ return gStringBundle; }
/**
* Interface methods on nsIAccessible shared with ISimpleDOM.
*/
void Language(nsAString& aLocale);
void ScrollTo(PRUint32 aType);
protected: protected:
nsPresContext* GetPresContext(); nsPresContext* GetPresContext();
@@ -221,8 +209,5 @@ private:
static nsApplicationAccessible *gApplicationAccessible; static nsApplicationAccessible *gApplicationAccessible;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessNode,
NS_ACCESSNODE_IMPL_CID)
#endif #endif

View File

@@ -40,6 +40,7 @@
// NOTE: alphabetically ordered // NOTE: alphabetically ordered
#include "nsAccessibilityService.h" #include "nsAccessibilityService.h"
#include "nsAccessiblePivot.h"
#include "nsCoreUtils.h" #include "nsCoreUtils.h"
#include "nsAccUtils.h" #include "nsAccUtils.h"
#include "nsApplicationAccessibleWrap.h" #include "nsApplicationAccessibleWrap.h"
@@ -864,6 +865,23 @@ nsAccessibilityService::GetAccessibleFromCache(nsIDOMNode* aNode,
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsAccessibilityService::CreateAccessiblePivot(nsIAccessible* aRoot,
nsIAccessiblePivot** aPivot)
{
NS_ENSURE_ARG_POINTER(aPivot);
NS_ENSURE_ARG(aRoot);
*aPivot = nsnull;
nsRefPtr<nsAccessible> accessibleRoot(do_QueryObject(aRoot));
NS_ENSURE_TRUE(accessibleRoot, NS_ERROR_INVALID_ARG);
nsAccessiblePivot* pivot = new nsAccessiblePivot(accessibleRoot);
NS_ADDREF(*aPivot = pivot);
return NS_OK;
}
// nsIAccesibilityService // nsIAccesibilityService
nsAccessible* nsAccessible*
nsAccessibilityService::GetAccessibleInShell(nsINode* aNode, nsAccessibilityService::GetAccessibleInShell(nsINode* aNode,

View File

@@ -534,6 +534,7 @@ static const char kEventTypeNames[][40] = {
"hypertext changed", // EVENT_HYPERTEXT_CHANGED "hypertext changed", // EVENT_HYPERTEXT_CHANGED
"hypertext links count changed", // EVENT_HYPERTEXT_NLINKS_CHANGED "hypertext links count changed", // EVENT_HYPERTEXT_NLINKS_CHANGED
"object attribute changed", // EVENT_OBJECT_ATTRIBUTE_CHANGED "object attribute changed", // EVENT_OBJECT_ATTRIBUTE_CHANGED
"virtual cursor changed" // EVENT_VIRTUALCURSOR_CHANGED
}; };
/** /**

View File

@@ -52,11 +52,14 @@
#include "nsAccessibilityService.h" #include "nsAccessibilityService.h"
#include "nsAccTreeWalker.h" #include "nsAccTreeWalker.h"
#include "nsIAccessibleRelation.h" #include "nsIAccessibleRelation.h"
#include "nsRootAccessible.h"
#include "nsTextEquivUtils.h" #include "nsTextEquivUtils.h"
#include "Relation.h" #include "Relation.h"
#include "Role.h" #include "Role.h"
#include "States.h" #include "States.h"
#include "nsIDOMCSSValue.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMDocumentXBL.h" #include "nsIDOMDocumentXBL.h"
@@ -229,6 +232,92 @@ nsAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
mRoleMapEntry = aRoleMapEntry; mRoleMapEntry = aRoleMapEntry;
} }
NS_IMETHODIMP
nsAccessible::GetComputedStyleValue(const nsAString& aPseudoElt,
const nsAString& aPropertyName,
nsAString& aValue)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl =
nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent);
NS_ENSURE_TRUE(styleDecl, NS_ERROR_FAILURE);
return styleDecl->GetPropertyValue(aPropertyName, aValue);
}
NS_IMETHODIMP
nsAccessible::GetComputedStyleCSSValue(const nsAString& aPseudoElt,
const nsAString& aPropertyName,
nsIDOMCSSPrimitiveValue **aCSSValue) {
NS_ENSURE_ARG_POINTER(aCSSValue);
*aCSSValue = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl =
nsCoreUtils::GetComputedStyleDeclaration(aPseudoElt, mContent);
NS_ENSURE_STATE(styleDecl);
nsCOMPtr<nsIDOMCSSValue> cssValue;
styleDecl->GetPropertyCSSValue(aPropertyName, getter_AddRefs(cssValue));
NS_ENSURE_TRUE(cssValue, NS_ERROR_FAILURE);
return CallQueryInterface(cssValue, aCSSValue);
}
NS_IMETHODIMP
nsAccessible::GetDocument(nsIAccessibleDocument **aDocument)
{
NS_ENSURE_ARG_POINTER(aDocument);
NS_IF_ADDREF(*aDocument = GetDocAccessible());
return NS_OK;
}
NS_IMETHODIMP
nsAccessible::GetDOMNode(nsIDOMNode **aDOMNode)
{
NS_ENSURE_ARG_POINTER(aDOMNode);
*aDOMNode = nsnull;
nsINode *node = GetNode();
if (node)
CallQueryInterface(node, aDOMNode);
return NS_OK;
}
NS_IMETHODIMP
nsAccessible::GetRootDocument(nsIAccessibleDocument **aRootDocument)
{
NS_ENSURE_ARG_POINTER(aRootDocument);
nsRootAccessible* rootDocument = RootAccessible();
NS_IF_ADDREF(*aRootDocument = rootDocument);
return NS_OK;
}
NS_IMETHODIMP
nsAccessible::GetInnerHTML(nsAString& aInnerHTML)
{
aInnerHTML.Truncate();
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
NS_ENSURE_TRUE(htmlElement, NS_ERROR_NULL_POINTER);
return htmlElement->GetInnerHTML(aInnerHTML);
}
NS_IMETHODIMP
nsAccessible::GetLanguage(nsAString& aLanguage)
{
Language(aLanguage);
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsAccessible::GetName(nsAString& aName) nsAccessible::GetName(nsAString& aName)
{ {
@@ -551,7 +640,7 @@ nsAccessible::GetChildren(nsIArray **aOutChildren)
} }
bool bool
nsAccessible::GetAllowsAnonChildAccessibles() nsAccessible::CanHaveAnonChildren()
{ {
return true; return true;
} }
@@ -1374,6 +1463,30 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::textIndent, value); nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::textIndent, value);
// Expose 'margin-left' attribute.
rv = GetComputedStyleValue(EmptyString(), NS_LITERAL_STRING("margin-left"),
value);
if (NS_SUCCEEDED(rv))
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginLeft, value);
// Expose 'margin-right' attribute.
rv = GetComputedStyleValue(EmptyString(), NS_LITERAL_STRING("margin-right"),
value);
if (NS_SUCCEEDED(rv))
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginRight, value);
// Expose 'margin-top' attribute.
rv = GetComputedStyleValue(EmptyString(), NS_LITERAL_STRING("margin-top"),
value);
if (NS_SUCCEEDED(rv))
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginTop, value);
// Expose 'margin-bottom' attribute.
rv = GetComputedStyleValue(EmptyString(), NS_LITERAL_STRING("margin-bottom"),
value);
if (NS_SUCCEEDED(rv))
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::marginBottom, value);
// Expose draggable object attribute? // Expose draggable object attribute?
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent); nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
if (htmlElement) { if (htmlElement) {
@@ -1828,6 +1941,10 @@ nsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
aName.AssignLiteral("click"); aName.AssignLiteral("click");
return NS_OK; return NS_OK;
case ePressAction:
aName.AssignLiteral("press");
return NS_OK;
case eCheckUncheckAction: case eCheckUncheckAction:
if (states & states::CHECKED) if (states & states::CHECKED)
aName.AssignLiteral("uncheck"); aName.AssignLiteral("uncheck");
@@ -2172,6 +2289,32 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, presShell, aContent); nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, presShell, aContent);
} }
NS_IMETHODIMP
nsAccessible::ScrollTo(PRUint32 aHow)
{
nsAccessNode::ScrollTo(aHow);
return NS_OK;
}
NS_IMETHODIMP
nsAccessible::ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY)
{
nsIFrame *frame = GetFrame();
if (!frame)
return NS_ERROR_FAILURE;
nsIntPoint coords;
nsresult rv = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
this, &coords);
NS_ENSURE_SUCCESS(rv, rv);
nsIFrame *parentFrame = frame;
while ((parentFrame = parentFrame->GetParent()))
nsCoreUtils::ScrollFrameToPoint(parentFrame, frame, coords);
return NS_OK;
}
// nsIAccessibleSelectable // nsIAccessibleSelectable
NS_IMETHODIMP nsAccessible::GetSelectedChildren(nsIArray **aSelectedAccessibles) NS_IMETHODIMP nsAccessible::GetSelectedChildren(nsIArray **aSelectedAccessibles)
{ {
@@ -2936,7 +3079,7 @@ nsAccessible::ContainerWidget() const
void void
nsAccessible::CacheChildren() nsAccessible::CacheChildren()
{ {
nsAccTreeWalker walker(mWeakShell, mContent, GetAllowsAnonChildAccessibles()); nsAccTreeWalker walker(mWeakShell, mContent, CanHaveAnonChildren());
nsAccessible* child = nsnull; nsAccessible* child = nsnull;
while ((child = walker.NextChild()) && AppendChild(child)); while ((child = walker.NextChild()) && AppendChild(child));

View File

@@ -129,6 +129,17 @@ public:
*/ */
virtual void Description(nsString& aDescription); virtual void Description(nsString& aDescription);
/**
* Return DOM node associated with this accessible.
*/
inline already_AddRefed<nsIDOMNode> DOMNode() const
{
nsIDOMNode *DOMNode = nsnull;
if (GetNode())
CallQueryInterface(GetNode(), &DOMNode);
return DOMNode;
}
/** /**
* Returns the accessible name specified by ARIA. * Returns the accessible name specified by ARIA.
*/ */
@@ -388,9 +399,9 @@ public:
virtual nsresult HandleAccEvent(AccEvent* aAccEvent); virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
/** /**
* Return true if there are accessible children in anonymous content * Return true if this accessible allows accessible children from anonymous subtree.
*/ */
virtual bool GetAllowsAnonChildAccessibles(); virtual bool CanHaveAnonChildren();
/** /**
* Returns text of accessible if accessible has text role otherwise empty * Returns text of accessible if accessible has text role otherwise empty

View File

@@ -0,0 +1,526 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Eitan Isaacson <eitan@monotonous.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessiblePivot.h"
#include "nsAccessible.h"
#include "nsAccUtils.h"
#include "nsHyperTextAccessible.h"
#include "States.h"
#include "nsArrayUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsISupportsPrimitives.h"
using namespace mozilla::a11y;
/**
* An object that stores a given traversal rule during
*/
class RuleCache
{
public:
RuleCache(nsIAccessibleTraversalRule* aRule) : mRule(aRule),
mAcceptRoles(nsnull) { }
~RuleCache () {
if (mAcceptRoles)
nsMemory::Free(mAcceptRoles);
}
nsresult ApplyFilter(nsAccessible* aAccessible, PRUint16* aResult);
private:
nsCOMPtr<nsIAccessibleTraversalRule> mRule;
PRUint32* mAcceptRoles;
PRUint32 mAcceptRolesLength;
PRUint32 mPreFilter;
};
////////////////////////////////////////////////////////////////////////////////
// nsAccessiblePivot
nsAccessiblePivot::nsAccessiblePivot(nsAccessible* aRoot) :
mRoot(aRoot), mPosition(nsnull),
mStartOffset(-1), mEndOffset(-1)
{
NS_ASSERTION(aRoot, "A root accessible is required");
}
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_CYCLE_COLLECTION_CLASS(nsAccessiblePivot)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsAccessiblePivot)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mRoot, nsIAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mPosition, nsIAccessible)
PRUint32 i, length = tmp->mObservers.Length(); \
for (i = 0; i < length; ++i) {
cb.NoteXPCOMChild(tmp->mObservers.ElementAt(i).get());
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsAccessiblePivot)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mRoot)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPosition)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mObservers)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccessiblePivot)
NS_INTERFACE_MAP_ENTRY(nsIAccessiblePivot)
NS_INTERFACE_MAP_ENTRY(nsAccessiblePivot)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessiblePivot)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccessiblePivot)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAccessiblePivot)
////////////////////////////////////////////////////////////////////////////////
// nsIAccessiblePivot
NS_IMETHODIMP
nsAccessiblePivot::GetRoot(nsIAccessible** aRoot)
{
NS_ENSURE_ARG_POINTER(aRoot);
NS_IF_ADDREF(*aRoot = mRoot);
return NS_OK;
}
NS_IMETHODIMP
nsAccessiblePivot::GetPosition(nsIAccessible** aPosition)
{
NS_ENSURE_ARG_POINTER(aPosition);
NS_IF_ADDREF(*aPosition = mPosition);
return NS_OK;
}
NS_IMETHODIMP
nsAccessiblePivot::SetPosition(nsIAccessible* aPosition)
{
nsRefPtr<nsAccessible> secondPosition;
if (aPosition) {
secondPosition = do_QueryObject(aPosition);
if (!secondPosition || !IsRootDescendant(secondPosition))
return NS_ERROR_INVALID_ARG;
}
// Swap old position with new position, saves us an AddRef/Release.
mPosition.swap(secondPosition);
PRInt32 oldStart = mStartOffset, oldEnd = mEndOffset;
mStartOffset = mEndOffset = -1;
NotifyPivotChanged(secondPosition, oldStart, oldEnd);
return NS_OK;
}
NS_IMETHODIMP
nsAccessiblePivot::GetStartOffset(PRInt32* aStartOffset)
{
NS_ENSURE_ARG_POINTER(aStartOffset);
*aStartOffset = mStartOffset;
return NS_OK;
}
NS_IMETHODIMP
nsAccessiblePivot::GetEndOffset(PRInt32* aEndOffset)
{
NS_ENSURE_ARG_POINTER(aEndOffset);
*aEndOffset = mEndOffset;
return NS_OK;
}
NS_IMETHODIMP
nsAccessiblePivot::SetTextRange(nsIAccessibleText* aTextAccessible,
PRInt32 aStartOffset, PRInt32 aEndOffset)
{
NS_ENSURE_ARG(aTextAccessible);
// Check that start offset is smaller than end offset, and that if a value is
// smaller than 0, both should be -1.
NS_ENSURE_TRUE(aStartOffset <= aEndOffset &&
(aStartOffset >= 0 || (aStartOffset != -1 && aEndOffset != -1)),
NS_ERROR_INVALID_ARG);
nsRefPtr<nsHyperTextAccessible> newPosition = do_QueryObject(aTextAccessible);
if (!newPosition || !IsRootDescendant(newPosition))
return NS_ERROR_INVALID_ARG;
// Make sure the given offsets don't exceed the character count.
PRInt32 charCount = newPosition->CharacterCount();
if (aEndOffset > charCount)
return NS_ERROR_FAILURE;
PRInt32 oldStart = mStartOffset, oldEnd = mEndOffset;
mStartOffset = aStartOffset;
mEndOffset = aEndOffset;
nsRefPtr<nsAccessible> oldPosition = mPosition.forget();
mPosition = newPosition.forget();
NotifyPivotChanged(oldPosition, oldStart, oldEnd);
return NS_OK;
}
// Traversal functions
NS_IMETHODIMP
nsAccessiblePivot::MoveNext(nsIAccessibleTraversalRule* aRule, bool* aResult)
{
NS_ENSURE_ARG(aResult);
NS_ENSURE_ARG(aRule);
nsresult rv = NS_OK;
nsAccessible* accessible = SearchForward(mPosition, aRule, false, &rv);
NS_ENSURE_SUCCESS(rv, rv);
*aResult = accessible;
if (*aResult)
MovePivotInternal(accessible);
return NS_OK;
}
NS_IMETHODIMP
nsAccessiblePivot::MovePrevious(nsIAccessibleTraversalRule* aRule, bool* aResult)
{
NS_ENSURE_ARG(aResult);
NS_ENSURE_ARG(aRule);
nsresult rv = NS_OK;
nsAccessible* accessible = SearchBackward(mPosition, aRule, false, &rv);
NS_ENSURE_SUCCESS(rv, rv);
*aResult = accessible;
if (*aResult)
MovePivotInternal(accessible);
return NS_OK;
}
NS_IMETHODIMP
nsAccessiblePivot::MoveFirst(nsIAccessibleTraversalRule* aRule, bool* aResult)
{
NS_ENSURE_ARG(aResult);
NS_ENSURE_ARG(aRule);
nsresult rv = NS_OK;
nsAccessible* accessible = SearchForward(mRoot, aRule, true, &rv);
NS_ENSURE_SUCCESS(rv, rv);
*aResult = accessible;
if (*aResult)
MovePivotInternal(accessible);
return NS_OK;
}
NS_IMETHODIMP
nsAccessiblePivot::MoveLast(nsIAccessibleTraversalRule* aRule, bool* aResult)
{
NS_ENSURE_ARG(aResult);
NS_ENSURE_ARG(aRule);
*aResult = false;
nsresult rv = NS_OK;
nsAccessible* lastAccessible = mRoot;
nsAccessible* accessible = nsnull;
// First got to the last accessible in pre-order
while (lastAccessible->HasChildren())
lastAccessible = lastAccessible->LastChild();
// Search backwards from last accessible and find the last occurrence in the doc
accessible = SearchBackward(lastAccessible, aRule, true, &rv);
NS_ENSURE_SUCCESS(rv, rv);
*aResult = accessible;
if (*aResult)
MovePivotInternal(accessible);
return NS_OK;
}
// TODO: Implement
NS_IMETHODIMP
nsAccessiblePivot::MoveNextByText(TextBoundaryType aBoundary, bool* aResult)
{
NS_ENSURE_ARG(aResult);
*aResult = false;
return NS_ERROR_NOT_IMPLEMENTED;
}
// TODO: Implement
NS_IMETHODIMP
nsAccessiblePivot::MovePreviousByText(TextBoundaryType aBoundary, bool* aResult)
{
NS_ENSURE_ARG(aResult);
*aResult = false;
return NS_ERROR_NOT_IMPLEMENTED;
}
// Observer functions
NS_IMETHODIMP
nsAccessiblePivot::AddObserver(nsIAccessiblePivotObserver* aObserver)
{
NS_ENSURE_ARG(aObserver);
mObservers.AppendElement(aObserver);
return NS_OK;
}
NS_IMETHODIMP
nsAccessiblePivot::RemoveObserver(nsIAccessiblePivotObserver* aObserver)
{
NS_ENSURE_ARG(aObserver);
return mObservers.RemoveElement(aObserver) ? NS_OK : NS_ERROR_FAILURE;
}
// Private utility methods
bool
nsAccessiblePivot::IsRootDescendant(nsAccessible* aAccessible)
{
nsAccessible* accessible = aAccessible;
do {
if (accessible == mRoot)
return true;
} while ((accessible = accessible->Parent()));
return false;
}
void
nsAccessiblePivot::MovePivotInternal(nsAccessible* aPosition)
{
nsRefPtr<nsAccessible> oldPosition = mPosition.forget();
mPosition = aPosition;
PRInt32 oldStart = mStartOffset, oldEnd = mEndOffset;
mStartOffset = mEndOffset = -1;
NotifyPivotChanged(oldPosition, oldStart, oldEnd);
}
nsAccessible*
nsAccessiblePivot::SearchBackward(nsAccessible* aAccessible,
nsIAccessibleTraversalRule* aRule,
bool searchCurrent,
nsresult* rv)
{
*rv = NS_OK;
// Initial position could be unset, in that case return null.
if (!aAccessible)
return nsnull;
RuleCache cache(aRule);
nsAccessible* accessible = aAccessible;
PRUint16 filtered = nsIAccessibleTraversalRule::FILTER_IGNORE;
if (searchCurrent) {
*rv = cache.ApplyFilter(accessible, &filtered);
NS_ENSURE_SUCCESS(*rv, nsnull);
if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
return accessible;
}
while (accessible != mRoot) {
nsAccessible* parent = accessible->Parent();
PRInt32 idxInParent = accessible->IndexInParent();
while (idxInParent > 0) {
if (!(accessible = parent->GetChildAt(--idxInParent)))
continue;
*rv = cache.ApplyFilter(accessible, &filtered);
NS_ENSURE_SUCCESS(*rv, nsnull);
nsAccessible* lastChild;
while (!(filtered & nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE) &&
(lastChild = accessible->LastChild())) {
parent = accessible;
accessible = lastChild;
*rv = cache.ApplyFilter(accessible, &filtered);
NS_ENSURE_SUCCESS(*rv, nsnull);
}
if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
return accessible;
}
if (!(accessible = parent))
break;
*rv = cache.ApplyFilter(accessible, &filtered);
NS_ENSURE_SUCCESS(*rv, nsnull);
if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
return accessible;
}
return nsnull;
}
nsAccessible*
nsAccessiblePivot::SearchForward(nsAccessible* aAccessible,
nsIAccessibleTraversalRule* aRule,
bool searchCurrent,
nsresult* rv)
{
*rv = NS_OK;
// Initial position could be not set, in that case begin search from root.
nsAccessible *accessible = (!aAccessible) ? mRoot.get() : aAccessible;
RuleCache cache(aRule);
PRUint16 filtered = nsIAccessibleTraversalRule::FILTER_IGNORE;
*rv = cache.ApplyFilter(accessible, &filtered);
NS_ENSURE_SUCCESS(*rv, nsnull);
if (searchCurrent && (filtered & nsIAccessibleTraversalRule::FILTER_MATCH))
return accessible;
while (true) {
nsAccessible* firstChild = nsnull;
while (!(filtered & nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE) &&
(firstChild = accessible->FirstChild())) {
accessible = firstChild;
*rv = cache.ApplyFilter(accessible, &filtered);
NS_ENSURE_SUCCESS(*rv, nsnull);
if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
return accessible;
}
nsAccessible* sibling = nsnull;
nsAccessible* temp = accessible;
do {
if (temp == mRoot)
break;
sibling = temp->NextSibling();
if (sibling)
break;
} while ((temp = temp->Parent()));
if (!sibling)
break;
accessible = sibling;
*rv = cache.ApplyFilter(accessible, &filtered);
NS_ENSURE_SUCCESS(*rv, nsnull);
if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
return accessible;
}
return nsnull;
}
void
nsAccessiblePivot::NotifyPivotChanged(nsAccessible* aOldPosition,
PRInt32 aOldStart, PRInt32 aOldEnd)
{
nsTObserverArray<nsCOMPtr<nsIAccessiblePivotObserver> >::ForwardIterator iter(mObservers);
while (iter.HasMore()) {
nsIAccessiblePivotObserver* obs = iter.GetNext();
obs->OnPivotChanged(this, aOldPosition, aOldStart, aOldEnd);
}
}
nsresult
RuleCache::ApplyFilter(nsAccessible* aAccessible, PRUint16* aResult)
{
*aResult = nsIAccessibleTraversalRule::FILTER_IGNORE;
if (!mAcceptRoles) {
nsresult rv = mRule->GetMatchRoles(&mAcceptRoles, &mAcceptRolesLength);
NS_ENSURE_SUCCESS(rv, rv);
rv = mRule->GetPreFilter(&mPreFilter);
NS_ENSURE_SUCCESS(rv, rv);
}
if (mPreFilter) {
PRUint64 state = aAccessible->State();
if ((nsIAccessibleTraversalRule::PREFILTER_INVISIBLE & mPreFilter) &&
(state & states::INVISIBLE))
return NS_OK;
if ((nsIAccessibleTraversalRule::PREFILTER_OFFSCREEN & mPreFilter) &&
(state & states::OFFSCREEN))
return NS_OK;
if ((nsIAccessibleTraversalRule::PREFILTER_NOT_FOCUSABLE & mPreFilter) &&
!(state & states::FOCUSABLE))
return NS_OK;
}
if (mAcceptRolesLength > 0) {
PRUint32 accessibleRole = aAccessible->Role();
bool matchesRole = false;
for (PRUint32 idx = 0; idx < mAcceptRolesLength; idx++) {
matchesRole = mAcceptRoles[idx] == accessibleRole;
if (matchesRole)
break;
}
if (!matchesRole)
return NS_OK;
}
return mRule->Match(aAccessible, aResult);
}

View File

@@ -0,0 +1,134 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Eitan Isaacson <eitan@monotonous.org> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsAccessiblePivot_H_
#define _nsAccessiblePivot_H_
#include "nsIAccessiblePivot.h"
#include "nsAutoPtr.h"
#include "nsTObserverArray.h"
#include "nsCycleCollectionParticipant.h"
class nsAccessible;
class nsIAccessibleTraversalRule;
/**
* Class represents an accessible pivot.
*/
class nsAccessiblePivot: public nsIAccessiblePivot
{
public:
nsAccessiblePivot(nsAccessible* aRoot);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsAccessiblePivot, nsIAccessiblePivot)
NS_DECL_NSIACCESSIBLEPIVOT
/*
* A simple getter for the pivot's position.
*/
nsAccessible* Position() { return mPosition; }
private:
nsAccessiblePivot() MOZ_DELETE;
nsAccessiblePivot(const nsAccessiblePivot&) MOZ_DELETE;
void operator = (const nsAccessiblePivot&) MOZ_DELETE;
/*
* Notify all observers on a pivot change.
*/
void NotifyPivotChanged(nsAccessible* aOldAccessible,
PRInt32 aOldStart, PRInt32 aOldEnd);
/*
* Check to see that the given accessible is in the pivot's subtree.
*/
bool IsRootDescendant(nsAccessible* aAccessible);
/*
* Search in preorder for the first accessible to match the rule.
*/
nsAccessible* SearchForward(nsAccessible* aAccessible,
nsIAccessibleTraversalRule* aRule,
bool searchCurrent,
nsresult* rv);
/*
* Reverse search in preorder for the first accessible to match the rule.
*/
nsAccessible* SearchBackward(nsAccessible* aAccessible,
nsIAccessibleTraversalRule* aRule,
bool searchCurrent,
nsresult* rv);
/*
* Update the pivot, and notify observers.
*/
void MovePivotInternal(nsAccessible* aPosition);
/*
* The root accessible.
*/
nsRefPtr<nsAccessible> mRoot;
/*
* The current pivot position.
*/
nsRefPtr<nsAccessible> mPosition;
/*
* The text start offset ofthe pivot.
*/
PRInt32 mStartOffset;
/*
* The text end offset ofthe pivot.
*/
PRInt32 mEndOffset;
/*
* The list of pivot-changed observers.
*/
nsTObserverArray<nsCOMPtr<nsIAccessiblePivotObserver> > mObservers;
};
#endif

View File

@@ -421,7 +421,7 @@ nsApplicationAccessible::GetSiblingAtOffset(PRInt32 aOffset,
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsIAccessNode and nsAccessNode // nsIAccessible
NS_IMETHODIMP NS_IMETHODIMP
nsApplicationAccessible::GetDOMNode(nsIDOMNode **aDOMNode) nsApplicationAccessible::GetDOMNode(nsIDOMNode **aDOMNode)

View File

@@ -69,7 +69,7 @@ public:
// nsISupports // nsISupports
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
// nsIAccessNode // nsIAccessible
NS_SCRIPTABLE NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode); NS_SCRIPTABLE NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode);
NS_SCRIPTABLE NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument); NS_SCRIPTABLE NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument);
NS_SCRIPTABLE NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument); NS_SCRIPTABLE NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument);
@@ -83,8 +83,6 @@ public:
const nsAString& aPropertyName, const nsAString& aPropertyName,
nsIDOMCSSPrimitiveValue** aValue NS_OUTPARAM); nsIDOMCSSPrimitiveValue** aValue NS_OUTPARAM);
NS_SCRIPTABLE NS_IMETHOD GetLanguage(nsAString& aLanguage); NS_SCRIPTABLE NS_IMETHOD GetLanguage(nsAString& aLanguage);
// nsIAccessible
NS_IMETHOD GetParent(nsIAccessible **aParent); NS_IMETHOD GetParent(nsIAccessible **aParent);
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling); NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling); NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);

View File

@@ -191,7 +191,7 @@ public:
/** /**
* Scrolls the given frame to the point, used for implememntation of * Scrolls the given frame to the point, used for implememntation of
* nsIAccessNode::scrollToPoint and nsIAccessibleText::scrollSubstringToPoint. * nsIAccessible::scrollToPoint and nsIAccessibleText::scrollSubstringToPoint.
* *
* @param aScrollableFrame the scrollable frame * @param aScrollableFrame the scrollable frame
* @param aFrame the frame to scroll * @param aFrame the frame to scroll

View File

@@ -39,6 +39,7 @@
#include "AccIterator.h" #include "AccIterator.h"
#include "nsAccCache.h" #include "nsAccCache.h"
#include "nsAccessibilityService.h" #include "nsAccessibilityService.h"
#include "nsAccessiblePivot.h"
#include "nsAccTreeWalker.h" #include "nsAccTreeWalker.h"
#include "nsAccUtils.h" #include "nsAccUtils.h"
#include "nsRootAccessible.h" #include "nsRootAccessible.h"
@@ -105,7 +106,8 @@ nsDocAccessible::
nsIWeakReference *aShell) : nsIWeakReference *aShell) :
nsHyperTextAccessibleWrap(aRootContent, aShell), nsHyperTextAccessibleWrap(aRootContent, aShell),
mDocument(aDocument), mScrollPositionChangedTicks(0), mDocument(aDocument), mScrollPositionChangedTicks(0),
mLoadState(eTreeConstructionPending), mLoadEventType(0) mLoadState(eTreeConstructionPending), mLoadEventType(0),
mVirtualCursor(nsnull)
{ {
mFlags |= eDocAccessible; mFlags |= eDocAccessible;
@@ -125,6 +127,10 @@ nsDocAccessible::
// nsAccDocManager creates document accessible when scrollable frame is // nsAccDocManager creates document accessible when scrollable frame is
// available already, it should be safe time to add scroll listener. // available already, it should be safe time to add scroll listener.
AddScrollListener(); AddScrollListener();
// We provide a virtual cursor if this is a root doc or if it's a tab doc.
mIsCursorable = (!(mDocument->GetParentDocument()) ||
nsCoreUtils::IsTabDocument(mDocument));
} }
nsDocAccessible::~nsDocAccessible() nsDocAccessible::~nsDocAccessible()
@@ -142,6 +148,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mNotificationController, NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mNotificationController,
NotificationController) NotificationController)
if (tmp->mVirtualCursor) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mVirtualCursor,
nsAccessiblePivot)
}
PRUint32 i, length = tmp->mChildDocuments.Length(); PRUint32 i, length = tmp->mChildDocuments.Length();
for (i = 0; i < length; ++i) { for (i = 0; i < length; ++i) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mChildDocuments[i], NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mChildDocuments[i],
@@ -154,6 +165,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDocAccessible, nsAccessible) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNotificationController) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNotificationController)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mVirtualCursor)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mChildDocuments) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mChildDocuments)
tmp->mDependentIDsHash.Clear(); tmp->mDependentIDsHash.Clear();
tmp->mNodeToAccessibleMap.Clear(); tmp->mNodeToAccessibleMap.Clear();
@@ -167,7 +179,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDocAccessible)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver) NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsIAccessiblePivotObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleDocument) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleDocument)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleCursorable,
mIsCursorable)
foundInterface = 0; foundInterface = 0;
nsresult status; nsresult status;
@@ -516,6 +531,27 @@ nsDocAccessible::GetChildDocumentAt(PRUint32 aIndex,
return *aDocument ? NS_OK : NS_ERROR_INVALID_ARG; return *aDocument ? NS_OK : NS_ERROR_INVALID_ARG;
} }
// nsIAccessibleVirtualCursor method
NS_IMETHODIMP
nsDocAccessible::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor)
{
NS_ENSURE_ARG_POINTER(aVirtualCursor);
*aVirtualCursor = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_ENSURE_TRUE(mIsCursorable, NS_ERROR_NOT_IMPLEMENTED);
if (!mVirtualCursor) {
mVirtualCursor = new nsAccessiblePivot(this);
mVirtualCursor->AddObserver(this);
}
NS_ADDREF(*aVirtualCursor = mVirtualCursor);
return NS_OK;
}
// nsIAccessibleHyperText method // nsIAccessibleHyperText method
NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor) NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
{ {
@@ -637,6 +673,11 @@ nsDocAccessible::Shutdown()
mChildDocuments.Clear(); mChildDocuments.Clear();
if (mVirtualCursor) {
mVirtualCursor->RemoveObserver(this);
mVirtualCursor = nsnull;
}
mWeakShell = nsnull; // Avoid reentrancy mWeakShell = nsnull; // Avoid reentrancy
mDependentIDsHash.Clear(); mDependentIDsHash.Clear();
@@ -888,6 +929,20 @@ NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic
return NS_OK; return NS_OK;
} }
////////////////////////////////////////////////////////////////////////////////
// nsIAccessiblePivotObserver
NS_IMETHODIMP
nsDocAccessible::OnPivotChanged(nsIAccessiblePivot* aPivot,
nsIAccessible* aOldAccessible,
PRInt32 aOldStart, PRInt32 aOldEnd)
{
nsRefPtr<AccEvent> event = new AccEvent(nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED, this);
nsEventShell::FireEvent(event);
return NS_OK;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsIDocumentObserver // nsIDocumentObserver
@@ -1470,7 +1525,7 @@ nsDocAccessible::CacheChildren()
// Search for accessible children starting from the document element since // Search for accessible children starting from the document element since
// some web pages tend to insert elements under it rather than document body. // some web pages tend to insert elements under it rather than document body.
nsAccTreeWalker walker(mWeakShell, mDocument->GetRootElement(), nsAccTreeWalker walker(mWeakShell, mDocument->GetRootElement(),
GetAllowsAnonChildAccessibles()); CanHaveAnonChildren());
nsAccessible* child = nsnull; nsAccessible* child = nsnull;
while ((child = walker.NextChild()) && AppendChild(child)); while ((child = walker.NextChild()) && AppendChild(child));
@@ -1826,7 +1881,7 @@ nsDocAccessible::UpdateTree(nsAccessible* aContainer, nsIContent* aChildNode,
} else { } else {
nsAccTreeWalker walker(mWeakShell, aChildNode, nsAccTreeWalker walker(mWeakShell, aChildNode,
aContainer->GetAllowsAnonChildAccessibles(), true); aContainer->CanHaveAnonChildren(), true);
while ((child = walker.NextChild())) while ((child = walker.NextChild()))
updateFlags |= UpdateTreeInternal(child, aIsInsert); updateFlags |= UpdateTreeInternal(child, aIsInsert);

View File

@@ -39,7 +39,9 @@
#ifndef _nsDocAccessible_H_ #ifndef _nsDocAccessible_H_
#define _nsDocAccessible_H_ #define _nsDocAccessible_H_
#include "nsIAccessibleCursorable.h"
#include "nsIAccessibleDocument.h" #include "nsIAccessibleDocument.h"
#include "nsIAccessiblePivot.h"
#include "nsEventShell.h" #include "nsEventShell.h"
#include "nsHyperTextAccessibleWrap.h" #include "nsHyperTextAccessibleWrap.h"
@@ -58,6 +60,7 @@
#include "nsIDocShellTreeNode.h" #include "nsIDocShellTreeNode.h"
class nsIScrollableView; class nsIScrollableView;
class nsAccessiblePivot;
const PRUint32 kDefaultCacheSize = 256; const PRUint32 kDefaultCacheSize = 256;
@@ -74,7 +77,9 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
public nsIDocumentObserver, public nsIDocumentObserver,
public nsIObserver, public nsIObserver,
public nsIScrollPositionListener, public nsIScrollPositionListener,
public nsSupportsWeakReference public nsSupportsWeakReference,
public nsIAccessibleCursorable,
public nsIAccessiblePivotObserver
{ {
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDocAccessible, nsAccessible) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDocAccessible, nsAccessible)
@@ -84,6 +89,10 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
NS_DECL_NSIOBSERVER NS_DECL_NSIOBSERVER
NS_DECL_NSIACCESSIBLECURSORABLE
NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
public: public:
using nsAccessible::GetParent; using nsAccessible::GetParent;
@@ -595,6 +604,16 @@ protected:
nsTArray<nsRefPtr<nsDocAccessible> > mChildDocuments; nsTArray<nsRefPtr<nsDocAccessible> > mChildDocuments;
/**
* Whether we support nsIAccessibleCursorable, used when querying the interface.
*/
bool mIsCursorable;
/**
* The virtual cursor of the document when it supports nsIAccessibleCursorable.
*/
nsRefPtr<nsAccessiblePivot> mVirtualCursor;
/** /**
* A storage class for pairing content with one of its relation attributes. * A storage class for pairing content with one of its relation attributes.
*/ */

View File

@@ -283,8 +283,8 @@ nsLangTextAttr::nsLangTextAttr(nsHyperTextAccessible *aRootAcc,
nsIContent *aRootContent, nsIContent *aContent) : nsIContent *aRootContent, nsIContent *aContent) :
nsTextAttr<nsAutoString>(aContent == nsnull), mRootContent(aRootContent) nsTextAttr<nsAutoString>(aContent == nsnull), mRootContent(aRootContent)
{ {
nsresult rv = aRootAcc->GetLanguage(mRootNativeValue); aRootAcc->Language(mRootNativeValue);
mIsRootDefined = NS_SUCCEEDED(rv) && !mRootNativeValue.IsEmpty(); mIsRootDefined = !mRootNativeValue.IsEmpty();
if (aContent) if (aContent)
mIsDefined = GetLang(aContent, mNativeValue); mIsDefined = GetLang(aContent, mNativeValue);

View File

@@ -458,7 +458,7 @@ nsHTMLTableAccessible::CacheChildren()
// caption only, because nsAccessibilityService ensures we don't create // caption only, because nsAccessibilityService ensures we don't create
// accessibles for the other captions, since only the first is actually // accessibles for the other captions, since only the first is actually
// visible. // visible.
nsAccTreeWalker walker(mWeakShell, mContent, GetAllowsAnonChildAccessibles()); nsAccTreeWalker walker(mWeakShell, mContent, CanHaveAnonChildren());
nsAccessible* child = nsnull; nsAccessible* child = nsnull;
while ((child = walker.NextChild())) { while ((child = walker.NextChild())) {

View File

@@ -1148,7 +1148,7 @@ nsHyperTextAccessible::GetTextAttributes(bool aIncludeDefAttrs,
// Compute spelling attributes on text accessible only. // Compute spelling attributes on text accessible only.
nsIFrame *offsetFrame = accAtOffset->GetFrame(); nsIFrame *offsetFrame = accAtOffset->GetFrame();
if (offsetFrame && offsetFrame->GetType() == nsGkAtoms::textFrame) { if (offsetFrame && offsetFrame->GetType() == nsGkAtoms::textFrame) {
nsCOMPtr<nsIDOMNode> node = accAtOffset->GetDOMNode(); nsCOMPtr<nsIDOMNode> node = accAtOffset->DOMNode();
PRInt32 nodeOffset = 0; PRInt32 nodeOffset = 0;
nsresult rv = RenderedToContentOffset(offsetFrame, offsetInAcc, nsresult rv = RenderedToContentOffset(offsetFrame, offsetInAcc,
@@ -1560,12 +1560,17 @@ nsHyperTextAccessible::GetAssociatedEditor(nsIEditor **aEditor)
nsresult nsresult
nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos) nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
{ {
nsresult rv = TakeFocus(); bool isFocusable = State() & states::FOCUSABLE;
NS_ENSURE_SUCCESS(rv, rv);
// If accessible is focusable then focus it before setting the selection to
// neglect control's selection changes on focus if any (for example, inputs
// that do select all on focus).
// some input controls
if (isFocusable)
TakeFocus();
// Set the selection // Set the selection
SetSelectionBounds(0, aStartPos, aEndPos); SetSelectionBounds(0, aStartPos, aEndPos);
NS_ENSURE_SUCCESS(rv, rv);
// If range 0 was successfully set, clear any additional selection // If range 0 was successfully set, clear any additional selection
// ranges remaining from previous selection // ranges remaining from previous selection
@@ -1585,7 +1590,12 @@ nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
domSel->RemoveRange(range); domSel->RemoveRange(range);
} }
// Now that selection is done, move the focus to the selection. // When selection is done, move the focus to the selection if accessible is
// not focusable. That happens when selection is set within hypertext
// accessible.
if (isFocusable)
return NS_OK;
nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager(); nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
if (DOMFocusManager) { if (DOMFocusManager) {
nsCOMPtr<nsIPresShell> shell = GetPresShell(); nsCOMPtr<nsIPresShell> shell = GetPresShell();
@@ -2255,10 +2265,8 @@ nsHyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame *aFrame,
if (!aFrame) { if (!aFrame) {
// If the given frame is null then set offset after the DOM node of the // If the given frame is null then set offset after the DOM node of the
// given accessible. // given accessible.
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible));
nsCOMPtr<nsIDOMNode> DOMNode; nsCOMPtr<nsIDOMNode> DOMNode;
accessNode->GetDOMNode(getter_AddRefs(DOMNode)); aAccessible->GetDOMNode(getter_AddRefs(DOMNode));
nsCOMPtr<nsIContent> content(do_QueryInterface(DOMNode)); nsCOMPtr<nsIContent> content(do_QueryInterface(DOMNode));
NS_ENSURE_STATE(content); NS_ENSURE_STATE(content);

View File

@@ -155,7 +155,7 @@ CAccessibleComponent::GetARGBValueFromCSSProperty(const nsAString& aPropName,
__try { __try {
*aColorValue = 0; *aColorValue = 0;
nsCOMPtr<nsIAccessNode> acc(do_QueryObject(this)); nsRefPtr<nsAccessible> acc(do_QueryObject(this));
if (!acc) if (!acc)
return E_FAIL; return E_FAIL;

View File

@@ -63,14 +63,6 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::a11y; using namespace mozilla::a11y;
/// the accessible library and cached methods
HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
HINSTANCE nsAccessNodeWrap::gmUserLib = nsnull;
LPFNACCESSIBLEOBJECTFROMWINDOW nsAccessNodeWrap::gmAccessibleObjectFromWindow = nsnull;
LPFNLRESULTFROMOBJECT nsAccessNodeWrap::gmLresultFromObject = NULL;
LPFNNOTIFYWINEVENT nsAccessNodeWrap::gmNotifyWinEvent = nsnull;
LPFNGETGUITHREADINFO nsAccessNodeWrap::gmGetGUIThreadInfo = nsnull;
AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull; AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -404,9 +396,8 @@ __try {
aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT : aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT :
nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT; nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT;
nsresult rv = ScrollTo(scrollType); ScrollTo(scrollType);
if (NS_SUCCEEDED(rv)) return S_OK;
return S_OK;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL; return E_FAIL;
@@ -562,10 +553,7 @@ __try {
*aLanguage = NULL; *aLanguage = NULL;
nsAutoString language; nsAutoString language;
if (NS_FAILED(GetLanguage(language))) { Language(language);
return E_FAIL;
}
if (language.IsEmpty()) if (language.IsEmpty())
return S_FALSE; return S_FALSE;
@@ -583,7 +571,7 @@ nsAccessNodeWrap::get_localInterface(
/* [out] */ void __RPC_FAR *__RPC_FAR *localInterface) /* [out] */ void __RPC_FAR *__RPC_FAR *localInterface)
{ {
__try { __try {
*localInterface = static_cast<nsIAccessNode*>(this); *localInterface = static_cast<nsAccessNode*>(this);
NS_ADDREF_THIS(); NS_ADDREF_THIS();
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK; return S_OK;
@@ -591,17 +579,6 @@ __try {
void nsAccessNodeWrap::InitAccessibility() void nsAccessNodeWrap::InitAccessibility()
{ {
if (!gmUserLib) {
gmUserLib =::LoadLibraryW(L"USER32.DLL");
}
if (gmUserLib) {
if (!gmNotifyWinEvent)
gmNotifyWinEvent = (LPFNNOTIFYWINEVENT)GetProcAddress(gmUserLib,"NotifyWinEvent");
if (!gmGetGUIThreadInfo)
gmGetGUIThreadInfo = (LPFNGETGUITHREADINFO)GetProcAddress(gmUserLib,"GetGUIThreadInfo");
}
Compatibility::Init(); Compatibility::Init();
nsWinUtils::MaybeStartWindowEmulation(); nsWinUtils::MaybeStartWindowEmulation();
@@ -678,8 +655,8 @@ nsAccessNodeWrap::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
IAccessible* msaaAccessible = NULL; IAccessible* msaaAccessible = NULL;
document->GetNativeInterface((void**)&msaaAccessible); // does an addref document->GetNativeInterface((void**)&msaaAccessible); // does an addref
if (msaaAccessible) { if (msaaAccessible) {
LRESULT result = LresultFromObject(IID_IAccessible, wParam, LRESULT result = ::LresultFromObject(IID_IAccessible, wParam,
msaaAccessible); // does an addref msaaAccessible); // does an addref
msaaAccessible->Release(); // release extra addref msaaAccessible->Release(); // release extra addref
return result; return result;
} }
@@ -698,21 +675,3 @@ nsAccessNodeWrap::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return ::DefWindowProcW(hWnd, msg, wParam, lParam); return ::DefWindowProcW(hWnd, msg, wParam, lParam);
} }
STDMETHODIMP_(LRESULT)
nsAccessNodeWrap::LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc)
{
// open the dll dynamically
if (!gmAccLib)
gmAccLib =::LoadLibraryW(L"OLEACC.DLL");
if (gmAccLib) {
if (!gmLresultFromObject)
gmLresultFromObject = (LPFNLRESULTFROMOBJECT)GetProcAddress(gmAccLib,"LresultFromObject");
if (gmLresultFromObject)
return gmLresultFromObject(riid, wParam, pAcc);
}
return 0;
}

View File

@@ -67,8 +67,6 @@
#include "nsRefPtrHashtable.h" #include "nsRefPtrHashtable.h"
typedef LRESULT (STDAPICALLTYPE *LPFNNOTIFYWINEVENT)(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREADINFO* pgui);
class AccTextChangeEvent; class AccTextChangeEvent;
@@ -149,18 +147,8 @@ public: // construction, destruction
static void InitAccessibility(); static void InitAccessibility();
static void ShutdownAccessibility(); static void ShutdownAccessibility();
/// the accessible library and cached methods
static HINSTANCE gmAccLib;
static HINSTANCE gmUserLib;
static LPFNACCESSIBLEOBJECTFROMWINDOW gmAccessibleObjectFromWindow;
static LPFNLRESULTFROMOBJECT gmLresultFromObject;
static LPFNNOTIFYWINEVENT gmNotifyWinEvent;
static LPFNGETGUITHREADINFO gmGetGUIThreadInfo;
static int FilterA11yExceptions(unsigned int aCode, EXCEPTION_POINTERS *aExceptionInfo); static int FilterA11yExceptions(unsigned int aCode, EXCEPTION_POINTERS *aExceptionInfo);
static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, static LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg,
WPARAM WParam, LPARAM lParam); WPARAM WParam, LPARAM lParam);

View File

@@ -163,38 +163,6 @@ __try {
// IAccessible methods // IAccessible methods
//----------------------------------------------------- //-----------------------------------------------------
STDMETHODIMP nsAccessibleWrap::AccessibleObjectFromWindow(HWND hwnd,
DWORD dwObjectID,
REFIID riid,
void **ppvObject)
{
// open the dll dynamically
if (!gmAccLib)
gmAccLib =::LoadLibraryW(L"OLEACC.DLL");
if (gmAccLib) {
if (!gmAccessibleObjectFromWindow)
gmAccessibleObjectFromWindow = (LPFNACCESSIBLEOBJECTFROMWINDOW)GetProcAddress(gmAccLib,"AccessibleObjectFromWindow");
if (gmAccessibleObjectFromWindow)
return gmAccessibleObjectFromWindow(hwnd, dwObjectID, riid, ppvObject);
}
return E_FAIL;
}
STDMETHODIMP nsAccessibleWrap::NotifyWinEvent(DWORD event,
HWND hwnd,
LONG idObjectType,
LONG idObject)
{
if (gmNotifyWinEvent)
return gmNotifyWinEvent(event, hwnd, idObjectType, idObject);
return E_FAIL;
}
STDMETHODIMP nsAccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent) STDMETHODIMP nsAccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
{ {
__try { __try {
@@ -211,9 +179,9 @@ __try {
nsWinUtils::IsWindowEmulationStarted() && nsWinUtils::IsWindowEmulationStarted() &&
nsCoreUtils::IsTabDocument(doc->GetDocumentNode())) { nsCoreUtils::IsTabDocument(doc->GetDocumentNode())) {
HWND hwnd = static_cast<HWND>(doc->GetNativeWindow()); HWND hwnd = static_cast<HWND>(doc->GetNativeWindow());
if (hwnd && SUCCEEDED(AccessibleObjectFromWindow(hwnd, OBJID_WINDOW, if (hwnd && SUCCEEDED(::AccessibleObjectFromWindow(hwnd, OBJID_WINDOW,
IID_IAccessible, IID_IAccessible,
(void**)ppdispParent))) { (void**)ppdispParent))) {
return S_OK; return S_OK;
} }
} }
@@ -1177,8 +1145,8 @@ STDMETHODIMP
nsAccessibleWrap::scrollTo(enum IA2ScrollType aScrollType) nsAccessibleWrap::scrollTo(enum IA2ScrollType aScrollType)
{ {
__try { __try {
nsresult rv = ScrollTo(aScrollType); nsAccessNode::ScrollTo(aScrollType);
return GetHRESULT(rv); return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { } } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL; return E_FAIL;
@@ -1398,9 +1366,7 @@ __try {
// Any two-letter subcode is understood to be a [ISO3166] country code. // Any two-letter subcode is understood to be a [ISO3166] country code.
nsAutoString lang; nsAutoString lang;
nsresult rv = GetLanguage(lang); Language(lang);
if (NS_FAILED(rv))
return GetHRESULT(rv);
// If primary code consists from two letters then expose it as language. // If primary code consists from two letters then expose it as language.
PRInt32 offset = lang.FindChar('-', 0); PRInt32 offset = lang.FindChar('-', 0);
@@ -1590,13 +1556,13 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
#endif #endif
// Fire MSAA event for client area window. // Fire MSAA event for client area window.
NotifyWinEvent(winEvent, hWnd, OBJID_CLIENT, childID); ::NotifyWinEvent(winEvent, hWnd, OBJID_CLIENT, childID);
// JAWS announces collapsed combobox navigation based on focus events. // JAWS announces collapsed combobox navigation based on focus events.
if (Compatibility::IsJAWS()) { if (Compatibility::IsJAWS()) {
if (eventType == nsIAccessibleEvent::EVENT_SELECTION && if (eventType == nsIAccessibleEvent::EVENT_SELECTION &&
accessible->Role() == roles::COMBOBOX_OPTION) { accessible->Role() == roles::COMBOBOX_OPTION) {
NotifyWinEvent(EVENT_OBJECT_FOCUS, hWnd, OBJID_CLIENT, childID); ::NotifyWinEvent(EVENT_OBJECT_FOCUS, hWnd, OBJID_CLIENT, childID);
} }
} }
@@ -1729,8 +1695,9 @@ IDispatch *nsAccessibleWrap::NativeAccessible(nsIAccessible *aXPAccessible)
accObject->GetHwnd(&hwnd); accObject->GetHwnd(&hwnd);
if (hwnd) { if (hwnd) {
IDispatch *retval = nsnull; IDispatch *retval = nsnull;
AccessibleObjectFromWindow(reinterpret_cast<HWND>(hwnd), ::AccessibleObjectFromWindow(reinterpret_cast<HWND>(hwnd),
OBJID_WINDOW, IID_IAccessible, (void **) &retval); OBJID_WINDOW, IID_IAccessible,
(void **) &retval);
return retval; return retval;
} }
} }

View File

@@ -331,11 +331,6 @@ public: // construction, destruction
NS_IMETHOD GetNativeInterface(void **aOutAccessible); NS_IMETHOD GetNativeInterface(void **aOutAccessible);
// NT4 does not have the oleacc that defines these methods. So we define copies here that automatically
// load the library only if needed.
static STDMETHODIMP AccessibleObjectFromWindow(HWND hwnd,DWORD dwObjectID,REFIID riid,void **ppvObject);
static STDMETHODIMP NotifyWinEvent(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
static IDispatch *NativeAccessible(nsIAccessible *aXPAccessible); static IDispatch *NativeAccessible(nsIAccessible *aXPAccessible);
/** /**

View File

@@ -131,6 +131,7 @@ static const PRUint32 gWinEventMap[] = {
IA2_EVENT_HYPERTEXT_CHANGED, // nsIAccessibleEvent::EVENT_HYPERTEXT_CHANGED IA2_EVENT_HYPERTEXT_CHANGED, // nsIAccessibleEvent::EVENT_HYPERTEXT_CHANGED
IA2_EVENT_HYPERTEXT_NLINKS_CHANGED, // nsIAccessibleEvent::EVENT_HYPERTEXT_NLINKS_CHANGED IA2_EVENT_HYPERTEXT_NLINKS_CHANGED, // nsIAccessibleEvent::EVENT_HYPERTEXT_NLINKS_CHANGED
IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED, // nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED, // nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED
kEVENT_LAST_ENTRY // nsIAccessibleEvent::EVENT_LAST_ENTRY kEVENT_LAST_ENTRY // nsIAccessibleEvent::EVENT_LAST_ENTRY
}; };

View File

@@ -43,6 +43,7 @@
#include "nsTextEquivUtils.h" #include "nsTextEquivUtils.h"
#include "Role.h" #include "Role.h"
#include "States.h" #include "States.h"
#include "Statistics.h"
#include "nscore.h" #include "nscore.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
@@ -70,6 +71,7 @@ nsXFormsAccessibleBase::nsXFormsAccessibleBase()
if (NS_FAILED(rv)) if (NS_FAILED(rv))
NS_WARNING("No XForms utility service."); NS_WARNING("No XForms utility service.");
} }
statistics::XFormsAccessibleUsed();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -213,7 +215,7 @@ nsXFormsAccessible::Description(nsString& aDescription)
} }
bool bool
nsXFormsAccessible::GetAllowsAnonChildAccessibles() nsXFormsAccessible::CanHaveAnonChildren()
{ {
return false; return false;
} }
@@ -236,7 +238,7 @@ nsXFormsContainerAccessible::NativeRole()
} }
bool bool
nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles() nsXFormsContainerAccessible::CanHaveAnonChildren()
{ {
return true; return true;
} }

View File

@@ -90,7 +90,7 @@ public:
// Denies accessible nodes in anonymous content of xforms element by // Denies accessible nodes in anonymous content of xforms element by
// always returning false value. // always returning false value.
virtual bool GetAllowsAnonChildAccessibles(); virtual bool CanHaveAnonChildren();
protected: protected:
// Returns value of first child xforms element by tagname that is bound to // Returns value of first child xforms element by tagname that is bound to
@@ -131,7 +131,7 @@ public:
// Allows accessible nodes in anonymous content of xforms element by // Allows accessible nodes in anonymous content of xforms element by
// always returning true value. // always returning true value.
virtual bool GetAllowsAnonChildAccessibles(); virtual bool CanHaveAnonChildren();
}; };

View File

@@ -590,7 +590,7 @@ nsXFormsSelectComboboxAccessible::NativeState()
} }
bool bool
nsXFormsSelectComboboxAccessible::GetAllowsAnonChildAccessibles() nsXFormsSelectComboboxAccessible::CanHaveAnonChildren()
{ {
return true; return true;
} }

View File

@@ -297,7 +297,7 @@ public:
// nsAccessible // nsAccessible
virtual mozilla::a11y::role NativeRole(); virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState(); virtual PRUint64 NativeState();
virtual bool GetAllowsAnonChildAccessibles(); virtual bool CanHaveAnonChildren();
}; };

View File

@@ -140,7 +140,7 @@ nsXULComboboxAccessible::Description(nsString& aDescription)
} }
bool bool
nsXULComboboxAccessible::GetAllowsAnonChildAccessibles() nsXULComboboxAccessible::CanHaveAnonChildren()
{ {
if (mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) || if (mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) ||
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable, mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable,

View File

@@ -61,7 +61,7 @@ public:
virtual void Description(nsString& aDescription); virtual void Description(nsString& aDescription);
virtual mozilla::a11y::role NativeRole(); virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState(); virtual PRUint64 NativeState();
virtual bool GetAllowsAnonChildAccessibles(); virtual bool CanHaveAnonChildren();
// ActionAccessible // ActionAccessible
virtual PRUint8 ActionCount(); virtual PRUint8 ActionCount();

View File

@@ -662,17 +662,10 @@ nsXULToolbarButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
bool bool
nsXULToolbarButtonAccessible::IsSeparator(nsAccessible *aAccessible) nsXULToolbarButtonAccessible::IsSeparator(nsAccessible *aAccessible)
{ {
nsCOMPtr<nsIDOMNode> domNode; nsIContent* content = aAccessible->GetContent();
aAccessible->GetDOMNode(getter_AddRefs(domNode)); return content && ((content->Tag() == nsGkAtoms::toolbarseparator) ||
nsCOMPtr<nsIContent> contentDomNode(do_QueryInterface(domNode)); (content->Tag() == nsGkAtoms::toolbarspacer) ||
(content->Tag() == nsGkAtoms::toolbarspring)); }
if (!contentDomNode)
return false;
return (contentDomNode->Tag() == nsGkAtoms::toolbarseparator) ||
(contentDomNode->Tag() == nsGkAtoms::toolbarspacer) ||
(contentDomNode->Tag() == nsGkAtoms::toolbarspring);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -851,7 +844,7 @@ NS_IMETHODIMP nsXULTextFieldAccessible::DoAction(PRUint8 index)
} }
bool bool
nsXULTextFieldAccessible::GetAllowsAnonChildAccessibles() nsXULTextFieldAccessible::CanHaveAnonChildren()
{ {
return false; return false;
} }

View File

@@ -267,7 +267,7 @@ public:
virtual void ApplyARIAState(PRUint64* aState); virtual void ApplyARIAState(PRUint64* aState);
virtual mozilla::a11y::role NativeRole(); virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState(); virtual PRUint64 NativeState();
virtual bool GetAllowsAnonChildAccessibles(); virtual bool CanHaveAnonChildren();
// ActionAccessible // ActionAccessible
virtual PRUint8 ActionCount(); virtual PRUint8 ActionCount();

View File

@@ -1024,7 +1024,7 @@ NS_IMETHODIMP nsXULListitemAccessible::GetActionName(PRUint8 aIndex, nsAString&
} }
bool bool
nsXULListitemAccessible::GetAllowsAnonChildAccessibles() nsXULListitemAccessible::CanHaveAnonChildren()
{ {
// That indicates we should walk anonymous children for listitems // That indicates we should walk anonymous children for listitems
return true; return true;

View File

@@ -141,7 +141,7 @@ public:
virtual PRUint64 NativeState(); virtual PRUint64 NativeState();
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet, virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
PRInt32 *aSetSize); PRInt32 *aSetSize);
virtual bool GetAllowsAnonChildAccessibles(); virtual bool CanHaveAnonChildren();
// Widgets // Widgets
virtual nsAccessible* ContainerWidget() const; virtual nsAccessible* ContainerWidget() const;

View File

@@ -320,7 +320,7 @@ nsXULMenuitemAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
} }
bool bool
nsXULMenuitemAccessible::GetAllowsAnonChildAccessibles() nsXULMenuitemAccessible::CanHaveAnonChildren()
{ {
// That indicates we don't walk anonymous children for menuitems // That indicates we don't walk anonymous children for menuitems
return false; return false;

View File

@@ -66,7 +66,7 @@ public:
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet, virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
PRInt32 *aSetSize); PRInt32 *aSetSize);
virtual bool GetAllowsAnonChildAccessibles(); virtual bool CanHaveAnonChildren();
// ActionAccessible // ActionAccessible
virtual PRUint8 ActionCount(); virtual PRUint8 ActionCount();

View File

@@ -190,7 +190,7 @@ nsXULSliderAccessible::SetCurrentValue(double aValue)
} }
bool bool
nsXULSliderAccessible::GetAllowsAnonChildAccessibles() nsXULSliderAccessible::CanHaveAnonChildren()
{ {
// Do not allow anonymous xul:slider be accessible. // Do not allow anonymous xul:slider be accessible.
return false; return false;

View File

@@ -65,7 +65,7 @@ public:
// nsAccessible // nsAccessible
virtual mozilla::a11y::role NativeRole(); virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState(); virtual PRUint64 NativeState();
virtual bool GetAllowsAnonChildAccessibles(); virtual bool CanHaveAnonChildren();
// ActionAccessible // ActionAccessible
virtual PRUint8 ActionCount(); virtual PRUint8 ActionCount();

View File

@@ -153,9 +153,9 @@ nsXULTabAccessible::RelationByType(PRUint32 aType)
if (!tabsElm) if (!tabsElm)
return rel; return rel;
nsCOMPtr<nsIDOMNode> DOMNode(GetDOMNode()); nsCOMPtr<nsIDOMNode> domNode(DOMNode());
nsCOMPtr<nsIDOMNode> tabpanelNode; nsCOMPtr<nsIDOMNode> tabpanelNode;
tabsElm->GetRelatedElement(DOMNode, getter_AddRefs(tabpanelNode)); tabsElm->GetRelatedElement(domNode, getter_AddRefs(tabpanelNode));
if (!tabpanelNode) if (!tabpanelNode)
return rel; return rel;
@@ -255,9 +255,9 @@ nsXULTabpanelAccessible::RelationByType(PRUint32 aType)
if (!tabpanelsElm) if (!tabpanelsElm)
return rel; return rel;
nsCOMPtr<nsIDOMNode> DOMNode(GetDOMNode()); nsCOMPtr<nsIDOMNode> domNode(DOMNode());
nsCOMPtr<nsIDOMNode> tabNode; nsCOMPtr<nsIDOMNode> tabNode;
tabpanelsElm->GetRelatedElement(DOMNode, getter_AddRefs(tabNode)); tabpanelsElm->GetRelatedElement(domNode, getter_AddRefs(tabNode));
if (!tabNode) if (!tabNode)
return rel; return rel;

View File

@@ -52,11 +52,13 @@ DIRS = \
hyperlink \ hyperlink \
hypertext \ hypertext \
name \ name \
pivot \
relations \ relations \
selectable \ selectable \
states \ states \
table \ table \
text \ text \
textcaret \
textselection \ textselection \
tree \ tree \
treeupdate \ treeupdate \
@@ -81,6 +83,7 @@ _TEST_FILES =\
grid.js \ grid.js \
layout.js \ layout.js \
name.js \ name.js \
pivot.js \
relations.js \ relations.js \
role.js \ role.js \
selectable.js \ selectable.js \
@@ -101,7 +104,6 @@ _TEST_FILES =\
test_nsIAccessNode_utils.html \ test_nsIAccessNode_utils.html \
test_nsOuterDocAccessible.html \ test_nsOuterDocAccessible.html \
test_role_nsHyperTextAcc.html \ test_role_nsHyperTextAcc.html \
test_text_caret.html \
test_textboxes.html \ test_textboxes.html \
test_textboxes.xul \ test_textboxes.xul \
testTextboxes.js \ testTextboxes.js \

View File

@@ -49,6 +49,15 @@
new scrollingChecker(getAccessible("bottom1")) new scrollingChecker(getAccessible("bottom1"))
] ]
}, },
{ // jump again (test for bug 437607)
ID: "anchor1",
actionName: "jump",
actionIndex: 0,
events: CLICK_EVENTS,
eventSeq: [
new scrollingChecker(getAccessible("bottom1"))
]
},
{ {
ID: "anchor2", ID: "anchor2",
actionName: "jump", actionName: "jump",

View File

@@ -27,7 +27,7 @@
}, },
{ {
ID: "button", ID: "button",
actionName: "click", actionName: "press",
events: CLICK_EVENTS events: CLICK_EVENTS
}, },
{ {

View File

@@ -2,6 +2,7 @@
<!-- <!--
https://bugzilla.mozilla.org/show_bug.cgi?id=439566 https://bugzilla.mozilla.org/show_bug.cgi?id=439566
https://bugzilla.mozilla.org/show_bug.cgi?id=460932 https://bugzilla.mozilla.org/show_bug.cgi?id=460932
https://bugzilla.mozilla.org/show_bug.cgi?id=689540
--> -->
<head> <head>
<title>CSS-like attributes tests</title> <title>CSS-like attributes tests</title>
@@ -25,7 +26,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=460932
var attrs = { var attrs = {
"display": computedStyle.display, "display": computedStyle.display,
"text-align": computedStyle.textAlign, "text-align": computedStyle.textAlign,
"text-indent": computedStyle.textIndent "text-indent": computedStyle.textIndent,
"margin-left": computedStyle.marginLeft,
"margin-right": computedStyle.marginRight,
"margin-top": computedStyle.marginTop,
"margin-bottom": computedStyle.marginBottom
}; };
testAttrs(aID, attrs, true); testAttrs(aID, attrs, true);
} }
@@ -34,7 +39,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=460932
{ {
testCSSAttrs("span"); testCSSAttrs("span");
testCSSAttrs("div"); testCSSAttrs("div");
testCSSAttrs("p"); testCSSAttrs("p");
testCSSAttrs("p2");
testCSSAttrs("pml");
testCSSAttrs("pmr");
testCSSAttrs("pmt");
testCSSAttrs("pmb");
testCSSAttrs("input"); testCSSAttrs("input");
testCSSAttrs("table"); testCSSAttrs("table");
testCSSAttrs("tr"); testCSSAttrs("tr");
@@ -59,6 +72,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=460932
title="text-indent and text-align should really be object attribute"> title="text-indent and text-align should really be object attribute">
Mozilla Bug 460932 Mozilla Bug 460932
</a> </a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=689540"
title="Expose IA2 margin- object attributes">
Mozilla Bug 689540
</a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"></div> <div id="content" style="display: none"></div>
@@ -67,7 +85,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=460932
<span id="span" role="group">It's span</span> <span id="span" role="group">It's span</span>
<div id="div">It's div</div> <div id="div">It's div</div>
<p id="p">It's paragraph"</p> <p id="p">It's paragraph"</p>
<p id="p2" style="text-indent: 5px">It's another paragraph</p>
<p id="pml" style="margin-left : 11px;">It's a paragraph with left margin</p>
<p id="pmr" style="margin-right : 21px;">It's a paragraph with right margin</p>
<p id="pmt" style="margin-top : 31px;">It's a paragraph with top margin</p>
<p id="pmb" style="margin-bottom : 41px;">It's a paragraph with bottom margin</p>
<input id="input"/> <input id="input"/>
<table id="table"> <table id="table">
<tr id="tr" role="group"> <tr id="tr" role="group">

View File

@@ -25,6 +25,14 @@ function browserWindow()
return gBrowserContext.browserWnd; return gBrowserContext.browserWnd;
} }
/**
* Return the document of the browser window.
*/
function browserDocument()
{
return browserWindow().document;
}
/** /**
* Return tab browser object. * Return tab browser object.
*/ */
@@ -49,6 +57,22 @@ function currentTabDocument()
return currentBrowser().contentDocument; return currentBrowser().contentDocument;
} }
/**
* Return browser element of the tab at the given index.
*/
function browserAt(aIndex)
{
return tabBrowser().getBrowserAtIndex(aIndex);
}
/**
* Return DOM document of the tab at the given index.
*/
function tabDocumentAt(aIndex)
{
return browserAt(aIndex).contentDocument;
}
/** /**
* Return input element of address bar. * Return input element of address bar.
*/ */

View File

@@ -18,7 +18,6 @@ const nsIAccessibleCoordinateType = Components.interfaces.nsIAccessibleCoordinat
const nsIAccessibleRelation = Components.interfaces.nsIAccessibleRelation; const nsIAccessibleRelation = Components.interfaces.nsIAccessibleRelation;
const nsIAccessNode = Components.interfaces.nsIAccessNode;
const nsIAccessible = Components.interfaces.nsIAccessible; const nsIAccessible = Components.interfaces.nsIAccessible;
const nsIAccessibleDocument = Components.interfaces.nsIAccessibleDocument; const nsIAccessibleDocument = Components.interfaces.nsIAccessibleDocument;
@@ -30,10 +29,13 @@ const nsIAccessibleEditableText = Components.interfaces.nsIAccessibleEditableTex
const nsIAccessibleHyperLink = Components.interfaces.nsIAccessibleHyperLink; const nsIAccessibleHyperLink = Components.interfaces.nsIAccessibleHyperLink;
const nsIAccessibleHyperText = Components.interfaces.nsIAccessibleHyperText; const nsIAccessibleHyperText = Components.interfaces.nsIAccessibleHyperText;
const nsIAccessibleCursorable = Components.interfaces.nsIAccessibleCursorable;
const nsIAccessibleImage = Components.interfaces.nsIAccessibleImage; const nsIAccessibleImage = Components.interfaces.nsIAccessibleImage;
const nsIAccessiblePivot = Components.interfaces.nsIAccessiblePivot;
const nsIAccessibleSelectable = Components.interfaces.nsIAccessibleSelectable; const nsIAccessibleSelectable = Components.interfaces.nsIAccessibleSelectable;
const nsIAccessibleTable = Components.interfaces.nsIAccessibleTable; const nsIAccessibleTable = Components.interfaces.nsIAccessibleTable;
const nsIAccessibleTableCell = Components.interfaces.nsIAccessibleTableCell; const nsIAccessibleTableCell = Components.interfaces.nsIAccessibleTableCell;
const nsIAccessibleTraversalRule = Components.interfaces.nsIAccessibleTraversalRule;
const nsIAccessibleValue = Components.interfaces.nsIAccessibleValue; const nsIAccessibleValue = Components.interfaces.nsIAccessibleValue;
const nsIObserverService = Components.interfaces.nsIObserverService; const nsIObserverService = Components.interfaces.nsIObserverService;
@@ -118,10 +120,8 @@ function getNode(aAccOrNodeOrID)
if (aAccOrNodeOrID instanceof nsIDOMNode) if (aAccOrNodeOrID instanceof nsIDOMNode)
return aAccOrNodeOrID; return aAccOrNodeOrID;
if (aAccOrNodeOrID instanceof nsIAccessible) { if (aAccOrNodeOrID instanceof nsIAccessible)
aAccOrNodeOrID.QueryInterface(nsIAccessNode);
return aAccOrNodeOrID.DOMNode; return aAccOrNodeOrID.DOMNode;
}
node = document.getElementById(aAccOrNodeOrID); node = document.getElementById(aAccOrNodeOrID);
if (!node) { if (!node) {
@@ -164,7 +164,6 @@ function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf)
var elm = null; var elm = null;
if (aAccOrElmOrID instanceof nsIAccessible) { if (aAccOrElmOrID instanceof nsIAccessible) {
aAccOrElmOrID.QueryInterface(nsIAccessNode);
elm = aAccOrElmOrID.DOMNode; elm = aAccOrElmOrID.DOMNode;
} else if (aAccOrElmOrID instanceof nsIDOMNode) { } else if (aAccOrElmOrID instanceof nsIDOMNode) {
@@ -196,8 +195,6 @@ function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf)
} }
} }
acc.QueryInterface(nsIAccessNode);
if (!aInterfaces) if (!aInterfaces)
return acc; return acc;
@@ -254,8 +251,7 @@ function getContainerAccessible(aAccOrElmOrID)
*/ */
function getRootAccessible(aAccOrElmOrID) function getRootAccessible(aAccOrElmOrID)
{ {
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document, var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document);
[nsIAccessNode]);
return acc ? acc.rootDocument.QueryInterface(nsIAccessible) : null; return acc ? acc.rootDocument.QueryInterface(nsIAccessible) : null;
} }
@@ -264,11 +260,10 @@ function getRootAccessible(aAccOrElmOrID)
*/ */
function getTabDocAccessible(aAccOrElmOrID) function getTabDocAccessible(aAccOrElmOrID)
{ {
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document, var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document);
[nsIAccessNode]);
var docAcc = acc.document.QueryInterface(nsIAccessible); var docAcc = acc.document.QueryInterface(nsIAccessible);
var containerDocAcc = docAcc.parent.QueryInterface(nsIAccessNode).document; var containerDocAcc = docAcc.parent.document;
// Test is running is stand-alone mode. // Test is running is stand-alone mode.
if (acc.rootDocument == containerDocAcc) if (acc.rootDocument == containerDocAcc)
@@ -581,7 +576,7 @@ function getTextFromClipboard()
function prettyName(aIdentifier) function prettyName(aIdentifier)
{ {
if (aIdentifier instanceof nsIAccessible) { if (aIdentifier instanceof nsIAccessible) {
var acc = getAccessible(aIdentifier, [nsIAccessNode]); var acc = getAccessible(aIdentifier);
var msg = "[" + getNodePrettyName(acc.DOMNode); var msg = "[" + getNodePrettyName(acc.DOMNode);
try { try {
msg += ", role: " + roleToString(acc.role); msg += ", role: " + roleToString(acc.role);

View File

@@ -27,6 +27,7 @@ const EVENT_TEXT_INSERTED = nsIAccessibleEvent.EVENT_TEXT_INSERTED;
const EVENT_TEXT_REMOVED = nsIAccessibleEvent.EVENT_TEXT_REMOVED; const EVENT_TEXT_REMOVED = nsIAccessibleEvent.EVENT_TEXT_REMOVED;
const EVENT_TEXT_SELECTION_CHANGED = nsIAccessibleEvent.EVENT_TEXT_SELECTION_CHANGED; const EVENT_TEXT_SELECTION_CHANGED = nsIAccessibleEvent.EVENT_TEXT_SELECTION_CHANGED;
const EVENT_VALUE_CHANGE = nsIAccessibleEvent.EVENT_VALUE_CHANGE; const EVENT_VALUE_CHANGE = nsIAccessibleEvent.EVENT_VALUE_CHANGE;
const EVENT_VIRTUALCURSOR_CHANGED = nsIAccessibleEvent.EVENT_VIRTUALCURSOR_CHANGED;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// General // General
@@ -1220,6 +1221,33 @@ function synthSelectAll(aNodeOrID, aCheckerOrEventSeq)
} }
} }
/**
* Set caret offset in text accessible.
*/
function setCaretOffset(aID, aOffset, aFocusTargetID)
{
this.target = getAccessible(aID, [nsIAccessibleText]);
this.offset = aOffset == -1 ? this.target.characterCount: aOffset;
this.focus = aFocusTargetID ? getAccessible(aFocusTargetID) : null;
this.invoke = function setCaretOffset_invoke()
{
this.target.caretOffset = this.offset;
}
this.getID = function setCaretOffset_getID()
{
return "Set caretOffset on " + prettyName(aID) + " at " + this.offset;
}
this.eventSeq = [
new caretMoveChecker(this.offset, this.target)
];
if (this.focus)
this.eventSeq.push(new asyncInvokerChecker(EVENT_FOCUS, this.focus));
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Event queue checkers // Event queue checkers

View File

@@ -45,8 +45,6 @@ relativesrcdir = accessible/events
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
# test_scroll.xul disabled for misusing <tabbrowser> (bug 715857)
_TEST_FILES =\ _TEST_FILES =\
docload_wnd.html \ docload_wnd.html \
focus.html \ focus.html \
@@ -82,6 +80,7 @@ _TEST_FILES =\
test_menu.xul \ test_menu.xul \
test_mutation.html \ test_mutation.html \
test_mutation.xhtml \ test_mutation.xhtml \
test_scroll.xul \
test_selection_aria.html \ test_selection_aria.html \
test_selection.html \ test_selection.html \
test_selection.xul \ test_selection.xul \

View File

@@ -91,7 +91,7 @@
var item = menu.getChildAt(idx); var item = menu.getChildAt(idx);
if (hasState(item, STATE_FOCUSED)) if (hasState(item, STATE_FOCUSED))
return getAccessible(item, [nsIAccessNode]); return getAccessible(item);
} }
return null; return null;
} }

View File

@@ -1,13 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?> <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- SeaMonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?> type="text/css"?>
@@ -16,7 +9,7 @@
<script type="application/javascript" <script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/> src="chrome://mochikit/content/chrome-harness.js"/>
<script type="application/javascript" <script type="application/javascript"
src="../common.js" /> src="../common.js" />
@@ -26,95 +19,74 @@
src="../states.js" /> src="../states.js" />
<script type="application/javascript" <script type="application/javascript"
src="../events.js" /> src="../events.js" />
<script type="application/javascript" <script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js"/> src="../browser.js"></script>
<script type="application/javascript"> <script type="application/javascript">
<![CDATA[ <![CDATA[
////////////////////////////////////////////////////////////////////////////
// Hacks to make xul:tabbrowser work
const Ci = Components.interfaces;
const CC = Components.classes;
Components.utils.import("resource://gre/modules/Services.jsm");
var handleDroppedLink = null;
var XULBrowserWindow = {
isBusy: false,
setOverLink: function (link, b) {
}
};
var gURLBar = {
focused: false
};
var gFindBarInitialized = false;
function goSetCommandEnabled() {}
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Tests // Tests
function getTabDocument() function getAnchorJumpInTabDocument(aTabIdx)
{ {
return getNode("tabBrowser").selectedBrowser.contentDocument; var tabDoc = aTabIdx ? tabDocumentAt(aTabIdx) : currentTabDocument();
return tabDoc.querySelector("a[name='link1']");
} }
function getAnchorJumpInTabDocument() function loadTab(aURL)
{ {
return getTabDocument().querySelector("a[name='link1']"); this.eventSeq = [
} new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument)
function loadTab(aTabBrowserID, aURL) ];
{
function loadTabChecker()
{
this.type = EVENT_REORDER;
this.match = function loadTabChecker_match(aEvent)
{
var target = aEvent.accessible;
if (target.role == ROLE_INTERNAL_FRAME &&
target.parent.parent == getAccessible(getNode(aTabBrowserID).mTabBox.tabpanels)) {
return true;
}
return false;
}
}
this.eventSeq = [ new loadTabChecker() ];
this.invoke = function loadTab_invoke() this.invoke = function loadTab_invoke()
{ {
getNode(aTabBrowserID).loadURI(aURL); tabBrowser().loadURI(aURL);
} }
this.getID = function loadTab_getID() this.getID = function loadTab_getID()
{ {
return "load tab " + aURL + " for " + prettyName(aTabBrowserID); return "load tab: " + aURL;
} }
} }
function advanceFocusIntoTab(aTabBrowserID) function loadTabInBackground(aURL)
{
this.eventSeq = [
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
];
this.unexpectedEventSeq = [
new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument, 1)
];
this.invoke = function loadTabInBackground_invoke()
{
tabBrowser().loadOneTab(aURL, null, "", null, true);
}
this.getID = function loadTabInBackground_getID()
{
return "load tab in background: " + aURL;
}
}
function switchToBackgroundTab()
{ {
this.eventSeq = [ this.eventSeq = [
new focusChecker(getTabDocument),
new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument) new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument)
]; ];
this.invoke = function advanceFocusIntoTab_invoke() this.invoke = function switchToBackgroundTab_invoke()
{ {
var tabDoc = getAccessible(getTabDocument()); tabBrowser().selectTabAtIndex(1);
tabDoc.takeFocus();
} }
this.getID = function advanceFocusIntoTab_getID() this.getID = function switchToBackgroundTab_getID()
{ {
return "advance focus into loaded tab"; return "switch to background tab";
} }
} }
@@ -138,28 +110,22 @@
var url = rootDir + "scroll.html#link1"; var url = rootDir + "scroll.html#link1";
gQueue = new eventQueue(); gQueue = new eventQueue();
gQueue.push(new loadTab("tabBrowser", url));
gQueue.push(new advanceFocusIntoTab("tabBrowser")); gQueue.push(new loadTab(url));
gQueue.push(new loadTabInBackground(url));
gQueue.push(new switchToBackgroundTab());
gQueue.onFinish = function() { closeBrowserWindow(); }
gQueue.invoke(); // Will call SimpleTest.finish(); gQueue.invoke(); // Will call SimpleTest.finish();
} }
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest); openBrowserWindow(doTest);
]]> ]]>
</script> </script>
<hbox flex="1" style="overflow: auto;"> <vbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml"> <body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=437607"
title="Clicking the 'Skip to main content' link once works, second time fails to initiate a V cursor jump">
Mozilla Bug 437607
</a><br/>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=519303"
title="Same page links to targets with content fires scrolling start accessible event on leaf text node">
Mozilla Bug 519303
</a>
<a target="_blank" <a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=691734" href="https://bugzilla.mozilla.org/show_bug.cgi?id=691734"
title="Make sure scrolling start event is fired when document receive focus"> title="Make sure scrolling start event is fired when document receive focus">
@@ -173,33 +139,6 @@
</pre> </pre>
</body> </body>
<vbox flex="1"> <vbox id="eventdump"></vbox>
<!-- Hack to make xul:tabbrowser work --> </vbox>
<menubar>
<menu label="menu">
<menupopup>
<menuitem label="close window hook" id="menu_closeWindow"/>
<menuitem label="close hook" id="menu_close"/>
</menupopup>
</menu>
</menubar>
<keyset>
<key id="key_close"/>
</keyset>
<hbox>
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
tabbrowser="tabBrowser"
flex="1">
<tab class="tabbrowser-tab" selected="true" label="tab"/>
</tabs>
</hbox>
<tabbrowser id="tabBrowser"
type="content-primary"
tabcontainer="tabbrowser-tabs"
flex="1"/>
</vbox>
<toolbar id="addon-bar"/>
</hbox>
</window> </window>

View File

@@ -60,7 +60,7 @@
{ {
this.containerNode = getNode(aContainerID); this.containerNode = getNode(aContainerID);
this.container = getAccessible(this.containerNode, nsIAccessibleHyperText); this.container = getAccessible(this.containerNode, nsIAccessibleHyperText);
this.text = this.container.firstChild.QueryInterface(nsIAccessNode); this.text = this.container.firstChild;
this.textNode = this.text.DOMNode; this.textNode = this.text.DOMNode;
this.textLen = this.textNode.data.length; this.textLen = this.textNode.data.length;

View File

@@ -45,8 +45,6 @@ relativesrcdir = accessible/name
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
# test_nsRootAcc.xul, nsRootAcc_wnd.xul disabled for misusing <tabbrowser> (bug 715857)
_TEST_FILES =\ _TEST_FILES =\
general.css \ general.css \
general.xbl \ general.xbl \
@@ -57,6 +55,7 @@ _TEST_FILES =\
test_link.html \ test_link.html \
test_list.html \ test_list.html \
test_markup.html \ test_markup.html \
test_browserui.xul \
test_tree.xul \ test_tree.xul \
markuprules.xml \ markuprules.xml \
$(NULL) $(NULL)

View File

@@ -1,128 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- SeaMonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/javascript">
<![CDATA[
var gOpenerWnd = window.opener.wrappedJSObject;
function ok(aCond, aMsg) {
gOpenerWnd.SimpleTest.ok(aCond, aMsg);
}
function is(aExpected, aActual, aMsg) {
gOpenerWnd.SimpleTest.is(aExpected, aActual, aMsg);
}
// Hacks to make xul:tabbrowser work.
var handleDroppedLink = null; // needed for tabbrowser usage
Components.utils.import("resource://gre/modules/Services.jsm");
var XULBrowserWindow = {
isBusy: false,
setOverLink: function (link, b) {
}
};
gFindBarInitialized = false;
////////////////////////////////////////////////////////////////////////////
// Invoker implementation.
function switchTabSelectChecker(aInvoker)
{
this.type = "select";
Object.defineProperty(this, "target", { get: function() { return aInvoker.getTabsElm(); }});
this.getID = function() { return "switch tab, select event"; }
}
function switchTabFocusChecker(aInvoker)
{
this.type = gOpenerWnd.EVENT_FOCUS;
Object.defineProperty(this, "target", { get: function() { return aInvoker.getContentDoc(); }});
this.check = function(aEvent)
{
is(gOpenerWnd.getAccessible(document).name, "about:mozilla" + aEvent.accessible.name,
"Oops almost :)");
}
this.getID = function() { return "switch tab, focus event"; }
}
function switchTabInvoker(aTabBrowser, aWindow)
{
this.invoke = function switchTabInvoker_invoke()
{
gOpenerWnd.synthesizeKey("VK_TAB", { ctrlKey: true }, aWindow);
}
this.eventSeq = [
new switchTabSelectChecker(this),
new switchTabFocusChecker(this)
];
this.getContentDoc = function switchTabInvoker_getContentDoc()
{
return aTabBrowser.getBrowserAtIndex(1).contentDocument;
}
this.getTabsElm = function switchTabInvoker_getTabsElm()
{
return aTabBrowser.tabContainer;
}
}
////////////////////////////////////////////////////////////////////////////
// Tests
var gQueue = null;
const Ci = Components.interfaces;
function doTest()
{
var tabBrowser = document.getElementById("content");
tabBrowser.loadURI("about:");
tabBrowser.addTab("about:mozilla");
gQueue = new gOpenerWnd.eventQueue();
gQueue.push(new switchTabInvoker(tabBrowser, window));
gQueue.onFinish = function() { window.close(); }
gQueue.invoke();
}
gOpenerWnd.addA11yLoadEvent(doTest);
]]>
</script>
<!-- Hack to make xul:tabbrowser work -->
<menubar>
<menu label="menu">
<menupopup>
<menuitem label="close window hook" id="menu_closeWindow"/>
<menuitem label="close hook" id="menu_close"/>
</menupopup>
</menu>
</menubar>
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
tabbrowser="content"
flex="1"
setfocus="false">
<tab class="tabbrowser-tab" selected="true"/>
</tabs>
<tabbrowser id="content"
type="content-primary"
tabcontainer="tabbrowser-tabs"
flex="1"/>
</window>

View File

@@ -0,0 +1,106 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessibility Name Calculating Test.">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript"
src="../browser.js"></script>
<script type="application/javascript">
<![CDATA[
function addTab(aURL)
{
this.eventSeq = [
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
];
this.invoke = function addTab_invoke()
{
tabBrowser().addTab(aURL);
}
this.getID = function addTab_getID()
{
return "add tab: " + aURL;
}
}
function switchTab(aTabBrowser, aWindow)
{
this.invoke = function switchTab_invoke()
{
synthesizeKey("VK_TAB", { ctrlKey: true }, browserWindow());
}
this.eventSeq = [
new focusChecker(tabDocumentAt, 1)
];
this.check = function switchTab_check(aEvent)
{
var title = getAccessible(browserDocument()).name;
ok(title.indexOf(aEvent.accessible.name) != -1,
"Window title contains the name of active tab document");
}
this.getID = function switchTab_getID() { return "switch tab"; }
}
////////////////////////////////////////////////////////////////////////////
// Tests
//gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpToConsole = true; // debug
var gQueue = null;
function doTests()
{
gQueue = new eventQueue();
gQueue.push(new addTab("about:mozilla"));
gQueue.push(new switchTab());
gQueue.onFinish = function()
{
closeBrowserWindow();
}
gQueue.invoke();
}
SimpleTest.waitForExplicitFinish();
openBrowserWindow(doTests, "about:");
]]>
</script>
<vbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=507382"
title="focus is fired earlier than root accessible name is changed when switching between tabs">
Mozilla Bug
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox id="eventdump"></vbox>
</vbox>
</window>

View File

@@ -0,0 +1,216 @@
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
////////////////////////////////////////////////////////////////////////////////
// Constants
const PREFILTER_INVISIBLE = nsIAccessibleTraversalRule.PREFILTER_INVISIBLE;
const FILTER_MATCH = nsIAccessibleTraversalRule.FILTER_MATCH;
const FILTER_IGNORE = nsIAccessibleTraversalRule.FILTER_IGNORE;
const FILTER_IGNORE_SUBTREE = nsIAccessibleTraversalRule.FILTER_IGNORE_SUBTREE;
////////////////////////////////////////////////////////////////////////////////
// Traversal rules
/**
* Rule object to traverse all focusable nodes and text nodes.
*/
var HeadersTraversalRule =
{
getMatchRoles: function(aRules)
{
aRules.value = [ROLE_HEADING];
return aRules.value.length;
},
preFilter: PREFILTER_INVISIBLE,
match: function(aAccessible)
{
return FILTER_MATCH;
},
QueryInterface: XPCOMUtils.generateQI([nsIAccessibleTraversalRule])
}
/**
* Traversal rule for all focusable nodes or leafs.
*/
var ObjectTraversalRule =
{
getMatchRoles: function(aRules)
{
aRules.value = [];
return 0;
},
preFilter: PREFILTER_INVISIBLE,
match: function(aAccessible)
{
var rv = FILTER_IGNORE;
var role = aAccessible.role;
if (hasState(aAccessible, STATE_FOCUSABLE) &&
(role != ROLE_DOCUMENT && role != ROLE_INTERNAL_FRAME))
rv = FILTER_IGNORE_SUBTREE | FILTER_MATCH;
else if (aAccessible.childCount == 0 &&
role != ROLE_STATICTEXT && aAccessible.name.trim())
rv = FILTER_MATCH;
return rv;
},
QueryInterface: XPCOMUtils.generateQI([nsIAccessibleTraversalRule])
};
////////////////////////////////////////////////////////////////////////////////
// Virtual state invokers and checkers
/**
* A checker for virtual cursor changed events.
*/
function virtualCursorChangedChecker(aDocAcc, aIdOrNameOrAcc, aTextOffsets)
{
this.__proto__ = new invokerChecker(EVENT_VIRTUALCURSOR_CHANGED, aDocAcc);
this.check = function virtualCursorChangedChecker_check(aEvent)
{
var position = aDocAcc.virtualCursor.position;
var idMatches = position.DOMNode.id == aIdOrNameOrAcc;
var nameMatches = position.name == aIdOrNameOrAcc;
var accMatches = position == aIdOrNameOrAcc;
SimpleTest.ok(idMatches || nameMatches || accMatches, "id or name matches",
"expecting " + aIdOrNameOrAcc + ", got '" +
prettyName(position));
if (aTextOffsets) {
SimpleTest.is(aDocAcc.virtualCursor.startOffset, aTextOffsets[0],
"wrong start offset");
SimpleTest.is(aDocAcc.virtualCursor.endOffset, aTextOffsets[1],
"wrong end offset");
}
};
}
/**
* Set a text range in the pivot and wait for virtual cursor change event.
*
* @param aDocAcc document that manages the virtual cursor
* @param aTextAccessible accessible to set to virtual cursor's position
* @param aTextOffsets start and end offsets of text range to set in virtual
* cursor
*/
function setVirtualCursorRangeInvoker(aDocAcc, aTextAccessible, aTextOffsets)
{
this.invoke = function virtualCursorChangedInvoker_invoke()
{
SimpleTest.info(prettyName(aTextAccessible) + " " + aTextOffsets);
aDocAcc.virtualCursor.setTextRange(aTextAccessible,
aTextOffsets[0],
aTextOffsets[1]);
};
this.getID = function setVirtualCursorRangeInvoker_getID()
{
return "Set offset in " + prettyName(aTextAccessible) +
" to (" + aTextOffsets[0] + ", " + aTextOffsets[1] + ")";
}
this.eventSeq = [
new virtualCursorChangedChecker(aDocAcc, aTextAccessible, aTextOffsets)
];
}
/**
* Move the pivot and wait for virtual cursor change event.
*
* @param aDocAcc document that manages the virtual cursor
* @param aPivotMoveMethod method to test (ie. "moveNext", "moveFirst", etc.)
* @param aRule traversal rule object
* @param aIdOrNameOrAcc id, accessivle or accessible name to expect virtual
* cursor to land on after performing move method.
*/
function setVirtualCursorPosInvoker(aDocAcc, aPivotMoveMethod, aRule,
aIdOrNameOrAcc)
{
this.invoke = function virtualCursorChangedInvoker_invoke()
{
var moved = aDocAcc.virtualCursor[aPivotMoveMethod](aRule);
SimpleTest.ok((aIdOrNameOrAcc && moved) || (!aIdOrNameOrAcc && !moved),
"moved pivot");
};
this.getID = function setVirtualCursorPosInvoker_getID()
{
return "Do " + (aIdOrNameOrAcc ? "" : "no-op ") + aPivotMoveMethod;
}
if (aIdOrNameOrAcc) {
this.eventSeq = [ new virtualCursorChangedChecker(aDocAcc, aIdOrNameOrAcc) ];
} else {
this.eventSeq = [];
this.unexpectedEventSeq = [
new invokerChecker(EVENT_VIRTUALCURSOR_CHANGED, aDocAcc)
];
}
}
/**
* Add invokers to a queue to test a rule and an expected sequence of element ids
* or accessible names for that rule in the given document.
*
* @param aQueue event queue in which to push invoker sequence.
* @param aDocAcc the managing document of the virtual cursor we are testing
* @param aRule the traversal rule to use in the invokers
* @param aSequence a sequence of accessible names or elemnt ids to expect with
* the given rule in the given document
*/
function queueTraversalSequence(aQueue, aDocAcc, aRule, aSequence)
{
aDocAcc.virtualCursor.position = null;
for (var i = 0; i < aSequence.length; i++) {
var invoker = new setVirtualCursorPosInvoker(aDocAcc, "moveNext",
aRule, aSequence[i]);
aQueue.push(invoker);
}
// No further more matches for given rule, expect no virtual cursor changes.
aQueue.push(new setVirtualCursorPosInvoker(aDocAcc, "moveNext", aRule, null));
for (var i = aSequence.length-2; i >= 0; i--) {
var invoker = new setVirtualCursorPosInvoker(aDocAcc, "movePrevious",
aRule, aSequence[i])
aQueue.push(invoker);
}
// No previous more matches for given rule, expect no virtual cursor changes.
aQueue.push(new setVirtualCursorPosInvoker(aDocAcc, "movePrevious", aRule, null));
aQueue.push(new setVirtualCursorPosInvoker(
aDocAcc, "moveLast", aRule, aSequence[aSequence.length - 1]));
// No further more matches for given rule, expect no virtual cursor changes.
aQueue.push(new setVirtualCursorPosInvoker(aDocAcc, "moveNext", aRule, null));
aQueue.push(new setVirtualCursorPosInvoker(
aDocAcc, "moveFirst", aRule, aSequence[0]));
// No previous more matches for given rule, expect no virtual cursor changes.
aQueue.push(new setVirtualCursorPosInvoker(aDocAcc, "movePrevious", aRule, null));
}
/**
* A debug utility for writing proper sequences for queueTraversalSequence.
*/
function dumpTraversalSequence(aPivot, aRule)
{
var sequence = []
if (aPivot.moveFirst(aRule)) {
do {
sequence.push("'" + prettyName(aPivot.position) + "'");
} while (aPivot.moveNext(aRule))
}
SimpleTest.info("\n[" + sequence.join(", ") + "]\n");
}

View File

@@ -0,0 +1,54 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Eitan Isaacson <eitan@monotonous.org> (original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = accessible/pivot
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
doc_virtualcursor.html \
test_virtualcursor.html \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)

View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>Pivot test document</title>
<meta charset="utf-8" />
</head>
<body>
<h1 id="heading-1-1">Main Title</h1>
<h2 id="heading-2-1">First Section Title</h2>
<p id="paragraph-1">
Lorem ipsum <strong>dolor</strong> sit amet. Integer vitae urna
leo, id <a href="#">semper</a> nulla.
</p>
<h2 id="heading-2-2">Second Section Title</h2>
<p id="paragraph-2">
Sed accumsan luctus lacus, vitae mollis arcu tristique vulputate.</p>
<iframe
src="data:text/html,<html><body>An <i>embedded</i> document.</body></html>">
</iframe>
<p>
<a href="http://mozilla.org" title="Link 1 title">Link 1</a>
<a href="http://mozilla.org" title="Link 2 title">Link 2</a>
<a href="http://mozilla.org" title="Link 3 title">Link 3</a>
</p>
</body>
</html>

View File

@@ -0,0 +1,95 @@
<!DOCTYPE html>
<html>
<head>
<title>Tests pivot functionality in virtual cursors</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
</script>
<script type="application/javascript" src="../common.js"></script>
<script type="application/javascript" src="../browser.js"></script>
<script type="application/javascript" src="../events.js"></script>
<script type="application/javascript" src="../role.js"></script>
<script type="application/javascript" src="../states.js"></script>
<script type="application/javascript" src="../pivot.js"></script>
<script type="application/javascript">
var gBrowserWnd = null;
var gQueue = null;
function doTest()
{
var rootAcc = getRootAccessible(browserWindow().document);
try {
rootAcc.QueryInterface(nsIAccessibleCursorable);
} catch (e) {
ok(false, "Root accessible does not support nsIAccessibleCursorable");
}
var doc = currentTabDocument();
var docAcc = getAccessible(doc, [nsIAccessibleDocument,
nsIAccessibleCursorable]);
// Test that embedded documents don't have their own virtual cursor.
is(docAcc.childDocumentCount, 1, "Expecting one child document");
var childDoc = docAcc.getChildDocumentAt(0);
var supportsVC = true;
try {
childDoc.QueryInterface(nsIAccessibleCursorable);
} catch (e) {
supportsVC = false;
}
ok(!supportsVC, "no nsIAccessibleCursorable support in child document");
gQueue = new eventQueue();
gQueue.onFinish = function onFinish()
{
closeBrowserWindow();
}
queueTraversalSequence(gQueue, docAcc, HeadersTraversalRule,
['heading-1-1', 'heading-2-1', 'heading-2-2']);
queueTraversalSequence(
gQueue, docAcc, ObjectTraversalRule,
['Main Title', 'First Section Title', 'Lorem ipsum ',
'dolor', ' sit amet. Integer vitae urna leo, id ',
'semper', ' nulla. ', 'Second Section Title',
'Sed accumsan luctus lacus, vitae mollis arcu tristique vulputate.',
'An ', 'embedded', ' document.', 'Link 1', 'Link 2', 'Link 3']);
// Just a random smoke test to see if our setTextRange works.
gQueue.push(
new setVirtualCursorRangeInvoker(
docAcc,
getAccessible(doc.getElementById('paragraph-2'), nsIAccessibleText),
[2,6]));
gQueue.invoke();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(function () {
/* We open a new browser because we need to test with a top-level content
document. */
openBrowserWindow(
doTest,
"chrome://mochitests/content/a11y/accessible/pivot/doc_virtualcursor.html");
});
</script>
</head>
<body id="body">
<a target="_blank"
title="Introduce virtual cursor/soft focus functionality to a11y API"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=698823">Mozilla Bug 698823</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
</body>
</html>

View File

@@ -45,12 +45,11 @@ relativesrcdir = accessible/relations
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
# test_tabbrowser.xul disabled for misusing <tabbrowser> (bug 715857)
_TEST_FILES =\ _TEST_FILES =\
test_embeds.xul \ test_embeds.xul \
test_general.html \ test_general.html \
test_general.xul \ test_general.xul \
test_tabbrowser.xul \
test_tree.xul \ test_tree.xul \
test_update.html \ test_update.html \
$(NULL) $(NULL)

View File

@@ -3,20 +3,13 @@
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?> type="text/css"?>
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- SeaMonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible XUL tabbrowser relation tests"> title="Accessible XUL tabbrowser relation tests">
<script type="application/javascript" <script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/> src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" <script type="application/javascript"
src="../common.js" /> src="../common.js" />
@@ -26,75 +19,63 @@
src="../relations.js" /> src="../relations.js" />
<script type="application/javascript" <script type="application/javascript"
src="../events.js" /> src="../events.js" />
<script type="application/javascript"
src="../browser.js"></script>
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/javascript"> <script type="application/javascript">
<![CDATA[ <![CDATA[
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Test // Invoker
function testTabRelations()
const Ci = Components.interfaces;
// Hack to make xul:tabbrowser work.
var handleDroppedLink = null;
Components.utils.import("resource://gre/modules/Services.jsm");
var XULBrowserWindow = {
isBusy: false,
setOverLink: function (link, b) {
}
};
var gFindBar = {
hidden: true
};
function doTest()
{ {
var tabBrowser = document.getElementById("tabbrowser"); this.eventSeq = [
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 0),
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
];
// Load documents into tabs and wait for reorder events caused by these this.invoke = function testTabRelations_invoke()
// documents load before we start the test. {
var docURIs = ["about:", "about:mozilla"]; var docURIs = ["about:", "about:mozilla"];
tabBrowser().loadTabs(docURIs, false, true);
}
var handler = { this.finalCheck = function testTabRelations_finalCheck(aEvent)
handleEvent: function handleEvent(aEvent) { {
var target = aEvent.accessible; ////////////////////////////////////////////////////////////////////////
if (target.role == ROLE_INTERNAL_FRAME && // 'labelled by'/'label for' relations for xul:tab and xul:tabpanel
target.parent.parent == getAccessible(this.tabBrowser.mTabBox.tabpanels)) {
this.reorderCnt++;
}
if (this.reorderCnt == docURIs.length) { var tabs = tabBrowser().tabContainer.childNodes;
unregisterA11yEventListener(EVENT_REORDER, this); var panels = tabBrowser().mTabBox.tabpanels.childNodes;
testRelations();
}
},
tabBrowser: tabBrowser, testRelation(panels[0], RELATION_LABELLED_BY, tabs[0]);
reorderCnt: 0 testRelation(tabs[0], RELATION_LABEL_FOR, panels[0]);
}; testRelation(panels[1], RELATION_LABELLED_BY, tabs[1]);
registerA11yEventListener(EVENT_REORDER, handler); testRelation(tabs[1], RELATION_LABEL_FOR, panels[1]);
}
tabBrowser.loadTabs(docURIs, false, true); this.getID = function testTabRelations_getID()
{
return "relations of tabs";
}
} }
function testRelations() ////////////////////////////////////////////////////////////////////////////
// Test
var gQueue = null;
function doTest()
{ {
////////////////////////////////////////////////////////////////////////// // Load documents into tabs and wait for DocLoadComplete events caused by
// 'labelled by'/'label for' relations for xul:tab and xul:tabpanel // these documents load before we start the test.
var tabs = getNode("tabbrowser").tabContainer.childNodes; gQueue = new eventQueue();
var panels = getNode("tabbrowser").mTabBox.tabpanels.childNodes;
testRelation(panels[0], RELATION_LABELLED_BY, tabs[0]); gQueue.push(new testTabRelations());
testRelation(tabs[0], RELATION_LABEL_FOR, panels[0]); gQueue.onFinish = function() { closeBrowserWindow(); }
testRelation(panels[1], RELATION_LABELLED_BY, tabs[1]); gQueue.invoke(); // Will call SimpleTest.finish();
testRelation(tabs[1], RELATION_LABEL_FOR, panels[1]);
SimpleTest.finish();
} }
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest); openBrowserWindow(doTest);
]]> ]]>
</script> </script>
@@ -112,26 +93,7 @@
</pre> </pre>
</body> </body>
<!-- Hack to make xul:tabbrowser work --> <vbox id="eventdump"></vbox>
<menubar>
<menu label="menu">
<menupopup>
<menuitem label="close window hook" id="menu_closeWindow"/>
<menuitem label="close hook" id="menu_close"/>
</menupopup>
</menu>
</menubar>
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
tabbrowser="tabbrowser"
setfocus="false">
<tab class="tabbrowser-tab" selected="true"/>
</tabs>
<tabbrowser id="tabbrowser"
type="content-primary"
tabcontainer="tabbrowser-tabs"
flex="1"/>
<toolbar id="addon-bar"/>
</vbox> </vbox>
</window> </window>

View File

@@ -131,7 +131,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=529289
<tr><td>hi<td></tr></table> <tr><td>hi<td></tr></table>
<!-- test gEmptyRoleMap --> <!-- test gEmptyRoleMap -->
<table role="label"> <table role="button">
<tr> <tr>
<td id="cell">cell</td> <td id="cell">cell</td>
</tr> </tr>

View File

@@ -37,15 +37,15 @@
testChildAtPoint(txt, -10000, 10000, false, null); testChildAtPoint(txt, -10000, 10000, false, null);
testChildAtPoint(txt, -10000, 10000, true, null); testChildAtPoint(txt, -10000, 10000, true, null);
// Not specific case, point is inside of label accessible. // Not specific case, point is inside of btn accessible.
var label = getAccessible("label"); var btn = getAccessible("btn");
var labelText = label.firstChild; var btnText = btn.firstChild;
testChildAtPoint(label, 1, 1, false, labelText); testChildAtPoint(btn, 1, 1, false, btnText);
testChildAtPoint(label, 1, 1, true, labelText); testChildAtPoint(btn, 1, 1, true, btnText);
// Not specific case, point is outside of label accessible. // Not specific case, point is outside of btn accessible.
testChildAtPoint(label, -1, 1, false, null); testChildAtPoint(btn, -1, 1, false, null);
testChildAtPoint(label, -1, 1, true, null); testChildAtPoint(btn, -1, 1, true, null);
// Out of flow accessible testing, do not return out of flow accessible // Out of flow accessible testing, do not return out of flow accessible
// because it's not a child of the accessible even visually it is. // because it's not a child of the accessible even visually it is.
@@ -78,7 +78,7 @@
<div role="listitem" id="listitem"><span role="image" id="image">img</span>item</div> <div role="listitem" id="listitem"><span role="image" id="image">img</span>item</div>
</div> </div>
<span role="label">label1</span><span role="label" id="label">label2</span> <span role="button">button1</span><span role="button" id="btn">button2</span>
<span role="textbox">textbox1</span><span role="textbox" id="txt">textbox2</span> <span role="textbox">textbox1</span><span role="textbox" id="txt">textbox2</span>

View File

@@ -15,7 +15,7 @@
function doTest() function doTest()
{ {
var elmObj = {}; var elmObj = {};
var acc = getAccessible("span", [nsIAccessNode], elmObj); var acc = getAccessible("span", null, elmObj);
computedStyle = document.defaultView.getComputedStyle(elmObj.value, ""); computedStyle = document.defaultView.getComputedStyle(elmObj.value, "");
// html:span element // html:span element
@@ -23,7 +23,7 @@
"Wrong color for element with ID 'span'"); "Wrong color for element with ID 'span'");
// text child of html:span element // text child of html:span element
acc = getAccessible(acc.firstChild, [nsIAccessNode]); acc = getAccessible(acc.firstChild);
is(acc.getComputedStyleValue("", "color"), computedStyle.color, is(acc.getComputedStyleValue("", "color"), computedStyle.color,
"Wrong color for text child of element with ID 'span'"); "Wrong color for text child of element with ID 'span'");

View File

@@ -0,0 +1,54 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2012
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Alexander Surkov <surkov.alexander@gmail.com> (original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = accessible/textcaret
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
test_browserui.xul \
test_general.html \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)

View File

@@ -4,7 +4,7 @@
type="text/css"?> type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessibility Name Calculating Test."> title="Accessibility Caret Offset Test.">
<script type="application/javascript" <script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
@@ -15,41 +15,47 @@
src="../common.js"></script> src="../common.js"></script>
<script type="application/javascript" <script type="application/javascript"
src="../role.js"></script> src="../role.js"></script>
<script type="application/javascript"
src="../states.js"></script>
<script type="application/javascript" <script type="application/javascript"
src="../events.js"></script> src="../events.js"></script>
<script type="application/javascript"
src="../browser.js"></script>
<script type="application/javascript"> <script type="application/javascript">
<![CDATA[ <![CDATA[
// var gA11yEventDumpID = "eventdump"; // debug stuff
function doTest() ////////////////////////////////////////////////////////////////////////////
// Tests
//gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpToConsole = true; // debug
var gQueue = null;
function doTests()
{ {
todo(false, "Disabled test. (Bug 586818)"); gQueue = new eventQueue();
SimpleTest.finish(); gQueue.push(new setCaretOffset(urlbarInput(), -1, urlbarInput()));
return; gQueue.push(new setCaretOffset(urlbarInput(), 0));
gQueue.onFinish = function()
if (LINUX) { {
todo(false, "Skip test on Linux. (Bug 525175)"); closeBrowserWindow();
SimpleTest.finish();
return;
} }
var w = window.openDialog("nsRootAcc_wnd.xul", gQueue.invoke();
"nsRootAcc_name_test",
"chrome,width=600,height=600");
} }
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest); openBrowserWindow(doTests, "about:");
]]> ]]>
</script> </script>
<vbox flex="1" style="overflow: auto;"> <vbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml"> <body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" <a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=507382" href="https://bugzilla.mozilla.org/show_bug.cgi?id=723833"
title="focus is fired earlier than root accessible name is changed when switching between tabs"> title="IAccessibleText::setCaretOffset on location or search bar causes focus to jump">
Mozilla Bug Mozilla Bug 723833
</a> </a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"> <div id="content" style="display: none">

View File

@@ -10,52 +10,11 @@
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" <script type="application/javascript"
src="common.js"></script> src="../common.js"></script>
<script type="application/javascript" <script type="application/javascript"
src="events.js"></script> src="../events.js"></script>
<script type="application/javascript"> <script type="application/javascript">
/**
* Checkers.
*/
function caretMovedChecker(aID, aOffset)
{
this.__proto__ = new invokerChecker(EVENT_TEXT_CARET_MOVED, aID);
this.check = function caretMovedChecker_check(aEvent)
{
is(aEvent.QueryInterface(nsIAccessibleCaretMoveEvent).caretOffset,
aOffset,
"Wrong caret offset for " + prettyName(aEvent.target));
}
}
/**
* Invokers.
*/
function setCaretOffsetInvoker(aID, aOffset, aFocusableContainerID)
{
this.target = getAccessible(aID, [nsIAccessibleText]);
this.focus = aFocusableContainerID ?
getAccessible(aFocusableContainerID) : this.target;
this.invoke = function setCaretOffsetInvoker_invoke()
{
this.target.caretOffset = aOffset;
}
this.getID = function setCaretOffsetInvoker_getID()
{
return "Set caretOffset on " + prettyName(aID) + " at " + aOffset;
}
this.eventSeq = [
new caretMovedChecker(this.target, aOffset),
new asyncInvokerChecker(EVENT_FOCUS, this.focus)
];
}
/** /**
* Turn on/off the caret browsing mode. * Turn on/off the caret browsing mode.
*/ */
@@ -81,9 +40,9 @@
// test caret move events and caret offsets // test caret move events and caret offsets
gQueue = new eventQueue(); gQueue = new eventQueue();
gQueue.push(new setCaretOffsetInvoker("textbox", 1)); gQueue.push(new setCaretOffset("textbox", 1, "textbox"));
gQueue.push(new setCaretOffsetInvoker("link", 1)); gQueue.push(new setCaretOffset("link", 1, "link"));
gQueue.push(new setCaretOffsetInvoker("heading", 1, document)); gQueue.push(new setCaretOffset("heading", 1, document));
gQueue.onFinish = function() gQueue.onFinish = function()
{ {
turnCaretBrowsing(false); turnCaretBrowsing(false);

View File

@@ -45,8 +45,6 @@ relativesrcdir = accessible/tree
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
# test_tabbrowser.xul disabled for misusing <tabbrowser> (bug 715857)
_TEST_FILES =\ _TEST_FILES =\
dockids.html \ dockids.html \
$(warning test_applicationacc.xul temporarily disabled, see bug 561508) \ $(warning test_applicationacc.xul temporarily disabled, see bug 561508) \
@@ -72,6 +70,7 @@ _TEST_FILES =\
test_media.html \ test_media.html \
test_select.html \ test_select.html \
test_tabbox.xul \ test_tabbox.xul \
test_tabbrowser.xul \
test_table.html \ test_table.html \
test_tree.xul \ test_tree.xul \
test_txtcntr.html \ test_txtcntr.html \

View File

@@ -1,13 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?> <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<!-- Firefox tabbrowser -->
<?xml-stylesheet href="chrome://browser/content/browser.css"
type="text/css"?>
<!-- SeaMonkey tabbrowser -->
<?xml-stylesheet href="chrome://navigator/content/navigator.css"
type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?> type="text/css"?>
@@ -17,7 +10,7 @@
<script type="application/javascript" <script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript" <script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/> src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" <script type="application/javascript"
src="../common.js" /> src="../common.js" />
@@ -25,201 +18,186 @@
src="../role.js" /> src="../role.js" />
<script type="application/javascript" <script type="application/javascript"
src="../events.js" /> src="../events.js" />
<script type="application/javascript"
src="../browser.js"></script>
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/javascript"> <script type="application/javascript">
<![CDATA[ <![CDATA[
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// Test // invoker
function testTabHierarchy()
const Ci = Components.interfaces;
// Hack to make xul:tabbrowser work.
Components.utils.import("resource://gre/modules/Services.jsm");
var handleDroppedLink = null;
var XULBrowserWindow = {
isBusy: false,
setOverLink: function (link, b) {}
};
var gFindBar = {
hidden: true
};
function doTest()
{ {
var tabBrowser = document.getElementById("tabbrowser"); this.eventSeq = [
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 0),
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
];
// Load documents into tabs and wait for reorder events caused by these this.invoke = function testTabHierarchy_invoke()
// documents load before we start the test. {
var docURIs = ["about:", "about:mozilla"]; var docURIs = ["about:", "about:mozilla"];
tabBrowser().loadTabs(docURIs, false, true);
var handler = {
handleEvent: function handleEvent(aEvent) {
var target = aEvent.accessible;
if (target.role == ROLE_INTERNAL_FRAME &&
target.parent.parent == getAccessible(this.tabBrowser.mTabBox.tabpanels)) {
this.reorderCnt++;
}
if (this.reorderCnt == docURIs.length) {
unregisterA11yEventListener(EVENT_REORDER, this);
testAccTree();
}
},
tabBrowser: tabBrowser,
reorderCnt: 0
};
registerA11yEventListener(EVENT_REORDER, handler);
// Test XUL and HTML documents.
tabBrowser.loadTabs(docURIs, false, true);
}
function testAccTree()
{
var tabBrowser = document.getElementById("tabbrowser");
////////////////////
// Tab bar
////////////////////
var tabsAccTree = {
// xul:tabs
role: ROLE_PAGETABLIST,
children: [
// Children depend on application (UI): see below.
]
};
// SeaMonkey and Firefox tabbrowser UIs differ.
if ("restoreTab" in tabBrowser) {
SimpleTest.ok(true, "Testing SeaMonkey tabbrowser UI.");
tabsAccTree.children.splice(0, 0,
{
// xul:toolbarbutton ("Open a new tab")
role: ROLE_PUSHBUTTON,
children: []
},
{
// xul:tab ("about:")
role: ROLE_PAGETAB,
children: []
},
{
// tab ("about:mozilla")
role: ROLE_PAGETAB,
children: []
},
{
// xul:toolbarbutton ("List all tabs")
role: ROLE_PUSHBUTTON,
children: [
{
// xul:menupopup
role: ROLE_MENUPOPUP,
children: []
}
]
},
{
// xul:toolbarbutton ("Close current tab")
role: ROLE_PUSHBUTTON,
children: []
}
);
} else {
SimpleTest.ok(true, "Testing Firefox tabbrowser UI.");
// NB: The (3) buttons are not visible, unless manually hovered,
// probably due to size reduction in this test.
tabsAccTree.children.splice(0, 0,
{
// xul:tab ("about:")
role: ROLE_PAGETAB,
children: [
{
// xul:toolbarbutton ("Close Tab")
role: ROLE_PUSHBUTTON,
children: []
}
]
},
{
// tab ("about:mozilla")
role: ROLE_PAGETAB,
children: [
{
// xul:toolbarbutton ("Close Tab")
role: ROLE_PUSHBUTTON,
children: []
}
]
},
{
// xul:toolbarbutton ("Open a new tab")
role: ROLE_PUSHBUTTON,
children: []
}
// "List all tabs" dropdown
// XXX: This child(?) is not present in this test.
// I'm not sure why (though probably expected).
);
} }
testAccessibleTree(tabBrowser.tabContainer, tabsAccTree); this.finalCheck = function testTabHierarchy_finalCheck(aEvent)
{
////////////////////
// Tab bar
////////////////////
var tabsAccTree = {
// xul:tabs
role: ROLE_PAGETABLIST,
children: [
// Children depend on application (UI): see below.
]
};
//////////////////// // SeaMonkey and Firefox tabbrowser UIs differ.
// Tab contents if ("restoreTab" in tabBrowser) {
//////////////////// SimpleTest.ok(true, "Testing SeaMonkey tabbrowser UI.");
var tabboxAccTree = {
// xul:tabpanels
role: ROLE_PANE,
children: [
{
// xul:notificationbox
role: ROLE_PROPERTYPAGE,
children: [
{
// xul:browser
role: ROLE_INTERNAL_FRAME,
children: [
{
// #document ("about:")
role: ROLE_DOCUMENT
// children: [ ... ] // Ignore document content.
}
]
}
]
},
{
// notificationbox
role: ROLE_PROPERTYPAGE,
children: [
{
// browser
role: ROLE_INTERNAL_FRAME,
children: [
{
// #document ("about:mozilla")
role: ROLE_DOCUMENT
// children: [ ... ] // Ignore document content.
}
]
}
]
}
]
};
testAccessibleTree(tabBrowser.mTabBox.tabpanels, tabboxAccTree); tabsAccTree.children.splice(0, 0,
{
// xul:toolbarbutton ("Open a new tab")
role: ROLE_PUSHBUTTON,
children: []
},
{
// xul:tab ("about:")
role: ROLE_PAGETAB,
children: []
},
{
// tab ("about:mozilla")
role: ROLE_PAGETAB,
children: []
},
{
// xul:toolbarbutton ("List all tabs")
role: ROLE_PUSHBUTTON,
children: [
{
// xul:menupopup
role: ROLE_MENUPOPUP,
children: []
}
]
},
{
// xul:toolbarbutton ("Close current tab")
role: ROLE_PUSHBUTTON,
children: []
}
);
} else {
SimpleTest.ok(true, "Testing Firefox tabbrowser UI.");
SimpleTest.finish(); // NB: The (3) buttons are not visible, unless manually hovered,
// probably due to size reduction in this test.
tabsAccTree.children.splice(0, 0,
{
// xul:tab ("about:")
role: ROLE_PAGETAB,
children: [
{
// xul:toolbarbutton ("Close Tab")
role: ROLE_PUSHBUTTON,
children: []
}
]
},
{
// tab ("about:mozilla")
role: ROLE_PAGETAB,
children: [
{
// xul:toolbarbutton ("Close Tab")
role: ROLE_PUSHBUTTON,
children: []
}
]
},
{
// xul:toolbarbutton ("Open a new tab")
role: ROLE_PUSHBUTTON,
children: []
}
// "List all tabs" dropdown
// XXX: This child(?) is not present in this test.
// I'm not sure why (though probably expected).
);
}
testAccessibleTree(tabBrowser().tabContainer, tabsAccTree);
////////////////////
// Tab contents
////////////////////
var tabboxAccTree = {
// xul:tabpanels
role: ROLE_PANE,
children: [
{
// xul:notificationbox
role: ROLE_PROPERTYPAGE,
children: [
{
// xul:browser
role: ROLE_INTERNAL_FRAME,
children: [
{
// #document ("about:")
role: ROLE_DOCUMENT
// children: [ ... ] // Ignore document content.
}
]
}
]
},
{
// notificationbox
role: ROLE_PROPERTYPAGE,
children: [
{
// browser
role: ROLE_INTERNAL_FRAME,
children: [
{
// #document ("about:mozilla")
role: ROLE_DOCUMENT
// children: [ ... ] // Ignore document content.
}
]
}
]
}
]
};
testAccessibleTree(tabBrowser().mTabBox.tabpanels, tabboxAccTree);
}
this.getID = function testTabHierarchy_getID()
{
return "hierarchy of tabs";
}
}
////////////////////////////////////////////////////////////////////////////
// Test
var gQueue = null;
function doTest()
{
// Load documents into tabs and wait for docLoadComplete events caused by these
// documents load before we start the test.
gQueue = new eventQueue();
gQueue.push(new testTabHierarchy());
gQueue.onFinish = function() { closeBrowserWindow(); }
gQueue.invoke(); // Will call SimpleTest.finish();
} }
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest); openBrowserWindow(doTest);
]]> ]]>
</script> </script>
@@ -242,26 +220,7 @@
</pre> </pre>
</body> </body>
<!-- Hack to make xul:tabbrowser work --> <vbox id="eventdump"></vbox>
<menubar>
<menu label="menu">
<menupopup>
<menuitem label="close window hook" id="menu_closeWindow"/>
<menuitem label="close hook" id="menu_close"/>
</menupopup>
</menu>
</menubar>
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
tabbrowser="tabbrowser"
setfocus="false">
<tab class="tabbrowser-tab" selected="true" fadein="true"/>
</tabs>
<tabbrowser id="tabbrowser"
type="content-primary"
tabcontainer="tabbrowser-tabs"
flex="1"/>
<toolbar id="addon-bar"/>
</vbox> </vbox>
</window> </window>

View File

@@ -64,8 +64,8 @@
this.preinvoke = function rootContentRemoved_preinvoke() this.preinvoke = function rootContentRemoved_preinvoke()
{ {
// Set up target for hide event before we invoke. // Set up target for hide event before we invoke.
var text = getAccessible(getAccessible(getDocNode(aID)).firstChild, var text =
[nsIAccessNode]).DOMNode; getAccessible(getAccessible(getDocNode(aID)).firstChild).DOMNode;
this.eventSeq[0].target = text; this.eventSeq[0].target = text;
} }

View File

@@ -38,7 +38,6 @@
#filter substitution #filter substitution
pref("toolkit.defaultChromeURI", "chrome://browser/content/shell.xul"); pref("toolkit.defaultChromeURI", "chrome://browser/content/shell.xul");
pref("general.useragent.compatMode.firefox", true);
pref("browser.chromeURL", "chrome://browser/content/"); pref("browser.chromeURL", "chrome://browser/content/");
#ifdef MOZ_OFFICIAL_BRANDING #ifdef MOZ_OFFICIAL_BRANDING
pref("browser.homescreenURL", "file:///system/home/homescreen.html"); pref("browser.homescreenURL", "file:///system/home/homescreen.html");
@@ -394,6 +393,15 @@ pref("layers.acceleration.force-enabled", true);
pref("dom.screenEnabledProperty.enabled", true); pref("dom.screenEnabledProperty.enabled", true);
pref("dom.screenBrightnessProperty.enabled", true); pref("dom.screenBrightnessProperty.enabled", true);
// handle links targeting new windows
// 1=current window/tab, 2=new window, 3=new tab in most recent window
pref("browser.link.open_newwindow", 3);
// 0: no restrictions - divert everything
// 1: don't divert window.open at all
// 2: don't divert window.open with features
pref("browser.link.open_newwindow.restriction", 0);
// Enable browser frame // Enable browser frame
pref("dom.mozBrowserFramesEnabled", true); pref("dom.mozBrowserFramesEnabled", true);
pref("dom.mozBrowserFramesWhitelist", "http://localhost:6666"); pref("dom.mozBrowserFramesWhitelist", "http://localhost:6666");
@@ -401,9 +409,14 @@ pref("dom.mozBrowserFramesWhitelist", "http://localhost:6666");
// Temporary permission hack for WebSMS // Temporary permission hack for WebSMS
pref("dom.sms.enabled", true); pref("dom.sms.enabled", true);
pref("dom.sms.whitelist", "file://,http://localhost:6666"); pref("dom.sms.whitelist", "file://,http://localhost:6666");
// Ignore X-Frame-Options headers. // Ignore X-Frame-Options headers.
pref("b2g.ignoreXFrameOptions", true); pref("b2g.ignoreXFrameOptions", true);
// controls if we want camera support
pref("device.camera.enabled", true);
pref("media.realtime_decoder.enabled", true);
// "Preview" landing of bug 710563, which is bogged down in analysis // "Preview" landing of bug 710563, which is bogged down in analysis
// of talos regression. This is a needed change for higher-framerate // of talos regression. This is a needed change for higher-framerate
// CSS animations, and incidentally works around an apparent bug in // CSS animations, and incidentally works around an apparent bug in
@@ -412,3 +425,6 @@ pref("b2g.ignoreXFrameOptions", true);
// secondary bug isn't really worth investigating since it's obseleted // secondary bug isn't really worth investigating since it's obseleted
// by bug 710563. // by bug 710563.
pref("layout.frame_rate.precise", true); pref("layout.frame_rate.precise", true);
// Screen timeout in minutes
pref("power.screen.timeout", 60);

View File

@@ -47,17 +47,19 @@ const LocalFile = CC('@mozilla.org/file/local;1',
Cu.import('resource://gre/modules/XPCOMUtils.jsm'); Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/Services.jsm'); Cu.import('resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyGetter(Services, 'env', function() { XPCOMUtils.defineLazyGetter(Services, 'env', function() {
return Cc['@mozilla.org/process/environment;1'] return Cc['@mozilla.org/process/environment;1']
.getService(Ci.nsIEnvironment); .getService(Ci.nsIEnvironment);
}); });
XPCOMUtils.defineLazyGetter(Services, 'ss', function() { XPCOMUtils.defineLazyGetter(Services, 'ss', function() {
return Cc['@mozilla.org/content/style-sheet-service;1'] return Cc['@mozilla.org/content/style-sheet-service;1']
.getService(Ci.nsIStyleSheetService); .getService(Ci.nsIStyleSheetService);
}); });
XPCOMUtils.defineLazyGetter(Services, 'fm', function() { XPCOMUtils.defineLazyGetter(Services, 'idle', function() {
return Cc['@mozilla.org/focus-manager;1'] return Cc['@mozilla.org/widget/idleservice;1']
.getService(Ci.nsIFocusManager); .getService(Ci.nsIIdleService);
}); });
// In order to use http:// scheme instead of file:// scheme // In order to use http:// scheme instead of file:// scheme
@@ -77,9 +79,10 @@ function startupHttpd(baseDir, port) {
// FIXME Bug 707625 // FIXME Bug 707625
// until we have a proper security model, add some rights to // until we have a proper security model, add some rights to
// the pre-installed web applications // the pre-installed web applications
// XXX never grant 'content-camera' to non-gaia apps
function addPermissions(urls) { function addPermissions(urls) {
let permissions = [ let permissions = [
'indexedDB', 'indexedDB-unlimited', 'webapps-manage', 'offline-app' 'indexedDB', 'indexedDB-unlimited', 'webapps-manage', 'offline-app', 'content-camera'
]; ];
urls.forEach(function(url) { urls.forEach(function(url) {
let uri = Services.io.newURI(url, null, null); let uri = Services.io.newURI(url, null, null);
@@ -96,9 +99,9 @@ var shell = {
// FIXME/bug 678695: this should be a system setting // FIXME/bug 678695: this should be a system setting
preferredScreenBrightness: 1.0, preferredScreenBrightness: 1.0,
get home() { get contentBrowser() {
delete this.home; delete this.contentBrowser;
return this.home = document.getElementById('homescreen'); return this.contentBrowser = document.getElementById('homescreen');
}, },
get homeURL() { get homeURL() {
@@ -131,7 +134,8 @@ var shell = {
window.controllers.appendController(this); window.controllers.appendController(this);
window.addEventListener('keypress', this); window.addEventListener('keypress', this);
window.addEventListener('MozApplicationManifest', this); window.addEventListener('MozApplicationManifest', this);
this.home.addEventListener('load', this, true); window.addEventListener("AppCommand", this);
this.contentBrowser.addEventListener('load', this, true);
try { try {
Services.io.offline = false; Services.io.offline = false;
@@ -156,7 +160,15 @@ var shell = {
return alert(msg); return alert(msg);
} }
let browser = this.home; // Load webapi+apps.js as a frame script
let frameScriptUrl = 'chrome://browser/content/webapi.js';
try {
messageManager.loadFrameScript(frameScriptUrl, true);
} catch (e) {
dump('Error when loading ' + frameScriptUrl + ' as a frame script: ' + e + '\n');
}
let browser = this.contentBrowser;
browser.homePage = homeURL; browser.homePage = homeURL;
browser.goHome(); browser.goHome();
}, },
@@ -187,7 +199,7 @@ var shell = {
doCommand: function shell_doCommand(cmd) { doCommand: function shell_doCommand(cmd) {
switch (cmd) { switch (cmd) {
case 'cmd_close': case 'cmd_close':
this.home.contentWindow.postMessage('appclose', '*'); content.postMessage('appclose', '*');
break; break;
} }
}, },
@@ -197,7 +209,7 @@ var shell = {
case 'keypress': case 'keypress':
switch (evt.keyCode) { switch (evt.keyCode) {
case evt.DOM_VK_HOME: case evt.DOM_VK_HOME:
this.sendEvent(this.home.contentWindow, 'home'); this.sendEvent(content, 'home');
break; break;
case evt.DOM_VK_SLEEP: case evt.DOM_VK_SLEEP:
this.toggleScreen(); this.toggleScreen();
@@ -205,7 +217,7 @@ var shell = {
let details = { let details = {
'enabled': screen.mozEnabled 'enabled': screen.mozEnabled
}; };
this.sendEvent(this.home.contentWindow, 'sleep', details); this.sendEvent(content, 'sleep', details);
break; break;
case evt.DOM_VK_ESCAPE: case evt.DOM_VK_ESCAPE:
if (evt.defaultPrevented) if (evt.defaultPrevented)
@@ -214,9 +226,20 @@ var shell = {
break; break;
} }
break; break;
case 'AppCommand':
switch (evt.command) {
case 'Menu':
this.sendEvent(content, 'menu');
break;
}
break;
case 'load': case 'load':
this.home.removeEventListener('load', this, true); this.contentBrowser.removeEventListener('load', this, true);
this.turnScreenOn(); this.turnScreenOn();
let chromeWindow = window.QueryInterface(Ci.nsIDOMChromeWindow);
chromeWindow.browserDOMWindow = new nsBrowserAccess();
this.sendEvent(window, 'ContentStart'); this.sendEvent(window, 'ContentStart');
break; break;
case 'MozApplicationManifest': case 'MozApplicationManifest':
@@ -229,7 +252,7 @@ var shell = {
if (!documentElement) if (!documentElement)
return; return;
let manifest = documentElement.getAttribute("manifest"); let manifest = documentElement.getAttribute('manifest');
if (!manifest) if (!manifest)
return; return;
@@ -273,78 +296,60 @@ var shell = {
turnScreenOn: function shell_turnScreenOn() { turnScreenOn: function shell_turnScreenOn() {
screen.mozEnabled = true; screen.mozEnabled = true;
screen.mozBrightness = this.preferredScreenBrightness; screen.mozBrightness = this.preferredScreenBrightness;
},
};
(function VirtualKeyboardManager() {
let activeElement = null;
let isKeyboardOpened = false;
let constructor = {
handleEvent: function vkm_handleEvent(evt) {
let contentWindow = shell.home.contentWindow.wrappedJSObject;
switch (evt.type) {
case 'ContentStart':
contentWindow.navigator.mozKeyboard = new MozKeyboard();
break;
case 'keypress':
if (evt.keyCode != evt.DOM_VK_ESCAPE || !isKeyboardOpened)
return;
shell.sendEvent(contentWindow, 'hideime');
isKeyboardOpened = false;
evt.preventDefault();
evt.stopPropagation();
break;
case 'mousedown':
if (evt.target != activeElement || isKeyboardOpened)
return;
let type = activeElement.type;
shell.sendEvent(contentWindow, 'showime', { type: type });
isKeyboardOpened = true;
break;
}
},
observe: function vkm_observe(subject, topic, data) {
let contentWindow = shell.home.contentWindow;
let shouldOpen = parseInt(data);
if (shouldOpen && !isKeyboardOpened) {
activeElement = Services.fm.focusedElement;
if (!activeElement)
return;
let type = activeElement.type;
shell.sendEvent(contentWindow, 'showime', { type: type });
} else if (!shouldOpen && isKeyboardOpened) {
shell.sendEvent(contentWindow, 'hideime');
}
isKeyboardOpened = shouldOpen;
}
};
Services.obs.addObserver(constructor, 'ime-enabled-state-changed', false);
['ContentStart', 'keypress', 'mousedown'].forEach(function vkm_events(type) {
window.addEventListener(type, constructor, true);
});
})();
function MozKeyboard() {
}
MozKeyboard.prototype = {
sendKey: function mozKeyboardSendKey(keyCode, charCode) {
charCode = (charCode == undefined) ? keyCode : charCode;
var utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
['keydown', 'keypress', 'keyup'].forEach(function sendKeyEvents(type) {
utils.sendKeyEvent(type, keyCode, charCode, null);
});
} }
}; };
(function PowerManager() {
let idleHandler = {
observe: function(subject, topic, time) {
if (topic === "idle") {
// TODO: Check wakelock status. See bug 697132.
shell.turnScreenOff();
}
},
}
let idleTimeout = Services.prefs.getIntPref("power.screen.timeout");
if (idleTimeout) {
Services.idle.addIdleObserver(idleHandler, idleTimeout);
}
})();
function nsBrowserAccess() {
}
nsBrowserAccess.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserDOMWindow]),
openURI: function openURI(uri, opener, where, context) {
// TODO This should be replaced by an 'open-browser-window' intent
let contentWindow = content.wrappedJSObject;
if (!('getApplicationManager' in contentWindow))
return null;
let applicationManager = contentWindow.getApplicationManager();
if (!applicationManager)
return null;
let url = uri ? uri.spec : 'about:blank';
let window = applicationManager.launch(url, where);
return window.contentWindow;
},
openURIInFrame: function openURIInFrame(uri, opener, where, context) {
throw new Error('Not Implemented');
},
isTabContentWindow: function isTabContentWindow(contentWindow) {
return contentWindow == window;
}
};
// Pipe `console` log messages to the nsIConsoleService which writes them
// to logcat.
Services.obs.addObserver(function onConsoleAPILogEvent(subject, topic, data) {
let message = subject.wrappedJSObject;
let prefix = "Content JS " + message.level.toUpperCase() +
" at " + message.filename + ":" + message.lineNumber +
" in " + (message.functionName || "anonymous") + ": ";
Services.console.logStringMessage(prefix + Array.join(message.arguments, " "));
}, "console-api-log-event", false);

View File

@@ -66,12 +66,12 @@
events: ['mousedown', 'mousemove', 'mouseup', 'click', 'unload'], events: ['mousedown', 'mousemove', 'mouseup', 'click', 'unload'],
start: function teh_start() { start: function teh_start() {
this.events.forEach((function(evt) { this.events.forEach((function(evt) {
shell.home.addEventListener(evt, this, true); shell.contentBrowser.addEventListener(evt, this, true);
}).bind(this)); }).bind(this));
}, },
stop: function teh_stop() { stop: function teh_stop() {
this.events.forEach((function(evt) { this.events.forEach((function(evt) {
shell.home.removeEventListener(evt, this, true); shell.contentBrowser.removeEventListener(evt, this, true);
}).bind(this)); }).bind(this));
}, },
handleEvent: function teh_handleEvent(evt) { handleEvent: function teh_handleEvent(evt) {
@@ -139,12 +139,7 @@
return; return;
case 'click': case 'click':
if (!isNewTouchAction) { if (isNewTouchAction) {
debug('click: cancel');
evt.preventDefault();
evt.stopPropagation();
} else {
// Mouse events has been cancelled so dispatch a sequence // Mouse events has been cancelled so dispatch a sequence
// of events to where touchend has been fired // of events to where touchend has been fired
if (preventMouseEvents) { if (preventMouseEvents) {

1788
b2g/chrome/content/webapi.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@ chrome.jar:
content/touch.js (content/touch.js) content/touch.js (content/touch.js)
content/commandUtil.js (content/commandUtil.js) content/commandUtil.js (content/commandUtil.js)
content/httpd.js (content/httpd.js) content/httpd.js (content/httpd.js)
content/webapi.js (content/webapi.js)
content/content.css (content/content.css) content/content.css (content/content.css)
% override chrome://global/content/netError.xhtml chrome://browser/content/netError.xhtml % override chrome://global/content/netError.xhtml chrome://browser/content/netError.xhtml

View File

@@ -1,2 +1,7 @@
# Scrollbars # Scrollbars
category agent-style-sheets browser-content-stylesheet chrome://browser/content/content.css category agent-style-sheets browser-content-stylesheet chrome://browser/content/content.css
# CameraContent.js
component {eff4231b-abce-4f7f-a40a-d646e8fde3ce} CameraContent.js
contract @mozilla.org/b2g-camera-content;1 {eff4231b-abce-4f7f-a40a-d646e8fde3ce}
category JavaScript-navigator-property mozCamera @mozilla.org/b2g-camera-content;1

View File

@@ -0,0 +1,83 @@
/* 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/. */
"use strict";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
const kProtocolName = "b2g-camera:";
let CameraContent = function() {
this.hasPrivileges = false;
this.mapping = [];
}
CameraContent.prototype = {
getCameraURI: function(aOptions) {
if (!this.hasPrivileges)
return null;
let options = aOptions || { };
if (!options.camera)
options.camera = 0;
if (!options.width)
options.width = 320;
if (!options.height)
options.height = 240;
let uuid = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID().toString();
uuid = uuid.substring(1, uuid.length - 2); // remove the brackets
this.mapping.push(uuid);
let uri = kProtocolName + "?camera=" + options.camera +
"&width=" + options.width +
"&height=" + options.height +
"&type=video/x-raw-yuv";
// XXX that's no e10s ready, but the camera inputstream itself is not...
Services.prefs.setCharPref("b2g.camera." + kProtocolName + "?" + uuid, uri);
return kProtocolName + "?" + uuid;
},
observe: function(aSubject, aTopic, aData) {
if (aTopic == "inner-window-destroyed") {
let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
if (wId == this.innerWindowID) {
Services.obs.removeObserver(this, "inner-window-destroyed");
for (let aId in this.mapping)
Services.prefs.clearUserPref("b2g.camera." + kProtocolName + "?" + aId);
this.mapping = null;
}
}
},
init: function(aWindow) {
let principal = aWindow.document.nodePrincipal;
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
let perm = principal == secMan.getSystemPrincipal() ? Ci.nsIPermissionManager.ALLOW_ACTION : Services.perms.testExactPermission(principal.URI, "content-camera");
//only pages with perm set and chrome pages can use the camera in content
this.hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION || from.schemeIs("chrome");
Services.obs.addObserver(this, "inner-window-destroyed", false);
let util = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
this.innerWindowID = util.currentInnerWindowID;
},
classID: Components.ID("{eff4231b-abce-4f7f-a40a-d646e8fde3ce}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIB2GCameraContent, Ci.nsIDOMGlobalPropertyInitializer, Ci.nsIObserver]),
classInfo: XPCOMUtils.generateCI({classID: Components.ID("{eff4231b-abce-4f7f-a40a-d646e8fde3ce}"),
contractID: "@mozilla.org/b2g-camera-content;1",
interfaces: [Ci.nsIB2GCameraContent],
flags: Ci.nsIClassInfo.DOM_OBJECT,
classDescription: "B2G Camera Content Helper"})
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([CameraContent]);

View File

@@ -44,8 +44,13 @@ include $(DEPTH)/config/autoconf.mk
MODULE = B2GComponents MODULE = B2GComponents
XPIDL_MODULE = B2GComponents XPIDL_MODULE = B2GComponents
XPIDLSRCS = \
b2g.idl \
$(NULL)
EXTRA_PP_COMPONENTS = \ EXTRA_PP_COMPONENTS = \
B2GComponents.manifest \ B2GComponents.manifest \
CameraContent.js \
$(NULL) $(NULL)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

12
b2g/components/b2g.idl Normal file
View File

@@ -0,0 +1,12 @@
/* 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 "domstubs.idl"
[scriptable, uuid(3615a616-571d-4194-bf54-ccf546067b14)]
interface nsIB2GCameraContent : nsISupports
{
/* temporary solution, waiting for getUserMedia */
DOMString getCameraURI([optional] in jsval options);
};

View File

@@ -38,7 +38,8 @@
MOZ_APP_BASENAME=B2G MOZ_APP_BASENAME=B2G
MOZ_APP_VENDOR=Mozilla MOZ_APP_VENDOR=Mozilla
MOZ_APP_VERSION=11.0a1 MOZ_APP_VERSION=13.0a1
MOZ_APP_UA_NAME=Firefox
MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official

View File

@@ -162,6 +162,7 @@
@BINPATH@/components/dom_indexeddb.xpt @BINPATH@/components/dom_indexeddb.xpt
@BINPATH@/components/dom_offline.xpt @BINPATH@/components/dom_offline.xpt
@BINPATH@/components/dom_json.xpt @BINPATH@/components/dom_json.xpt
@BINPATH@/components/dom_power.xpt
@BINPATH@/components/dom_range.xpt @BINPATH@/components/dom_range.xpt
@BINPATH@/components/dom_sidebar.xpt @BINPATH@/components/dom_sidebar.xpt
@BINPATH@/components/dom_sms.xpt @BINPATH@/components/dom_sms.xpt
@@ -602,3 +603,4 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/chrome/chrome.manifest @BINPATH@/chrome/chrome.manifest
@BINPATH@/components/B2GComponents.manifest @BINPATH@/components/B2GComponents.manifest
@BINPATH@/components/B2GComponents.xpt @BINPATH@/components/B2GComponents.xpt
@BINPATH@/components/CameraContent.js

View File

@@ -1,6 +1,10 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1327685994000"> <blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1328289666000">
<emItems> <emItems>
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}"> <emItem blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
<versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1"> <versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1">
</versionRange> </versionRange>
@@ -43,8 +47,10 @@
<versionRange minVersion="0.1" maxVersion="14.4.0" severity="1"> <versionRange minVersion="0.1" maxVersion="14.4.0" severity="1">
</versionRange> </versionRange>
</emItem> </emItem>
<emItem blockID="i53" id="{a3a5c777-f583-4fef-9380-ab4add1bc2a8}"> <emItem blockID="i61" id="youtube@youtube3.com">
<versionRange minVersion="2.0.3" maxVersion="2.0.3"> <versionRange minVersion="0" maxVersion="*">
</versionRange>
<versionRange minVersion="0" maxVersion="*">
</versionRange> </versionRange>
</emItem> </emItem>
<emItem blockID="i10" id="{8CE11043-9A15-4207-A565-0C94C42D590D}"> <emItem blockID="i10" id="{8CE11043-9A15-4207-A565-0C94C42D590D}">
@@ -85,6 +91,14 @@
<versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1"> <versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1">
</versionRange> </versionRange>
</emItem> </emItem>
<emItem blockID="i53" id="{a3a5c777-f583-4fef-9380-ab4add1bc2a8}">
<versionRange minVersion="2.0.3" maxVersion="2.0.3">
</versionRange>
</emItem>
<emItem blockID="i59" id="ghostviewer@youtube2.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i51" id="admin@youtubeplayer.com"> <emItem blockID="i51" id="admin@youtubeplayer.com">
<versionRange minVersion="0" maxVersion="*"> <versionRange minVersion="0" maxVersion="*">
</versionRange> </versionRange>
@@ -96,19 +110,25 @@
</targetApplication> </targetApplication>
</versionRange> </versionRange>
</emItem> </emItem>
<emItem blockID="i23" id="firefox@bandoo.com"> <emItem blockID="i60" id="youtb3@youtb3.com">
<versionRange minVersion="5.0" maxVersion="5.0" severity="1"> <versionRange minVersion="0" maxVersion="*">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"> </versionRange>
<versionRange minVersion="3.7a1pre" maxVersion="*" /> </emItem>
</targetApplication> <emItem blockID="i56" id="flash@adobe.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange> </versionRange>
</emItem> </emItem>
<emItem blockID="i55" id="youtube@youtube7.com"> <emItem blockID="i55" id="youtube@youtube7.com">
<versionRange minVersion="0" maxVersion="*"> <versionRange minVersion="0" maxVersion="*">
</versionRange> </versionRange>
</emItem> </emItem>
<emItem blockID="i47" id="youtube@youtube2.com"> <emItem blockID="i11" id="yslow@yahoo-inc.com">
</emItem> <versionRange minVersion="2.0.5" maxVersion="2.0.5">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.5.7" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i22" id="ShopperReports@ShopperReports.com"> <emItem blockID="i22" id="ShopperReports@ShopperReports.com">
<versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0"> <versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0">
</versionRange> </versionRange>
@@ -140,17 +160,19 @@
<versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1"> <versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1">
</versionRange> </versionRange>
</emItem> </emItem>
<emItem blockID="i11" id="yslow@yahoo-inc.com"> <emItem blockID="i47" id="youtube@youtube2.com">
<versionRange minVersion="2.0.5" maxVersion="2.0.5"> </emItem>
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.5.7" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}"> <emItem blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
<versionRange minVersion="2.2" maxVersion="2.2"> <versionRange minVersion="2.2" maxVersion="2.2">
</versionRange> </versionRange>
</emItem> </emItem>
<emItem blockID="i23" id="firefox@bandoo.com">
<versionRange minVersion="5.0" maxVersion="5.0" severity="1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.7a1pre" maxVersion="*" />
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i45" id="{22119944-ED35-4ab1-910B-E619EA06A115}"> <emItem blockID="i45" id="{22119944-ED35-4ab1-910B-E619EA06A115}">
<versionRange minVersion="0.1" maxVersion="7.6.1"> <versionRange minVersion="0.1" maxVersion="7.6.1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"> <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">

View File

@@ -65,6 +65,7 @@ pref("extensions.minCompatibleAppVersion", "4.0");
pref("extensions.getAddons.cache.enabled", true); pref("extensions.getAddons.cache.enabled", true);
pref("extensions.getAddons.maxResults", 15); pref("extensions.getAddons.maxResults", 15);
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=%OS%&appVersion=%VERSION%"); pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=%OS%&appVersion=%VERSION%");
pref("extensions.getAddons.getWithPerformance.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=%OS%&appVersion=%VERSION%&tMain=%TIME_MAIN%&tFirstPaint=%TIME_FIRST_PAINT%&tSessionRestored=%TIME_SESSION_RESTORED%");
pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%"); pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%");
pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%/%COMPATIBILITY_MODE%?src=firefox"); pref("extensions.getAddons.search.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%/%COMPATIBILITY_MODE%?src=firefox");
pref("extensions.webservice.discoverURL", "https://services.addons.mozilla.org/%LOCALE%/firefox/discovery/pane/%VERSION%/%OS%/%COMPATIBILITY_MODE%"); pref("extensions.webservice.discoverURL", "https://services.addons.mozilla.org/%LOCALE%/firefox/discovery/pane/%VERSION%/%OS%/%COMPATIBILITY_MODE%");
@@ -1030,6 +1031,12 @@ pref("devtools.errorconsole.enabled", false);
pref("devtools.inspector.enabled", true); pref("devtools.inspector.enabled", true);
pref("devtools.inspector.htmlHeight", 112); pref("devtools.inspector.htmlHeight", 112);
// Enable the Debugger
pref("devtools.debugger.enabled", false);
// The default Debugger UI height
pref("devtools.debugger.ui.height", 250);
// Enable the style inspector // Enable the style inspector
pref("devtools.styleinspector.enabled", true); pref("devtools.styleinspector.enabled", true);
@@ -1111,10 +1118,15 @@ pref("prompts.tab_modal.enabled", true);
pref("browser.panorama.animate_zoom", true); pref("browser.panorama.animate_zoom", true);
// Defines the url to be used for new tabs. // Defines the url to be used for new tabs.
pref("browser.newtab.url", "about:blank"); pref("browser.newtab.url", "about:newtab");
// Toggles the content of 'about:newtab'. Shows the grid when enabled. // Toggles the content of 'about:newtab'. Shows the grid when enabled.
pref("browser.newtabpage.enabled", false); pref("browser.newtabpage.enabled", true);
// Enable the DOM full-screen API. // Enable the DOM full-screen API.
pref("full-screen-api.enabled", true); pref("full-screen-api.enabled", true);
// Startup Crash Tracking
// number of startup crashes that can occur before starting into safe mode automatically
// (this pref has no effect if more than 6 hours have passed since the last crash)
pref("toolkit.startup.max_resumed_crashes", 2);

View File

@@ -49,9 +49,7 @@ abs_srcdir = $(call core_abspath,$(srcdir))
CHROME_DEPS += $(abs_srcdir)/content/overrides/app-license.html CHROME_DEPS += $(abs_srcdir)/content/overrides/app-license.html
ifdef ENABLE_TESTS TEST_DIRS += content/test
DIRS += content/test
endif
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

View File

@@ -265,17 +265,17 @@ appUpdater.prototype =
if (cancelQuit.data) if (cancelQuit.data)
return; return;
let appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
getService(Components.interfaces.nsIAppStartup);
// If already in safe mode restart in safe mode (bug 327119) // If already in safe mode restart in safe mode (bug 327119)
if (Services.appinfo.inSafeMode) { if (Services.appinfo.inSafeMode) {
let env = Components.classes["@mozilla.org/process/environment;1"]. appStartup.restartInSafeMode(Components.interfaces.nsIAppStartup.eAttemptQuit);
getService(Components.interfaces.nsIEnvironment); return;
env.set("MOZ_SAFE_MODE_RESTART", "1");
} }
Components.classes["@mozilla.org/toolkit/app-startup;1"]. appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
getService(Components.interfaces.nsIAppStartup). Components.interfaces.nsIAppStartup.eRestart);
quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
Components.interfaces.nsIAppStartup.eRestart);
return; return;
} }

View File

@@ -189,6 +189,11 @@
type="checkbox" type="checkbox"
command="Tools:Inspect" command="Tools:Inspect"
key="key_inspect"/> key="key_inspect"/>
<menuitem id="appmenu_debugger"
hidden="true"
label="&debuggerMenu.label;"
key="key_debugger"
command="Tools:Debugger"/>
<menuitem id="appmenu_scratchpad" <menuitem id="appmenu_scratchpad"
hidden="true" hidden="true"
label="&scratchpad.label;" label="&scratchpad.label;"

View File

@@ -19,5 +19,7 @@
#endif #endif
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd"> <!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
%aboutHomeDTD; %aboutHomeDTD;
<!ENTITY % debuggerDTD SYSTEM "chrome://browser/locale/devtools/debugger.dtd">
%debuggerDTD;
]> ]>

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