Merge m-c into maple
This commit is contained in:
5
.hgtags
5
.hgtags
@@ -73,3 +73,8 @@ c0983049bcaa9551e5f276d5a77ce154c151e0b0 AURORA_BASE_20110927
|
||||
54bfd8bf682e295ffd7f22fa921ca343957b6c1c AURORA_BASE_20111108
|
||||
a8506ab2c65480cf2f85f54e203ea746522c62bb AURORA_BASE_20111220
|
||||
462c726144bc1fb45b61e774f64ac5d61b4e047c UPDATE_PACKAGING_R16
|
||||
bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
|
||||
bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
|
||||
0000000000000000000000000000000000000000 AURORA_BASE_20120131
|
||||
0000000000000000000000000000000000000000 AURORA_BASE_20120131
|
||||
bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
|
||||
|
||||
@@ -45,9 +45,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = accessibility
|
||||
DIRS = public src build
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += tests
|
||||
endif
|
||||
TEST_DIRS += tests
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
@@ -61,11 +61,12 @@ XPIDLSRCS = \
|
||||
nsIAccessibleDocument.idl \
|
||||
nsIAccessibleProvider.idl \
|
||||
nsIAccessibleSelectable.idl \
|
||||
nsIAccessNode.idl \
|
||||
nsIAccessibleCursorable.idl \
|
||||
nsIAccessibleEvent.idl \
|
||||
nsIAccessibleEditableText.idl \
|
||||
nsIAccessibleHyperLink.idl \
|
||||
nsIAccessibleHyperText.idl \
|
||||
nsIAccessiblePivot.idl \
|
||||
nsIAccessibleTable.idl \
|
||||
nsIAccessibleText.idl \
|
||||
nsIAccessibleValue.idl \
|
||||
|
||||
@@ -117,7 +117,7 @@ cpp_quote("//")
|
||||
cpp_quote("//")
|
||||
cpp_quote("// get_localInterface(/* [out] */ void **localInterface);")
|
||||
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("// get_language(/* [out] */ BSTR *htmlText);")
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -43,7 +43,10 @@
|
||||
#include "nsIArray.idl"
|
||||
|
||||
interface nsIPersistentProperties;
|
||||
interface nsIDOMCSSPrimitiveValue;
|
||||
interface nsIDOMDOMStringList;
|
||||
interface nsIDOMNode;
|
||||
interface nsIAccessibleDocument;
|
||||
interface nsIAccessibleRelation;
|
||||
|
||||
/**
|
||||
@@ -100,6 +103,53 @@ interface nsIAccessible : nsISupports
|
||||
*/
|
||||
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
|
||||
* specified by ARIA or by native markup. Example of ARIA markup is
|
||||
@@ -285,6 +335,26 @@ interface nsIAccessible : nsISupports
|
||||
*/
|
||||
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
|
||||
* to the OS/accessibility toolkit we're running on.
|
||||
|
||||
59
accessible/public/nsIAccessibleCursorable.idl
Normal file
59
accessible/public/nsIAccessibleCursorable.idl
Normal 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;
|
||||
};
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIAccessible;
|
||||
interface nsIAccessNode;
|
||||
interface nsIDOMDocument;
|
||||
interface nsIDOMNode;
|
||||
interface nsIDOMWindow;
|
||||
@@ -50,10 +49,9 @@ interface nsIDOMWindow;
|
||||
* When accessibility is turned on in Gecko,
|
||||
* there is an nsIAccessibleDocument for each document
|
||||
* whether it is XUL, HTML or whatever.
|
||||
* You can QueryInterface to nsIAccessibleDocument from
|
||||
* the nsIAccessible or nsIAccessNode for the root node
|
||||
* of a document. You can also get one from
|
||||
* nsIAccessNode::GetAccessibleDocument() or
|
||||
* You can QueryInterface to nsIAccessibleDocument from the nsIAccessible for
|
||||
* the root node of a document. You can also get one from
|
||||
* nsIAccessible::GetAccessibleDocument() or
|
||||
* nsIAccessibleEvent::GetAccessibleDocument()
|
||||
*/
|
||||
[scriptable, uuid(451242bd-8a0c-4198-ae88-c053609a4e5d)]
|
||||
|
||||
@@ -441,10 +441,15 @@ interface nsIAccessibleEvent : nsISupports
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
const unsigned long EVENT_LAST_ENTRY = 0x0056;
|
||||
const unsigned long EVENT_LAST_ENTRY = 0x0057;
|
||||
|
||||
/**
|
||||
* The type of event, based on the enumerated event values
|
||||
|
||||
221
accessible/public/nsIAccessiblePivot.idl
Normal file
221
accessible/public/nsIAccessiblePivot.idl
Normal 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);
|
||||
};
|
||||
@@ -43,15 +43,12 @@ interface nsIAccessible;
|
||||
interface nsIWeakReference;
|
||||
interface nsIPresShell;
|
||||
interface nsIDOMWindow;
|
||||
interface nsIAccessNode;
|
||||
interface nsIDOMDOMStringList;
|
||||
|
||||
interface nsIAccessiblePivot;
|
||||
|
||||
/**
|
||||
* An interface for in-process accessibility clients
|
||||
* wishing to get an nsIAccessible or nsIAccessNode for
|
||||
* a given DOM node.
|
||||
* More documentation at:
|
||||
* An interface for in-process accessibility clients wishing to get an
|
||||
* nsIAccessible for a given DOM node. More documentation at:
|
||||
* http://www.mozilla.org/projects/ui/accessibility
|
||||
*/
|
||||
[scriptable, uuid(310ce77d-c92b-4761-82e8-77e1a728e8d4)]
|
||||
@@ -112,6 +109,14 @@ interface nsIAccessibleRetrieval : nsISupports
|
||||
* @return cached accessible for the given DOM node if any
|
||||
*/
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ getDocumentLocaleCB(AtkDocument *aDocument)
|
||||
return nsnull;
|
||||
|
||||
nsAutoString locale;
|
||||
accWrap->GetLanguage(locale);
|
||||
accWrap->Language(locale);
|
||||
return locale.IsEmpty() ? nsnull : nsAccessibleWrap::ReturnString(locale);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ CPPSRCS = \
|
||||
nsAccUtils.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
nsAccessible.cpp \
|
||||
nsAccessiblePivot.cpp \
|
||||
nsAccTreeWalker.cpp \
|
||||
nsBaseWidgetAccessible.cpp \
|
||||
nsEventShell.cpp \
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* 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
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@@ -47,7 +48,7 @@ namespace a11y {
|
||||
namespace statistics {
|
||||
|
||||
inline void A11yInitialized()
|
||||
{ Telemetry::Accumulate(Telemetry::A11Y_INSTANTIATED, true); }
|
||||
{ Telemetry::Accumulate(Telemetry::A11Y_INSTANTIATED, 1); }
|
||||
|
||||
inline void A11yConsumers(PRUint32 aConsumer)
|
||||
{ Telemetry::Accumulate(Telemetry::A11Y_CONSUMERS, aConsumer); }
|
||||
@@ -56,7 +57,13 @@ namespace statistics {
|
||||
* Report that ISimpleDOM* has been used.
|
||||
*/
|
||||
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.
|
||||
@@ -64,6 +71,12 @@ namespace statistics {
|
||||
inline void IAccessibleTableUsed()
|
||||
{ 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 a11y
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -105,7 +105,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
roles::PUSHBUTTON,
|
||||
kUseMapRole,
|
||||
eNoValue,
|
||||
eClickAction,
|
||||
ePressAction,
|
||||
eNoLiveAttr,
|
||||
kNoReqStates,
|
||||
eARIAPressed
|
||||
@@ -219,15 +219,6 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
|
||||
eNoLiveAttr,
|
||||
kNoReqStates
|
||||
},
|
||||
{
|
||||
"label",
|
||||
roles::LABEL,
|
||||
kUseMapRole,
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
eNoLiveAttr,
|
||||
kNoReqStates
|
||||
},
|
||||
{
|
||||
"link",
|
||||
roles::LINK,
|
||||
|
||||
@@ -78,6 +78,7 @@ enum EActionRule
|
||||
eNoAction,
|
||||
eActivateAction,
|
||||
eClickAction,
|
||||
ePressAction,
|
||||
eCheckUncheckAction,
|
||||
eExpandAction,
|
||||
eJumpAction,
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#define nsAccUtils_h_
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessNode.h"
|
||||
#include "nsIAccessibleRole.h"
|
||||
#include "nsIAccessibleText.h"
|
||||
#include "nsIAccessibleTable.h"
|
||||
|
||||
@@ -36,37 +36,27 @@
|
||||
*
|
||||
* ***** 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 "nsAccUtils.h"
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsRootAccessible.h"
|
||||
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMCSSPrimitiveValue.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
/* For documentation of the accessibility architecture,
|
||||
@@ -89,9 +79,7 @@ nsApplicationAccessible *nsAccessNode::gApplicationAccessible = nsnull;
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsAccessNode, mContent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccessNode)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessNode)
|
||||
NS_INTERFACE_MAP_ENTRY(nsAccessNode)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessNode)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccessNode)
|
||||
@@ -287,126 +275,28 @@ nsAccessNode::IsPrimaryForNode() const
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessNode
|
||||
|
||||
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
|
||||
void
|
||||
nsAccessNode::ScrollTo(PRUint32 aScrollType)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell(GetPresShell());
|
||||
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
nsIFrame *frame = GetFrame();
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIContent> content = frame->GetContent();
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
nsIContent* content = frame->GetContent();
|
||||
if (!content)
|
||||
return;
|
||||
|
||||
PRInt16 vPercent, hPercent;
|
||||
nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
|
||||
return shell->ScrollContentIntoView(content, vPercent, hPercent,
|
||||
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);
|
||||
shell->ScrollContentIntoView(content, vPercent, hPercent,
|
||||
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
|
||||
}
|
||||
|
||||
// nsAccessNode public
|
||||
@@ -443,20 +333,18 @@ nsAccessNode::GetCurrentFocus()
|
||||
return focusedNode;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNode::GetLanguage(nsAString& aLanguage)
|
||||
void
|
||||
nsAccessNode::Language(nsAString& aLanguage)
|
||||
{
|
||||
aLanguage.Truncate();
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
|
||||
nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage);
|
||||
|
||||
if (aLanguage.IsEmpty()) { // Nothing found, so use document's language
|
||||
mContent->OwnerDoc()->GetHeaderData(nsGkAtoms::headerContentLanguage,
|
||||
aLanguage);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#ifndef _nsAccessNode_H_
|
||||
#define _nsAccessNode_H_
|
||||
|
||||
#include "nsIAccessNode.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
|
||||
#include "a11yGeneric.h"
|
||||
@@ -68,15 +67,7 @@ class nsIDocShellTreeItem;
|
||||
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
|
||||
#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
|
||||
|
||||
#define NS_ACCESSNODE_IMPL_CID \
|
||||
{ /* 2b07e3d7-00b3-4379-aa0b-ea22e2c8ffda */ \
|
||||
0x2b07e3d7, \
|
||||
0x00b3, \
|
||||
0x4379, \
|
||||
{ 0xaa, 0x0b, 0xea, 0x22, 0xe2, 0xc8, 0xff, 0xda } \
|
||||
}
|
||||
|
||||
class nsAccessNode: public nsIAccessNode
|
||||
class nsAccessNode: public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -84,10 +75,7 @@ public:
|
||||
virtual ~nsAccessNode();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsAccessNode, nsIAccessNode)
|
||||
|
||||
NS_DECL_NSIACCESSNODE
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSNODE_IMPL_CID)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsAccessNode)
|
||||
|
||||
static void InitXPAccessibility();
|
||||
static void ShutdownXPAccessibility();
|
||||
@@ -134,18 +122,6 @@ public:
|
||||
* Return frame for the given access node object.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -195,6 +171,18 @@ public:
|
||||
*/
|
||||
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:
|
||||
nsPresContext* GetPresContext();
|
||||
|
||||
@@ -221,8 +209,5 @@ private:
|
||||
static nsApplicationAccessible *gApplicationAccessible;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessNode,
|
||||
NS_ACCESSNODE_IMPL_CID)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessiblePivot.h"
|
||||
#include "nsCoreUtils.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
@@ -864,6 +865,23 @@ nsAccessibilityService::GetAccessibleFromCache(nsIDOMNode* aNode,
|
||||
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
|
||||
nsAccessible*
|
||||
nsAccessibilityService::GetAccessibleInShell(nsINode* aNode,
|
||||
|
||||
@@ -534,6 +534,7 @@ static const char kEventTypeNames[][40] = {
|
||||
"hypertext changed", // EVENT_HYPERTEXT_CHANGED
|
||||
"hypertext links count changed", // EVENT_HYPERTEXT_NLINKS_CHANGED
|
||||
"object attribute changed", // EVENT_OBJECT_ATTRIBUTE_CHANGED
|
||||
"virtual cursor changed" // EVENT_VIRTUALCURSOR_CHANGED
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,11 +52,14 @@
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
|
||||
#include "nsIDOMCSSValue.h"
|
||||
#include "nsIDOMCSSPrimitiveValue.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
@@ -229,6 +232,92 @@ nsAccessible::SetRoleMapEntry(nsRoleMapEntry* 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
|
||||
nsAccessible::GetName(nsAString& aName)
|
||||
{
|
||||
@@ -551,7 +640,7 @@ nsAccessible::GetChildren(nsIArray **aOutChildren)
|
||||
}
|
||||
|
||||
bool
|
||||
nsAccessible::GetAllowsAnonChildAccessibles()
|
||||
nsAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1374,6 +1463,30 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
if (NS_SUCCEEDED(rv))
|
||||
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?
|
||||
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
|
||||
if (htmlElement) {
|
||||
@@ -1828,6 +1941,10 @@ nsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
aName.AssignLiteral("click");
|
||||
return NS_OK;
|
||||
|
||||
case ePressAction:
|
||||
aName.AssignLiteral("press");
|
||||
return NS_OK;
|
||||
|
||||
case eCheckUncheckAction:
|
||||
if (states & states::CHECKED)
|
||||
aName.AssignLiteral("uncheck");
|
||||
@@ -2172,6 +2289,32 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
|
||||
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
|
||||
NS_IMETHODIMP nsAccessible::GetSelectedChildren(nsIArray **aSelectedAccessibles)
|
||||
{
|
||||
@@ -2936,7 +3079,7 @@ nsAccessible::ContainerWidget() const
|
||||
void
|
||||
nsAccessible::CacheChildren()
|
||||
{
|
||||
nsAccTreeWalker walker(mWeakShell, mContent, GetAllowsAnonChildAccessibles());
|
||||
nsAccTreeWalker walker(mWeakShell, mContent, CanHaveAnonChildren());
|
||||
|
||||
nsAccessible* child = nsnull;
|
||||
while ((child = walker.NextChild()) && AppendChild(child));
|
||||
|
||||
@@ -129,6 +129,17 @@ public:
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -388,9 +399,9 @@ public:
|
||||
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
|
||||
|
||||
526
accessible/src/base/nsAccessiblePivot.cpp
Normal file
526
accessible/src/base/nsAccessiblePivot.cpp
Normal 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);
|
||||
}
|
||||
134
accessible/src/base/nsAccessiblePivot.h
Normal file
134
accessible/src/base/nsAccessiblePivot.h
Normal 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
|
||||
@@ -421,7 +421,7 @@ nsApplicationAccessible::GetSiblingAtOffset(PRInt32 aOffset,
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessNode and nsAccessNode
|
||||
// nsIAccessible
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::GetDOMNode(nsIDOMNode **aDOMNode)
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIAccessNode
|
||||
// nsIAccessible
|
||||
NS_SCRIPTABLE NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode);
|
||||
NS_SCRIPTABLE NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument);
|
||||
NS_SCRIPTABLE NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument);
|
||||
@@ -83,8 +83,6 @@ public:
|
||||
const nsAString& aPropertyName,
|
||||
nsIDOMCSSPrimitiveValue** aValue NS_OUTPARAM);
|
||||
NS_SCRIPTABLE NS_IMETHOD GetLanguage(nsAString& aLanguage);
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
|
||||
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
|
||||
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
|
||||
/**
|
||||
* 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 aFrame the frame to scroll
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "AccIterator.h"
|
||||
#include "nsAccCache.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccessiblePivot.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsRootAccessible.h"
|
||||
@@ -105,7 +106,8 @@ nsDocAccessible::
|
||||
nsIWeakReference *aShell) :
|
||||
nsHyperTextAccessibleWrap(aRootContent, aShell),
|
||||
mDocument(aDocument), mScrollPositionChangedTicks(0),
|
||||
mLoadState(eTreeConstructionPending), mLoadEventType(0)
|
||||
mLoadState(eTreeConstructionPending), mLoadEventType(0),
|
||||
mVirtualCursor(nsnull)
|
||||
{
|
||||
mFlags |= eDocAccessible;
|
||||
|
||||
@@ -125,6 +127,10 @@ nsDocAccessible::
|
||||
// nsAccDocManager creates document accessible when scrollable frame is
|
||||
// available already, it should be safe time to add scroll listener.
|
||||
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()
|
||||
@@ -142,6 +148,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mNotificationController,
|
||||
NotificationController)
|
||||
|
||||
if (tmp->mVirtualCursor) {
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mVirtualCursor,
|
||||
nsAccessiblePivot)
|
||||
}
|
||||
|
||||
PRUint32 i, length = tmp->mChildDocuments.Length();
|
||||
for (i = 0; i < length; ++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_NSCOMPTR(mDocument)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNotificationController)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mVirtualCursor)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mChildDocuments)
|
||||
tmp->mDependentIDsHash.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(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessiblePivotObserver)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleDocument)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleCursorable,
|
||||
mIsCursorable)
|
||||
foundInterface = 0;
|
||||
|
||||
nsresult status;
|
||||
@@ -516,6 +531,27 @@ nsDocAccessible::GetChildDocumentAt(PRUint32 aIndex,
|
||||
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
|
||||
NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
||||
{
|
||||
@@ -637,6 +673,11 @@ nsDocAccessible::Shutdown()
|
||||
|
||||
mChildDocuments.Clear();
|
||||
|
||||
if (mVirtualCursor) {
|
||||
mVirtualCursor->RemoveObserver(this);
|
||||
mVirtualCursor = nsnull;
|
||||
}
|
||||
|
||||
mWeakShell = nsnull; // Avoid reentrancy
|
||||
|
||||
mDependentIDsHash.Clear();
|
||||
@@ -888,6 +929,20 @@ NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic
|
||||
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
|
||||
|
||||
@@ -1470,7 +1525,7 @@ nsDocAccessible::CacheChildren()
|
||||
// Search for accessible children starting from the document element since
|
||||
// some web pages tend to insert elements under it rather than document body.
|
||||
nsAccTreeWalker walker(mWeakShell, mDocument->GetRootElement(),
|
||||
GetAllowsAnonChildAccessibles());
|
||||
CanHaveAnonChildren());
|
||||
|
||||
nsAccessible* child = nsnull;
|
||||
while ((child = walker.NextChild()) && AppendChild(child));
|
||||
@@ -1826,7 +1881,7 @@ nsDocAccessible::UpdateTree(nsAccessible* aContainer, nsIContent* aChildNode,
|
||||
|
||||
} else {
|
||||
nsAccTreeWalker walker(mWeakShell, aChildNode,
|
||||
aContainer->GetAllowsAnonChildAccessibles(), true);
|
||||
aContainer->CanHaveAnonChildren(), true);
|
||||
|
||||
while ((child = walker.NextChild()))
|
||||
updateFlags |= UpdateTreeInternal(child, aIsInsert);
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
#ifndef _nsDocAccessible_H_
|
||||
#define _nsDocAccessible_H_
|
||||
|
||||
#include "nsIAccessibleCursorable.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIAccessiblePivot.h"
|
||||
|
||||
#include "nsEventShell.h"
|
||||
#include "nsHyperTextAccessibleWrap.h"
|
||||
@@ -58,6 +60,7 @@
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
|
||||
class nsIScrollableView;
|
||||
class nsAccessiblePivot;
|
||||
|
||||
const PRUint32 kDefaultCacheSize = 256;
|
||||
|
||||
@@ -74,7 +77,9 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
|
||||
public nsIDocumentObserver,
|
||||
public nsIObserver,
|
||||
public nsIScrollPositionListener,
|
||||
public nsSupportsWeakReference
|
||||
public nsSupportsWeakReference,
|
||||
public nsIAccessibleCursorable,
|
||||
public nsIAccessiblePivotObserver
|
||||
{
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDocAccessible, nsAccessible)
|
||||
@@ -84,6 +89,10 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
|
||||
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
NS_DECL_NSIACCESSIBLECURSORABLE
|
||||
|
||||
NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
|
||||
|
||||
public:
|
||||
using nsAccessible::GetParent;
|
||||
|
||||
@@ -595,6 +604,16 @@ protected:
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -283,8 +283,8 @@ nsLangTextAttr::nsLangTextAttr(nsHyperTextAccessible *aRootAcc,
|
||||
nsIContent *aRootContent, nsIContent *aContent) :
|
||||
nsTextAttr<nsAutoString>(aContent == nsnull), mRootContent(aRootContent)
|
||||
{
|
||||
nsresult rv = aRootAcc->GetLanguage(mRootNativeValue);
|
||||
mIsRootDefined = NS_SUCCEEDED(rv) && !mRootNativeValue.IsEmpty();
|
||||
aRootAcc->Language(mRootNativeValue);
|
||||
mIsRootDefined = !mRootNativeValue.IsEmpty();
|
||||
|
||||
if (aContent)
|
||||
mIsDefined = GetLang(aContent, mNativeValue);
|
||||
|
||||
@@ -458,7 +458,7 @@ nsHTMLTableAccessible::CacheChildren()
|
||||
// caption only, because nsAccessibilityService ensures we don't create
|
||||
// accessibles for the other captions, since only the first is actually
|
||||
// visible.
|
||||
nsAccTreeWalker walker(mWeakShell, mContent, GetAllowsAnonChildAccessibles());
|
||||
nsAccTreeWalker walker(mWeakShell, mContent, CanHaveAnonChildren());
|
||||
|
||||
nsAccessible* child = nsnull;
|
||||
while ((child = walker.NextChild())) {
|
||||
|
||||
@@ -1148,7 +1148,7 @@ nsHyperTextAccessible::GetTextAttributes(bool aIncludeDefAttrs,
|
||||
// Compute spelling attributes on text accessible only.
|
||||
nsIFrame *offsetFrame = accAtOffset->GetFrame();
|
||||
if (offsetFrame && offsetFrame->GetType() == nsGkAtoms::textFrame) {
|
||||
nsCOMPtr<nsIDOMNode> node = accAtOffset->GetDOMNode();
|
||||
nsCOMPtr<nsIDOMNode> node = accAtOffset->DOMNode();
|
||||
|
||||
PRInt32 nodeOffset = 0;
|
||||
nsresult rv = RenderedToContentOffset(offsetFrame, offsetInAcc,
|
||||
@@ -1560,12 +1560,17 @@ nsHyperTextAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
||||
nsresult
|
||||
nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
nsresult rv = TakeFocus();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
bool isFocusable = State() & states::FOCUSABLE;
|
||||
|
||||
// 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
|
||||
SetSelectionBounds(0, aStartPos, aEndPos);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If range 0 was successfully set, clear any additional selection
|
||||
// ranges remaining from previous selection
|
||||
@@ -1585,7 +1590,12 @@ nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
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();
|
||||
if (DOMFocusManager) {
|
||||
nsCOMPtr<nsIPresShell> shell = GetPresShell();
|
||||
@@ -2255,10 +2265,8 @@ nsHyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame *aFrame,
|
||||
if (!aFrame) {
|
||||
// If the given frame is null then set offset after the DOM node of the
|
||||
// given accessible.
|
||||
nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aAccessible));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
accessNode->GetDOMNode(getter_AddRefs(DOMNode));
|
||||
aAccessible->GetDOMNode(getter_AddRefs(DOMNode));
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(DOMNode));
|
||||
NS_ENSURE_STATE(content);
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ CAccessibleComponent::GetARGBValueFromCSSProperty(const nsAString& aPropName,
|
||||
__try {
|
||||
*aColorValue = 0;
|
||||
|
||||
nsCOMPtr<nsIAccessNode> acc(do_QueryObject(this));
|
||||
nsRefPtr<nsAccessible> acc(do_QueryObject(this));
|
||||
if (!acc)
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
@@ -63,14 +63,6 @@
|
||||
using namespace mozilla;
|
||||
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;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -404,9 +396,8 @@ __try {
|
||||
aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT :
|
||||
nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT;
|
||||
|
||||
nsresult rv = ScrollTo(scrollType);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return S_OK;
|
||||
ScrollTo(scrollType);
|
||||
return S_OK;
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
|
||||
return E_FAIL;
|
||||
@@ -562,10 +553,7 @@ __try {
|
||||
*aLanguage = NULL;
|
||||
|
||||
nsAutoString language;
|
||||
if (NS_FAILED(GetLanguage(language))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
Language(language);
|
||||
if (language.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
@@ -583,7 +571,7 @@ nsAccessNodeWrap::get_localInterface(
|
||||
/* [out] */ void __RPC_FAR *__RPC_FAR *localInterface)
|
||||
{
|
||||
__try {
|
||||
*localInterface = static_cast<nsIAccessNode*>(this);
|
||||
*localInterface = static_cast<nsAccessNode*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return S_OK;
|
||||
@@ -591,17 +579,6 @@ __try {
|
||||
|
||||
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();
|
||||
|
||||
nsWinUtils::MaybeStartWindowEmulation();
|
||||
@@ -678,8 +655,8 @@ nsAccessNodeWrap::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
IAccessible* msaaAccessible = NULL;
|
||||
document->GetNativeInterface((void**)&msaaAccessible); // does an addref
|
||||
if (msaaAccessible) {
|
||||
LRESULT result = LresultFromObject(IID_IAccessible, wParam,
|
||||
msaaAccessible); // does an addref
|
||||
LRESULT result = ::LresultFromObject(IID_IAccessible, wParam,
|
||||
msaaAccessible); // does an addref
|
||||
msaaAccessible->Release(); // release extra addref
|
||||
return result;
|
||||
}
|
||||
@@ -698,21 +675,3 @@ nsAccessNodeWrap::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM 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;
|
||||
}
|
||||
|
||||
@@ -67,8 +67,6 @@
|
||||
|
||||
#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;
|
||||
|
||||
@@ -149,18 +147,8 @@ public: // construction, destruction
|
||||
static void InitAccessibility();
|
||||
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 STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
|
||||
|
||||
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg,
|
||||
WPARAM WParam, LPARAM lParam);
|
||||
|
||||
|
||||
@@ -163,38 +163,6 @@ __try {
|
||||
// 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)
|
||||
{
|
||||
__try {
|
||||
@@ -211,9 +179,9 @@ __try {
|
||||
nsWinUtils::IsWindowEmulationStarted() &&
|
||||
nsCoreUtils::IsTabDocument(doc->GetDocumentNode())) {
|
||||
HWND hwnd = static_cast<HWND>(doc->GetNativeWindow());
|
||||
if (hwnd && SUCCEEDED(AccessibleObjectFromWindow(hwnd, OBJID_WINDOW,
|
||||
IID_IAccessible,
|
||||
(void**)ppdispParent))) {
|
||||
if (hwnd && SUCCEEDED(::AccessibleObjectFromWindow(hwnd, OBJID_WINDOW,
|
||||
IID_IAccessible,
|
||||
(void**)ppdispParent))) {
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
@@ -1177,8 +1145,8 @@ STDMETHODIMP
|
||||
nsAccessibleWrap::scrollTo(enum IA2ScrollType aScrollType)
|
||||
{
|
||||
__try {
|
||||
nsresult rv = ScrollTo(aScrollType);
|
||||
return GetHRESULT(rv);
|
||||
nsAccessNode::ScrollTo(aScrollType);
|
||||
return S_OK;
|
||||
|
||||
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
|
||||
return E_FAIL;
|
||||
@@ -1398,9 +1366,7 @@ __try {
|
||||
// Any two-letter subcode is understood to be a [ISO3166] country code.
|
||||
|
||||
nsAutoString lang;
|
||||
nsresult rv = GetLanguage(lang);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
Language(lang);
|
||||
|
||||
// If primary code consists from two letters then expose it as language.
|
||||
PRInt32 offset = lang.FindChar('-', 0);
|
||||
@@ -1590,13 +1556,13 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
|
||||
#endif
|
||||
|
||||
// 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.
|
||||
if (Compatibility::IsJAWS()) {
|
||||
if (eventType == nsIAccessibleEvent::EVENT_SELECTION &&
|
||||
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);
|
||||
if (hwnd) {
|
||||
IDispatch *retval = nsnull;
|
||||
AccessibleObjectFromWindow(reinterpret_cast<HWND>(hwnd),
|
||||
OBJID_WINDOW, IID_IAccessible, (void **) &retval);
|
||||
::AccessibleObjectFromWindow(reinterpret_cast<HWND>(hwnd),
|
||||
OBJID_WINDOW, IID_IAccessible,
|
||||
(void **) &retval);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,11 +331,6 @@ public: // construction, destruction
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
|
||||
@@ -131,6 +131,7 @@ static const PRUint32 gWinEventMap[] = {
|
||||
IA2_EVENT_HYPERTEXT_CHANGED, // nsIAccessibleEvent::EVENT_HYPERTEXT_CHANGED
|
||||
IA2_EVENT_HYPERTEXT_NLINKS_CHANGED, // nsIAccessibleEvent::EVENT_HYPERTEXT_NLINKS_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
|
||||
};
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
#include "Statistics.h"
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
@@ -70,6 +71,7 @@ nsXFormsAccessibleBase::nsXFormsAccessibleBase()
|
||||
if (NS_FAILED(rv))
|
||||
NS_WARNING("No XForms utility service.");
|
||||
}
|
||||
statistics::XFormsAccessibleUsed();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -213,7 +215,7 @@ nsXFormsAccessible::Description(nsString& aDescription)
|
||||
}
|
||||
|
||||
bool
|
||||
nsXFormsAccessible::GetAllowsAnonChildAccessibles()
|
||||
nsXFormsAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -236,7 +238,7 @@ nsXFormsContainerAccessible::NativeRole()
|
||||
}
|
||||
|
||||
bool
|
||||
nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles()
|
||||
nsXFormsContainerAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
|
||||
// Denies accessible nodes in anonymous content of xforms element by
|
||||
// always returning false value.
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
virtual bool CanHaveAnonChildren();
|
||||
|
||||
protected:
|
||||
// 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
|
||||
// always returning true value.
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
virtual bool CanHaveAnonChildren();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -590,7 +590,7 @@ nsXFormsSelectComboboxAccessible::NativeState()
|
||||
}
|
||||
|
||||
bool
|
||||
nsXFormsSelectComboboxAccessible::GetAllowsAnonChildAccessibles()
|
||||
nsXFormsSelectComboboxAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual mozilla::a11y::role NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
virtual bool CanHaveAnonChildren();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ nsXULComboboxAccessible::Description(nsString& aDescription)
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULComboboxAccessible::GetAllowsAnonChildAccessibles()
|
||||
nsXULComboboxAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
if (mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) ||
|
||||
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable,
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
virtual void Description(nsString& aDescription);
|
||||
virtual mozilla::a11y::role NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
virtual bool CanHaveAnonChildren();
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
@@ -662,17 +662,10 @@ nsXULToolbarButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
bool
|
||||
nsXULToolbarButtonAccessible::IsSeparator(nsAccessible *aAccessible)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
aAccessible->GetDOMNode(getter_AddRefs(domNode));
|
||||
nsCOMPtr<nsIContent> contentDomNode(do_QueryInterface(domNode));
|
||||
|
||||
if (!contentDomNode)
|
||||
return false;
|
||||
|
||||
return (contentDomNode->Tag() == nsGkAtoms::toolbarseparator) ||
|
||||
(contentDomNode->Tag() == nsGkAtoms::toolbarspacer) ||
|
||||
(contentDomNode->Tag() == nsGkAtoms::toolbarspring);
|
||||
}
|
||||
nsIContent* content = aAccessible->GetContent();
|
||||
return content && ((content->Tag() == nsGkAtoms::toolbarseparator) ||
|
||||
(content->Tag() == nsGkAtoms::toolbarspacer) ||
|
||||
(content->Tag() == nsGkAtoms::toolbarspring)); }
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -851,7 +844,7 @@ NS_IMETHODIMP nsXULTextFieldAccessible::DoAction(PRUint8 index)
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULTextFieldAccessible::GetAllowsAnonChildAccessibles()
|
||||
nsXULTextFieldAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ public:
|
||||
virtual void ApplyARIAState(PRUint64* aState);
|
||||
virtual mozilla::a11y::role NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
virtual bool CanHaveAnonChildren();
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
@@ -1024,7 +1024,7 @@ NS_IMETHODIMP nsXULListitemAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULListitemAccessible::GetAllowsAnonChildAccessibles()
|
||||
nsXULListitemAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
// That indicates we should walk anonymous children for listitems
|
||||
return true;
|
||||
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
virtual PRUint64 NativeState();
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
virtual bool CanHaveAnonChildren();
|
||||
|
||||
// Widgets
|
||||
virtual nsAccessible* ContainerWidget() const;
|
||||
|
||||
@@ -320,7 +320,7 @@ nsXULMenuitemAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULMenuitemAccessible::GetAllowsAnonChildAccessibles()
|
||||
nsXULMenuitemAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
// That indicates we don't walk anonymous children for menuitems
|
||||
return false;
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
virtual bool CanHaveAnonChildren();
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
@@ -190,7 +190,7 @@ nsXULSliderAccessible::SetCurrentValue(double aValue)
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULSliderAccessible::GetAllowsAnonChildAccessibles()
|
||||
nsXULSliderAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
// Do not allow anonymous xul:slider be accessible.
|
||||
return false;
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual mozilla::a11y::role NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
virtual bool CanHaveAnonChildren();
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
@@ -153,9 +153,9 @@ nsXULTabAccessible::RelationByType(PRUint32 aType)
|
||||
if (!tabsElm)
|
||||
return rel;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(GetDOMNode());
|
||||
nsCOMPtr<nsIDOMNode> domNode(DOMNode());
|
||||
nsCOMPtr<nsIDOMNode> tabpanelNode;
|
||||
tabsElm->GetRelatedElement(DOMNode, getter_AddRefs(tabpanelNode));
|
||||
tabsElm->GetRelatedElement(domNode, getter_AddRefs(tabpanelNode));
|
||||
if (!tabpanelNode)
|
||||
return rel;
|
||||
|
||||
@@ -255,9 +255,9 @@ nsXULTabpanelAccessible::RelationByType(PRUint32 aType)
|
||||
if (!tabpanelsElm)
|
||||
return rel;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(GetDOMNode());
|
||||
nsCOMPtr<nsIDOMNode> domNode(DOMNode());
|
||||
nsCOMPtr<nsIDOMNode> tabNode;
|
||||
tabpanelsElm->GetRelatedElement(DOMNode, getter_AddRefs(tabNode));
|
||||
tabpanelsElm->GetRelatedElement(domNode, getter_AddRefs(tabNode));
|
||||
if (!tabNode)
|
||||
return rel;
|
||||
|
||||
|
||||
@@ -52,11 +52,13 @@ DIRS = \
|
||||
hyperlink \
|
||||
hypertext \
|
||||
name \
|
||||
pivot \
|
||||
relations \
|
||||
selectable \
|
||||
states \
|
||||
table \
|
||||
text \
|
||||
textcaret \
|
||||
textselection \
|
||||
tree \
|
||||
treeupdate \
|
||||
@@ -81,6 +83,7 @@ _TEST_FILES =\
|
||||
grid.js \
|
||||
layout.js \
|
||||
name.js \
|
||||
pivot.js \
|
||||
relations.js \
|
||||
role.js \
|
||||
selectable.js \
|
||||
@@ -101,7 +104,6 @@ _TEST_FILES =\
|
||||
test_nsIAccessNode_utils.html \
|
||||
test_nsOuterDocAccessible.html \
|
||||
test_role_nsHyperTextAcc.html \
|
||||
test_text_caret.html \
|
||||
test_textboxes.html \
|
||||
test_textboxes.xul \
|
||||
testTextboxes.js \
|
||||
|
||||
@@ -49,6 +49,15 @@
|
||||
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",
|
||||
actionName: "jump",
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
},
|
||||
{
|
||||
ID: "button",
|
||||
actionName: "click",
|
||||
actionName: "press",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<!--
|
||||
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=689540
|
||||
-->
|
||||
<head>
|
||||
<title>CSS-like attributes tests</title>
|
||||
@@ -25,7 +26,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=460932
|
||||
var attrs = {
|
||||
"display": computedStyle.display,
|
||||
"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);
|
||||
}
|
||||
@@ -34,7 +39,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=460932
|
||||
{
|
||||
testCSSAttrs("span");
|
||||
testCSSAttrs("div");
|
||||
|
||||
testCSSAttrs("p");
|
||||
testCSSAttrs("p2");
|
||||
|
||||
testCSSAttrs("pml");
|
||||
testCSSAttrs("pmr");
|
||||
testCSSAttrs("pmt");
|
||||
testCSSAttrs("pmb");
|
||||
|
||||
testCSSAttrs("input");
|
||||
testCSSAttrs("table");
|
||||
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">
|
||||
Mozilla Bug 460932
|
||||
</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>
|
||||
<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>
|
||||
<div id="div">It's div</div>
|
||||
|
||||
<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"/>
|
||||
<table id="table">
|
||||
<tr id="tr" role="group">
|
||||
|
||||
@@ -25,6 +25,14 @@ function browserWindow()
|
||||
return gBrowserContext.browserWnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the document of the browser window.
|
||||
*/
|
||||
function browserDocument()
|
||||
{
|
||||
return browserWindow().document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return tab browser object.
|
||||
*/
|
||||
@@ -49,6 +57,22 @@ function currentTabDocument()
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,6 @@ const nsIAccessibleCoordinateType = Components.interfaces.nsIAccessibleCoordinat
|
||||
|
||||
const nsIAccessibleRelation = Components.interfaces.nsIAccessibleRelation;
|
||||
|
||||
const nsIAccessNode = Components.interfaces.nsIAccessNode;
|
||||
const nsIAccessible = Components.interfaces.nsIAccessible;
|
||||
|
||||
const nsIAccessibleDocument = Components.interfaces.nsIAccessibleDocument;
|
||||
@@ -30,10 +29,13 @@ const nsIAccessibleEditableText = Components.interfaces.nsIAccessibleEditableTex
|
||||
const nsIAccessibleHyperLink = Components.interfaces.nsIAccessibleHyperLink;
|
||||
const nsIAccessibleHyperText = Components.interfaces.nsIAccessibleHyperText;
|
||||
|
||||
const nsIAccessibleCursorable = Components.interfaces.nsIAccessibleCursorable;
|
||||
const nsIAccessibleImage = Components.interfaces.nsIAccessibleImage;
|
||||
const nsIAccessiblePivot = Components.interfaces.nsIAccessiblePivot;
|
||||
const nsIAccessibleSelectable = Components.interfaces.nsIAccessibleSelectable;
|
||||
const nsIAccessibleTable = Components.interfaces.nsIAccessibleTable;
|
||||
const nsIAccessibleTableCell = Components.interfaces.nsIAccessibleTableCell;
|
||||
const nsIAccessibleTraversalRule = Components.interfaces.nsIAccessibleTraversalRule;
|
||||
const nsIAccessibleValue = Components.interfaces.nsIAccessibleValue;
|
||||
|
||||
const nsIObserverService = Components.interfaces.nsIObserverService;
|
||||
@@ -118,10 +120,8 @@ function getNode(aAccOrNodeOrID)
|
||||
if (aAccOrNodeOrID instanceof nsIDOMNode)
|
||||
return aAccOrNodeOrID;
|
||||
|
||||
if (aAccOrNodeOrID instanceof nsIAccessible) {
|
||||
aAccOrNodeOrID.QueryInterface(nsIAccessNode);
|
||||
if (aAccOrNodeOrID instanceof nsIAccessible)
|
||||
return aAccOrNodeOrID.DOMNode;
|
||||
}
|
||||
|
||||
node = document.getElementById(aAccOrNodeOrID);
|
||||
if (!node) {
|
||||
@@ -164,7 +164,6 @@ function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf)
|
||||
var elm = null;
|
||||
|
||||
if (aAccOrElmOrID instanceof nsIAccessible) {
|
||||
aAccOrElmOrID.QueryInterface(nsIAccessNode);
|
||||
elm = aAccOrElmOrID.DOMNode;
|
||||
|
||||
} else if (aAccOrElmOrID instanceof nsIDOMNode) {
|
||||
@@ -196,8 +195,6 @@ function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf)
|
||||
}
|
||||
}
|
||||
|
||||
acc.QueryInterface(nsIAccessNode);
|
||||
|
||||
if (!aInterfaces)
|
||||
return acc;
|
||||
|
||||
@@ -254,8 +251,7 @@ function getContainerAccessible(aAccOrElmOrID)
|
||||
*/
|
||||
function getRootAccessible(aAccOrElmOrID)
|
||||
{
|
||||
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document,
|
||||
[nsIAccessNode]);
|
||||
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document);
|
||||
return acc ? acc.rootDocument.QueryInterface(nsIAccessible) : null;
|
||||
}
|
||||
|
||||
@@ -264,11 +260,10 @@ function getRootAccessible(aAccOrElmOrID)
|
||||
*/
|
||||
function getTabDocAccessible(aAccOrElmOrID)
|
||||
{
|
||||
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document,
|
||||
[nsIAccessNode]);
|
||||
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document);
|
||||
|
||||
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.
|
||||
if (acc.rootDocument == containerDocAcc)
|
||||
@@ -581,7 +576,7 @@ function getTextFromClipboard()
|
||||
function prettyName(aIdentifier)
|
||||
{
|
||||
if (aIdentifier instanceof nsIAccessible) {
|
||||
var acc = getAccessible(aIdentifier, [nsIAccessNode]);
|
||||
var acc = getAccessible(aIdentifier);
|
||||
var msg = "[" + getNodePrettyName(acc.DOMNode);
|
||||
try {
|
||||
msg += ", role: " + roleToString(acc.role);
|
||||
|
||||
@@ -27,6 +27,7 @@ const EVENT_TEXT_INSERTED = nsIAccessibleEvent.EVENT_TEXT_INSERTED;
|
||||
const EVENT_TEXT_REMOVED = nsIAccessibleEvent.EVENT_TEXT_REMOVED;
|
||||
const EVENT_TEXT_SELECTION_CHANGED = nsIAccessibleEvent.EVENT_TEXT_SELECTION_CHANGED;
|
||||
const EVENT_VALUE_CHANGE = nsIAccessibleEvent.EVENT_VALUE_CHANGE;
|
||||
const EVENT_VIRTUALCURSOR_CHANGED = nsIAccessibleEvent.EVENT_VIRTUALCURSOR_CHANGED;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
|
||||
@@ -45,8 +45,6 @@ relativesrcdir = accessible/events
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# test_scroll.xul disabled for misusing <tabbrowser> (bug 715857)
|
||||
|
||||
_TEST_FILES =\
|
||||
docload_wnd.html \
|
||||
focus.html \
|
||||
@@ -82,6 +80,7 @@ _TEST_FILES =\
|
||||
test_menu.xul \
|
||||
test_mutation.html \
|
||||
test_mutation.xhtml \
|
||||
test_scroll.xul \
|
||||
test_selection_aria.html \
|
||||
test_selection.html \
|
||||
test_selection.xul \
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
var item = menu.getChildAt(idx);
|
||||
|
||||
if (hasState(item, STATE_FOCUSED))
|
||||
return getAccessible(item, [nsIAccessNode]);
|
||||
return getAccessible(item);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
<?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"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
@@ -16,7 +9,7 @@
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/utilityOverlay.js"/>
|
||||
src="chrome://mochikit/content/chrome-harness.js"/>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js" />
|
||||
@@ -26,95 +19,74 @@
|
||||
src="../states.js" />
|
||||
<script type="application/javascript"
|
||||
src="../events.js" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/chrome-harness.js"/>
|
||||
src="../browser.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
<![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
|
||||
|
||||
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']");
|
||||
}
|
||||
|
||||
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.eventSeq = [
|
||||
new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
|
||||
new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument)
|
||||
];
|
||||
|
||||
this.invoke = function loadTab_invoke()
|
||||
{
|
||||
getNode(aTabBrowserID).loadURI(aURL);
|
||||
tabBrowser().loadURI(aURL);
|
||||
}
|
||||
|
||||
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 = [
|
||||
new focusChecker(getTabDocument),
|
||||
new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument)
|
||||
];
|
||||
|
||||
this.invoke = function advanceFocusIntoTab_invoke()
|
||||
this.invoke = function switchToBackgroundTab_invoke()
|
||||
{
|
||||
var tabDoc = getAccessible(getTabDocument());
|
||||
tabDoc.takeFocus();
|
||||
tabBrowser().selectTabAtIndex(1);
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
openBrowserWindow(doTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<hbox flex="1" style="overflow: auto;">
|
||||
<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=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"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=691734"
|
||||
title="Make sure scrolling start event is fired when document receive focus">
|
||||
@@ -173,33 +139,6 @@
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<vbox flex="1">
|
||||
<!-- 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>
|
||||
<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>
|
||||
|
||||
<vbox id="eventdump"></vbox>
|
||||
</vbox>
|
||||
</window>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
{
|
||||
this.containerNode = getNode(aContainerID);
|
||||
this.container = getAccessible(this.containerNode, nsIAccessibleHyperText);
|
||||
this.text = this.container.firstChild.QueryInterface(nsIAccessNode);
|
||||
this.text = this.container.firstChild;
|
||||
this.textNode = this.text.DOMNode;
|
||||
this.textLen = this.textNode.data.length;
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ relativesrcdir = accessible/name
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# test_nsRootAcc.xul, nsRootAcc_wnd.xul disabled for misusing <tabbrowser> (bug 715857)
|
||||
|
||||
_TEST_FILES =\
|
||||
general.css \
|
||||
general.xbl \
|
||||
@@ -57,6 +55,7 @@ _TEST_FILES =\
|
||||
test_link.html \
|
||||
test_list.html \
|
||||
test_markup.html \
|
||||
test_browserui.xul \
|
||||
test_tree.xul \
|
||||
markuprules.xml \
|
||||
$(NULL)
|
||||
|
||||
@@ -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>
|
||||
106
accessible/tests/mochitest/name/test_browserui.xul
Normal file
106
accessible/tests/mochitest/name/test_browserui.xul
Normal 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>
|
||||
216
accessible/tests/mochitest/pivot.js
Normal file
216
accessible/tests/mochitest/pivot.js
Normal 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");
|
||||
}
|
||||
54
accessible/tests/mochitest/pivot/Makefile.in
Normal file
54
accessible/tests/mochitest/pivot/Makefile.in
Normal 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)
|
||||
26
accessible/tests/mochitest/pivot/doc_virtualcursor.html
Normal file
26
accessible/tests/mochitest/pivot/doc_virtualcursor.html
Normal 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>
|
||||
95
accessible/tests/mochitest/pivot/test_virtualcursor.html
Normal file
95
accessible/tests/mochitest/pivot/test_virtualcursor.html
Normal 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>
|
||||
@@ -45,12 +45,11 @@ relativesrcdir = accessible/relations
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# test_tabbrowser.xul disabled for misusing <tabbrowser> (bug 715857)
|
||||
|
||||
_TEST_FILES =\
|
||||
test_embeds.xul \
|
||||
test_general.html \
|
||||
test_general.xul \
|
||||
test_tabbrowser.xul \
|
||||
test_tree.xul \
|
||||
test_update.html \
|
||||
$(NULL)
|
||||
|
||||
@@ -3,20 +3,13 @@
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.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"
|
||||
title="Accessible XUL tabbrowser relation tests">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/utilityOverlay.js"/>
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js" />
|
||||
@@ -26,75 +19,63 @@
|
||||
src="../relations.js" />
|
||||
<script type="application/javascript"
|
||||
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">
|
||||
<![CDATA[
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
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()
|
||||
// Invoker
|
||||
function testTabRelations()
|
||||
{
|
||||
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
|
||||
// documents load before we start the test.
|
||||
var docURIs = ["about:", "about:mozilla"];
|
||||
this.invoke = function testTabRelations_invoke()
|
||||
{
|
||||
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++;
|
||||
}
|
||||
this.finalCheck = function testTabRelations_finalCheck(aEvent)
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// 'labelled by'/'label for' relations for xul:tab and xul:tabpanel
|
||||
|
||||
if (this.reorderCnt == docURIs.length) {
|
||||
unregisterA11yEventListener(EVENT_REORDER, this);
|
||||
testRelations();
|
||||
}
|
||||
},
|
||||
var tabs = tabBrowser().tabContainer.childNodes;
|
||||
var panels = tabBrowser().mTabBox.tabpanels.childNodes;
|
||||
|
||||
tabBrowser: tabBrowser,
|
||||
reorderCnt: 0
|
||||
};
|
||||
registerA11yEventListener(EVENT_REORDER, handler);
|
||||
testRelation(panels[0], RELATION_LABELLED_BY, tabs[0]);
|
||||
testRelation(tabs[0], RELATION_LABEL_FOR, panels[0]);
|
||||
testRelation(panels[1], RELATION_LABELLED_BY, tabs[1]);
|
||||
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()
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// 'labelled by'/'label for' relations for xul:tab and xul:tabpanel
|
||||
// Load documents into tabs and wait for DocLoadComplete events caused by
|
||||
// these documents load before we start the test.
|
||||
|
||||
var tabs = getNode("tabbrowser").tabContainer.childNodes;
|
||||
var panels = getNode("tabbrowser").mTabBox.tabpanels.childNodes;
|
||||
gQueue = new eventQueue();
|
||||
|
||||
testRelation(panels[0], RELATION_LABELLED_BY, tabs[0]);
|
||||
testRelation(tabs[0], RELATION_LABEL_FOR, panels[0]);
|
||||
testRelation(panels[1], RELATION_LABELLED_BY, tabs[1]);
|
||||
testRelation(tabs[1], RELATION_LABEL_FOR, panels[1]);
|
||||
|
||||
SimpleTest.finish();
|
||||
gQueue.push(new testTabRelations());
|
||||
gQueue.onFinish = function() { closeBrowserWindow(); }
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
openBrowserWindow(doTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
@@ -112,26 +93,7 @@
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<!-- 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="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 id="eventdump"></vbox>
|
||||
</vbox>
|
||||
|
||||
</window>
|
||||
|
||||
@@ -131,7 +131,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=529289
|
||||
<tr><td>hi<td></tr></table>
|
||||
|
||||
<!-- test gEmptyRoleMap -->
|
||||
<table role="label">
|
||||
<table role="button">
|
||||
<tr>
|
||||
<td id="cell">cell</td>
|
||||
</tr>
|
||||
|
||||
@@ -37,15 +37,15 @@
|
||||
testChildAtPoint(txt, -10000, 10000, false, null);
|
||||
testChildAtPoint(txt, -10000, 10000, true, null);
|
||||
|
||||
// Not specific case, point is inside of label accessible.
|
||||
var label = getAccessible("label");
|
||||
var labelText = label.firstChild;
|
||||
testChildAtPoint(label, 1, 1, false, labelText);
|
||||
testChildAtPoint(label, 1, 1, true, labelText);
|
||||
// Not specific case, point is inside of btn accessible.
|
||||
var btn = getAccessible("btn");
|
||||
var btnText = btn.firstChild;
|
||||
testChildAtPoint(btn, 1, 1, false, btnText);
|
||||
testChildAtPoint(btn, 1, 1, true, btnText);
|
||||
|
||||
// Not specific case, point is outside of label accessible.
|
||||
testChildAtPoint(label, -1, 1, false, null);
|
||||
testChildAtPoint(label, -1, 1, true, null);
|
||||
// Not specific case, point is outside of btn accessible.
|
||||
testChildAtPoint(btn, -1, 1, false, null);
|
||||
testChildAtPoint(btn, -1, 1, true, null);
|
||||
|
||||
// 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.
|
||||
@@ -78,7 +78,7 @@
|
||||
<div role="listitem" id="listitem"><span role="image" id="image">img</span>item</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>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
function doTest()
|
||||
{
|
||||
var elmObj = {};
|
||||
var acc = getAccessible("span", [nsIAccessNode], elmObj);
|
||||
var acc = getAccessible("span", null, elmObj);
|
||||
computedStyle = document.defaultView.getComputedStyle(elmObj.value, "");
|
||||
|
||||
// html:span element
|
||||
@@ -23,7 +23,7 @@
|
||||
"Wrong color for element with ID 'span'");
|
||||
|
||||
// text child of html:span element
|
||||
acc = getAccessible(acc.firstChild, [nsIAccessNode]);
|
||||
acc = getAccessible(acc.firstChild);
|
||||
is(acc.getComputedStyleValue("", "color"), computedStyle.color,
|
||||
"Wrong color for text child of element with ID 'span'");
|
||||
|
||||
|
||||
54
accessible/tests/mochitest/textcaret/Makefile.in
Normal file
54
accessible/tests/mochitest/textcaret/Makefile.in
Normal 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)
|
||||
@@ -4,7 +4,7 @@
|
||||
type="text/css"?>
|
||||
|
||||
<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"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
@@ -15,41 +15,47 @@
|
||||
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[
|
||||
// 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)");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
|
||||
if (LINUX) {
|
||||
todo(false, "Skip test on Linux. (Bug 525175)");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
gQueue = new eventQueue();
|
||||
gQueue.push(new setCaretOffset(urlbarInput(), -1, urlbarInput()));
|
||||
gQueue.push(new setCaretOffset(urlbarInput(), 0));
|
||||
gQueue.onFinish = function()
|
||||
{
|
||||
closeBrowserWindow();
|
||||
}
|
||||
|
||||
var w = window.openDialog("nsRootAcc_wnd.xul",
|
||||
"nsRootAcc_name_test",
|
||||
"chrome,width=600,height=600");
|
||||
gQueue.invoke();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doTest);
|
||||
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
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=723833"
|
||||
title="IAccessibleText::setCaretOffset on location or search bar causes focus to jump">
|
||||
Mozilla Bug 723833
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
@@ -10,52 +10,11 @@
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="common.js"></script>
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="events.js"></script>
|
||||
src="../events.js"></script>
|
||||
|
||||
<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.
|
||||
*/
|
||||
@@ -81,9 +40,9 @@
|
||||
// test caret move events and caret offsets
|
||||
gQueue = new eventQueue();
|
||||
|
||||
gQueue.push(new setCaretOffsetInvoker("textbox", 1));
|
||||
gQueue.push(new setCaretOffsetInvoker("link", 1));
|
||||
gQueue.push(new setCaretOffsetInvoker("heading", 1, document));
|
||||
gQueue.push(new setCaretOffset("textbox", 1, "textbox"));
|
||||
gQueue.push(new setCaretOffset("link", 1, "link"));
|
||||
gQueue.push(new setCaretOffset("heading", 1, document));
|
||||
gQueue.onFinish = function()
|
||||
{
|
||||
turnCaretBrowsing(false);
|
||||
@@ -45,8 +45,6 @@ relativesrcdir = accessible/tree
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# test_tabbrowser.xul disabled for misusing <tabbrowser> (bug 715857)
|
||||
|
||||
_TEST_FILES =\
|
||||
dockids.html \
|
||||
$(warning test_applicationacc.xul temporarily disabled, see bug 561508) \
|
||||
@@ -72,6 +70,7 @@ _TEST_FILES =\
|
||||
test_media.html \
|
||||
test_select.html \
|
||||
test_tabbox.xul \
|
||||
test_tabbrowser.xul \
|
||||
test_table.html \
|
||||
test_tree.xul \
|
||||
test_txtcntr.html \
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
<?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"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
|
||||
@@ -17,7 +10,7 @@
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://browser/content/utilityOverlay.js"/>
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js" />
|
||||
@@ -25,201 +18,186 @@
|
||||
src="../role.js" />
|
||||
<script type="application/javascript"
|
||||
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">
|
||||
<![CDATA[
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
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()
|
||||
// invoker
|
||||
function testTabHierarchy()
|
||||
{
|
||||
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
|
||||
// documents load before we start the test.
|
||||
var docURIs = ["about:", "about:mozilla"];
|
||||
|
||||
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).
|
||||
);
|
||||
this.invoke = function testTabHierarchy_invoke()
|
||||
{
|
||||
var docURIs = ["about:", "about:mozilla"];
|
||||
tabBrowser().loadTabs(docURIs, false, true);
|
||||
}
|
||||
|
||||
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.
|
||||
]
|
||||
};
|
||||
|
||||
////////////////////
|
||||
// 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.
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
// SeaMonkey and Firefox tabbrowser UIs differ.
|
||||
if ("restoreTab" in tabBrowser) {
|
||||
SimpleTest.ok(true, "Testing SeaMonkey tabbrowser UI.");
|
||||
|
||||
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();
|
||||
addA11yLoadEvent(doTest);
|
||||
openBrowserWindow(doTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
@@ -242,26 +220,7 @@
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<!-- 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="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 id="eventdump"></vbox>
|
||||
</vbox>
|
||||
|
||||
</window>
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
this.preinvoke = function rootContentRemoved_preinvoke()
|
||||
{
|
||||
// Set up target for hide event before we invoke.
|
||||
var text = getAccessible(getAccessible(getDocNode(aID)).firstChild,
|
||||
[nsIAccessNode]).DOMNode;
|
||||
var text =
|
||||
getAccessible(getAccessible(getDocNode(aID)).firstChild).DOMNode;
|
||||
this.eventSeq[0].target = text;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#filter substitution
|
||||
|
||||
pref("toolkit.defaultChromeURI", "chrome://browser/content/shell.xul");
|
||||
pref("general.useragent.compatMode.firefox", true);
|
||||
pref("browser.chromeURL", "chrome://browser/content/");
|
||||
#ifdef MOZ_OFFICIAL_BRANDING
|
||||
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.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
|
||||
pref("dom.mozBrowserFramesEnabled", true);
|
||||
pref("dom.mozBrowserFramesWhitelist", "http://localhost:6666");
|
||||
@@ -401,9 +409,14 @@ pref("dom.mozBrowserFramesWhitelist", "http://localhost:6666");
|
||||
// Temporary permission hack for WebSMS
|
||||
pref("dom.sms.enabled", true);
|
||||
pref("dom.sms.whitelist", "file://,http://localhost:6666");
|
||||
|
||||
// Ignore X-Frame-Options headers.
|
||||
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
|
||||
// of talos regression. This is a needed change for higher-framerate
|
||||
// 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
|
||||
// by bug 710563.
|
||||
pref("layout.frame_rate.precise", true);
|
||||
|
||||
// Screen timeout in minutes
|
||||
pref("power.screen.timeout", 60);
|
||||
|
||||
@@ -47,17 +47,19 @@ const LocalFile = CC('@mozilla.org/file/local;1',
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, 'env', function() {
|
||||
return Cc['@mozilla.org/process/environment;1']
|
||||
.getService(Ci.nsIEnvironment);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(Services, 'ss', function() {
|
||||
return Cc['@mozilla.org/content/style-sheet-service;1']
|
||||
.getService(Ci.nsIStyleSheetService);
|
||||
});
|
||||
XPCOMUtils.defineLazyGetter(Services, 'fm', function() {
|
||||
return Cc['@mozilla.org/focus-manager;1']
|
||||
.getService(Ci.nsIFocusManager);
|
||||
XPCOMUtils.defineLazyGetter(Services, 'idle', function() {
|
||||
return Cc['@mozilla.org/widget/idleservice;1']
|
||||
.getService(Ci.nsIIdleService);
|
||||
});
|
||||
|
||||
// In order to use http:// scheme instead of file:// scheme
|
||||
@@ -77,9 +79,10 @@ function startupHttpd(baseDir, port) {
|
||||
// FIXME Bug 707625
|
||||
// until we have a proper security model, add some rights to
|
||||
// the pre-installed web applications
|
||||
// XXX never grant 'content-camera' to non-gaia apps
|
||||
function addPermissions(urls) {
|
||||
let permissions = [
|
||||
'indexedDB', 'indexedDB-unlimited', 'webapps-manage', 'offline-app'
|
||||
'indexedDB', 'indexedDB-unlimited', 'webapps-manage', 'offline-app', 'content-camera'
|
||||
];
|
||||
urls.forEach(function(url) {
|
||||
let uri = Services.io.newURI(url, null, null);
|
||||
@@ -96,9 +99,9 @@ var shell = {
|
||||
// FIXME/bug 678695: this should be a system setting
|
||||
preferredScreenBrightness: 1.0,
|
||||
|
||||
get home() {
|
||||
delete this.home;
|
||||
return this.home = document.getElementById('homescreen');
|
||||
get contentBrowser() {
|
||||
delete this.contentBrowser;
|
||||
return this.contentBrowser = document.getElementById('homescreen');
|
||||
},
|
||||
|
||||
get homeURL() {
|
||||
@@ -131,7 +134,8 @@ var shell = {
|
||||
window.controllers.appendController(this);
|
||||
window.addEventListener('keypress', this);
|
||||
window.addEventListener('MozApplicationManifest', this);
|
||||
this.home.addEventListener('load', this, true);
|
||||
window.addEventListener("AppCommand", this);
|
||||
this.contentBrowser.addEventListener('load', this, true);
|
||||
|
||||
try {
|
||||
Services.io.offline = false;
|
||||
@@ -156,7 +160,15 @@ var shell = {
|
||||
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.goHome();
|
||||
},
|
||||
@@ -187,7 +199,7 @@ var shell = {
|
||||
doCommand: function shell_doCommand(cmd) {
|
||||
switch (cmd) {
|
||||
case 'cmd_close':
|
||||
this.home.contentWindow.postMessage('appclose', '*');
|
||||
content.postMessage('appclose', '*');
|
||||
break;
|
||||
}
|
||||
},
|
||||
@@ -197,7 +209,7 @@ var shell = {
|
||||
case 'keypress':
|
||||
switch (evt.keyCode) {
|
||||
case evt.DOM_VK_HOME:
|
||||
this.sendEvent(this.home.contentWindow, 'home');
|
||||
this.sendEvent(content, 'home');
|
||||
break;
|
||||
case evt.DOM_VK_SLEEP:
|
||||
this.toggleScreen();
|
||||
@@ -205,7 +217,7 @@ var shell = {
|
||||
let details = {
|
||||
'enabled': screen.mozEnabled
|
||||
};
|
||||
this.sendEvent(this.home.contentWindow, 'sleep', details);
|
||||
this.sendEvent(content, 'sleep', details);
|
||||
break;
|
||||
case evt.DOM_VK_ESCAPE:
|
||||
if (evt.defaultPrevented)
|
||||
@@ -214,9 +226,20 @@ var shell = {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'AppCommand':
|
||||
switch (evt.command) {
|
||||
case 'Menu':
|
||||
this.sendEvent(content, 'menu');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'load':
|
||||
this.home.removeEventListener('load', this, true);
|
||||
this.contentBrowser.removeEventListener('load', this, true);
|
||||
this.turnScreenOn();
|
||||
|
||||
let chromeWindow = window.QueryInterface(Ci.nsIDOMChromeWindow);
|
||||
chromeWindow.browserDOMWindow = new nsBrowserAccess();
|
||||
|
||||
this.sendEvent(window, 'ContentStart');
|
||||
break;
|
||||
case 'MozApplicationManifest':
|
||||
@@ -229,7 +252,7 @@ var shell = {
|
||||
if (!documentElement)
|
||||
return;
|
||||
|
||||
let manifest = documentElement.getAttribute("manifest");
|
||||
let manifest = documentElement.getAttribute('manifest');
|
||||
if (!manifest)
|
||||
return;
|
||||
|
||||
@@ -273,78 +296,60 @@ var shell = {
|
||||
turnScreenOn: function shell_turnScreenOn() {
|
||||
screen.mozEnabled = true;
|
||||
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);
|
||||
|
||||
@@ -66,12 +66,12 @@
|
||||
events: ['mousedown', 'mousemove', 'mouseup', 'click', 'unload'],
|
||||
start: function teh_start() {
|
||||
this.events.forEach((function(evt) {
|
||||
shell.home.addEventListener(evt, this, true);
|
||||
shell.contentBrowser.addEventListener(evt, this, true);
|
||||
}).bind(this));
|
||||
},
|
||||
stop: function teh_stop() {
|
||||
this.events.forEach((function(evt) {
|
||||
shell.home.removeEventListener(evt, this, true);
|
||||
shell.contentBrowser.removeEventListener(evt, this, true);
|
||||
}).bind(this));
|
||||
},
|
||||
handleEvent: function teh_handleEvent(evt) {
|
||||
@@ -139,12 +139,7 @@
|
||||
return;
|
||||
|
||||
case 'click':
|
||||
if (!isNewTouchAction) {
|
||||
debug('click: cancel');
|
||||
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
} else {
|
||||
if (isNewTouchAction) {
|
||||
// Mouse events has been cancelled so dispatch a sequence
|
||||
// of events to where touchend has been fired
|
||||
if (preventMouseEvents) {
|
||||
|
||||
1788
b2g/chrome/content/webapi.js
Normal file
1788
b2g/chrome/content/webapi.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ chrome.jar:
|
||||
content/touch.js (content/touch.js)
|
||||
content/commandUtil.js (content/commandUtil.js)
|
||||
content/httpd.js (content/httpd.js)
|
||||
content/webapi.js (content/webapi.js)
|
||||
content/content.css (content/content.css)
|
||||
|
||||
% override chrome://global/content/netError.xhtml chrome://browser/content/netError.xhtml
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
# Scrollbars
|
||||
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
|
||||
|
||||
83
b2g/components/CameraContent.js
Normal file
83
b2g/components/CameraContent.js
Normal 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]);
|
||||
@@ -44,8 +44,13 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MODULE = B2GComponents
|
||||
XPIDL_MODULE = B2GComponents
|
||||
|
||||
XPIDLSRCS = \
|
||||
b2g.idl \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_PP_COMPONENTS = \
|
||||
B2GComponents.manifest \
|
||||
CameraContent.js \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
12
b2g/components/b2g.idl
Normal file
12
b2g/components/b2g.idl
Normal 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);
|
||||
};
|
||||
@@ -38,7 +38,8 @@
|
||||
MOZ_APP_BASENAME=B2G
|
||||
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_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official
|
||||
|
||||
@@ -162,6 +162,7 @@
|
||||
@BINPATH@/components/dom_indexeddb.xpt
|
||||
@BINPATH@/components/dom_offline.xpt
|
||||
@BINPATH@/components/dom_json.xpt
|
||||
@BINPATH@/components/dom_power.xpt
|
||||
@BINPATH@/components/dom_range.xpt
|
||||
@BINPATH@/components/dom_sidebar.xpt
|
||||
@BINPATH@/components/dom_sms.xpt
|
||||
@@ -602,3 +603,4 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
|
||||
@BINPATH@/chrome/chrome.manifest
|
||||
@BINPATH@/components/B2GComponents.manifest
|
||||
@BINPATH@/components/B2GComponents.xpt
|
||||
@BINPATH@/components/CameraContent.js
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?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>
|
||||
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
|
||||
<versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1">
|
||||
</versionRange>
|
||||
@@ -43,8 +47,10 @@
|
||||
<versionRange minVersion="0.1" maxVersion="14.4.0" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i53" id="{a3a5c777-f583-4fef-9380-ab4add1bc2a8}">
|
||||
<versionRange minVersion="2.0.3" maxVersion="2.0.3">
|
||||
<emItem blockID="i61" id="youtube@youtube3.com">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<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>
|
||||
</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">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
@@ -96,19 +110,25 @@
|
||||
</targetApplication>
|
||||
</versionRange>
|
||||
</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>
|
||||
<emItem blockID="i60" id="youtb3@youtb3.com">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i56" id="flash@adobe.com">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i55" id="youtube@youtube7.com">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i47" id="youtube@youtube2.com">
|
||||
</emItem>
|
||||
<emItem blockID="i11" id="yslow@yahoo-inc.com">
|
||||
<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">
|
||||
<versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0">
|
||||
</versionRange>
|
||||
@@ -140,17 +160,19 @@
|
||||
<versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i11" id="yslow@yahoo-inc.com">
|
||||
<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="i47" id="youtube@youtube2.com">
|
||||
</emItem>
|
||||
<emItem blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
|
||||
<versionRange minVersion="2.2" maxVersion="2.2">
|
||||
</versionRange>
|
||||
</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}">
|
||||
<versionRange minVersion="0.1" maxVersion="7.6.1">
|
||||
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
|
||||
|
||||
@@ -65,6 +65,7 @@ pref("extensions.minCompatibleAppVersion", "4.0");
|
||||
pref("extensions.getAddons.cache.enabled", true);
|
||||
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.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.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%");
|
||||
@@ -1030,6 +1031,12 @@ pref("devtools.errorconsole.enabled", false);
|
||||
pref("devtools.inspector.enabled", true);
|
||||
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
|
||||
pref("devtools.styleinspector.enabled", true);
|
||||
|
||||
@@ -1111,10 +1118,15 @@ pref("prompts.tab_modal.enabled", true);
|
||||
pref("browser.panorama.animate_zoom", true);
|
||||
|
||||
// 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.
|
||||
pref("browser.newtabpage.enabled", false);
|
||||
pref("browser.newtabpage.enabled", true);
|
||||
|
||||
// Enable the DOM full-screen API.
|
||||
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);
|
||||
|
||||
@@ -49,9 +49,7 @@ abs_srcdir = $(call core_abspath,$(srcdir))
|
||||
|
||||
CHROME_DEPS += $(abs_srcdir)/content/overrides/app-license.html
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
DIRS += content/test
|
||||
endif
|
||||
TEST_DIRS += content/test
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
@@ -265,17 +265,17 @@ appUpdater.prototype =
|
||||
if (cancelQuit.data)
|
||||
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 (Services.appinfo.inSafeMode) {
|
||||
let env = Components.classes["@mozilla.org/process/environment;1"].
|
||||
getService(Components.interfaces.nsIEnvironment);
|
||||
env.set("MOZ_SAFE_MODE_RESTART", "1");
|
||||
appStartup.restartInSafeMode(Components.interfaces.nsIAppStartup.eAttemptQuit);
|
||||
return;
|
||||
}
|
||||
|
||||
Components.classes["@mozilla.org/toolkit/app-startup;1"].
|
||||
getService(Components.interfaces.nsIAppStartup).
|
||||
quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
|
||||
Components.interfaces.nsIAppStartup.eRestart);
|
||||
appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
|
||||
Components.interfaces.nsIAppStartup.eRestart);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,6 +189,11 @@
|
||||
type="checkbox"
|
||||
command="Tools:Inspect"
|
||||
key="key_inspect"/>
|
||||
<menuitem id="appmenu_debugger"
|
||||
hidden="true"
|
||||
label="&debuggerMenu.label;"
|
||||
key="key_debugger"
|
||||
command="Tools:Debugger"/>
|
||||
<menuitem id="appmenu_scratchpad"
|
||||
hidden="true"
|
||||
label="&scratchpad.label;"
|
||||
|
||||
@@ -19,5 +19,7 @@
|
||||
#endif
|
||||
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
|
||||
%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
Reference in New Issue
Block a user