Merge mozilla-central into Electrolysis

This commit is contained in:
Benjamin Smedberg 2009-08-26 12:15:27 -04:00
Родитель 20d542c5c3 4c939def3d
Коммит 8f00e422eb
2750 изменённых файлов: 86279 добавлений и 105812 удалений

Просмотреть файл

@ -34,3 +34,4 @@ f817a4378f32b1ad0a7c4b5a9949586dba816da5 FENNEC_M11
fe9cc55b8db7f56f7e68a246acba363743854979 UPDATE_PACKAGING_R8
6fd4bb500d425c406c1b52f66e5b195b20ae5e0a chromium-import-r15462
6fd4bb500d425c406c1b52f66e5b195b20ae5e0a chromium-import-latest
376b78fc72230aaf2ca4e279a8f4ef1efd4a1d9f GECKO_1_9_2_BASE

Просмотреть файл

@ -54,8 +54,6 @@ MODULE_NAME = nsAccessibilityModule
GRE_MODULE = 1
LIBXUL_LIBRARY = 1
REQUIRES = xpcom \
$(NULL)
CPPSRCS = nsAccessibilityFactory.cpp

Просмотреть файл

@ -45,30 +45,13 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_toolkit_s
LIBXUL_LIBRARY = 1
REQUIRES = content \
docshell \
dom \
editor \
gfx \
thebes \
intl \
layout \
locale \
necko \
string \
uriloader \
view \
webshell \
widget \
xpcom \
$(NULL)
CPPSRCS = \
nsAccessNodeWrap.cpp \
nsAccessibleWrap.cpp \
nsDocAccessibleWrap.cpp \
nsRootAccessibleWrap.cpp \
nsAppRootAccessible.cpp \
nsApplicationAccessibleWrap.cpp \
nsMaiInterfaceComponent.cpp \
nsMaiInterfaceAction.cpp \
nsMaiInterfaceText.cpp \

Просмотреть файл

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsAccessNodeWrap.h"
#include "nsAppRootAccessible.h"
#include "nsApplicationAccessibleWrap.h"
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html

Просмотреть файл

@ -40,6 +40,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibleWrap.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsRootAccessible.h"
#include "nsDocAccessibleWrap.h"
#include "nsIAccessibleValue.h"
@ -63,9 +64,8 @@
#include "nsMaiInterfaceDocument.h"
#include "nsMaiInterfaceImage.h"
#include "nsAppRootAccessible.h"
extern "C" GType g_atk_hyperlink_impl_type; //defined in nsAppRootAccessible.cpp
//defined in nsApplicationAccessibleWrap.cpp
extern "C" GType g_atk_hyperlink_impl_type;
/* MaiAtkObject */

Просмотреть файл

@ -39,14 +39,16 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsApplicationAccessibleWrap.h"
#include "nsCOMPtr.h"
#include "nsMai.h"
#include "nsAppRootAccessible.h"
#include "prlink.h"
#include "prenv.h"
#include "nsIPrefBranch.h"
#include "nsIServiceManager.h"
#include "nsAutoPtr.h"
#include "nsAccessibilityService.h"
#include <gtk/gtk.h>
#include <atk/atk.h>
@ -435,17 +437,21 @@ mai_util_remove_key_event_listener (guint remove_listener)
AtkObject *
mai_util_get_root(void)
{
if (nsAccessibilityService::gIsShutdown) {
// We've shutdown, try to use gail instead
// (to avoid assert in spi_atk_tidy_windows())
if (gail_get_root)
return gail_get_root();
return nsnull;
}
nsRefPtr<nsApplicationAccessibleWrap> root =
nsAccessNode::GetApplicationAccessible();
if (root)
return root->GetAtkObject();
// We've shutdown, try to use gail instead
// (to avoid assert in spi_atk_tidy_windows())
if (gail_get_root)
return gail_get_root();
return nsnull;
}

Просмотреть файл

@ -45,66 +45,15 @@
// --------------------------------------------------------
// nsXULTreeAccessibleWrap Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeAccessibleWrap, nsXULTreeAccessible, nsIAccessibleTable)
nsXULTreeAccessibleWrap::nsXULTreeAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsXULTreeAccessible(aDOMNode, aShell)
nsXULTreeGridAccessibleWrap::
nsXULTreeGridAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsXULTreeGridAccessible(aDOMNode, aShell)
{
}
// tree's children count is row count * col count + treecols count
// override "children count = row count + treecols count" defined in
// nsXULTreeAccessible
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetChildCount(PRInt32 *aAccChildCount)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
// get treecols count, which is cached by nsAccessibleTreeWalker
// by going through DOM structure of XUL tree
nsAccessible::GetChildCount(aAccChildCount);
if (*aAccChildCount != 0 && *aAccChildCount != eChildCountUninitialized) {
// add the count of table cell (or tree item) accessibles, which are
// created and appended by XUL tree accessible implementation
PRInt32 rowCount, colCount = 1;
mTreeView->GetRowCount(&rowCount);
GetColumns(&colCount);
*aAccChildCount += rowCount * colCount;
}
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetCaption(nsIAccessible **aCaption)
{
*aCaption = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetSummary(nsAString &aSummary)
{
aSummary.Truncate();
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumns(PRInt32 *aColumnCount)
{
NS_ENSURE_ARG_POINTER(aColumnCount);
*aColumnCount = 0;
nsCOMPtr<nsITreeColumn> column;
column = GetFirstVisibleColumn(mTree);
if (!column)
return NS_ERROR_FAILURE;
do {
(*aColumnCount)++;
} while ((column = GetNextVisibleColumn(column)));
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
NS_IMETHODIMP
nsXULTreeGridAccessibleWrap::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
{
nsresult rv = NS_OK;
@ -121,210 +70,8 @@ NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumnHeader(nsIAccessibleTable **aCol
return rv;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRows(PRInt32 *aRows)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
return mTreeView->GetRowCount(aRows);
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRowHeader(nsIAccessibleTable **aRowHeader)
{
// Row header not supported
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeAccessibleWrap::GetSelectedCellsCount(PRUint32* aCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeAccessibleWrap::GetSelectedColumnsCount(PRUint32* aCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeAccessibleWrap::GetSelectedRowsCount(PRUint32* aCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeAccessibleWrap::GetSelectedCells(PRUint32 *aNumCells,
PRInt32 **aCells)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetSelectedColumns(PRUint32 *aNumColumns, PRInt32 **aColumns)
{
// If all the row has been selected, then all the columns are selected.
// Because we can't select a column alone.
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
NS_ENSURE_ARG_POINTER(aNumColumns);
nsresult rv = NS_OK;
PRInt32 rows;
rv = GetRows(&rows);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedRows;
rv = GetSelectionCount(&selectedRows);
NS_ENSURE_SUCCESS(rv, rv);
if (rows == selectedRows) {
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
*aNumColumns = columns;
} else {
*aNumColumns = 0;
return rv;
}
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof(PRInt32));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
for (PRUint32 index = 0; index < *aNumColumns; index++) {
outArray[index] = index;
}
*aColumns = outArray;
return rv;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetSelectedRows(PRUint32 *aNumRows, PRInt32 **aRows)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
NS_ENSURE_ARG_POINTER(aNumRows);
nsresult rv = NS_OK;
rv = GetSelectionCount((PRInt32 *)aNumRows);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumRows) * sizeof(PRInt32));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsITreeView> view;
rv = mTree->GetView(getter_AddRefs(view));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsITreeSelection> selection;
rv = view->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowCount;
rv = GetRows(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRBool isSelected;
PRInt32 index, curr = 0;
for (index = 0; index < rowCount; index++) {
selection->IsSelected(index, &isSelected);
if (isSelected) {
outArray[curr++] = index;
}
}
*aRows = outArray;
return rv;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::CellRefAt(PRInt32 aRow, PRInt32 aColumn, nsIAccessible **aAccessibleCell)
{
NS_ENSURE_TRUE(mDOMNode && mTree, NS_ERROR_FAILURE);
nsresult rv = NS_OK;
PRInt32 index;
rv = GetIndexAt(aRow, aColumn, &index);
NS_ENSURE_SUCCESS(rv, rv);
return GetChildAt(index, aAccessibleCell);
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *aIndex)
{
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
NS_ENSURE_ARG_POINTER(aIndex);
nsresult rv = NS_OK;
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 treeCols;
nsAccessible::GetChildCount(&treeCols);
*aIndex = aRow * columns + aColumn + treeCols;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *aColumn)
{
NS_ENSURE_ARG_POINTER(aColumn);
*aColumn = -1;
nsresult rv = NS_OK;
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 treeCols;
nsAccessible::GetChildCount(&treeCols);
if (aIndex >= treeCols) {
*aColumn = (aIndex - treeCols) % columns;
}
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRowAtIndex(PRInt32 aIndex, PRInt32 *aRow)
{
NS_ENSURE_ARG_POINTER(aRow);
*aRow = -1;
nsresult rv = NS_OK;
PRInt32 columns;
rv = GetColumns(&columns);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 treeCols;
nsAccessible::GetChildCount(&treeCols);
if (aIndex >= treeCols) {
*aRow = (aIndex - treeCols) / columns;
}
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumnDescription(PRInt32 aColumn, nsAString & _retval)
nsXULTreeGridAccessibleWrap::GetColumnDescription(PRInt32 aColumn, nsAString & _retval)
{
nsCOMPtr<nsIAccessibleTable> columnHeader;
nsresult rv = GetColumnHeader(getter_AddRefs(columnHeader));
@ -334,112 +81,6 @@ NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumnDescription(PRInt32 aColumn, nsA
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRowDescription(PRInt32 aRow, nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::IsColumnSelected(PRInt32 aColumn, PRBool *_retval)
{
// If all the row has been selected, then all the columns are selected.
// Because we can't select a column alone.
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv = NS_OK;
PRInt32 rows;
rv = GetRows(&rows);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedRows;
rv = GetSelectionCount(&selectedRows);
NS_ENSURE_SUCCESS(rv, rv);
*_retval = rows == selectedRows;
return rv;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::IsRowSelected(PRInt32 aRow, PRBool *_retval)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
nsresult rv = NS_OK;
nsCOMPtr<nsITreeView> view;
rv = mTree->GetView(getter_AddRefs(view));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsITreeSelection> selection;
rv = view->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
return selection->IsSelected(aRow, _retval);
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::IsCellSelected(PRInt32 aRow, PRInt32 aColumn, PRBool *_retval)
{
return IsRowSelected(aRow, _retval);
}
NS_IMETHODIMP
nsXULTreeAccessibleWrap::SelectRow(PRInt32 aRow)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeAccessibleWrap::SelectColumn(PRInt32 aColumn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeAccessibleWrap::UnselectRow(PRInt32 aRow)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeAccessibleWrap::UnselectColumn(PRInt32 aColumn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
PRInt32 rowIndex;
nsresult rv = GetRowAtIndex(aIndex, &rowIndex);
nsCOMPtr<nsITreeSelection> selection;
rv = mTreeView->GetSelection(getter_AddRefs(selection));
NS_ASSERTION(selection, "Can't get selection from mTreeView");
if (selection) {
selection->IsSelected(rowIndex, aSelState);
// XXX: Can move to nsXULTreeAccessible if this can be applied to cross-platform
if ((!(*aSelState) && eSelection_Add == aMethod)) {
nsresult rv = selection->Select(rowIndex);
mTree->EnsureRowIsVisible(aIndex);
return rv;
}
// XXX: Will eSelection_Remove happen for XULTree? Leave the original implementation here
if ((*aSelState) && eSelection_Remove == aMethod) {
return selection->ToggleSelect(rowIndex);
}
}
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
{
*aIsProbablyForLayout = PR_FALSE;
return NS_OK;
}
// --------------------------------------------------------
// nsXULTreeColumnsAccessibleWrap Accessible
// --------------------------------------------------------

Просмотреть файл

@ -40,27 +40,16 @@
#ifndef __nsXULTreeAccessibleWrap_h__
#define __nsXULTreeAccessibleWrap_h__
#include "nsIAccessibleTable.h"
#include "nsXULTreeAccessible.h"
#include "nsXULTreeGridAccessible.h"
typedef class nsXULTreeitemAccessible nsXULTreeitemAccessibleWrap;
class nsXULTreeAccessibleWrap : public nsXULTreeAccessible,
public nsIAccessibleTable
class nsXULTreeGridAccessibleWrap : public nsXULTreeGridAccessible
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
nsXULTreeGridAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
nsXULTreeAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeAccessibleWrap() {}
// nsIAccessible
NS_IMETHOD GetChildCount(PRInt32 *_retval);
protected:
NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod,
PRBool *aSelState);
// nsIAccessibleTable
NS_IMETHOD GetColumnHeader(nsIAccessibleTable **aColumnHeader);
NS_IMETHOD GetColumnDescription(PRInt32 aColumn, nsAString& aDescription);
};
class nsXULTreeColumnsAccessibleWrap : public nsXULTreeColumnsAccessible,
@ -71,7 +60,6 @@ public:
NS_DECL_NSIACCESSIBLETABLE
nsXULTreeColumnsAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeColumnsAccessibleWrap() {}
};
#endif

Просмотреть файл

@ -46,31 +46,6 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_base_s
LIBXUL_LIBRARY = 1
REQUIRES = appshell \
commandhandler \
composer \
content \
docshell \
dom \
editor \
gfx \
thebes \
intl \
layout \
locale \
necko \
plugin \
pref \
string \
unicharutil \
uriloader \
view \
webshell \
widget \
xpcom \
xuldoc \
imglib2 \
$(NULL)
CPPSRCS = \
nsAccessNode.cpp \

Просмотреть файл

@ -50,7 +50,7 @@
#include "nsAccessibleTreeWalker.h"
#include "nsAccessible.h"
#include "nsARIAMap.h"
#include "nsXULTreeAccessible.h"
#include "nsXULTreeGridAccessible.h"
#include "nsIDOMXULContainerElement.h"
#include "nsIDOMXULSelectCntrlEl.h"
@ -779,16 +779,6 @@ nsAccUtils::QueryAccessibleTree(nsIAccessible *aAccessible)
return accessible;
}
already_AddRefed<nsXULTreeitemAccessible>
nsAccUtils::QueryAccessibleTreeitem(nsIAccessNode *aAccessNode)
{
nsXULTreeitemAccessible* accessible = nsnull;
if (aAccessNode)
CallQueryInterface(aAccessNode, &accessible);
return accessible;
}
#endif
#ifdef DEBUG_A11Y

Просмотреть файл

@ -58,7 +58,6 @@ class nsHTMLTableAccessible;
class nsDocAccessible;
#ifdef MOZ_XUL
class nsXULTreeAccessible;
class nsXULTreeitemAccessible;
#endif
class nsAccUtils
@ -289,6 +288,28 @@ public:
*/
static void GetLiveAttrValue(PRUint32 aRule, nsAString& aValue);
/**
* Query DestinationType from the given SourceType.
*/
template<class DestinationType, class SourceType> static inline
already_AddRefed<DestinationType> QueryObject(SourceType *aObject)
{
DestinationType* object = nsnull;
if (aObject)
CallQueryInterface(aObject, &object);
return object;
}
template<class DestinationType, class SourceType> static inline
already_AddRefed<DestinationType> QueryObject(nsCOMPtr<SourceType>& aObject)
{
DestinationType* object = nsnull;
if (aObject)
CallQueryInterface(aObject, &object);
return object;
}
/**
* Query nsAccessNode from the given nsIAccessible.
*/
@ -364,12 +385,6 @@ public:
*/
static already_AddRefed<nsXULTreeAccessible>
QueryAccessibleTree(nsIAccessible *aAccessible);
/**
* Query nsXULTreeitemAccessible from the given nsIAccessNode.
*/
static already_AddRefed<nsXULTreeitemAccessible>
QueryAccessibleTreeitem(nsIAccessNode *aAccessNode);
#endif
#ifdef DEBUG_A11Y

Просмотреть файл

@ -41,6 +41,7 @@
#include "nsAccessibilityAtoms.h"
#include "nsHashtable.h"
#include "nsAccessibilityService.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsIAccessibleDocument.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
@ -68,12 +69,6 @@
#include "nsFocusManager.h"
#include "nsIObserverService.h"
#ifdef MOZ_ACCESSIBILITY_ATK
#include "nsAppRootAccessible.h"
#else
#include "nsApplicationAccessibleWrap.h"
#endif
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/

Просмотреть файл

@ -74,6 +74,18 @@ class nsIDocShellTreeItem;
typedef nsInterfaceHashtable<nsVoidPtrHashKey, nsIAccessNode>
nsAccessNodeHashtable;
// What we want is: NS_INTERFACE_MAP_ENTRY(self) for static IID accessors,
// but some of our classes have an ambiguous base class of nsISupports which
// prevents this from working (the default macro converts it to nsISupports,
// then addrefs it, then returns it). Therefore, we expand the macro here and
// change it so that it works. Yuck.
#define NS_INTERFACE_MAP_STATIC_AMBIGUOUS(_class) \
if (aIID.Equals(NS_GET_IID(_class))) { \
NS_ADDREF(this); \
*aInstancePtr = this; \
return NS_OK; \
} else
#define NS_OK_DEFUNCT_OBJECT \
NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x22)

Просмотреть файл

@ -181,6 +181,7 @@ ACCESSIBILITY_ATOM(minpos, "minpos") // XUL
ACCESSIBILITY_ATOM(multiline, "multiline") // XUL
ACCESSIBILITY_ATOM(name, "name")
ACCESSIBILITY_ATOM(onclick, "onclick")
ACCESSIBILITY_ATOM(popup, "popup")
ACCESSIBILITY_ATOM(readonly, "readonly")
ACCESSIBILITY_ATOM(scope, "scope") // HTML table
ACCESSIBILITY_ATOM(simple, "simple") // XLink

Просмотреть файл

@ -41,6 +41,7 @@
#include "nsAccessibilityService.h"
#include "nsCoreUtils.h"
#include "nsAccUtils.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsARIAGridAccessibleWrap.h"
#include "nsARIAMap.h"
#include "nsIContentViewer.h"
@ -106,12 +107,6 @@
#include "nsXFormsWidgetsAccessible.h"
#endif
#ifdef MOZ_ACCESSIBILITY_ATK
#include "nsAppRootAccessible.h"
#else
#include "nsApplicationAccessibleWrap.h"
#endif
nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nsnull;
PRBool nsAccessibilityService::gIsShutdown = PR_TRUE;
@ -1912,8 +1907,7 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
*aAccessible = new nsXULThumbAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULTree:
*aAccessible = new nsXULTreeAccessibleWrap(aNode, weakShell);
break;
return GetAccessibleForXULTree(aNode, weakShell, aAccessible);
case nsIAccessibleProvider::XULTreeColumns:
*aAccessible = new nsXULTreeColumnsAccessibleWrap(aNode, weakShell);
break;
@ -2147,3 +2141,34 @@ nsAccessibilityService::GetAccessibleForDeckChildren(nsIDOMNode *aNode, nsIAcces
return NS_OK;
}
#ifdef MOZ_XUL
nsresult
nsAccessibilityService::GetAccessibleForXULTree(nsIDOMNode *aNode,
nsIWeakReference *aWeakShell,
nsIAccessible **aAccessible)
{
nsCOMPtr<nsITreeBoxObject> treeBoxObj;
nsCoreUtils::GetTreeBoxObject(aNode, getter_AddRefs(treeBoxObj));
if (!treeBoxObj)
return NS_ERROR_FAILURE;
nsCOMPtr<nsITreeColumns> treeColumns;
treeBoxObj->GetColumns(getter_AddRefs(treeColumns));
if (!treeColumns)
return NS_OK;
PRInt32 count = 0;
treeColumns->GetCount(&count);
if (count == 1) // outline of list accessible
*aAccessible = new nsXULTreeAccessible(aNode, aWeakShell);
else // table or tree table accessible
*aAccessible = new nsXULTreeGridAccessibleWrap(aNode, aWeakShell);
if (!*aAccessible)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aAccessible);
return NS_OK;
}
#endif

Просмотреть файл

@ -136,6 +136,15 @@ private:
nsresult GetAccessibleForDeckChildren(nsIDOMNode *aNode,
nsIAccessible **aAccessible);
#ifdef MOZ_XUL
/**
* Create accessible for XUL tree element.
*/
nsresult GetAccessibleForXULTree(nsIDOMNode *aNode,
nsIWeakReference *aWeakShell,
nsIAccessible **aAccessible);
#endif
static nsAccessibilityService *gAccessibilityService;
/**

Просмотреть файл

@ -94,7 +94,6 @@
#include "nsNetUtil.h"
#ifdef NS_DEBUG
#include "nsIFrameDebug.h"
#include "nsIDOMCharacterData.h"
#endif
@ -1049,6 +1048,11 @@ nsAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
if (frame && (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW))
*aState |= nsIAccessibleStates::STATE_FLOATING;
// Check if a XUL element has the popup attribute (an attached popup menu).
if (content->IsNodeOfType(nsINode::eXUL))
if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::popup))
*aState |= nsIAccessibleStates::STATE_HASPOPUP;
// Add 'linked' state for simple xlink.
if (nsCoreUtils::IsXLink(content))
*aState |= nsIAccessibleStates::STATE_LINKED;
@ -2700,48 +2704,9 @@ NS_IMETHODIMP nsAccessible::GetNativeInterface(void **aOutAccessible)
return NS_ERROR_NOT_IMPLEMENTED;
}
void nsAccessible::DoCommandCallback(nsITimer *aTimer, void *aClosure)
nsresult
nsAccessible::DoCommand(nsIContent *aContent, PRUint32 aActionIndex)
{
NS_ASSERTION(gDoCommandTimer,
"How did we get here if there was no gDoCommandTimer?");
NS_RELEASE(gDoCommandTimer);
nsCOMPtr<nsIContent> content =
reinterpret_cast<nsIContent*>(aClosure);
nsIDocument *doc = content->GetDocument();
if (!doc)
return;
nsCOMPtr<nsIPresShell> presShell = doc->GetPrimaryShell();
// Scroll into view.
presShell->ScrollContentIntoView(content, NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE);
// Fire mouse down and mouse up events.
PRBool res = nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell,
content);
if (!res)
return;
nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, presShell, content);
}
/*
* Use Timer to execute "Click" command of XUL/HTML element (e.g. menuitem, button...).
*
* When "Click" is to open a "modal" dialog/window, it won't return untill the
* dialog/window is closed. If executing "Click" command directly in
* nsXXXAccessible::DoAction, it will block AT-Tools(e.g. GOK) that invoke
* "action" of mozilla accessibles direclty.
*/
nsresult nsAccessible::DoCommand(nsIContent *aContent)
{
nsCOMPtr<nsIContent> content = aContent;
if (!content) {
content = do_QueryInterface(mDOMNode);
}
if (gDoCommandTimer) {
// Already have timer going for another command
NS_WARNING("Doubling up on do command timers doesn't work. This wasn't expected.");
@ -2749,14 +2714,55 @@ nsresult nsAccessible::DoCommand(nsIContent *aContent)
}
nsCOMPtr<nsITimer> timer = do_CreateInstance("@mozilla.org/timer;1");
if (!timer) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ENSURE_TRUE(timer, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIContent> content = aContent;
if (!content)
content = do_QueryInterface(mDOMNode);
// Command closure object memory will be free in DoCommandCallback().
nsCommandClosure *closure =
new nsCommandClosure(this, content, aActionIndex);
NS_ENSURE_TRUE(closure, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(gDoCommandTimer = timer);
return gDoCommandTimer->InitWithFuncCallback(DoCommandCallback,
(void*)content, 0,
nsITimer::TYPE_ONE_SHOT);
static_cast<void*>(closure),
0, nsITimer::TYPE_ONE_SHOT);
}
void
nsAccessible::DoCommandCallback(nsITimer *aTimer, void *aClosure)
{
NS_ASSERTION(gDoCommandTimer,
"How did we get here if there was no gDoCommandTimer?");
NS_RELEASE(gDoCommandTimer);
nsCommandClosure *closure = static_cast<nsCommandClosure*>(aClosure);
closure->accessible->DispatchClickEvent(closure->content,
closure->actionIndex);
delete closure;
}
void
nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
{
if (IsDefunct())
return;
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
// Scroll into view.
presShell->ScrollContentIntoView(aContent, NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE);
// Fire mouse down and mouse up events.
PRBool res = nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell,
aContent);
if (!res)
return;
nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, presShell, aContent);
}
already_AddRefed<nsIAccessible>
@ -3221,6 +3227,11 @@ nsAccessible::GetActionRule(PRUint32 aStates)
if (nsCoreUtils::IsXLink(content))
return eJumpAction;
// Return "click" action on elements that have an attached popup menu.
if (content->IsNodeOfType(nsINode::eXUL))
if (content->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::popup))
return eClickAction;
// Has registered 'click' event handler.
PRBool isOnclick = nsCoreUtils::HasListener(content,
NS_LITERAL_STRING("click"));

Просмотреть файл

@ -338,9 +338,52 @@ protected:
// Hyperlink helpers
virtual nsresult GetLinkOffset(PRInt32* aStartOffset, PRInt32* aEndOffset);
// For accessibles that have actions
//////////////////////////////////////////////////////////////////////////////
// Action helpers
/**
* Used to describe click action target. See DoCommand() method.
*/
struct nsCommandClosure
{
nsCommandClosure(nsAccessible *aAccessible, nsIContent *aContent,
PRUint32 aActionIndex) :
accessible(aAccessible), content(aContent), actionIndex(aActionIndex) {}
nsRefPtr<nsAccessible> accessible;
nsCOMPtr<nsIContent> content;
PRUint32 actionIndex;
};
/**
* Prepares click action that will be invoked in timeout.
*
* @note DoCommand() prepares an action in timeout because when action
* command opens a modal dialog/window, it won't return until the
* dialog/window is closed. If executing action command directly in
* nsIAccessible::DoAction() method, it will block AT tools (e.g. GOK) that
* invoke action of mozilla accessibles direclty (see bug 277888 for details).
*
* @param aContent [in, optional] element to click
* @param aActionIndex [in, optional] index of accessible action
*/
nsresult DoCommand(nsIContent *aContent = nsnull, PRUint32 aActionIndex = 0);
/**
* Dispatch click event to target by calling DispatchClickEvent() method.
*
* @param aTimer [in] timer object
* @param aClosure [in] nsCommandClosure object describing a target.
*/
static void DoCommandCallback(nsITimer *aTimer, void *aClosure);
nsresult DoCommand(nsIContent *aContent = nsnull);
/**
* Dispatch click event.
*/
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
//////////////////////////////////////////////////////////////////////////////
// Helpers
// Check the visibility across both parent content and chrome
PRBool CheckVisibilityInParentChain(nsIDocument* aDocument, nsIView* aView);

Просмотреть файл

@ -38,6 +38,7 @@
#include "nsAccessibleEventData.h"
#include "nsAccessibilityAtoms.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsCoreUtils.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessNode.h"
@ -111,7 +112,17 @@ void nsAccEvent::CaptureIsFromUserInput(PRBool aIsAsynch)
nsCOMPtr<nsIDOMNode> eventNode;
GetDOMNode(getter_AddRefs(eventNode));
if (!eventNode) {
NS_NOTREACHED("There should always be a DOM node for an event");
#ifdef DEBUG
// XXX: remove this hack during reorganization of 506907. Meanwhile we
// want to get rid an assertion for application accessible events which
// don't have DOM node (see bug 506206).
nsRefPtr<nsApplicationAccessibleWrap> applicationAcc =
nsAccessNode::GetApplicationAccessible();
if (mAccessible != static_cast<nsIAccessible*>(applicationAcc.get()))
NS_ASSERTION(eventNode, "There should always be a DOM node for an event");
#endif
return;
}
@ -266,8 +277,8 @@ nsAccEvent::GetAccessibleByNode()
if (!accService)
return nsnull;
nsIAccessible *accessible = nsnull;
accService->GetAccessibleFor(mDOMNode, &accessible);
nsCOMPtr<nsIAccessible> accessible;
accService->GetAccessibleFor(mDOMNode, getter_AddRefs(accessible));
#ifdef MOZ_XUL
// hack for xul tree table. We need a better way for firing delayed event
@ -283,18 +294,16 @@ nsAccEvent::GetAccessibleByNode()
PRInt32 treeIndex = -1;
multiSelect->GetCurrentIndex(&treeIndex);
if (treeIndex >= 0) {
nsRefPtr<nsXULTreeAccessible> treeCache =
nsRefPtr<nsXULTreeAccessible> treeAcc =
nsAccUtils::QueryAccessibleTree(accessible);
if (treeCache) {
treeCache->GetCachedTreeitemAccessible(treeIndex, nsnull,
&accessible);
}
if (treeAcc)
treeAcc->GetTreeItemAccessible(treeIndex, getter_AddRefs(accessible));
}
}
}
#endif
return accessible;
return accessible.forget();
}
/* static */

Просмотреть файл

@ -48,7 +48,7 @@
/**
* nsApplicationAccessible is for the whole application of Mozilla.
* Only one instance of nsAppRootAccessible exists for one Mozilla instance.
* Only one instance of nsApplicationAccessible exists for one Mozilla instance.
* And this one should be created when Mozilla Startup (if accessibility
* feature has been enabled) and destroyed when Mozilla Shutdown.
*

Просмотреть файл

@ -84,6 +84,69 @@ nsCoreUtils::HasListener(nsIContent *aContent, const nsAString& aEventType)
return listenerManager && listenerManager->HasListenersFor(aEventType);
}
void
nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
PRInt32 aRowIndex, nsITreeColumn *aColumn,
const nsCString& aPseudoElt)
{
nsCOMPtr<nsIDOMElement> tcElm;
aTreeBoxObj->GetTreeBody(getter_AddRefs(tcElm));
if (!tcElm)
return;
nsCOMPtr<nsIContent> tcContent(do_QueryInterface(tcElm));
nsIDocument *document = tcContent->GetCurrentDoc();
if (!document)
return;
nsIPresShell *presShell = nsnull;
presShell = document->GetPrimaryShell();
if (!presShell)
return;
// Ensure row is visible.
aTreeBoxObj->EnsureRowIsVisible(aRowIndex);
// Calculate x and y coordinates.
PRInt32 x = 0, y = 0, width = 0, height = 0;
nsresult rv = aTreeBoxObj->GetCoordsForCellItem(aRowIndex, aColumn,
aPseudoElt,
&x, &y, &width, &height);
if (NS_FAILED(rv))
return;
nsCOMPtr<nsIDOMXULElement> tcXULElm(do_QueryInterface(tcElm));
nsCOMPtr<nsIBoxObject> tcBoxObj;
tcXULElm->GetBoxObject(getter_AddRefs(tcBoxObj));
PRInt32 tcX = 0;
tcBoxObj->GetX(&tcX);
PRInt32 tcY = 0;
tcBoxObj->GetY(&tcY);
// Dispatch mouse events.
nsIFrame* tcFrame = presShell->GetPrimaryFrameFor(tcContent);
nsIFrame* rootFrame = presShell->GetRootFrame();
nsPoint offset;
nsIWidget *rootWidget =
rootFrame->GetViewExternal()->GetNearestWidget(&offset);
nsPresContext* presContext = presShell->GetPresContext();
PRInt32 cnvdX = presContext->CSSPixelsToDevPixels(tcX + x + 1) +
presContext->AppUnitsToDevPixels(offset.x);
PRInt32 cnvdY = presContext->CSSPixelsToDevPixels(tcY + y + 1) +
presContext->AppUnitsToDevPixels(offset.y);
DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, cnvdX, cnvdY,
tcContent, tcFrame, presShell, rootWidget);
DispatchMouseEvent(NS_MOUSE_BUTTON_UP, cnvdX, cnvdY,
tcContent, tcFrame, presShell, rootWidget);
}
PRBool
nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType,
nsIPresShell *aPresShell,
@ -109,21 +172,28 @@ nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType,
PRInt32 x = presContext->AppUnitsToDevPixels(point.x + size.width / 2);
PRInt32 y = presContext->AppUnitsToDevPixels(point.y + size.height / 2);
// Fire mouse event.
nsMouseEvent event(PR_TRUE, aEventType, rootWidget,
DispatchMouseEvent(aEventType, x, y, aContent, frame, aPresShell, rootWidget);
return PR_TRUE;
}
void
nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType, PRInt32 aX, PRInt32 aY,
nsIContent *aContent, nsIFrame *aFrame,
nsIPresShell *aPresShell, nsIWidget *aRootWidget)
{
nsMouseEvent event(PR_TRUE, aEventType, aRootWidget,
nsMouseEvent::eReal, nsMouseEvent::eNormal);
event.refPoint = nsIntPoint(x, y);
event.refPoint = nsIntPoint(aX, aY);
event.clickCount = 1;
event.button = nsMouseEvent::eLeftButton;
event.time = PR_IntervalNow();
nsEventStatus status = nsEventStatus_eIgnore;
aPresShell->HandleEventWithTarget(&event, frame, aContent, &status);
return PR_TRUE;
nsEventStatus status = nsEventStatus_eIgnore;
aPresShell->HandleEventWithTarget(&event, aFrame, aContent, &status);
}
PRUint32
@ -891,3 +961,149 @@ nsCoreUtils::GetTreeBodyBoxObject(nsITreeBoxObject *aTreeBoxObj)
tcXULElm->GetBoxObject(&boxObj);
return boxObj;
}
void
nsCoreUtils::GetTreeBoxObject(nsIDOMNode *aDOMNode,
nsITreeBoxObject **aBoxObject)
{
nsAutoString name;
nsCOMPtr<nsIDOMNode> parentNode, currentNode;
// Find DOMNode's parents recursively until reach the <tree> tag
currentNode = aDOMNode;
while (currentNode) {
currentNode->GetLocalName(name);
if (name.EqualsLiteral("tree")) {
// We will get the nsITreeBoxObject from the tree node
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(currentNode));
if (xulElement) {
nsCOMPtr<nsIBoxObject> box;
xulElement->GetBoxObject(getter_AddRefs(box));
nsCOMPtr<nsITreeBoxObject> treeBox(do_QueryInterface(box));
if (treeBox) {
*aBoxObject = treeBox;
NS_ADDREF(*aBoxObject);
return;
}
}
}
currentNode->GetParentNode(getter_AddRefs(parentNode));
currentNode = parentNode;
}
*aBoxObject = nsnull;
}
already_AddRefed<nsITreeColumn>
nsCoreUtils::GetFirstSensibleColumn(nsITreeBoxObject *aTree)
{
nsCOMPtr<nsITreeColumns> cols;
aTree->GetColumns(getter_AddRefs(cols));
if (!cols)
return nsnull;
nsCOMPtr<nsITreeColumn> column;
cols->GetFirstColumn(getter_AddRefs(column));
if (column && IsColumnHidden(column))
return GetNextSensibleColumn(column);
return column.forget();
}
already_AddRefed<nsITreeColumn>
nsCoreUtils::GetLastSensibleColumn(nsITreeBoxObject *aTree)
{
nsCOMPtr<nsITreeColumns> cols;
aTree->GetColumns(getter_AddRefs(cols));
if (!cols)
return nsnull;
nsCOMPtr<nsITreeColumn> column;
cols->GetLastColumn(getter_AddRefs(column));
if (column && IsColumnHidden(column))
return GetPreviousSensibleColumn(column);
return column.forget();
}
PRUint32
nsCoreUtils::GetSensibleColumnsCount(nsITreeBoxObject *aTree)
{
PRUint32 count = 0;
nsCOMPtr<nsITreeColumns> cols;
aTree->GetColumns(getter_AddRefs(cols));
if (!cols)
return count;
nsCOMPtr<nsITreeColumn> column;
cols->GetFirstColumn(getter_AddRefs(column));
while (column) {
if (!IsColumnHidden(column))
count++;
nsCOMPtr<nsITreeColumn> nextColumn;
column->GetNext(getter_AddRefs(nextColumn));
column.swap(nextColumn);
}
return count;
}
already_AddRefed<nsITreeColumn>
nsCoreUtils::GetSensibleColumnAt(nsITreeBoxObject *aTree, PRUint32 aIndex)
{
PRUint32 idx = aIndex;
nsCOMPtr<nsITreeColumn> column = GetFirstSensibleColumn(aTree);
while (column) {
if (idx == 0)
return column.forget();
idx--;
column = GetNextSensibleColumn(column);
}
return nsnull;
}
already_AddRefed<nsITreeColumn>
nsCoreUtils::GetNextSensibleColumn(nsITreeColumn *aColumn)
{
nsCOMPtr<nsITreeColumn> nextColumn;
aColumn->GetNext(getter_AddRefs(nextColumn));
while (nextColumn && IsColumnHidden(nextColumn)) {
nsCOMPtr<nsITreeColumn> tempColumn;
nextColumn->GetNext(getter_AddRefs(tempColumn));
nextColumn.swap(tempColumn);
}
return nextColumn.forget();
}
already_AddRefed<nsITreeColumn>
nsCoreUtils::GetPreviousSensibleColumn(nsITreeColumn *aColumn)
{
nsCOMPtr<nsITreeColumn> prevColumn;
aColumn->GetPrevious(getter_AddRefs(prevColumn));
while (prevColumn && IsColumnHidden(prevColumn)) {
nsCOMPtr<nsITreeColumn> tempColumn;
prevColumn->GetPrevious(getter_AddRefs(tempColumn));
prevColumn.swap(tempColumn);
}
return prevColumn.forget();
}
PRBool
nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn)
{
nsCOMPtr<nsIDOMElement> element;
aColumn->GetElement(getter_AddRefs(element));
nsCOMPtr<nsIContent> content = do_QueryInterface(element);
return content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::hidden,
nsAccessibilityAtoms::_true, eCaseMatters);
}

Просмотреть файл

@ -45,6 +45,7 @@
#include "nsIContent.h"
#include "nsIBoxObject.h"
#include "nsITreeBoxObject.h"
#include "nsITreeColumns.h"
#include "nsIFrame.h"
#include "nsIDocShellTreeItem.h"
@ -62,16 +63,45 @@ public:
static PRBool HasListener(nsIContent *aContent, const nsAString& aEventType);
/**
* Send mouse events to the given element.
* Dispatch click event to XUL tree cell.
*
* @param aEventType an event type (see nsGUIEvent.h for constants)
* @param aPresShell the presshell for the given element
* @param aContent the element element
* @param aTreeBoxObj [in] tree box object
* @param aRowIndex [in] row index
* @param aColumn [in] column object
* @param aPseudoElm [in] pseudo elemenet inside the cell, see
* nsITreeBoxObject for available values
*/
static void DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
PRInt32 aRowIndex, nsITreeColumn *aColumn,
const nsCString& aPseudoElt = EmptyCString());
/**
* Send mouse event to the given element.
*
* @param aEventType [in] an event type (see nsGUIEvent.h for constants)
* @param aPresShell [in] the presshell for the given element
* @param aContent [in] the element
*/
static PRBool DispatchMouseEvent(PRUint32 aEventType,
nsIPresShell *aPresShell,
nsIContent *aContent);
/**
* Send mouse event to the given element.
*
* @param aEventType [in] an event type (see nsGUIEvent.h for constants)
* @param aX [in] x coordinate in dev pixels
* @param aY [in] y coordinate in dev pixels
* @param aContent [in] the element
* @param aFrame [in] frame of the element
* @param aPresShell [in] the presshell for the element
* @param aRootWidget [in] the root widget of the element
*/
static void DispatchMouseEvent(PRUint32 aEventType, PRInt32 aX, PRInt32 aY,
nsIContent *aContent, nsIFrame *aFrame,
nsIPresShell *aPresShell,
nsIWidget *aRootWidget);
/**
* Return an accesskey registered on the given element by
* nsIEventStateManager or 0 if there is no registered accesskey.
@ -362,6 +392,52 @@ public:
static already_AddRefed<nsIBoxObject>
GetTreeBodyBoxObject(nsITreeBoxObject *aTreeBoxObj);
/**
* Return tree box object from any levels DOMNode under the XUL tree.
*/
static void
GetTreeBoxObject(nsIDOMNode* aDOMNode, nsITreeBoxObject** aBoxObject);
/**
* Return first sensible column for the given tree box object.
*/
static already_AddRefed<nsITreeColumn>
GetFirstSensibleColumn(nsITreeBoxObject *aTree);
/**
* Return last sensible column for the given tree box object.
*/
static already_AddRefed<nsITreeColumn>
GetLastSensibleColumn(nsITreeBoxObject *aTree);
/**
* Return sensible columns count for the given tree box object.
*/
static PRUint32 GetSensibleColumnsCount(nsITreeBoxObject *aTree);
/**
* Return sensible column at the given index for the given tree box object.
*/
static already_AddRefed<nsITreeColumn>
GetSensibleColumnAt(nsITreeBoxObject *aTree, PRUint32 aIndex);
/**
* Return next sensible column for the given column.
*/
static already_AddRefed<nsITreeColumn>
GetNextSensibleColumn(nsITreeColumn *aColumn);
/**
* Return previous sensible column for the given column.
*/
static already_AddRefed<nsITreeColumn>
GetPreviousSensibleColumn(nsITreeColumn *aColumn);
/**
* Return true if the given column is hidden (i.e. not sensible).
*/
static PRBool IsColumnHidden(nsITreeColumn *aColumn);
/**
* Return true if the given node is table header element.
*/

Просмотреть файл

@ -88,6 +88,9 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell)
mScrollPositionChangedTicks(0), mIsContentLoaded(PR_FALSE),
mIsLoadCompleteFired(PR_FALSE), mInFlushPendingEvents(PR_FALSE)
{
// XXX aaronl should we use an algorithm for the initial cache size?
mAccessNodeCache.Init(kDefaultCacheSize);
// For GTK+ native window, we do nothing here.
if (!mDOMNode)
return;
@ -113,9 +116,6 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell)
}
}
// XXX aaronl should we use an algorithm for the initial cache size?
mAccessNodeCache.Init(kDefaultCacheSize);
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(docShellTreeItem);
@ -150,18 +150,6 @@ ElementTraverser(const void *aKey, nsIAccessNode *aAccessNode,
return PL_DHASH_NEXT;
}
// What we want is: NS_INTERFACE_MAP_ENTRY(self) for static IID accessors,
// but some of our classes have an ambiguous base class of nsISupports which
// prevents this from working (the default macro converts it to nsISupports,
// then addrefs it, then returns it). Therefore, we expand the macro here and
// change it so that it works. Yuck.
#define NS_INTERFACE_MAP_STATIC_AMBIGUOUS(_class) \
if (aIID.Equals(NS_GET_IID(_class))) { \
NS_ADDREF(this); \
*aInstancePtr = this; \
return NS_OK; \
} else
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
@ -581,6 +569,17 @@ nsDocAccessible::CacheAccessNode(void *aUniqueID, nsIAccessNode *aAccessNode)
PutCacheEntry(mAccessNodeCache, aUniqueID, aAccessNode);
}
void
nsDocAccessible::RemoveAccessNodeFromCache(nsIAccessNode *aAccessNode)
{
if (!aAccessNode)
return;
void *uniqueID = nsnull;
aAccessNode->GetUniqueID(&uniqueID);
mAccessNodeCache.Remove(uniqueID);
}
NS_IMETHODIMP nsDocAccessible::GetParent(nsIAccessible **aParent)
{
// Hook up our new accessible with our parent
@ -1351,6 +1350,15 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
// COM says we cannot change what interfaces are supported on-the-fly,
// so invalidate this object. A new one will be created on demand.
InvalidateCacheSubtree(aContent, nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE);
return;
}
// For aria drag and drop changes we fire a generic attribute change event;
// at least until native API comes up with a more meaningful event.
if (aAttribute == nsAccessibilityAtoms::aria_grabbed ||
aAttribute == nsAccessibilityAtoms::aria_dropeffect) {
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED,
targetNode);
}
}
@ -1797,12 +1805,11 @@ nsDocAccessible::FlushPendingEvents()
}
}
mEventsToFire.Clear(); // Clear out array
mInFlushPendingEvents = PR_FALSE;
NS_RELEASE_THIS(); // Release kung fu death grip
// After a flood of events, reset so that user input flag is off
nsAccEvent::ResetLastInputState();
mInFlushPendingEvents = PR_FALSE;
}
void nsDocAccessible::FlushEventsCallback(nsITimer *aTimer, void *aClosure)

Просмотреть файл

@ -56,11 +56,11 @@ class nsIScrollableView;
const PRUint32 kDefaultCacheSize = 256;
#define NS_DOCACCESSIBLE_IMPL_CID \
{ /* 0ed1be1d-52a7-4bfd-b4f5-0de7caed4617 */ \
0x0ed1be1d, \
0x52a7, \
0x4bfd, \
{ 0xb4, 0xf5, 0x0d, 0xe7, 0xca, 0xed, 0x46, 0x17 } \
{ /* 9735bc5f-a4b6-4668-ab73-6f8434c8e750 */ \
0x9735bc5f, \
0xa4b6, \
0x4668, \
{ 0xab, 0x73, 0x6f, 0x84, 0x34, 0xc8, 0xe7, 0x50 } \
}
class nsDocAccessible : public nsHyperTextAccessibleWrap,
@ -160,6 +160,11 @@ public:
*/
void CacheAccessNode(void *aUniqueID, nsIAccessNode *aAccessNode);
/**
* Remove the given access node from document cache.
*/
void RemoveAccessNodeFromCache(nsIAccessNode *aAccessNode);
/**
* Fires pending events.
*/

Просмотреть файл

@ -42,6 +42,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocumentXBL.h"
#include "nsAutoPtr.h"
#include "nsArrayUtils.h"
@ -99,7 +100,8 @@ nsRelUtils::AddTargetFromContent(PRUint32 aRelationType,
nsresult
nsRelUtils::AddTargetFromIDRefAttr(PRUint32 aRelationType,
nsIAccessibleRelation **aRelation,
nsIContent *aContent, nsIAtom *aAttr)
nsIContent *aContent, nsIAtom *aAttr,
PRBool aMayBeAnon)
{
nsAutoString id;
if (!aContent->GetAttr(kNameSpaceID_None, aAttr, id))
@ -112,7 +114,18 @@ nsRelUtils::AddTargetFromIDRefAttr(PRUint32 aRelationType,
return NS_OK_NO_RELATION_TARGET;
nsCOMPtr<nsIDOMElement> refElm;
document->GetElementById(id, getter_AddRefs(refElm));
if (aMayBeAnon && aContent->GetBindingParent()) {
nsCOMPtr<nsIDOMDocumentXBL> documentXBL(do_QueryInterface(document));
nsCOMPtr<nsIDOMElement> bindingParent =
do_QueryInterface(aContent->GetBindingParent());
documentXBL->GetAnonymousElementByAttribute(bindingParent,
NS_LITERAL_STRING("id"),
id,
getter_AddRefs(refElm));
}
else {
document->GetElementById(id, getter_AddRefs(refElm));
}
nsCOMPtr<nsIContent> refContent(do_QueryInterface(refElm));
return AddTargetFromContent(aRelationType, aRelation, refContent);

Просмотреть файл

@ -97,10 +97,14 @@ public:
* @param aRelation [in, out] relation object
* @param aContent [in] node having the given IDRef attribute
* @param aAttr [in] IDRef attribute
* @param aMayBeAnon [in] true if the target may be anonymous; if so,
* we need to look for it under the binding
* parent of aContent.
*/
static nsresult AddTargetFromIDRefAttr(PRUint32 aRelationType,
nsIAccessibleRelation **aRelation,
nsIContent *aContent, nsIAtom *aAttr);
nsIContent *aContent, nsIAtom *aAttr,
PRBool aMayBeAnon = PR_FALSE);
/**
* Create the relation if the given relation is null and add the targets to it

Просмотреть файл

@ -38,8 +38,9 @@
// NOTE: alphabetically ordered
#include "nsAccessibilityService.h"
#include "nsAccessibleEventData.h"
#include "nsApplicationAccessibleWrap.h"
#include "nsHTMLSelectAccessible.h"
#include "nsIBaseWindow.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
@ -53,6 +54,7 @@
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMDataContainerEvent.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
@ -82,12 +84,6 @@
#include "nsIXULWindow.h"
#endif
#ifdef MOZ_ACCESSIBILITY_ATK
#include "nsAppRootAccessible.h"
#else
#include "nsApplicationAccessibleWrap.h"
#endif
// Expanded version of NS_IMPL_ISUPPORTS_INHERITED2
// so we can QI directly to concrete nsRootAccessible
NS_IMPL_QUERY_HEAD(nsRootAccessible)
@ -115,7 +111,6 @@ nsRootAccessible::~nsRootAccessible()
{
}
// helpers
/* readonly attribute AString name; */
NS_IMETHODIMP
nsRootAccessible::GetName(nsAString& aName)
@ -133,22 +128,8 @@ nsRootAccessible::GetName(nsAString& aName)
}
}
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(treeOwner));
if (baseWindow) {
nsXPIDLString title;
baseWindow->GetTitle(getter_Copies(title));
aName.Assign(title);
return NS_OK;
}
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMNSDocument> document(do_QueryInterface(mDocument));
return document->GetTitle(aName);
}
/* readonly attribute nsIAccessible accParent; */
@ -736,11 +717,11 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
PRInt32 treeIndex = -1;
multiSelect->GetCurrentIndex(&treeIndex);
if (treeIndex >= 0) {
nsRefPtr<nsXULTreeAccessible> treeCache =
nsRefPtr<nsXULTreeAccessible> treeAcc =
nsAccUtils::QueryAccessibleTree(accessible);
if (treeCache) {
treeCache->GetCachedTreeitemAccessible(treeIndex, nsnull,
getter_AddRefs(treeItemAccessible));
if (treeAcc) {
treeAcc->GetTreeItemAccessible(treeIndex,
getter_AddRefs(treeItemAccessible));
if (treeItemAccessible)
accessible = treeItemAccessible;
}

Просмотреть файл

@ -47,26 +47,6 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_html_s
LIBXUL_LIBRARY = 1
REQUIRES = composer \
content \
docshell \
dom \
editor \
gfx \
imglib2 \
intl \
js \
layout \
locale \
necko \
string \
thebes \
view \
webshell \
widget \
xpcom \
xpconnect \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
REQUIRES += editor

Просмотреть файл

@ -222,7 +222,7 @@ protected:
PRBool HasDescendant(const nsAString& aTagName, PRBool aAllowEmpty = PR_TRUE);
#ifdef SHOW_LAYOUT_HEURISTIC
nsAutoString mLayoutHeuristic;
nsString mLayoutHeuristic;
#endif
};

Просмотреть файл

@ -45,22 +45,6 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_toolkit_s
LIBXUL_LIBRARY = 1
REQUIRES = content \
layout \
docshell \
dom \
editor \
gfx \
thebes \
intl \
locale \
string \
uriloader \
view \
widget \
xpcom \
necko \
$(NULL)
CMMSRCS = nsAccessNodeWrap.mm \

Просмотреть файл

@ -238,7 +238,7 @@ nsAccessibleWrap::GetUnignoredChildCount(PRBool aDeepCount)
nsCOMPtr<nsIAccessible> curAcc;
while (NextChild(curAcc)) {
nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curAcc.get());
nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>(curAcc.get());
// if the current child is not ignored, count it.
if (!childWrap->IsIgnored())
@ -280,7 +280,7 @@ nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aC
return;
while (NextChild(curAcc)) {
nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curAcc.get());
nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>(curAcc.get());
if (childWrap->IsIgnored()) {
// element is ignored, so try adding its children as substitutes, if it has any.
if (!nsAccUtils::MustPrune(childWrap)) {
@ -301,7 +301,7 @@ already_AddRefed<nsIAccessible>
nsAccessibleWrap::GetUnignoredParent()
{
nsCOMPtr<nsIAccessible> parent(GetParent());
nsAccessibleWrap *parentWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)parent.get());
nsAccessibleWrap *parentWrap = static_cast<nsAccessibleWrap*>(parent.get());
if (!parentWrap)
return nsnull;

Просмотреть файл

@ -38,9 +38,8 @@
#ifndef __nsXULTreeAccessibleWrap_h__
#define __nsXULTreeAccessibleWrap_h__
#include "nsXULTreeAccessible.h"
typedef class nsXULTreeAccessible nsXULTreeAccessibleWrap;
typedef class nsXULTreeitemAccessible nsXULTreeitemAccessibleWrap;
#include "nsXULTreeGridAccessible.h"
typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap;
typedef class nsXULTreeColumnsAccessible nsXULTreeColumnsAccessibleWrap;
#endif

Просмотреть файл

@ -45,27 +45,6 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_toolkit_s
LIBXUL_LIBRARY = 1
REQUIRES = content \
docshell \
dom \
editor \
gfx \
thebes \
htmlparser \
intl \
layout \
locale \
necko \
plugin \
pref \
string \
uriloader \
view \
webshell \
widget \
xpcom \
xuldoc \
$(NULL)
CPPSRCS = \
nsAccessNodeWrap.cpp \

Просмотреть файл

@ -1294,6 +1294,15 @@ __try {
"MSAA role map skewed");
*aRole = gWindowsRoleMap[xpRole].ia2Role;
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
// the IA2 role a ROLE_OUTLINEITEM.
if (xpRole == nsIAccessibleRole::ROLE_ROW) {
nsCOMPtr<nsIAccessible> parent = GetParent();
if (nsAccUtils::Role(parent) == nsIAccessibleRole::ROLE_TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
}
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

Просмотреть файл

@ -20,7 +20,8 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aaron Leventhal
* Aaron Leventhal <aaronleventhal@moonset.net> (original author)
* Alexander Surkov <surkov.alexander@gmail.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
@ -38,124 +39,19 @@
#include "nsXULTreeAccessibleWrap.h"
#include "nsTextFormatter.h"
#include "nsIFrame.h"
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
// --------------------------------------------------------
// nsXULTreeAccessibleWrap
// --------------------------------------------------------
nsXULTreeAccessibleWrap::nsXULTreeAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsXULTreeAccessible(aDOMNode, aShell)
nsXULTreeGridAccessibleWrap::
nsXULTreeGridAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
nsXULTreeGridAccessible(aDOMNode, aShell)
{
}
nsresult
nsXULTreeAccessibleWrap::GetRoleInternal(PRUint32 *aRole)
{
NS_ENSURE_STATE(mTree);
nsCOMPtr<nsITreeColumns> cols;
mTree->GetColumns(getter_AddRefs(cols));
nsCOMPtr<nsITreeColumn> primaryCol;
if (cols) {
cols->GetPrimaryColumn(getter_AddRefs(primaryCol));
}
// No primary column means we're in a list
// In fact, history and mail turn off the primary flag when switching to a flat view
*aRole = primaryCol ? nsIAccessibleRole::ROLE_OUTLINE :
nsIAccessibleRole::ROLE_LIST;
return NS_OK;
}
// --------------------------------------------------------
// nsXULTreeitemAccessibleWrap Accessible
// --------------------------------------------------------
nsXULTreeitemAccessibleWrap::nsXULTreeitemAccessibleWrap(nsIAccessible *aParent,
nsIDOMNode *aDOMNode,
nsIWeakReference *aShell,
PRInt32 aRow,
nsITreeColumn* aColumn) :
nsXULTreeitemAccessible(aParent, aDOMNode, aShell, aRow, aColumn)
{
}
nsresult
nsXULTreeitemAccessibleWrap::GetRoleInternal(PRUint32 *aRole)
{
// No primary column means we're in a list
// In fact, history and mail turn off the primary flag when switching to a flat view
NS_ENSURE_STATE(mColumn);
PRBool isPrimary = PR_FALSE;
mColumn->GetPrimary(&isPrimary);
*aRole = isPrimary ? nsIAccessibleRole::ROLE_OUTLINEITEM :
nsIAccessibleRole::ROLE_LISTITEM;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeitemAccessibleWrap::GetBounds(PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight)
{
NS_ENSURE_ARG_POINTER(aX);
*aX = 0;
NS_ENSURE_ARG_POINTER(aY);
*aY = 0;
NS_ENSURE_ARG_POINTER(aWidth);
*aWidth = 0;
NS_ENSURE_ARG_POINTER(aHeight);
*aHeight = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
// Get x coordinate and width from treechildren element, get y coordinate and
// height from tree cell.
nsCOMPtr<nsIBoxObject> boxObj = nsCoreUtils::GetTreeBodyBoxObject(mTree);
NS_ENSURE_STATE(boxObj);
PRInt32 cellStartX, cellWidth;
nsresult rv = mTree->GetCoordsForCellItem(mRow, mColumn, EmptyCString(),
&cellStartX, aY,
&cellWidth, aHeight);
NS_ENSURE_SUCCESS(rv, rv);
boxObj->GetWidth(aWidth);
PRInt32 tcX = 0, tcY = 0;
boxObj->GetScreenX(&tcX);
boxObj->GetScreenY(&tcY);
*aX = tcX;
*aY += tcY;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeitemAccessibleWrap::GetName(nsAString& aName)
{
NS_ENSURE_STATE(mTree);
nsCOMPtr<nsITreeColumns> cols;
mTree->GetColumns(getter_AddRefs(cols));
if (!cols) {
return NS_OK;
}
nsCOMPtr<nsITreeColumn> column;
cols->GetFirstColumn(getter_AddRefs(column));
while (column) {
nsAutoString colText;
mTreeView->GetCellText(mRow, column, colText);
aName += colText + NS_LITERAL_STRING(" ");
nsCOMPtr<nsITreeColumn> nextColumn;
column->GetNext(getter_AddRefs(nextColumn));
column = nextColumn;
}
return NS_OK;
}
NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeGridAccessibleWrap,
nsXULTreeGridAccessible)
IMPL_IUNKNOWN_INHERITED1(nsXULTreeGridAccessibleWrap,
nsAccessibleWrap,
CAccessibleTable);

Просмотреть файл

@ -20,7 +20,8 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pete Zha (pete.zha@sun.com)
* Pete Zha <pete.zha@sun.com> (original author)
* Alexander Surkov <surkov.alexander@gmail.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
@ -39,33 +40,28 @@
#ifndef __nsXULTreeAccessibleWrap_h__
#define __nsXULTreeAccessibleWrap_h__
#include "nsXULTreeAccessible.h"
#include "nsXULTreeGridAccessible.h"
#include "CAccessibleTable.h"
typedef class nsXULTreeColumnsAccessible nsXULTreeColumnsAccessibleWrap;
class nsXULTreeAccessibleWrap : public nsXULTreeAccessible
/**
* IA2 wrapper of nsXULTreeGridAccessible class, implements IAccessibleTable
* interface.
*/
class nsXULTreeGridAccessibleWrap : public nsXULTreeGridAccessible,
public CAccessibleTable
{
public:
nsXULTreeAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
virtual ~nsXULTreeAccessibleWrap() {}
nsXULTreeGridAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
virtual ~nsXULTreeGridAccessibleWrap() {}
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
};
// IUnknown
DECL_IUNKNOWN_INHERITED
class nsXULTreeitemAccessibleWrap : public nsXULTreeitemAccessible
{
public:
nsXULTreeitemAccessibleWrap(nsIAccessible *aParent, nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
PRInt32 aRow, nsITreeColumn* aColumn);
virtual ~nsXULTreeitemAccessibleWrap() {}
// nsIAccessible
NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
NS_IMETHOD GetName(nsAString &aName);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
};
#endif

Просмотреть файл

@ -45,27 +45,6 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_toolkit_s
LIBXUL_LIBRARY = 1
REQUIRES = content \
docshell \
dom \
editor \
gfx \
thebes \
htmlparser \
intl \
layout \
locale \
necko \
plugin \
pref \
string \
uriloader \
view \
webshell \
widget \
xpcom \
xuldoc \
$(NULL)
CPPSRCS = \
nsAccessNodeWrap.cpp \

Просмотреть файл

@ -38,9 +38,8 @@
#ifndef __nsXULTreeAccessibleWrap_h__
#define __nsXULTreeAccessibleWrap_h__
#include "nsXULTreeAccessible.h"
typedef class nsXULTreeAccessible nsXULTreeAccessibleWrap;
typedef class nsXULTreeitemAccessible nsXULTreeitemAccessibleWrap;
#include "nsXULTreeGridAccessible.h"
typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap;
typedef class nsXULTreeColumnsAccessible nsXULTreeColumnsAccessibleWrap;
#endif

Просмотреть файл

@ -47,21 +47,6 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_xforms_s
LIBXUL_LIBRARY = 1
REQUIRES = content \
docshell \
dom \
editor \
gfx \
thebes \
intl \
layout \
locale \
necko \
pref \
string \
widget \
xpcom \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
REQUIRES += editor

Просмотреть файл

@ -47,21 +47,6 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_xul_s
LIBXUL_LIBRARY = 1
REQUIRES = content \
docshell \
dom \
editor \
gfx \
thebes \
intl \
layout \
locale \
necko \
pref \
string \
widget \
xpcom \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
REQUIRES += editor
@ -77,6 +62,7 @@ CPPSRCS = \
nsXULTabAccessible.cpp \
nsXULTextAccessible.cpp \
nsXULTreeAccessible.cpp \
nsXULTreeGridAccessible.cpp \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.

Просмотреть файл

@ -149,7 +149,8 @@ nsXULTabAccessible::GetRelationByType(PRUint32 aRelationType,
// Check whether tab and tabpanel are related by 'linkedPanel' attribute on
// xul:tab element.
rv = nsRelUtils::AddTargetFromIDRefAttr(aRelationType, aRelation, content,
nsAccessibilityAtoms::linkedPanel);
nsAccessibilityAtoms::linkedPanel,
PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
if (rv != NS_OK_NO_RELATION_TARGET)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -65,22 +65,25 @@ class nsXULTreeAccessible : public nsXULSelectableAccessible
{
public:
nsXULTreeAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeAccessible() {}
// nsISupports
// nsISupports and cycle collection
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeAccessible,
nsAccessible)
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
NS_IMETHOD GetChildCount(PRInt32 *aChildCount);
NS_IMETHOD GetChildAt(PRInt32 aChildIndex, nsIAccessible **aChild);
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
// nsIAccessibleSelectable
NS_DECL_NSIACCESSIBLESELECTABLE
// nsIAccessible
NS_IMETHOD GetValue(nsAString& _retval);
NS_IMETHOD GetFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetLastChild(nsIAccessible **_retval);
NS_IMETHOD GetChildCount(PRInt32 *_retval);
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
// nsAccessNode
virtual PRBool IsDefunct();
virtual nsresult Shutdown();
@ -97,16 +100,13 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEACCESSIBLE_IMPL_CID)
/**
* Return tree item accessible at the givem row and column. If accessible
* doesn't exist in the cache then create it.
* Return tree item accessible at the givem row. If accessible doesn't exist
* in the cache then create and cache it.
*
* @param aRow [in] the given row index
* @param aColumn [in] the given column object. If is is nsnull then
* primary column is used
* @param aAccessible [out] tree item accessible
*/
void GetCachedTreeitemAccessible(PRInt32 aRow, nsITreeColumn *aColumn,
nsIAccessible **aAccessible);
void GetTreeItemAccessible(PRInt32 aRow, nsIAccessible **aAccessible);
/**
* Invalidates the number of cached treeitem accessibles.
@ -135,18 +135,16 @@ public:
*/
void TreeViewChanged();
static void GetTreeBoxObject(nsIDOMNode* aDOMNode, nsITreeBoxObject** aBoxObject);
static nsresult GetColumnCount(nsITreeBoxObject* aBoxObject, PRInt32 *aCount);
static PRBool IsColumnHidden(nsITreeColumn *aColumn);
static already_AddRefed<nsITreeColumn> GetNextVisibleColumn(nsITreeColumn *aColumn);
static already_AddRefed<nsITreeColumn> GetFirstVisibleColumn(nsITreeBoxObject *aTree);
static already_AddRefed<nsITreeColumn> GetLastVisibleColumn(nsITreeBoxObject *aTree);
protected:
/**
* Creates tree item accessible for the given row index.
*/
virtual void CreateTreeItemAccessible(PRInt32 aRowIndex,
nsAccessNode** aAccessNode);
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
nsAccessNodeHashtable *mAccessNodeCache;
nsAccessNodeHashtable mAccessNodeCache;
NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState);
};
@ -155,47 +153,112 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeAccessible,
NS_XULTREEACCESSIBLE_IMPL_CID)
/**
* Accessible class for items for XUL tree.
* Base class for tree item accessibles.
*/
#define NS_XULTREEITEMACCESSIBLE_IMPL_CID \
{ /* 7b1aa039-7270-4523-aeb3-61063a13ac3f */ \
0x7b1aa039, \
0x7270, \
0x4523, \
{ 0xae, 0xb3, 0x61, 0x06, 0x3a, 0x13, 0xac, 0x3f } \
#define NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID \
{ /* 1ab79ae7-766a-443c-940b-b1e6b0831dfc */ \
0x1ab79ae7, \
0x766a, \
0x443c, \
{ 0x94, 0x0b, 0xb1, 0xe6, 0xb0, 0x83, 0x1d, 0xfc } \
}
class nsXULTreeitemAccessible : public nsLeafAccessible
class nsXULTreeItemAccessibleBase : public nsAccessibleWrap
{
public:
enum { eAction_Click = 0, eAction_Expand = 1 };
nsXULTreeitemAccessible(nsIAccessible *aParent, nsIDOMNode *aDOMNode, nsIWeakReference *aShell, PRInt32 aRow, nsITreeColumn* aColumn = nsnull);
virtual ~nsXULTreeitemAccessible() {}
nsXULTreeItemAccessibleBase(nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
nsIAccessible *aParent, nsITreeBoxObject *aTree,
nsITreeView *aTreeView, PRInt32 aRow);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessNode
NS_IMETHOD GetUniqueID(void **aUniqueID);
// nsIAccessible
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetNumActions(PRUint8 *_retval);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD GetParent(nsIAccessible **aParent);
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
NS_IMETHOD GetParent(nsIAccessible **_retval);
NS_IMETHOD GetNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
NS_IMETHOD SetSelected(PRBool aSelect);
NS_IMETHOD TakeFocus(void);
NS_IMETHOD TakeFocus();
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
nsIAccessibleRelation **aRelation);
// nsIAccessNode
NS_IMETHOD GetUniqueID(void **aUniqueID);
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessNode
virtual PRBool IsDefunct();
virtual nsresult Shutdown();
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// nsXULTreeItemAccessibleBase
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID)
/**
* Return cell accessible for the given column. If XUL tree accessible is not
* accessible table then return null.
*/
virtual void GetCellAccessible(nsITreeColumn *aColumn,
nsIAccessible **aCellAcc)
{ *aCellAcc = nsnull; }
/**
* Proccess row invalidation. Used to fires name change events.
*/
virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx) = 0;
protected:
enum { eAction_Click = 0, eAction_Expand = 1 };
// nsAccessible
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
// nsXULTreeItemAccessibleBase
/**
* Return true if the tree item accessible is expandable (contains subrows).
*/
PRBool IsExpandable();
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
PRInt32 mRow;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeItemAccessibleBase,
NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID)
/**
* Accessible class for items for XUL tree.
*/
class nsXULTreeItemAccessible : public nsXULTreeItemAccessibleBase
{
public:
nsXULTreeItemAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
nsIAccessible *aParent, nsITreeBoxObject *aTree,
nsITreeView *aTreeView, PRInt32 aRow);
// nsIAccessible
NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
NS_IMETHOD GetChildCount(PRInt32 *aChildCount);
NS_IMETHOD GetName(nsAString& aName);
// nsAccessNode
virtual PRBool IsDefunct();
@ -203,30 +266,16 @@ public:
virtual nsresult Shutdown();
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// nsXULTreeitemAccessible
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEITEMACCESSIBLE_IMPL_CID)
/**
* Get/set cached name.
*/
void GetCachedName(nsAString& aName);
void SetCachedName(const nsAString& aName);
// nsXULTreeItemAccessibleBase
virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);
protected:
PRBool IsExpandable();
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
PRInt32 mRow;
nsCOMPtr<nsITreeColumn> mColumn;
nsString mCachedName;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeitemAccessible,
NS_XULTREEITEMACCESSIBLE_IMPL_CID)
/**
* Accessible class for columns element of XUL tree.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,203 @@
/* -*- 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
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* 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 ***** */
#ifndef __nsXULTreeGridAccessible_h__
#define __nsXULTreeGridAccessible_h__
#include "nsIAccessibleTable.h"
#include "nsXULTreeAccessible.h"
/**
* Represents accessible for XUL tree in the case when it has multiple columns.
*/
class nsXULTreeGridAccessible : public nsXULTreeAccessible,
public nsIAccessibleTable
{
public:
nsXULTreeGridAccessible(nsIDOMNode *aDOMNode,
nsIWeakReference *aShell);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessibleTable
NS_DECL_NSIACCESSIBLETABLE
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
protected:
// nsXULTreeAccessible
virtual void CreateTreeItemAccessible(PRInt32 aRow,
nsAccessNode** aAccessNode);
};
/**
* Represents accessible for XUL tree item in the case when XUL tree has
* multiple columns.
*/
class nsXULTreeGridRowAccessible : public nsXULTreeItemAccessibleBase
{
public:
nsXULTreeGridRowAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
nsIAccessible *aParent, nsITreeBoxObject *aTree,
nsITreeView *aTreeView, PRInt32 aRow);
// nsISupports and cycle collection
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridRowAccessible,
nsAccessible)
// nsIAccessible
NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
NS_IMETHOD GetChildCount(PRInt32 *aChildCount);
NS_IMETHOD GetChildAt(PRInt32 aChildIndex, nsIAccessible **aChild);
// nsAccessNode
virtual nsresult Shutdown();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
PRBool aDeepestChild,
nsIAccessible **aChild);
// nsXULTreeItemAccessibleBase
virtual void GetCellAccessible(nsITreeColumn *aColumn, nsIAccessible **aCell);
virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);
protected:
nsAccessNodeHashtable mAccessNodeCache;
};
/**
* Represents an accessible for XUL tree cell in the case when XUL tree has
* multiple columns.
*/
#define NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID \
{ /* 84588ad4-549c-4196-a932-4c5ca5de5dff */ \
0x84588ad4, \
0x549c, \
0x4196, \
{ 0xa9, 0x32, 0x4c, 0x5c, 0xa5, 0xde, 0x5d, 0xff } \
}
class nsXULTreeGridCellAccessible : public nsLeafAccessible
{
public:
nsXULTreeGridCellAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
nsXULTreeGridRowAccessible *aRowAcc,
nsITreeBoxObject *aTree, nsITreeView *aTreeView,
PRInt32 aRow, nsITreeColumn* aColumn);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessNode
NS_IMETHOD GetUniqueID(void **aUniqueID);
// nsIAccessible
NS_IMETHOD GetParent(nsIAccessible **aParent);
NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
NS_IMETHOD GetPreviousSibling(nsIAccessible **aPrevSibling);
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight);
NS_IMETHOD GetNumActions(PRUint8 *aCount);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessNode
virtual PRBool IsDefunct();
virtual nsresult Init();
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
// nsXULTreeGridCellAccessible
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
/**
* Return index of the column.
*/
PRInt32 GetColumnIndex() const;
/**
* Fire name or state change event if the accessible text or value has been
* changed.
*/
void CellInvalidated();
protected:
// nsAccessible
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
// nsXULTreeGridCellAccessible
/**
* Return true if value of cell can be modified.
*/
PRBool IsEditable() const;
enum { eAction_Click = 0 };
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
PRInt32 mRow;
nsCOMPtr<nsITreeColumn> mColumn;
nsString mCachedTextEquiv;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeGridCellAccessible,
NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)
#endif

Просмотреть файл

@ -59,6 +59,7 @@ _TEST_FILES =\
name.css \
name.js \
name.xbl \
name_nsRootAcc_wnd.xul \
namerules.xml \
nsIAccessible_selects.js \
nsIAccessibleEditableText.js \
@ -68,9 +69,11 @@ _TEST_FILES =\
table.js \
value.js \
test_accessnode_invalidation.html \
test_actions.xul \
test_actions_aria.html \
test_actions_inputs.html \
test_actions.xul \
test_actions_tree.xul \
test_actions_treegrid.xul \
test_aria_activedescendant.html \
test_aria_role_article.html \
test_aria_role_equation.html \
@ -78,6 +81,7 @@ _TEST_FILES =\
test_aria_roles.html \
test_aria_roles.xul \
test_aria_token_attrs.html \
test_attrs_elm_tree.xul \
test_bug420863.html \
$(warning test_childAtPoint.html temporarily disabled) \
$(warning test_childAtPoint.xul temporarily disabled) \
@ -86,9 +90,11 @@ _TEST_FILES =\
test_elm_filectrl.html \
$(warning test_elm_media.html temporarily disabled) \
test_elm_table.html \
test_elm_tree.xul \
test_elm_txtcntnr.html \
test_events_caretmove.html \
test_events_doc.html \
test_events_draganddrop.html \
test_events_focus.xul \
test_events_mutation.html \
test_events_tree.xul \
@ -100,6 +106,7 @@ _TEST_FILES =\
test_name_button.html \
test_name_link.html \
test_name_markup.html \
test_name_nsRootAcc.xul \
test_nsIAccessible_applicationAccessible.html \
$(warning test_nsIAccessible_comboboxes.xul temporarily disabled) \
test_nsIAccessible_selects.html \
@ -117,26 +124,32 @@ _TEST_FILES =\
test_relations.html \
test_relations.xul \
test_relations_table.html \
test_relations_tree.xul \
test_role_nsHyperTextAcc.html \
test_role_table_cells.html \
test_states.html \
test_states_editablebody.html \
test_states_doc.html \
test_states_docarticle.html \
test_states_editablebody.html \
test_states_frames.html \
test_states_popup.xul \
test_states_tree.xul \
test_table_1.html \
test_table_2.html \
test_table_4.html \
test_table_indexes.html \
test_table_indexes_ariagrid.html \
test_table_indexes_tree.xul \
test_table_layoutguess.html \
test_table_sels.html \
test_table_sels_ariagrid.html \
test_table_sels_tree.xul \
test_textattrs.html \
test_textboxes.html \
test_textboxes.xul \
test_value.xul \
testTextboxes.js \
treeview.css \
treeview.js \
z_states_frame.html \
z_states_framearticle.html \

Просмотреть файл

@ -18,14 +18,25 @@ const ALL_EVENTS = CLICK_EVENTS | COMMAND_EVENT;
* Action tester interface is:
*
* var actionObj = {
* // identifier of accessible
* // identifier of accessible to perform an action on
* get ID() {},
*
* // name of default action
* // index of the action
* get actionIndex() {},
*
* // name of the action
* get actionName() {},
*
* // event constant defined above
* get events() {}
* // DOM events (see constants defined above)
* get events() {},
*
* // [optional] identifier of target DOM events listeners are registered on,
* // used with 'events', if missing then 'ID' is used instead.
* get targetID() {},
*
* // [optional] perform checks when 'click' event is handled if 'events'
* // is used.
* checkOnClickEvent: function() {},
*
* // [optional] an array of invoker's checker objects (see eventQueue
* // constructor events.js)
@ -43,13 +54,15 @@ function testActions(aArray)
var actionObj = aArray[idx];
var accOrElmOrID = actionObj.ID;
var actionIndex = actionObj.actionIndex;
var actionName = actionObj.actionName;
var events = actionObj.events;
var accOrElmOrIDOfTarget = actionObj.targetID ?
actionObj.targetID : accOrElmOrID;
var eventSeq = new Array();
if (events) {
var elm = getNode(accOrElmOrID);
//alert(elm.QueryInterface(Components.interfaces.nsIDOMNode));
var elm = getNode(accOrElmOrIDOfTarget);
if (events & MOUSEDOWN_EVENT)
eventSeq.push(new checkerOfActionInvoker("mousedown", elm));
@ -66,7 +79,8 @@ function testActions(aArray)
if (actionObj.eventSeq)
eventSeq = eventSeq.concat(actionObj.eventSeq);
var invoker = new actionInvoker(accOrElmOrID, actionName, eventSeq);
var invoker = new actionInvoker(accOrElmOrID, actionIndex, actionName,
eventSeq);
gActionsQueue.push(invoker);
}
@ -78,7 +92,7 @@ function testActions(aArray)
var gActionsQueue = null;
function actionInvoker(aAccOrElmOrId, aActionName, aEventSeq)
function actionInvoker(aAccOrElmOrId, aActionIndex, aActionName, aEventSeq)
{
this.invoke = function actionInvoker_invoke()
{
@ -93,14 +107,14 @@ function actionInvoker(aAccOrElmOrId, aActionName, aEventSeq)
if (!isThereActions)
return INVOKER_ACTION_FAILED;
is(acc.getActionName(0), aActionName,
is(acc.getActionName(aActionIndex), aActionName,
"Wrong action name of the accessible for " + prettyName(aAccOrElmOrId));
try {
acc.doAction(0);
acc.doAction(aActionIndex);
}
catch (e){
ok(false, "doAction(0) failed with: " + e.name);
ok(false, "doAction(" + aActionIndex + ") failed with: " + e.name);
return INVOKER_ACTION_FAILED;
}
}
@ -114,6 +128,8 @@ function checkerOfActionInvoker(aType, aTarget, aActionObj)
this.target = aTarget;
this.phase = false;
this.getID = function getID()
{
return aType + " event handling";
@ -121,7 +137,7 @@ function checkerOfActionInvoker(aType, aTarget, aActionObj)
this.check = function check(aEvent)
{
if (aActionObj && "check" in aActionObj)
aActionObj.check(aEvent);
if (aActionObj && "checkOnClickEvent" in aActionObj)
aActionObj.checkOnClickEvent(aEvent);
}
}

Просмотреть файл

@ -179,11 +179,11 @@ function testAttrsInternal(aAccOrElmOrID, aAttrs, aSkipUnexpectedAttrs,
} catch (e) { }
if (!attrs) {
ok(false, "Can't get object attributes for " + aAccOrElmOrID);
ok(false, "Can't get object attributes for " + prettyName(aAccOrElmOrID));
return;
}
var errorMsg = " for " + aAccOrElmOrID;
var errorMsg = " for " + prettyName(aAccOrElmOrID);
compareAttrs(errorMsg, attrs, aAttrs, aSkipUnexpectedAttrs, aAbsentAttrs);
}
@ -199,7 +199,7 @@ function compareAttrs(aErrorMsg, aAttrs, aExpectedAttrs, aSkipUnexpectedAttrs,
ok(false, "Unexpected attribute '" + prop.key + "' having '" +
prop.value + "'" + aErrorMsg);
} else {
var msg = "Attribute '" + prop.key + " 'has wrong value" + aErrorMsg;
var msg = "Attribute '" + prop.key + "' has wrong value" + aErrorMsg;
var expectedValue = aExpectedAttrs[prop.key];
if (typeof expectedValue == "function")

Просмотреть файл

@ -163,7 +163,7 @@ const DONOTFAIL_IF_NO_INTERFACE = 2;
/**
* Return accessible for the given identifier (may be ID attribute or DOM
* element or accessible object).
* element or accessible object) or null.
*
* @param aAccOrElmOrID [in] identifier to get an accessible implementing
* the given interfaces
@ -177,7 +177,7 @@ const DONOTFAIL_IF_NO_INTERFACE = 2;
function getAccessible(aAccOrElmOrID, aInterfaces, aElmObj, aDoNotFailIf)
{
if (!aAccOrElmOrID)
return;
return null;
var elm = null;
@ -252,6 +252,23 @@ function isAccessible(aAccOrElmOrID, aInterfaces)
true : false;
}
/**
* Return root accessible for the given identifier.
*/
function getRootAccessible(aAccOrElmOrID)
{
var acc = getAccessible(aAccOrElmOrID ? aAccOrElmOrID : document);
while (acc) {
var parent = acc.parent;
if (parent && !parent.parent)
return acc;
acc = parent;
}
return null;
}
/**
* Run through accessible tree of the given identifier so that we ensure
* accessible tree is created.

Просмотреть файл

@ -6,6 +6,7 @@ const EVENT_DOCUMENT_LOAD_COMPLETE =
const EVENT_DOM_DESTROY = nsIAccessibleEvent.EVENT_DOM_DESTROY;
const EVENT_FOCUS = nsIAccessibleEvent.EVENT_FOCUS;
const EVENT_NAME_CHANGE = nsIAccessibleEvent.EVENT_NAME_CHANGE;
const EVENT_STATE_CHANGE = nsIAccessibleEvent.EVENT_STATE_CHANGE;
const EVENT_REORDER = nsIAccessibleEvent.EVENT_REORDER;
////////////////////////////////////////////////////////////////////////////////
@ -133,6 +134,7 @@ function invokerChecker(aEventType, aTarget)
* // var checker = {
* // type getter: function() {}, // DOM or a11y event type
* // target getter: function() {}, // DOM node or accessible
* // phase getter: function() {}, // DOM event phase (false - bubbling)
* // check: function(aEvent) {},
* // getID: function() {}
* // };
@ -175,6 +177,14 @@ function eventQueue(aEventType)
this);
}
/**
* This function is called when all events in the queue were handled.
* Override it if you need to be notified of this.
*/
this.onFinish = function eventQueue_finish()
{
}
// private
/**
@ -229,6 +239,7 @@ function eventQueue(aEventType)
gA11yEventApplicantsCount--;
listenA11yEvents(false);
this.onFinish();
SimpleTest.finish();
return;
}
@ -281,26 +292,10 @@ function eventQueue(aEventType)
// We wait for events in order specified by eventSeq variable.
var idx = this.mEventSeqIdx + 1;
if (gA11yEventDumpID) { // debug stuff
var matched = this.compareEvents(idx, aEvent);
this.dumpEventToDOM(aEvent, idx, matched);
if (aEvent instanceof nsIDOMEvent) {
var info = "Event type: " + aEvent.type;
info += ". Target: " + prettyName(aEvent.originalTarget);
dumpInfoToDOM(info);
}
var currType = this.getEventType(idx);
var currTarget = this.getEventTarget(idx);
var info = "Event queue processing. Expected event type: ";
info += (typeof currType == "string") ?
currType : eventTypeToString(currType);
info += ". Target: " + prettyName(currTarget);
dumpInfoToDOM(info);
}
if (this.compareEvents(idx, aEvent)) {
if (matched) {
this.checkEvent(idx, aEvent);
invoker.wasCaught[idx] = true;
@ -340,10 +335,16 @@ function eventQueue(aEventType)
for (var idx = 0; idx < this.mEventSeq.length; idx++) {
var eventType = this.getEventType(idx);
if (typeof eventType == "string") // DOM event
document.addEventListener(eventType, this, true);
else // A11y event
if (typeof eventType == "string") {
// DOM event
var target = this.getEventTarget(idx);
var phase = this.getEventPhase(idx);
target.ownerDocument.addEventListener(eventType, this, phase);
} else {
// A11y event
addA11yEventListener(eventType, this);
}
}
}
}
@ -353,10 +354,16 @@ function eventQueue(aEventType)
if (this.mEventSeq) {
for (var idx = 0; idx < this.mEventSeq.length; idx++) {
var eventType = this.getEventType(idx);
if (typeof eventType == "string") // DOM event
document.removeEventListener(eventType, this, true);
else // A11y event
if (typeof eventType == "string") {
// DOM event
var target = this.getEventTarget(idx);
var phase = this.getEventPhase(idx);
target.ownerDocument.removeEventListener(eventType, this, phase);
} else {
// A11y event
removeA11yEventListener(eventType, this);
}
}
this.mEventSeq = null;
@ -373,6 +380,15 @@ function eventQueue(aEventType)
return this.mEventSeq[aIdx].target;
}
this.getEventPhase = function eventQueue_getEventPhase(aIdx)
{
var eventItem = this.mEventSeq[aIdx];
if ("phase" in eventItem)
return eventItem.phase;
return true;
}
this.compareEvents = function eventQueue_compareEvents(aIdx, aEvent)
{
var eventType1 = this.getEventType(aIdx);
@ -419,6 +435,32 @@ function eventQueue(aEventType)
return invoker.getID();
}
this.dumpEventToDOM = function eventQueue_dumpEventToDOM(aOrigEvent,
aExpectedEventIdx,
aMatch)
{
if (!gA11yEventDumpID) // debug stuff
return;
// Dump DOM event information. Skip a11y event since it is dumped by
// gA11yEventObserver.
if (aOrigEvent instanceof nsIDOMEvent) {
var info = "Event type: " + aOrigEvent.type;
info += ". Target: " + prettyName(aOrigEvent.originalTarget);
dumpInfoToDOM(info);
}
var currType = this.getEventType(aExpectedEventIdx);
var currTarget = this.getEventTarget(aExpectedEventIdx);
var info = "EQ: " + (aMatch ? "matched" : "expected") + " event, type: ";
info += (typeof currType == "string") ?
currType : eventTypeToString(currType);
info += ". Target: " + prettyName(currTarget);
dumpInfoToDOM(info);
}
this.mDefEventType = aEventType;
this.mInvokers = new Array();

Просмотреть файл

@ -0,0 +1,103 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<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);
}
// Hack to make xul:tabbrowser work.
var XULBrowserWindow = {
isBusy: false,
setOverLink: function (link, b) {
}
}
////////////////////////////////////////////////////////////////////////////
// Invoker implementation.
function switchTabSelectChecker(aInvoker)
{
this.type = "select";
this.target getter = function() { return aInvoker.getTabsElm(); }
this.getID = function() { return "switch tab, select event"; }
}
function switchTabFocusChecker(aInvoker)
{
this.type = gOpenerWnd.EVENT_FOCUS;
this.target getter = 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)
{
this.invoke = function switchTabInvoker_invoke()
{
gOpenerWnd.synthesizeKey("VK_TAB", { ctrlKey: true });
}
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 onload()
{
var tabBrowser = document.getElementById("content");
tabBrowser.loadURI("about:");
tabBrowser.addTab("about:mozilla");
gQueue = new gOpenerWnd.eventQueue();
gQueue.push(new switchTabInvoker(tabBrowser));
gQueue.onFinish = function() { window.close(); }
gQueue.invoke();
}
]]>
</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>
<tabbrowser type="content-primary" flex="1" id="content"/>
</window>

Просмотреть файл

@ -24,8 +24,11 @@ const ROLE_LABEL = nsIAccessibleRole.ROLE_LABEL;
const ROLE_LINK = nsIAccessibleRole.ROLE_LINK;
const ROLE_LIST = nsIAccessibleRole.ROLE_LIST;
const ROLE_LISTBOX = nsIAccessibleRole.ROLE_LISTBOX;
const ROLE_LISTITEM = nsIAccessibleRole.ROLE_LISTITEM;
const ROLE_NOTHING = nsIAccessibleRole.ROLE_NOTHING;
const ROLE_OPTION = nsIAccessibleRole.ROLE_OPTION;
const ROLE_OUTLINE = nsIAccessibleRole.ROLE_OUTLINE;
const ROLE_OUTLINEITEM = nsIAccessibleRole.ROLE_OUTLINEITEM;
const ROLE_PARAGRAPH = nsIAccessibleRole.ROLE_PARAGRAPH;
const ROLE_PASSWORD_TEXT = nsIAccessibleRole.ROLE_PASSWORD_TEXT;
const ROLE_PROGRESSBAR = nsIAccessibleRole.ROLE_PROGRESSBAR;
@ -37,6 +40,7 @@ const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;
const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER;
const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF;
const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON;
const ROLE_TREE_TABLE = nsIAccessibleRole.ROLE_TREE_TABLE;
////////////////////////////////////////////////////////////////////////////////
// Public methods

Просмотреть файл

@ -50,6 +50,11 @@
ID: "buttonmenu",
actionName: "press",
events: CLICK_EVENTS
},
{
ID: "labelWithPopup",
actionName: "click",
events: CLICK_EVENTS
}/*, // XXX: bug 490288
{
ID: "buttonmenu_item",
@ -73,6 +78,11 @@
title="nsIAccessible actions testing">
Mozilla Bug 410765
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=504252"
title="Expose STATE_HASPOPUP on XUL elements that have an @popup attribute">
Mozilla Bug 504252
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
@ -102,6 +112,10 @@
<menuitem label="item1"/>
</menupopup>
</button>
<label id="labelWithPopup" value="file name"
popup="fileContext"
tabindex="0"/>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,139 @@
<?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="Accessible XUL tree actions tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/states.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/events.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/actions.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Accessible tree testers
function focusChecker(aAcc, aStates)
{
this.type = EVENT_FOCUS;
this.target = aAcc;
this.getID = function focusChecker_getID()
{
return "focus handling";
}
this.check = function focusChecker_check(aEvent)
{
var states = aStates ? aStates : 0;
testStates(this.target, STATE_FOCUSED | STATE_SELECTED | states);
}
}
////////////////////////////////////////////////////////////////////////////
// Test
// gA11yEventDumpID = "debug";
function doTestActions()
{
var treeNode = getNode("tree");
treeNode.removeEventListener("TreeViewChanged", doTestActions, false);
var treeBodyNode = treeNode.boxObject.treeBody;
var tree = getAccessible(treeNode);
var expandedTreeItem = tree.getChildAt(2);
var collapsedTreeItem = tree.getChildAt(5);
var actions = [
{
ID: expandedTreeItem,
actionName: "activate",
actionIndex: 0,
events: CLICK_EVENTS,
targetID: treeBodyNode,
eventSeq: [
new focusChecker(expandedTreeItem, STATE_EXPANDED)
]
},
{
ID: collapsedTreeItem,
actionName: "expand",
actionIndex: 1,
events: CLICK_EVENTS,
targetID: treeBodyNode,
checkOnClickEvent: function check(aEvent)
{
testStates(this.ID, STATE_EXPANDED);
}
},
{
ID: collapsedTreeItem,
actionName: "collapse",
actionIndex: 1,
events: CLICK_EVENTS,
targetID: treeBodyNode,
checkOnClickEvent: function check(aEvent)
{
testStates(this.ID, STATE_COLLAPSED);
}
}
];
testActions(actions); // Will call SimpleTest.finish();
}
function doTest()
{
var treeNode = getNode("tree");
treeNode.addEventListener("TreeViewChanged", doTestActions, false);
treeNode.view = new nsTreeTreeView();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox 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=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<tree id="tree" flex="1" minheight="100px">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<vbox id="debug"/>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,200 @@
<?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"?>
<?xml-stylesheet href="chrome://mochikit/content/a11y/accessible/treeview.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible XUL tree actions tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/states.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/events.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/actions.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Accessible tree testers
function focusChecker(aAcc, aStates)
{
this.type = EVENT_FOCUS;
this.target = aAcc;
this.getID = function focusChecker_getID()
{
return "focus handling";
}
this.check = function focusChecker_check(aEvent)
{
var states = aStates ? aStates : 0;
testStates(this.target, STATE_FOCUSED | STATE_SELECTED | states);
}
}
function stateChangeChecker(aAcc, aIsEnabled)
{
this.type = EVENT_STATE_CHANGE;
this.target = aAcc;
this.getID = function stateChangeChecker_getID()
{
return "state change handling";
}
this.check = function stateChangeChecker_check(aEvent)
{
if (aIsEnabled)
testStates(this.target, STATE_CHECKED);
else
testStates(this.target, STATE_CHECKABLE, 0, STATE_CHECKED);
}
}
////////////////////////////////////////////////////////////////////////////
// Test
function doTestActions()
{
var treeNode = getNode("tabletree");
treeNode.removeEventListener("TreeViewChanged", doTestActions, false);
var treeBodyNode = treeNode.boxObject.treeBody;
treeNode.focus();
var tree = getAccessible(treeNode);
var expandedTreeItem = tree.getChildAt(2);
var collapsedTreeItem = tree.getChildAt(5);
var cycleCell = expandedTreeItem.getChildAt(0);
var checkableCell = expandedTreeItem.getChildAt(3);
var actions = [
{
ID: expandedTreeItem,
actionName: "activate",
actionIndex: 0,
events: CLICK_EVENTS,
targetID: treeBodyNode,
eventSeq: [
new focusChecker(expandedTreeItem, STATE_EXPANDED)
]
},
{
ID: collapsedTreeItem,
actionName: "expand",
actionIndex: 1,
events: CLICK_EVENTS,
targetID: treeBodyNode,
check: function check(aEvent)
{
testStates(this.ID, STATE_EXPANDED);
}
},
{
ID: collapsedTreeItem,
actionName: "collapse",
actionIndex: 1,
events: CLICK_EVENTS,
targetID: treeBodyNode,
check: function check(aEvent)
{
testStates(this.ID, STATE_COLLAPSED);
}
},
{
ID: cycleCell,
actionName: "cycle",
actionIndex: 0,
events: CLICK_EVENTS,
targetID: treeBodyNode
},
{
ID: checkableCell,
actionName: "uncheck",
actionIndex: 0,
events: CLICK_EVENTS,
targetID: treeBodyNode,
eventSeq: [
new stateChangeChecker(checkableCell, false)
]
},
{
ID: checkableCell,
actionName: "check",
actionIndex: 0,
events: CLICK_EVENTS,
targetID: treeBodyNode,
eventSeq: [
new stateChangeChecker(checkableCell, true)
]
}
];
testActions(actions); // Will call SimpleTest.finish();
}
// gA11yEventDumpID = "debug";
function doTest()
{
var treeNode = getNode("tabletree");
treeNode.addEventListener("TreeViewChanged", doTestActions, false);
treeNode.view = new nsTreeTreeView();
}
function test1()
{
var boxObj = getNode("tabletree").treeBoxObject;
boxObj.view.setCellValue(0, boxObj.columns.firstColumn, "false");
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox 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=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<tree id="tabletree" flex="1" editable="true">
<treecols>
<treecol id="tabletree_col1" cycler="true" label="cycler"/>
<treecol id="tabletree_col2" flex="1" primary="true" label="column1"/>
<treecol id="tabletree_col3" flex="1" label="column2"/>
<treecol id="tabletree_col4" flex="1" label="checker"
type="checkbox" editable="true"/>
</treecols>
<treechildren/>
</tree>
<vbox id="debug"/>
<button oncommand="test1();" label="uncheck"/>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -2,6 +2,7 @@
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=481114
https://bugzilla.mozilla.org/show_bug.cgi?id=469688
-->
<head>
<title>Test weak ARIA roles</title>
@ -39,6 +40,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=481114
for (l in weak_landmarks)
testRole(weak_landmarks[l], ROLE_SECTION);
for (l in weak_landmarks) {
var id = weak_landmarks[l] + "_table";
testRole(id, ROLE_TABLE);
var accessibleTable = getAccessible(id, [nsIAccessibleTable], null,
DONOTFAIL_IF_NO_INTERFACE);
ok(accessibleTable ? true : false,
"landmarked table should have nsIAccessibleTable");
if (accessibleTable)
is(accessibleTable.cellRefAt(0,0).firstChild.name, "hi", "no cell");
}
// test gEmptyRoleMap
testRole("cell", ROLE_NOTHING);
@ -52,6 +66,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=481114
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=481114">Mozilla Bug 481114</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 469688</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -73,6 +88,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=481114
<div role="navigation" id="navigation">navigation</div>
<div role="search" id="search">search</div>
<!-- landmarks are tables -->
<table role="application" id="application_table">application table
<tr><td>hi<td></tr></table>
<table role="banner" id="banner_table">banner table
<tr><td>hi<td></tr></table>
<table role="complementary" id="complementary_table">complementary table
<tr><td>hi<td></tr></table>
<table role="contentinfo" id="contentinfo_table">contentinfo table
<tr><td>hi<td></tr></table>
<table role="main" id="main_table">main table
<tr><td>hi<td></tr></table>
<table role="navigation" id="navigation_table">navigation table
<tr><td>hi<td></tr></table>
<table role="search" id="search_table">search table
<tr><td>hi<td></tr></table>
<!-- test gEmptyRoleMap -->
<table role="label">
<tr>

Просмотреть файл

@ -0,0 +1,93 @@
<?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="Accessible XUL tree attributes tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/attributes.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
function doTestAttrs()
{
var treeNode = getNode("tree");
treeNode.removeEventListener("TreeViewChanged", doTestAttrs, false);
var tree = getAccessible(treeNode);
var treeitem1 = tree.firstChild.nextSibling;
testGroupAttrs(treeitem1, "1", "4", "1");
var treeitem2 = treeitem1.nextSibling;
testGroupAttrs(treeitem2, "2", "4", "1");
var treeitem3 = treeitem2.nextSibling;
testGroupAttrs(treeitem3, "1", "2", "2");
var treeitem4 = treeitem3.nextSibling;
testGroupAttrs(treeitem4, "2", "2", "2");
var treeitem5 = treeitem4.nextSibling;
testGroupAttrs(treeitem5, "3", "4", "1");
var treeitem6 = treeitem5.nextSibling;
testGroupAttrs(treeitem6, "4", "4", "1");
SimpleTest.finish();
}
function doTest()
{
var treeNode = getNode("tree");
treeNode.addEventListener("TreeViewChanged", doTestAttrs, false);
treeNode.view = new nsTreeTreeView();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox 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=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<vbox id="debug"/>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,185 @@
<?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="Accessible XUL tree hierarchy tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/events.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Accessible tree testers
function getTreeItemAccTree(aTableRole, aColumnsCount)
{
var treeItemRole;
switch (aTableRole) {
case ROLE_LIST:
treeItemRole = ROLE_LISTITEM;
break;
case ROLE_OUTLINE:
treeItemRole = ROLE_OUTLINEITEM;
break;
case ROLE_TABLE: case ROLE_TREE_TABLE:
treeItemRole = ROLE_ROW;
break;
}
var accTree = {
role: treeItemRole,
children: []
};
if (aTableRole == ROLE_TABLE || aTableRole == ROLE_TREE_TABLE) {
for (var idx = 0; idx < aColumnsCount; idx++) {
var cellAccTree = {
role: ROLE_GRID_CELL,
children: []
};
accTree.children.push(cellAccTree);
}
}
return accTree;
}
function testAccessibleTreeFor(aTree, aRole)
{
var accTreeForColumns = {
role: ROLE_LIST,
children: []
};
var accTreeForTree = {
role: aRole,
children: [
accTreeForColumns
]
};
var treeBoxObject = aTree.treeBoxObject;
var view = treeBoxObject.view;
var columnsCount = treeBoxObject.columns.count;
for (var idx = 0; idx < columnsCount; idx++)
accTreeForColumns.children.push({ role: ROLE_COLUMNHEADER, children: []});
if (!aTree.hasAttribute("hidecolumnpicker"))
accTreeForColumns.children.push({ role: ROLE_PUSHBUTTON, children: []});
for (var idx = 0; idx < view.rowCount; idx++)
accTreeForTree.children.push(getTreeItemAccTree(aRole, columnsCount));
testAccessibleTree(aTree, accTreeForTree);
}
/**
* Event queue invoker object to test accessible tree for XUL tree element.
*/
function treeChecker(aID, aView, aRole)
{
this.DOMNode = getNode(aID);
this.invoke = function invoke()
{
this.DOMNode.treeBoxObject.view = aView;
}
this.check = function check(aEvent)
{
testAccessibleTreeFor(this.DOMNode, aRole);
}
this.getID = function getID()
{
return "Tree testing of " + aID;
}
}
////////////////////////////////////////////////////////////////////////////
// Test
// gA11yEventDumpID = "debug";
var gQueue = null;
function doTest()
{
var gQueue = new eventQueue("TreeViewChanged");
gQueue.push(new treeChecker("list", new nsTableTreeView(3), ROLE_LIST));
gQueue.push(new treeChecker("tree", new nsTreeTreeView(), ROLE_OUTLINE));
gQueue.push(new treeChecker("table", new nsTableTreeView(3), ROLE_TABLE));
gQueue.push(new treeChecker("treetable", new nsTreeTreeView(), ROLE_TREE_TABLE));
gQueue.invoke(); // Will call SimpleTest.finish()
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox 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=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<tree id="list" flex="1" hidecolumnpicker="true">
<treecols>
<treecol id="col" flex="1" hideheader="true"/>
</treecols>
<treechildren/>
</tree>
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<tree id="table" flex="1">
<treecols>
<treecol id="col1" flex="1" label="column"/>
<treecol id="col2" flex="1" label="column 2"/>
</treecols>
<treechildren/>
</tree>
<tree id="treetable" flex="1">
<treecols>
<treecol id="col1" flex="1" primary="true" label="column"/>
<treecol id="col2" flex="1" label="column 2"/>
</treecols>
<treechildren/>
</tree>
<vbox id="debug"/>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,112 @@
<html>
<head>
<title>Accessible drag and drop event testing</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/events.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/attributes.js"></script>
<script type="application/javascript">
/**
* Do tests.
*/
var gQueue = null;
// aria grabbed invoker
function changeGrabbed(aNodeOrID, aGrabValue)
{
this.DOMNode = getNode(aNodeOrID);
this.invoke = function changeGrabbed_invoke() {
if (aGrabValue != undefined) {
this.DOMNode.setAttribute("aria-grabbed", aGrabValue);
}
}
this.check = function changeGrabbed_check() {
testAttrs(aNodeOrID, {"grabbed" : aGrabValue}, true);
}
this.getID = function changeGrabbed_getID() {
return prettyName(aNodeOrID) + " aria-grabbed changed";
}
}
// aria dropeffect invoker
function changeDropeffect(aNodeOrID, aDropeffectValue)
{
this.DOMNode = getNode(aNodeOrID);
this.invoke = function changeDropeffect_invoke() {
if (aDropeffectValue != undefined) {
this.DOMNode.setAttribute("aria-dropeffect", aDropeffectValue);
}
}
this.check = function changeDropeffect_check() {
testAttrs(aNodeOrID, {"dropeffect" : aDropeffectValue}, true);
}
this.getID = function changeDropeffect_getID() {
return prettyName(aNodeOrID) + " aria-dropeffect changed";
}
}
function doTests()
{
// Test aria attribute mutation events
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_OBJECT_ATTRIBUTE_CHANGED);
var id="grabbable";
gQueue.push(new changeGrabbed(id, "true"));
gQueue.push(new changeGrabbed(id, "false"));
todo(false, "uncomment this test when 472142 is fixed.");
//gQueue.push(new changeGrabbed(id, "undefined"));
var id="dropregion";
gQueue.push(new changeDropeffect(id, "copy"));
gQueue.push(new changeDropeffect(id, "execute"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=510441"
title="Add support for nsIAccessibleEvent::OBJECT_ATTRIBUTE_CHANGED">
Mozilla Bug 510441
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div id="eventdump"></div>
<!-- ARIA grabbed -->
<div id="grabbable" role="button" aria-grabbed="foo">button</div>
<!-- ARIA dropeffect -->
<div id="dropregion" role="region" aria-dropeffect="none">button</div>
</body>
</html>

Просмотреть файл

@ -30,6 +30,24 @@
////////////////////////////////////////////////////////////////////////////
// Invoker's checkers
/**
* Check TreeViewChanged event and run through accessible tree to ensure
* it's created.
*/
function treeViewChangedChecker(aMsg)
{
this.type = "TreeViewChanged";
this.target = gTree;
this.check = function check(aEvent)
{
ensureAccessibleTree(gTree);
}
this.getID = function getID()
{
return "TreeViewChanged";
}
}
/**
* Check TreeRowCountChanged event.
*/
@ -93,13 +111,8 @@
{
var acc = getAccessible(gTree);
var tableAcc = getAccessible(acc, [nsIAccessibleTable], null,
DONOTFAIL_IF_NO_INTERFACE);
if (tableAcc)
return tableAcc.cellRefAt(aRow, aCol);
return acc.getChildAt(aRow + 1);
var tableAcc = getAccessible(acc, [nsIAccessibleTable]);
return tableAcc.cellRefAt(aRow, aCol);
}
this.getID = function getID()
{
@ -122,7 +135,7 @@
this.getID = function setTreeView_getID() { return "TreeViewChanged"; }
this.eventSeq = [ new invokerChecker("TreeViewChanged", gTree) ];
this.eventSeq = [ new treeViewChangedChecker() ];
};
/**
@ -133,7 +146,7 @@
{
this.invoke = function insertRow_invoke()
{
++gView.mRowCount;
gView.appendItem("last");
gTreeBox.rowCountChanged(0, 1);
}
@ -154,18 +167,14 @@
{
// Make sure accessibles for the tree is created because it makes
// sure accessible events will be fired.
var treeAcc = getAccessible(gTree);
// Makes sure tree children accessibles are created otherwise they won't
// Make sure tree children accessibles are created otherwise they won't
// be a cause of name changed events.
var children = treeAcc.children;
ensureAccessibleTree(gTree);
// Fire 'TreeInvalidated' event by InvalidateColumn()
var firstCol = gTree.columns.getFirstColumn();
for (var i = 0; i < gView.mRowCount; i++) {
var key = String(i) + firstCol.id;
gView.mData[key] = key + "_col";
}
for (var i = 0; i < gView.rowCount; i++)
gView.setCellText(i, firstCol, "hey " + String(i) + "x0");
gTreeBox.invalidateColumn(firstCol);
}
@ -193,9 +202,10 @@
{
// Fire 'TreeInvalidated' event by InvalidateRow()
var colCount = gTree.columns.count;
for (var i = 0; i < colCount; i++) {
var key = "1" + gTree.columns.getColumnAt(i).id;
gView.mData[key] = key + "_row";
var column = gTree.columns.getFirstColumn();
while (column) {
gView.setCellText(1, column, "aloha 1x" + String(column.index));
column = column.getNext();
}
gTreeBox.invalidateRow(1);
@ -204,6 +214,7 @@
this.eventSeq =
[
new nameChangeChecker("invalidateColumn: ", 1, 0),
new nameChangeChecker("invalidateColumn: ", 1, 1),
new treeInvalidatedChecker("invalidateColumn", 1, 1, null, null)
];
}
@ -223,9 +234,7 @@
// Initialize the tree
gTree = document.getElementById("tree");
gTreeBox = gTree.treeBoxObject;
gView = new inTreeView();
gView.mRowCount = 5;
gView = new nsTableTreeView(5);
// Perform actions
gQueue = new eventQueue();
@ -265,8 +274,8 @@
<vbox id="debug"/>
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
<treecol id="scol" flex="1" label="column 2"/>
<treecol id="col1" flex="1" primary="true" label="column"/>
<treecol id="col2" flex="1" label="column 2"/>
</treecols>
<treechildren id="treechildren"/>
</tree>

Просмотреть файл

@ -0,0 +1,50 @@
<?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/MochiKit/packed.js"></script>
<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="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/events.js"></script>
<script type="application/javascript">
<![CDATA[
// var gA11yEventDumpID = "eventdump"; // debug stuff
SimpleTest.waitForExplicitFinish();
window.openDialog("chrome://mochikit/content/a11y/accessible/name_nsRootAcc_wnd.xul",
"nsRootAcc_name_test",
"chrome,width=600,height=600");
]]>
</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>

Просмотреть файл

@ -0,0 +1,93 @@
<?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="Accessible XUL tree relations tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/relations.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
function doTestRelations()
{
var treeNode = getNode("tree");
treeNode.removeEventListener("TreeViewChanged", doTestRelations, false);
var tree = getAccessible(treeNode);
var treeitem1 = tree.firstChild.nextSibling;
testRelation(treeitem1, RELATION_NODE_CHILD_OF, [tree]);
var treeitem2 = treeitem1.nextSibling;
testRelation(treeitem2, RELATION_NODE_CHILD_OF, [tree]);
var treeitem3 = treeitem2.nextSibling;
testRelation(treeitem3, RELATION_NODE_CHILD_OF, [treeitem2]);
var treeitem4 = treeitem3.nextSibling;
testRelation(treeitem4, RELATION_NODE_CHILD_OF, [treeitem2]);
var treeitem5 = treeitem4.nextSibling;
testRelation(treeitem5, RELATION_NODE_CHILD_OF, [tree]);
var treeitem6 = treeitem5.nextSibling;
testRelation(treeitem6, RELATION_NODE_CHILD_OF, [tree]);
SimpleTest.finish();
}
function doTest()
{
var treeNode = getNode("tree");
treeNode.addEventListener("TreeViewChanged", doTestRelations, false);
treeNode.view = new nsTreeTreeView();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox 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=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<vbox id="debug"/>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,55 @@
<?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="XUL popup attribute test">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/states.js" />
<script type="application/javascript">
<![CDATA[
function doTest()
{
// label with popup
testStates("labelWithPopup", STATE_HASPOPUP);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox 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=504252"
title="Expose STATE_HASPOPUP on XUL elements that have an @popup attribute">
Mozilla Bug 504252
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<!-- label with popup attribute -->
<label id="labelWithPopup" value="file name"
popup="fileContext"
tabindex="0"/>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,145 @@
<?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"?>
<?xml-stylesheet href="chrome://mochikit/content/a11y/accessible/treeview.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible XUL tree states tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/states.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/events.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
// gA11yEventDumpID = "debug";
/**
* Event queue invoker object to test accessible states for XUL tree
* accessible.
*/
function statesChecker(aTreeID, aView)
{
this.DOMNode = getNode(aTreeID);
this.invoke = function invoke()
{
this.DOMNode.treeBoxObject.view = aView;
}
this.check = function check()
{
var tree = getAccessible(this.DOMNode);
// tree states
testStates(tree, STATE_READONLY);
if (this.DOMNode.getAttribute("seltype") != "single")
testStates(tree, STATE_MULTISELECTABLE);
else
testStates(tree, 0, 0, STATE_MULTISELECTABLE);
// tree item states
var expandedItem = tree.getChildAt(2);
testStates(expandedItem,
STATE_SELECTABLE | STATE_FOCUSABLE | STATE_EXPANDED);
var collapsedItem = tree.getChildAt(5);
testStates(collapsedItem,
STATE_SELECTABLE | STATE_FOCUSABLE | STATE_COLLAPSED);
// cells states if any
var cells = collapsedItem.children;
if (cells && cells.length) {
for (var idx = 0; idx < cells.length; idx++) {
var cell = cells.queryElementAt(idx, nsIAccessible);
testStates(cell, STATE_SELECTABLE);
}
var checkboxCell = cells.queryElementAt(3, nsIAccessible);
testStates(checkboxCell, STATE_CHECKABLE | STATE_CHECKED);
}
}
this.getID = function getID()
{
"tree processor for " + prettyName(aTreeID);
}
}
var gQueue = null;
function doTest()
{
gQueue = new eventQueue("TreeViewChanged");
gQueue.push(new statesChecker("tree", new nsTreeTreeView()));
gQueue.push(new statesChecker("treesingle", new nsTreeTreeView()));
gQueue.push(new statesChecker("tabletree", new nsTreeTreeView()));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox 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=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<tree id="treesingle" flex="1" seltype="single">
<treecols>
<treecol id="col_single" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<tree id="tabletree" flex="1" editable="true">
<treecols>
<treecol id="tabletree_col1" cycler="true" label="cycler"/>
<treecol id="tabletree_col2" flex="1" primary="true" label="column1"/>
<treecol id="tabletree_col3" flex="1" label="column2"/>
<treecol id="tabletree_col4" flex="1" label="checker"
type="checkbox" editable="true"/>
</treecols>
<treechildren/>
</tree>
<vbox id="debug"/>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,88 @@
<?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="Accessible Table indexes tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
var gTree = null;
var gTreeBox = null;
var gTreeView = null;
// gA11yEventDumpID = "debug";
function doTest()
{
// Initialize the tree
gTree = document.getElementById("tree");
gTreeBox = gTree.treeBoxObject;
gView = new nsTableTreeView(3);
gTree.addEventListener("TreeViewChanged", continueTest, false);
gTreeBox.view = gView;
}
function continueTest()
{
gTree.removeEventListener("TreeViewChanged", continueTest, false);
var idxes = [
[0, 1],
[2, 3],
[4, 5]
];
testTableIndexes(gTree, idxes);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox 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=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox id="debug"/>
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
<treecol id="scol" flex="1" label="column 2"/>
</treecols>
<treechildren id="treechildren"/>
</tree>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,94 @@
<?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="Accessible Table selection tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/states.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
var gTree = null;
var gTreeBox = null;
var gTreeView = null;
// gA11yEventDumpID = "debug";
function doTest()
{
// Initialize the tree
gTree = document.getElementById("tree");
gTreeBox = gTree.treeBoxObject;
gView = new nsTableTreeView(3);
gTree.addEventListener("TreeViewChanged", continueTest, false);
gTreeBox.view = gView;
}
function continueTest()
{
gTree.removeEventListener("TreeViewChanged", continueTest, false);
var cellsArray =
[
[false, false],
[false, false],
[false, false]
];
testTableSelection(gTree, cellsArray);
testSelectTableRow(gTree, 0, cellsArray);
testUnselectTableRow(gTree, 0, cellsArray);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox 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=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox id="debug"/>
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
<treecol id="scol" flex="1" label="column 2"/>
</treecols>
<treechildren id="treechildren"/>
</tree>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,15 @@
treechildren::-moz-tree-checkbox(checked) {
list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif");
}
treechildren::-moz-tree-image(cyclerState1) {
list-style-image: url("chrome://global/skin/console/bullet-question.png");
}
treechildren::-moz-tree-image(cyclerState2) {
list-style-image: url("chrome://global/skin/console/bullet-warning.png");
}
treechildren::-moz-tree-image(cyclerState3) {
list-style-image: url("chrome://global/skin/console/bullet-error.png");
}

Просмотреть файл

@ -1,14 +1,33 @@
function inTreeView() { }
inTreeView.prototype =
function nsTableTreeView(aRowCount)
{
mRowCount: 0,
mTree: null,
mData: {},
this.__proto__ = new nsTreeView();
for (var idx = 0; idx < aRowCount; idx++)
this.mData.push(new treeItem("row" + String(idx) + "_"));
}
function nsTreeTreeView()
{
this.__proto__ = new nsTreeView();
this.mData = [
new treeItem("row1"),
new treeItem("row2_", true, [new treeItem("row2.1_"), new treeItem("row2.2_")]),
new treeItem("row3_", false, [new treeItem("row3.1_"), new treeItem("row3.2_")]),
new treeItem("row4")
];
}
function nsTreeView() { }
nsTreeView.prototype =
{
//////////////////////////////////////////////////////////////////////////////
// nsITreeView implementation
get rowCount()
{
return this.mRowCount;
return this.getRowCountIntl(this.mData);
},
setTree: function setTree(aTree)
{
@ -16,35 +35,198 @@ inTreeView.prototype =
},
getCellText: function getCellText(aRow, aCol)
{
var key = String(aRow) + aCol.id;
if (key in this.mData)
return this.mData[key];
return "hello";
var data = this.getDataForIndex(aRow);
if (aCol in data.colsText)
return data.colsText[aCol];
return data.text + aCol.id;
},
getCellValue: function getCellValue(aRow, aCol)
{
var data = this.getDataForIndex(aRow);
return data.value;
},
getRowProperties: function getRowProperties(aIndex, aProperties) {},
getCellProperties: function getCellProperties(aIndex, aCol, aProperties) {},
getCellProperties: function getCellProperties(aIndex, aCol, aProperties)
{
if (!aCol.cycler)
return;
var data = this.getDataForIndex(aIndex);
var atom = this.mCyclerStates[data.cyclerState];
aProperties.AppendElement(atom);
},
getColumnProperties: function getColumnProperties(aCol, aProperties) {},
getParentIndex: function getParentIndex(aRowIndex) { },
getParentIndex: function getParentIndex(aRowIndex)
{
var info = this.getInfoByIndex(aRowIndex);
return info.parentIndex;
},
hasNextSibling: function hasNextSibling(aRowIndex, aAfterIndex) { },
getLevel: function getLevel(aIndex) {},
getLevel: function getLevel(aIndex)
{
var info = this.getInfoByIndex(aIndex);
return info.level;
},
getImageSrc: function getImageSrc(aRow, aCol) {},
getProgressMode: function getProgressMode(aRow, aCol) {},
getCellValue: function getCellValue(aRow, aCol) {},
isContainer: function isContainer(aIndex) {},
isContainerOpen: function isContainerOpen(aIndex) {},
isContainerEmpty: function isContainerEmpty(aIndex) {},
isContainer: function isContainer(aIndex)
{
var data = this.getDataForIndex(aIndex);
return data.open != undefined;
},
isContainerOpen: function isContainerOpen(aIndex)
{
var data = this.getDataForIndex(aIndex);
return data.open;
},
isContainerEmpty: function isContainerEmpty(aIndex)
{
var data = this.getDataForIndex(aIndex);
return data.open == undefined;
},
isSeparator: function isSeparator(aIndex) {},
isSorted: function isSorted() {},
toggleOpenState: function toggleOpenState(aIndex) {},
toggleOpenState: function toggleOpenState(aIndex)
{
var data = this.getDataForIndex(aIndex);
data.open = !data.open;
var rowCount = this.getRowCountIntl(data.children);
if (data.open)
this.mTree.rowCountChanged(aIndex + 1, rowCount);
else
this.mTree.rowCountChanged(aIndex + 1, -rowCount);
},
selectionChanged: function selectionChanged() {},
cycleHeader: function cycleHeader(aCol) {},
cycleCell: function cycleCell(aRow, aCol) {},
isEditable: function isEditable(aRow, aCol) {},
cycleCell: function cycleCell(aRow, aCol)
{
var data = this.getDataForIndex(aRow);
data.cyclerState = (data.cyclerState + 1) % 3;
this.mTree.invalidateCell(aRow, aCol);
},
isEditable: function isEditable(aRow, aCol)
{
return true;
},
isSelectable: function isSelectable(aRow, aCol) {},
setCellValue: function setCellValue(aRow, aCol, aValue) {},
setCellText: function setCellText(aRow, aCol, aValue) { },
setCellText: function setCellText(aRow, aCol, aValue)
{
var data = this.getDataForIndex(aRow);
data.colsText[aCol] = aValue;
},
setCellValue: function setCellValue(aRow, aCol, aValue)
{
var data = this.getDataForIndex(aRow);
data.value = aValue;
this.mTree.invalidateCell(aRow, aCol);
},
performAction: function performAction(aAction) {},
performActionOnRow: function performActionOnRow(aAction, aRow) {},
performActionOnCell: function performActionOnCell(aAction, aRow, aCol) {}
performActionOnCell: function performActionOnCell(aAction, aRow, aCol) {},
//////////////////////////////////////////////////////////////////////////////
// public implementation
appendItem: function appendItem(aText)
{
this.mData.push(new treeItem(aText));
},
//////////////////////////////////////////////////////////////////////////////
// private implementation
getDataForIndex: function getDataForIndex(aRowIndex)
{
return this.getInfoByIndex(aRowIndex).data;
},
getInfoByIndex: function getInfoByIndex(aRowIndex)
{
var info = {
data: null,
parentIndex: -1,
level: 0,
index: -1
};
this.getInfoByIndexIntl(aRowIndex, info, this.mData, 0);
return info;
},
getRowCountIntl: function getRowCountIntl(aChildren)
{
var rowCount = 0;
for (var childIdx = 0; childIdx < aChildren.length; childIdx++) {
rowCount++;
var data = aChildren[childIdx];
if (data.open)
rowCount += this.getRowCountIntl(data.children);
}
return rowCount;
},
getInfoByIndexIntl: function getInfoByIndexIntl(aRowIdx, aInfo,
aChildren, aLevel)
{
var rowIdx = aRowIdx;
for (var childIdx = 0; childIdx < aChildren.length; childIdx++) {
var data = aChildren[childIdx];
aInfo.index++;
if (rowIdx == 0) {
aInfo.data = data;
aInfo.level = aLevel;
return -1;
}
if (data.open) {
var parentIdx = aInfo.index;
rowIdx = this.getInfoByIndexIntl(rowIdx - 1, aInfo, data.children,
aLevel + 1);
if (rowIdx == -1) {
if (aInfo.parentIndex == -1)
aInfo.parentIndex = parentIdx;
return 0;
}
} else {
rowIdx--;
}
}
return rowIdx;
},
mTree: null,
mData: [],
mCyclerStates: [
createAtom("cyclerState1"),
createAtom("cyclerState2"),
createAtom("cyclerState3")
]
};
function treeItem(aText, aOpen, aChildren)
{
this.text = aText;
this.colsText = {};
this.open = aOpen;
this.value = "true";
this.cyclerState = 0;
if (aChildren)
this.children = aChildren;
}
function createAtom(aName)
{
return Components.classes["@mozilla.org/atom-service;1"]
.getService(Components.interfaces.nsIAtomService).getAtom(aName);
}

Просмотреть файл

@ -217,7 +217,6 @@ ifeq ($(OS_ARCH),OS2)
RESFILE=splashos2.res
RCFLAGS += -DMOZ_PHOENIX
ifdef BUILD_STATIC_LIBS
EXE_DEF_FILE = browser.def
RCFLAGS += -DMOZ_STATIC_BUILD -i $(DIST)/include/widget
endif
ifdef DEBUG
@ -262,20 +261,6 @@ endif
$(PROGRAM): $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
ifeq ($(OS_ARCH),OS2)
ifdef BUILD_STATIC_LIBS
$(EXE_DEF_FILE):
rm -f $@
@echo NAME mozilla >$(EXE_DEF_FILE)
@echo IMPORTS >>$(EXE_DEF_FILE)
@echo WinQueryProperty = PMMERGE.5450 >>$(EXE_DEF_FILE)
@echo WinRemoveProperty = PMMERGE.5451 >>$(EXE_DEF_FILE)
@echo WinSetProperty = PMMERGE.5452 >>$(EXE_DEF_FILE)
LDFLAGS += -Zlinker /NOE
endif
endif
ifneq (,$(filter-out OS2 WINNT WINCE,$(OS_ARCH)))
$(MOZ_APP_NAME):: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)

Просмотреть файл

@ -168,6 +168,9 @@ pref("extensions.dss.enabled", false); // Dynamic Skin Switching
pref("extensions.dss.switchPending", false); // Non-dynamic switch pending after next
// restart.
pref("extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.name", "chrome://browser/locale/browser.properties");
pref("extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.description", "chrome://browser/locale/browser.properties");
pref("xpinstall.whitelist.add", "update.mozilla.org");
pref("xpinstall.whitelist.add.103", "addons.mozilla.org");
@ -222,11 +225,6 @@ pref("browser.urlbar.filter.javascript", true);
// the maximum number of results to show in autocomplete when doing richResults
pref("browser.urlbar.maxRichResults", 12);
// Size of "chunks" affects the number of places to process between each search
// timeout (ms). Too big and the UI will be unresponsive; too small and we'll
// be waiting on the timeout too often without many results.
pref("browser.urlbar.search.chunkSize", 1000);
pref("browser.urlbar.search.timeout", 100);
// The amount of time (ms) to wait after the user has stopped typing
// before starting to perform autocomplete. 50 is the default set in
// autocomplete.xml.
@ -858,10 +856,7 @@ pref("geo.wifi.uri", "https://www.google.com/loc/json");
#ifdef WINCE
// tweak awesomebar -- increase the delay until a search happens, and reduce
// the amount of time spent waiting for a search result
pref("browser.urlbar.search.chunkSize", 100);
pref("browser.urlbar.search.timeout", 500);
// tweak awesomebar -- increase the delay until a search happens.
pref("browser.urlbar.delay", 1000);
// disable safe browsing, due to perf hit
@ -885,6 +880,9 @@ pref("content.sink.interactive_time", 750000); /* default 750000 */
pref("content.sink.initial_perf_time", 500000); /* default 2000000 */
pref("content.sink.enable_perf_mode", 0); /* default 0; 0 == switch, 1 == stay interactive, 2 == stay perf */
// Write sessionstore.js less often
pref("browser.sessionstore.interval", 60000);
#endif /* WINCE */
// Whether to use a panel that looks like an OS X sheet for customization

Просмотреть файл

@ -439,7 +439,7 @@
label="&fullScreenCmd.label;"
key="key_fullScreen"
type="checkbox"
command="View:FullScreen"/>
observes="View:FullScreen"/>
#endif
<menuitem id="menu_showAllTabs"
hidden="true"

Просмотреть файл

@ -644,12 +644,13 @@ var HistoryMenu = {
undoPopup.appendChild(m);
}
// "Open All in Tabs"
// "Restore All Tabs"
var strings = gNavigatorBundle;
undoPopup.appendChild(document.createElement("menuseparator"));
m = undoPopup.appendChild(document.createElement("menuitem"));
m.setAttribute("label", strings.getString("menuOpenAllInTabs.label"));
m.setAttribute("accesskey", strings.getString("menuOpenAllInTabs.accesskey"));
m.id = "menu_restoreAllTabs";
m.setAttribute("label", strings.getString("menuRestoreAllTabs.label"));
m.setAttribute("accesskey", strings.getString("menuRestoreAllTabs.accesskey"));
m.addEventListener("command", function() {
for (var i = 0; i < undoItems.length; i++)
undoCloseTab();
@ -718,6 +719,7 @@ var HistoryMenu = {
// "Open All in Windows"
undoPopup.appendChild(document.createElement("menuseparator"));
let m = undoPopup.appendChild(document.createElement("menuitem"));
m.id = "menu_restoreAllWindows";
m.setAttribute("label", gNavigatorBundle.getString("menuRestoreAllWindows.label"));
m.setAttribute("accesskey", gNavigatorBundle.getString("menuRestoreAllWindows.accesskey"));
m.setAttribute("oncommand",
@ -879,6 +881,7 @@ var BookmarksEventHandler = {
if (!target._endOptSeparator) {
// create a separator before options
target._endOptSeparator = document.createElement("menuseparator");
target._endOptSeparator.className = "bookmarks-actions-menuseparator";
target._endMarker = target.childNodes.length;
target.appendChild(target._endOptSeparator);
}
@ -886,6 +889,7 @@ var BookmarksEventHandler = {
if (siteURIString && !target._endOptOpenSiteURI) {
// Add "Open (Feed Name)" menuitem if it's a livemark with a siteURI
target._endOptOpenSiteURI = document.createElement("menuitem");
target._endOptOpenSiteURI.className = "openlivemarksite-menuitem";
target._endOptOpenSiteURI.setAttribute("siteURI", siteURIString);
target._endOptOpenSiteURI.setAttribute("oncommand",
"openUILink(this.getAttribute('siteURI'), event);");
@ -905,6 +909,7 @@ var BookmarksEventHandler = {
// Add the "Open All in Tabs" menuitem if there are
// at least two menuitems with places result nodes.
target._endOptOpenAllInTabs = document.createElement("menuitem");
target._endOptOpenAllInTabs.className = "openintabs-menuitem";
target._endOptOpenAllInTabs.setAttribute("oncommand",
"PlacesUIUtils.openContainerNodeInTabs(this.parentNode._resultNode, event);");
target._endOptOpenAllInTabs.setAttribute("onclick",

Просмотреть файл

@ -126,7 +126,7 @@
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
<command id="Tools:Sanitize"
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window || null);"/>
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
<command id="Tools:PrivateBrowsing" oncommand="gPrivateBrowsingUI.toggleMode();"/>
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
<command id="History:UndoCloseWindow" oncommand="undoCloseWindow();"/>

Просмотреть файл

@ -266,8 +266,19 @@ var FullZoom = {
// location change observer
onLocationChange: function FullZoom_onLocationChange(aURI, aBrowser) {
if (!aURI)
/**
* Called when the location of a tab changes.
* When that happens, we need to update the current zoom level if appropriate.
*
* @param aURI
* A URI object representing the new location.
* @param aIsTabSwitch
* Whether this location change has happened because of a tab switch.
* @param aBrowser
* (optional) browser object displaying the document
*/
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
if (!aURI || (aIsTabSwitch && !this.siteSpecific))
return;
this._applyPrefToSetting(this._cps.getPref(aURI, this.name), aBrowser);
},
@ -302,11 +313,6 @@ var FullZoom = {
this._removePref();
},
setSettingValue: function FullZoom_setSettingValue() {
var value = this._cps.getPref(gBrowser.currentURI, this.name);
this._applyPrefToSetting(value);
},
/**
* Set the zoom level for the current tab.
*
@ -329,12 +335,13 @@ var FullZoom = {
_applyPrefToSetting: function FullZoom__applyPrefToSetting(aValue, aBrowser) {
var browser = aBrowser || gBrowser.selectedBrowser;
if (!this.siteSpecific || gInPrintPreviewMode ||
browser.contentDocument instanceof Ci.nsIImageDocument)
return;
var resetZoom = (!this.siteSpecific || gInPrintPreviewMode ||
browser.contentDocument instanceof Ci.nsIImageDocument);
try {
if (typeof aValue != "undefined")
if (resetZoom)
ZoomManager.setZoomForBrowser(browser, 1);
else if (typeof aValue != "undefined")
ZoomManager.setZoomForBrowser(browser, this._ensureValid(aValue));
else if (typeof this.globalValue != "undefined")
ZoomManager.setZoomForBrowser(browser, this.globalValue);

Просмотреть файл

@ -46,6 +46,7 @@
# Thomas K. Dyas <tdyas@zecador.org>
# Edward Lee <edward.lee@engineering.uiuc.edu>
# Paul OShannessy <paul@oshannessy.com>
# Nils Maier <maierman@web.de>
#
# 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
@ -1210,9 +1211,9 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
window.addEventListener("fullscreen", onFullScreen, true);
if (isLoadingBlank && gURLBar && isElementVisible(gURLBar))
focusElement(gURLBar);
gURLBar.focus();
else
focusElement(content);
gBrowser.selectedBrowser.focus();
if (gURLBar)
gURLBar.emptyText = gURLBarEmptyText.value;
@ -1839,6 +1840,35 @@ function delayedOpenTab(aUrl, aReferrer, aCharset, aPostData, aAllowThirdPartyFi
gBrowser.loadOneTab(aUrl, aReferrer, aCharset, aPostData, false, aAllowThirdPartyFixup);
}
var gLastOpenDirectory = {
_lastDir: null,
get path() {
if (!this._lastDir || !this._lastDir.exists()) {
try {
this._lastDir = gPrefService.getComplexValue("browser.open.lastDir",
Ci.nsILocalFile);
if (!this._lastDir.exists())
this._lastDir = null;
}
catch(e) {}
}
return this._lastDir;
},
set path(val) {
if (!val || !val.exists() || !val.isDirectory())
return;
this._lastDir = val.clone();
// Don't save the last open directory pref inside the Private Browsing mode
if (!gPrivateBrowsingUI.privateBrowsingEnabled)
gPrefService.setComplexValue("browser.open.lastDir", Ci.nsILocalFile,
this._lastDir);
},
reset: function() {
this._lastDir = null;
}
};
function BrowserOpenFileWindow()
{
// Get filepicker component.
@ -1848,9 +1878,13 @@ function BrowserOpenFileWindow()
fp.init(window, gNavigatorBundle.getString("openFile"), nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText | nsIFilePicker.filterImages |
nsIFilePicker.filterXML | nsIFilePicker.filterHTML);
fp.displayDirectory = gLastOpenDirectory.path;
if (fp.show() == nsIFilePicker.returnOK)
if (fp.show() == nsIFilePicker.returnOK) {
if (fp.file && fp.file.exists())
gLastOpenDirectory.path = fp.file.parent.QueryInterface(Ci.nsILocalFile);
openTopWin(fp.fileURL.spec);
}
} catch (ex) {
}
}
@ -2557,7 +2591,6 @@ function onExitPrintPreview()
{
// restore chrome to original state
gInPrintPreviewMode = false;
FullZoom.setSettingValue();
toggleAffectedChrome(false);
}
@ -3471,7 +3504,7 @@ var FullScreen =
// show/hide all menubars, toolbars, and statusbars (except the full screen toolbar)
this.showXULChrome("toolbar", window.fullScreen);
this.showXULChrome("statusbar", window.fullScreen);
document.getElementById("fullScreenItem").setAttribute("checked", !window.fullScreen);
document.getElementById("View:FullScreen").setAttribute("checked", !window.fullScreen);
var fullScrToggler = document.getElementById("fullscr-toggler");
if (!window.fullScreen) {
@ -4228,7 +4261,7 @@ var XULBrowserWindow = {
// simulate all change notifications after switching tabs
onUpdateCurrentBrowser: function (aStateFlags, aStatus, aMessage, aTotalProgress) {
if (FullZoom.updateBackgroundTabs)
FullZoom.onLocationChange(gBrowser.currentURI);
FullZoom.onLocationChange(gBrowser.currentURI, true);
var nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
var loadingDone = aStateFlags & nsIWebProgressListener.STATE_STOP;
// use a pseudo-object instead of a (potentially non-existing) channel for getting
@ -4295,7 +4328,7 @@ var TabsProgressListener = {
onLocationChange: function (aBrowser, aWebProgress, aRequest, aLocationURI) {
// Filter out any sub-frame loads
if (aBrowser.contentWindow == aWebProgress.DOMWindow)
FullZoom.onLocationChange(aLocationURI, aBrowser);
FullZoom.onLocationChange(aLocationURI, false, aBrowser);
},
onStatusChange: function (aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
@ -5263,20 +5296,6 @@ var BrowserOffline = {
var ioService = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService2);
// if ioService is managing the offline status, then ioservice.offline
// is already set correctly. We will continue to allow the ioService
// to manage its offline state until the user uses the "Work Offline" UI.
if (!ioService.manageOfflineStatus) {
// set the initial state
var isOffline = false;
try {
isOffline = gPrefService.getBoolPref("browser.offline");
}
catch (e) { }
ioService.offline = isOffline;
}
this._updateOfflineUI(ioService.offline);
},
@ -5651,19 +5670,13 @@ var OfflineApps = {
function WindowIsClosing()
{
var cn = gBrowser.tabContainer.childNodes;
var numtabs = cn.length;
var reallyClose =
closeWindow(false,
function () {
return gBrowser.warnAboutClosingTabs(true);
});
var reallyClose = closeWindow(false, warnAboutClosingWindow);
if (!reallyClose)
return false;
for (var i = 0; reallyClose && i < numtabs; ++i) {
var ds = gBrowser.getBrowserForTab(cn[i]).docShell;
var numBrowsers = gBrowser.browsers.length;
for (let i = 0; reallyClose && i < numBrowsers; ++i) {
let ds = gBrowser.browsers[i].docShell;
if (ds.contentViewer && !ds.contentViewer.permitUnload())
reallyClose = false;
@ -5672,6 +5685,49 @@ function WindowIsClosing()
return reallyClose;
}
/**
* Checks if this is the last full *browser* window around. If it is, this will
* be communicated like quitting. Otherwise, we warn about closing multiple tabs.
* @returns true if closing can proceed, false if it got cancelled.
*/
function warnAboutClosingWindow() {
// Popups aren't considered full browser windows.
if (!toolbar.visible)
return gBrowser.warnAboutClosingTabs(true);
// Figure out if there's at least one other browser window around.
let foundOtherBrowserWindow = false;
let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
let e = wm.getEnumerator("navigator:browser");
while (e.hasMoreElements() && !foundOtherBrowserWindow) {
let win = e.getNext();
if (win != window && win.toolbar.visible)
foundOtherBrowserWindow = true;
}
if (foundOtherBrowserWindow)
return gBrowser.warnAboutClosingTabs(true);
let os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
let closingCanceled = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
os.notifyObservers(closingCanceled,
"browser-lastwindow-close-requested", null);
if (closingCanceled.data)
return false;
os.notifyObservers(null, "browser-lastwindow-close-granted", null);
#ifdef XP_MACOSX
// OS X doesn't quit the application when the last window is closed, but keeps
// the session alive. Hence don't prompt users to save tabs, but warn about
// closing multiple tabs.
return gBrowser.warnAboutClosingTabs(true);
#else
return true;
#endif
}
var MailIntegration = {
sendLinkForWindow: function (aWindow) {
this.sendMessage(aWindow.location.href,
@ -6653,6 +6709,12 @@ let DownloadMonitorPanel = {
_lastTime: Infinity,
_listening: false,
get DownloadUtils() {
delete this.DownloadUtils;
Cu.import("resource://gre/modules/DownloadUtils.jsm", this);
return this.DownloadUtils;
},
//////////////////////////////////////////////////////////////////////////////
//// DownloadMonitorPanel Public Methods
@ -6660,9 +6722,6 @@ let DownloadMonitorPanel = {
* Initialize the status panel and member variables
*/
init: function DMP_init() {
// Load the modules to help display strings
Cu.import("resource://gre/modules/DownloadUtils.jsm");
// Initialize "private" member variables
this._panel = document.getElementById("download-monitor");
@ -6681,10 +6740,17 @@ let DownloadMonitorPanel = {
gDownloadMgr.removeListener(this);
},
inited: function DMP_inited() {
return this._panel != null;
},
/**
* Update status based on the number of active and paused downloads
*/
updateStatus: function DMP_updateStatus() {
if (!this.inited())
return;
let numActive = gDownloadMgr.activeDownloadCount;
// Hide the panel and reset the "last time" if there's no downloads
@ -6714,7 +6780,8 @@ let DownloadMonitorPanel = {
// Get the remaining time string and last sec for time estimation
let timeLeft;
[timeLeft, this._lastTime] = DownloadUtils.getTimeLeft(maxTime, this._lastTime);
[timeLeft, this._lastTime] =
this.DownloadUtils.getTimeLeft(maxTime, this._lastTime);
// Figure out how many downloads are currently downloading
let numDls = numActive - numPaused;
@ -6780,7 +6847,8 @@ function getNavToolbox() gNavToolbox;
let gPrivateBrowsingUI = {
_observerService: null,
_privateBrowsingService: null,
_privateBrowsingAutoStarted: false,
_searchBarValue: null,
_findBarValue: null,
init: function PBUI_init() {
this._observerService = Cc["@mozilla.org/observer-service;1"].
@ -6865,6 +6933,12 @@ let gPrivateBrowsingUI = {
},
onEnterPrivateBrowsing: function PBUI_onEnterPrivateBrowsing() {
if (BrowserSearch.searchBar)
this._searchBarValue = BrowserSearch.searchBar.textbox.value;
if (gFindBar)
this._findBarValue = gFindBar.getElement("findbar-textbox").value;
this._setPBMenuTitle("stop");
document.getElementById("menu_import").setAttribute("disabled", "true");
@ -6873,9 +6947,7 @@ let gPrivateBrowsingUI = {
// temporary fix until bug 463607 is fixed
document.getElementById("Tools:Sanitize").setAttribute("disabled", "true");
this._privateBrowsingAutoStarted = this._privateBrowsingService.autoStarted;
if (this._privateBrowsingAutoStarted) {
if (this._privateBrowsingService.autoStarted) {
// Disable the menu item in auto-start mode
document.getElementById("privateBrowsingItem")
.setAttribute("disabled", "true");
@ -6890,12 +6962,23 @@ let gPrivateBrowsingUI = {
docElement.setAttribute("titlemodifier",
docElement.getAttribute("titlemodifier_privatebrowsing"));
docElement.setAttribute("browsingmode", "private");
gBrowser.updateTitlebar();
}
setTimeout(function () {
DownloadMonitorPanel.updateStatus();
}, 0);
},
onExitPrivateBrowsing: function PBUI_onExitPrivateBrowsing() {
if (BrowserSearch.searchBar)
BrowserSearch.searchBar.textbox.reset();
if (BrowserSearch.searchBar) {
let searchBox = BrowserSearch.searchBar.textbox;
searchBox.reset();
if (this._searchBarValue) {
searchBox.value = this._searchBarValue;
this._searchBarValue = null;
}
}
document.getElementById("menu_import").removeAttribute("disabled");
@ -6903,8 +6986,14 @@ let gPrivateBrowsingUI = {
// temporary fix until bug 463607 is fixed
document.getElementById("Tools:Sanitize").removeAttribute("disabled");
if (gFindBar)
gFindBar.getElement("findbar-textbox").reset();
if (gFindBar) {
let findbox = gFindBar.getElement("findbar-textbox");
findbox.reset();
if (this._findBarValue) {
findbox.value = this._findBarValue;
this._findBarValue = null;
}
}
this._setPBMenuTitle("start");
@ -6924,7 +7013,11 @@ let gPrivateBrowsingUI = {
document.getElementById("Tools:PrivateBrowsing")
.removeAttribute("disabled");
this._privateBrowsingAutoStarted = false;
gLastOpenDirectory.reset();
setTimeout(function () {
DownloadMonitorPanel.updateStatus();
}, 0);
},
_setPBMenuTitle: function PBUI__setPBMenuTitle(aMode) {

Просмотреть файл

@ -83,6 +83,7 @@
windowtype="navigator:browser"
screenX="4" screenY="4"
browsingmode="normal"
toggletoolbar="true"
persist="screenX screenY width height sizemode">
# All JS files which are not content (only) dependent that browser.xul
@ -378,7 +379,6 @@
showimagecolumn="true"
enablehistory="true"
maxrows="6"
timeout="75"
newlines="stripsurroundingwhitespace"
oninput="gBrowser.userTypedValue = this.value;"
ontextentered="this.handleCommand(param);"
@ -511,7 +511,13 @@
label="&pasteCmd.label;"
command="cmd_paste"
tooltiptext="&pasteButton.tooltip;"/>
#ifndef XP_MACOSX
<toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
observes="View:FullScreen"
type="checkbox"
label="&fullScreenCmd.label;"
tooltiptext="&fullScreenButton.tooltip;"/>
#endif
</toolbarpalette>
<toolbar id="nav-bar" class="toolbar-primary chromeclass-toolbar"

Просмотреть файл

@ -234,7 +234,6 @@
<li>Mitchell Baker</li>
<li>Rhian Baker</li>
<li>Jeff Balogh</li>
<li>Honza Bambas</li>
<li>Jan Bambas</li>
<li>Rey Bango</li>
<li>Mark Banner</li>

Просмотреть файл

@ -79,7 +79,7 @@
<label value="&openWhere.label;"/>
<menulist id="openWhereList">
<menupopup>
<menuitem value="0" id="currentWindow" label="&topWindow.label;"/>
<menuitem value="0" id="currentWindow" label="&topTab.label;"/>
<menuitem value="1" label="&newWindow.label;"/>
<menuitem value="3" label="&newTab.label;"/>
</menupopup>

Просмотреть файл

@ -111,7 +111,7 @@ function onOK() {
try {
if (document.getElementById("resetUserPrefs").checked)
clearAllPrefs();
if (document.getElementById("resetBookmarks").checked)
if (document.getElementById("deleteBookmarks").checked)
restoreDefaultBookmarks();
if (document.getElementById("resetToolbars").checked)
deleteLocalstore();
@ -139,7 +139,7 @@ function onLoad() {
function UpdateOKButtonState() {
document.documentElement.getButton("accept").disabled =
!document.getElementById("resetUserPrefs").checked &&
!document.getElementById("resetBookmarks").checked &&
!document.getElementById("deleteBookmarks").checked &&
!document.getElementById("resetToolbars").checked &&
!document.getElementById("disableAddons").checked &&
!document.getElementById("restoreSearch").checked;

Просмотреть файл

@ -79,7 +79,7 @@
<vbox id="tasks">
<checkbox id="disableAddons" label="&disableAddons.label;" accesskey="&disableAddons.accesskey;"/>
<checkbox id="resetToolbars" label="&resetToolbars.label;" accesskey="&resetToolbars.accesskey;"/>
<checkbox id="resetBookmarks" label="&resetBookmarks.label;" accesskey="&resetBookmarks.accesskey;"/>
<checkbox id="deleteBookmarks" label="&deleteBookmarks.label;" accesskey="&deleteBookmarks.accesskey;"/>
<checkbox id="resetUserPrefs" label="&resetUserPrefs.label;" accesskey="&resetUserPrefs.accesskey;"/>
<checkbox id="restoreSearch" label="&restoreSearch.label;" accesskey="&restoreSearch.accesskey;"/>
</vbox>

Просмотреть файл

@ -460,13 +460,10 @@ Sanitizer.showUI = function(aParentWindow)
/**
* Deletes privacy sensitive data in a batch, optionally showing the
* sanitize UI, according to user preferences
*
* @returns null (displayed UI, which should handle errors)
*/
Sanitizer.sanitize = function(aParentWindow)
{
Sanitizer.showUI(aParentWindow);
return null;
};
Sanitizer.onStartup = function()

Просмотреть файл

@ -173,7 +173,8 @@
accesskey="&detailsProgressiveDisclosure.accesskey;"
control="detailsExpander"/>
</hbox>
<listbox id="itemList" rows="6" collapsed="true" persist="collapsed">
<listbox id="itemList" rows="6" collapsed="true" persist="collapsed"
flex="1">
<listitem label="&itemHistoryAndDownloads.label;"
type="checkbox"
accesskey="&itemHistoryAndDownloads.accesskey;"

Просмотреть файл

@ -1184,7 +1184,7 @@
/* In RTL UI, the tab is visually added to the left side of the
* tabstrip. This means the tabstip has to be scrolled back in
* order to make sure the same set of tabs is visible before and
* after the new tab is added */
* after the new tab is added. See bug 508816. */
this.tabContainer.mTabstrip.scrollByPixels(this.mTabs[0].clientWidth);
}
@ -1490,7 +1490,6 @@
if (aNewTab && gURLBar)
gURLBar.focus();
this.tabContainer.adjustTabstrip();
// workaround for bug 345399
this.tabContainer.mTabstrip._updateScrollButtonsDisabledState();
}
@ -1528,6 +1527,10 @@
for (let i = aTab._tPos; i < this.mTabs.length; i++)
this.mTabs[i]._tPos = i;
// update tab close buttons state
if (!this._windowIsClosing)
this.tabContainer.adjustTabstrip();
// update first-tab/last-tab/beforeselected/afterselected attributes
this.selectedTab._selected = true;

Просмотреть файл

@ -62,6 +62,14 @@ _TEST_FILES = \
offlineEvent.html \
offlineEvent.cacheManifest \
offlineEvent.cacheManifest^headers^ \
test_bug364677.html \
bug364677-data.xml \
bug364677-data.xml^headers^ \
test_offline_gzip.html \
gZipOfflineChild.html \
gZipOfflineChild.html^headers^ \
gZipOfflineChild.cacheManifest \
gZipOfflineChild.cacheManifest^headers^ \
$(NULL)
# The following tests are disabled because they are unreliable:

Просмотреть файл

@ -38,51 +38,30 @@
function test() {
waitForExplicitFinish();
let deletedURLTab, fullURLTab, partialURLTab, testPartialURL, testURL;
if (Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager).activeWindow !=
window) {
setTimeout(test, 0);
window.focus();
return;
}
let charsToDelete, deletedURLTab, fullURLTab, partialURLTab, testPartialURL, testURL;
charsToDelete = 5;
deletedURLTab = gBrowser.addTab();
fullURLTab = gBrowser.addTab();
partialURLTab = gBrowser.addTab();
testPartialURL = "http://example.org/brow";
testURL = "http://example.org/browser/browser/base/content/test/dummy_page.html";
function cleanUp() {
testPartialURL = testURL.substr(0, (testURL.length - charsToDelete));
function cleanUp() {
gBrowser.removeTab(fullURLTab);
gBrowser.removeTab(partialURLTab);
gBrowser.removeTab(deletedURLTab);
}
// function borrowed from browser_bug386835.js
function load(tab, url, cb) {
tab.linkedBrowser.addEventListener("load", function (event) {
event.currentTarget.removeEventListener("load", arguments.callee, true);
cb();
}, true);
tab.linkedBrowser.loadURI(url);
}
function runTests() {
gBrowser.selectedTab = fullURLTab;
is(gURLBar.value, testURL, 'gURLBar.value should be testURL after initial switch to fullURLTab');
gBrowser.selectedTab = partialURLTab;
is(gURLBar.value, testURL, 'gURLBar.value should be testURL after initial switch to partialURLTab');
// simulate the user removing part of the url from the location bar
gBrowser.userTypedValue = testPartialURL;
URLBarSetURI();
is(gURLBar.value, testPartialURL, 'gURLBar.value should be testPartialURL (just set)');
gBrowser.selectedTab = deletedURLTab;
is(gURLBar.value, testURL, 'gURLBar.value should be testURL after initial switch to deletedURLTab');
// simulate the user removing the whole url from the location bar
gBrowser.userTypedValue = '';
URLBarSetURI();
is(gURLBar.value, '', 'gURLBar.value should be "" (just set)');
// now cycle the tabs and make sure everything looks good
function cycleTabs() {
gBrowser.selectedTab = fullURLTab;
is(gURLBar.value, testURL, 'gURLBar.value should be testURL after switching back to fullURLTab');
@ -96,13 +75,87 @@ function test() {
is(gURLBar.value, testURL, 'gURLBar.value should be testURL after switching back to fullURLTab');
}
// function borrowed from browser_bug386835.js
function load(tab, url, cb) {
tab.linkedBrowser.addEventListener("load", function (event) {
event.currentTarget.removeEventListener("load", arguments.callee, true);
cb();
}, true);
tab.linkedBrowser.loadURI(url);
}
function urlbarBackspace(cb) {
gBrowser.selectedBrowser.focus();
gURLBar.addEventListener("focus", function () {
gURLBar.removeEventListener("focus", arguments.callee, false);
gURLBar.addEventListener("input", function () {
gURLBar.removeEventListener("input", arguments.callee, false);
cb();
}, false);
executeSoon(function () {
EventUtils.synthesizeKey("VK_BACK_SPACE", {});
});
}, false);
gURLBar.focus();
}
function prepareDeletedURLTab(cb) {
gBrowser.selectedTab = deletedURLTab;
is(gURLBar.value, testURL, 'gURLBar.value should be testURL after initial switch to deletedURLTab');
// simulate the user removing the whole url from the location bar
gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", true);
urlbarBackspace(function () {
is(gURLBar.value, "", 'gURLBar.value should be "" (just set)');
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
cb();
});
}
function prepareFullURLTab(cb) {
gBrowser.selectedTab = fullURLTab;
is(gURLBar.value, testURL, 'gURLBar.value should be testURL after initial switch to fullURLTab');
cb();
}
function preparePartialURLTab(cb) {
gBrowser.selectedTab = partialURLTab;
is(gURLBar.value, testURL, 'gURLBar.value should be testURL after initial switch to partialURLTab');
// simulate the user removing part of the url from the location bar
gPrefService.setBoolPref("browser.urlbar.clickSelectsAll", false);
var deleted = 0;
urlbarBackspace(function () {
deleted++;
if (deleted < charsToDelete) {
urlbarBackspace(arguments.callee);
} else {
is(gURLBar.value, testPartialURL, "gURLBar.value should be testPartialURL (just set)");
gPrefService.clearUserPref("browser.urlbar.clickSelectsAll");
cb();
}
});
}
function runTests() {
// prepare the three tabs required by this test
prepareFullURLTab(function () {
preparePartialURLTab(function () {
prepareDeletedURLTab(function () {
// now cycle the tabs and make sure everything looks good
cycleTabs();
cleanUp();
finish();
});
});
});
}
load(deletedURLTab, testURL, function() {
load(fullURLTab, testURL, function() {
load(partialURLTab, testURL, function() {
runTests();
cleanUp();
finish();
});
load(partialURLTab, testURL, runTests);
});
});
}

Просмотреть файл

@ -142,6 +142,7 @@ function test_paste(aCurrentTest) {
// Focus the window.
window.focus();
gBrowser.selectedBrowser.focus();
// Focus the element and wait for focus event.
info("About to focus " + element.id);

Просмотреть файл

@ -2,6 +2,8 @@ var gTestPage = "http://example.org/browser/browser/base/content/test/dummy_page
var gTestImage = "http://example.org/browser/browser/base/content/test/moz.png";
var gTab1, gTab2, gTab3;
var gLevel;
const kBack = 0;
const kForward = 1;
function test() {
waitForExplicitFinish();
@ -53,10 +55,74 @@ function imageLoaded() {
gBrowser.selectedTab = gTab1;
zoomTest(gTab1, 1, "Zoom should still be 1 when tab with image is selected");
finishTest();
executeSoon(imageZoomSwitch);
}
function imageZoomSwitch() {
navigate(kBack, function() {
navigate(kForward, function() {
zoomTest(gTab1, 1, "Tab 1 should not be zoomed when an image loads");
gBrowser.selectedTab = gTab2;
zoomTest(gTab1, 1, "Tab 1 should still not be zoomed when deselected");
// Mac OS X does not support print preview, so skip those tests
let isOSX = ("nsILocalFileMac" in Components.interfaces);
if (isOSX)
finishTest();
else
runPrintPreviewTests();
});
});
}
function runPrintPreviewTests() {
// test print preview on image document
testPrintPreview(gTab1, function() {
// test print preview on HTML document
testPrintPreview(gTab2, function() {
// test print preview on image document with siteSpecific set to false
gPrefService.setBoolPref("browser.zoom.siteSpecific", false);
testPrintPreview(gTab1, function() {
// test print preview of HTML document with siteSpecific set to false
testPrintPreview(gTab2, function() {
gPrefService.clearUserPref("browser.zoom.siteSpecific");
finishTest();
});
});
});
});
}
function testPrintPreview(aTab, aCallback) {
gBrowser.selectedTab = aTab;
FullZoom.enlarge();
let level = ZoomManager.zoom;
function onEnterPP() {
toggleAffectedChromeOrig.apply(null, arguments);
function onExitPP() {
toggleAffectedChromeOrig.apply(null, arguments);
toggleAffectedChrome = toggleAffectedChromeOrig;
zoomTest(aTab, level, "Toggling print preview mode should not affect zoom level");
FullZoom.reset();
aCallback();
}
toggleAffectedChrome = onExitPP;
PrintUtils.exitPrintPreview();
}
let toggleAffectedChromeOrig = toggleAffectedChrome;
toggleAffectedChrome = onEnterPP;
let printPreview = new Function(document.getElementById("cmd_printPreview")
.getAttribute("oncommand"));
executeSoon(printPreview);
}
function finishTest() {
gBrowser.selectedTab = gTab1;
FullZoom.reset();
gBrowser.removeTab(gTab1);
FullZoom.reset();
@ -77,3 +143,14 @@ function load(tab, url, cb) {
}, true);
tab.linkedBrowser.loadURI(url);
}
function navigate(direction, cb) {
gBrowser.addEventListener("pageshow", function(event) {
gBrowser.removeEventListener("pageshow", arguments.callee, true);
setTimeout(cb, 0);
}, true);
if (direction == kBack)
gBrowser.goBack();
else if (direction == kForward)
gBrowser.goForward();
}

Просмотреть файл

@ -29,24 +29,23 @@ function next() {
win.addEventListener("load", function () {
win.removeEventListener("load", arguments.callee, false);
win.gBrowser.addEventListener("pageshow", function() {
win.gBrowser.removeEventListener("pageshow", arguments.callee, false);
var _delayedStartup = win.delayedStartup;
win.delayedStartup = function delayedStartup() {
_delayedStartup.apply(win, arguments);
win.delayedStartup = _delayedStartup;
// wait for delayedStartup
win.setTimeout(function () {
is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
is(win.gURLBar.value, "", uri + ": urlbar is empty");
ok(win.gURLBar.emptyText, uri + ": emptytext is present");
ok(win.gURLBar.hasAttribute("isempty"), uri + ": emptytext is displayed");
is(win.gBrowser.currentURI.spec, uri, uri + ": uri loaded in detached tab");
is(win.document.activeElement, win.gBrowser.selectedBrowser, uri + ": browser is focused");
is(win.gURLBar.value, "", uri + ": urlbar is empty");
ok(win.gURLBar.emptyText, uri + ": emptytext is present");
ok(win.gURLBar.hasAttribute("isempty"), uri + ": emptytext is displayed");
win.close();
if (uris.length)
next();
else
executeSoon(finish);
}, 100);
}, false);
win.close();
if (uris.length)
next();
else
executeSoon(finish);
};
}, false);
}
}

Просмотреть файл

@ -3,10 +3,7 @@ function test() {
if (Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager).activeWindow !=
window) {
window.addEventListener("focus", function () {
window.removeEventListener("focus", arguments.callee, false);
test();
}, false);
setTimeout(test, 0);
window.focus();
return;
}

Просмотреть файл

@ -0,0 +1,5 @@
<rss version="2.0">
<channel>
<title>t</title>
</channel>
</rss>

Просмотреть файл

@ -0,0 +1 @@
Content-Type: text/xml

Просмотреть файл

@ -0,0 +1,2 @@
CACHE MANIFEST
gZipOfflineChild.html

Просмотреть файл

@ -0,0 +1 @@
Content-Type: text/cache-manifest

Двоичные данные
browser/base/content/test/gZipOfflineChild.html Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,2 @@
Content-Type: text/html
Content-Encoding: gzip

Просмотреть файл

@ -0,0 +1,21 @@
<html manifest="gZipOfflineChild.cacheManifest">
<head>
<!-- This file is gzipped to create gZipOfflineChild.html -->
<title></title>
<script type="text/javascript">
function finish(success) {
window.parent.postMessage(success, "*");
}
applicationCache.oncached = function() { finish("oncache"); }
applicationCache.onnoupdate = function() { finish("onupdate"); }
applicationCache.onerror = function() { finish("onerror"); }
</script>
</head>
<body>
<h1>Child</h1>
</body>
</html>

Просмотреть файл

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=364677
-->
<head>
<title>Test for Bug 364677</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=364677">Mozilla Bug 364677</a>
<p id="display"><iframe id="testFrame" src="bug364677-data.xml"></iframe></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 364677 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
// Need privs because the feed seems to have an about:feeds principal or some
// such. It's not same-origin with us in any case.
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
is($("testFrame").contentDocument.documentElement.id, "feedHandler",
"Feed served as text/xml without a channel/link should have been sniffed");
});
addLoadEvent(SimpleTest.finish);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -28,28 +28,8 @@ function openContextMenuFor(element) {
// Context menu should be closed before we open it again.
is(contextMenu.state, "closed", "checking if popup is closed");
// XXX this doesn't work:
// var eventDetails = { type : "contextmenu", button : 2 }
// synthesizeMouse(element, 50, 90, eventDetails);
//
// It triggers the popup, but then we fail in nsContextMenu when
// initializing: ine 565: this.target.ownerDocument is null
// |this.target| was assigned there from |document.popupNode|, but it's a
// HTMLDocument instead of the node we supposedly fired the event at.
// I think the event's |target| is never being set, and we're hitting the
// fallback case in nsXULPopupListener::PreLaunchPopup.
//
// Also interesting is that just firing a mousedown+mouseup doesn't seem
// to do anything. Not clear why we'd specifically have to fire a
// contextmenu event instead of just a right-click.
// This seems to work, as long as we explicitly set the popupNode first.
// For frames, the popupNode needs to be set to inside the frame.
if (element.localName == "iframe")
chromeWin.document.popupNode = element.contentDocument.body;
else
chromeWin.document.popupNode = element;
contextMenu.openPopup(element, "overlap", 5, 5, true, false);
var eventDetails = { type : "contextmenu", button : 2 }
synthesizeMouse(element, 2, 2, eventDetails, element.ownerDocument.defaultView);
}
function closeContextMenu() {
@ -387,8 +367,24 @@ function startTest() {
// The frame causes an extra menu item, and prevents running the test
// standalone (ie, clicking the test name in the Mochitest window) to see
// success/failure messages.
var painted = false, loaded = false;
function waitForEvents(event)
{
if (event.type == "MozAfterPaint")
painted = true;
else if (event.type == "load")
loaded = true;
if (painted && loaded) {
subwindow.removeEventListener("MozAfterPaint", waitForEvents, false);
subwindow.onload = null;
startTest();
}
}
var subwindow = window.open("./subtst_contextmenu.html", "contextmenu-subtext", "width=600,height=700");
subwindow.onload = startTest;
subwindow.addEventListener("MozAfterPaint", waitForEvents, false);
subwindow.onload = waitForEvents;
SimpleTest.waitForExplicitFinish();
</script>

Просмотреть файл

@ -0,0 +1,114 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=501422
When content which was transported over the network with
Content-Type: gzip is added to the offline
cache, it can be fetched from the cache successfully.
-->
<head>
<title>Test gzipped offline resources</title>
<script type="text/javascript"
src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript"
src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="loaded()">
<p id="display">
<iframe name="testFrame" src="gZipOfflineChild.html"></iframe>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
var cacheCount = 0;
var intervalID = 0;
window.addEventListener("message", handleMessageEvents, false);
SimpleTest.waitForExplicitFinish();
function finishTest() {
// Clean up after ourselves.
netscape.security.PrivilegeManager
.enablePrivilege("UniversalXPConnect");
var pm = Components.classes["@mozilla.org/permissionmanager;1"].
getService(Components.interfaces.nsIPermissionManager);
pm.remove("localhost", "offline-app");
window.removeEventListener("message", handleMessageEvents, false);
SimpleTest.finish();
}
////
// Handle "message" events which are posted from the iframe upon
// offline cache events.
//
function handleMessageEvents(event) {
cacheCount++;
switch (cacheCount) {
case 1:
// This is the initial caching off offline data.
is(event.data, "oncache", "Child was successfully cached.");
// Reload the frame; this will generate an error message
// in the case of bug 501422.
frames.testFrame.window.location.reload();
// Use setInterval to repeatedly call a function which
// checks that one of two things has occurred: either
// the offline cache is udpated (which means our iframe
// successfully reloaded), or the string "error" appears
// in the iframe, as in the case of bug 501422.
intervalID = setInterval(function() {
netscape.security.PrivilegeManager
.enablePrivilege("UniversalXPConnect");
// Sometimes document.body may not exist, and trying to access
// it will throw an exception, so handle this case.
try {
var bodyInnerHTML = frames.testFrame.document.body.innerHTML;
}
catch (e) {
var bodyInnerHTML = "";
}
if (cacheCount == 2 || (bodyInnerHTML.indexOf("error") != -1)) {
clearInterval(intervalID);
is(cacheCount, 2, "frame not reloaded successfully");
if (cacheCount != 2) {
finishTest();
}
}
}, 100);
break;
case 2:
is(event.data, "onupdate", "Child was successfully updated.");
finishTest();
break;
default:
// how'd we get here?
ok(false, "cacheCount not 1 or 2");
}
}
function loaded() {
// Click the notification bar's "Allow" button. This should kick
// off updates, which will eventually lead to getting messages from
// the iframe.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
getService(Components.interfaces.nsIWindowMediator);
var win = wm.getMostRecentWindow("navigator:browser");
var notificationBox = win.gBrowser.getNotificationBox();
var notification = notificationBox
.getNotificationWithValue("offline-app-requested-localhost");
notification.childNodes[0].click();
}
</script>
</pre>
</body>
</html>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше