--- a/.hgtags
+++ b/.hgtags
@@ -1,1 +1,2 @@
df7a3c8ffeeaba229067efee5a20e21dae0dd877 MOZILLA_1_9_a4_BASE
+4209e16b58411750ac73f761023e46b76b793e2c MOZILLA_1_9_a6_BASE
--- a/Makefile.in
+++ b/Makefile.in
@@ -106,17 +106,17 @@ endif
distclean::
cat unallmakefiles | $(XARGS) rm -f
rm -f unallmakefiles $(DIST_GARBAGE)
ifeq ($(OS_ARCH),WINNT)
rebase:
ifdef MOZILLA_OFFICIAL
echo rebasing $(DIST)
- /bin/find $(DIST) -name "*.dll" > rebase.lst
+ /bin/find $(DIST) -name "*.dll" -a -not -name "msvc*" > rebase.lst
rebase -b 60000000 -R . -G rebase.lst
rm rebase.lst
endif
splitsymbols:
ifdef MOZILLA_OFFICIAL
ifdef MOZ_DEBUG_SYMBOLS
echo finding pdb files
@@ -132,56 +132,51 @@ ifdef MOZ_PROFILE
/bin/find $(DIST) -name "*.EXE" -exec splitsym {} \;
mkdir -p $(DIST)/$(BUILDID)
/bin/find $(DIST) -name "*.dbg" -exec mv {} $(DIST)/$(BUILDID) \;
endif # MOZ_PROFILE
endif # MOZILLA_OFFICIAL
endif # WINNT
ifeq ($(OS_ARCH),WINNT)
-SYM_FIND_CMD := /bin/find . -path dist -prune -o -name "*.exe" \
- -o -name "*.dll" -o -name "*.EXE" | sed "s/\.[^\.]*$$/\.pdb/"
# we want to copy PDB files on Windows
MAKE_SYM_STORE_ARGS := -c
DUMP_SYMS_BIN := $(topsrcdir)/toolkit/airbag/tools/win32/dump_syms.exe
+# PDB files don't get moved to dist, so we need to scan the whole objdir
+MAKE_SYM_STORE_PATH := .
endif
ifeq ($(OS_ARCH),Darwin)
# need to pass arch flags for universal builds
ifdef UNIVERSAL_BINARY
-MAKE_SYM_STORE_ARGS := -a "ppc i386"
-SYM_DIST := $(DIST)/universal
+MAKE_SYM_STORE_ARGS := -a "ppc i386" --vcs-info
+MAKE_SYM_STORE_PATH := $(DIST)/universal
else
-MAKE_SYM_STORE_ARGS := -a $(OS_TEST)
-SYM_DIST := $(DIST)
+MAKE_SYM_STORE_ARGS := -a $(OS_TEST) --vcs-info
+MAKE_SYM_STORE_PATH := $(DIST)/bin
endif
-# |file| is stupid on universal binaries, it produces one line of output
-# for the file, and one line of output for each architecture contained within.
-SYM_FIND_CMD := find -L $(SYM_DIST) -type f -a -perm -100 -o -name "*.dylib" \
- | xargs file -L | grep "Mach-O" | grep -v "for architecture" | cut -f1 -d':'
DUMP_SYMS_BIN := $(DIST)/host/bin/dump_syms
endif
ifeq ($(OS_ARCH),Linux)
-MAKE_SYM_STORE_ARGS :=
-SYM_FIND_CMD := find -L $(DIST)/bin -type f -a -perm -100 -o -name "*.so" \
- | xargs file -L | grep "ELF" | cut -f1 -d':'
+MAKE_SYM_STORE_ARGS := --vcs-info
DUMP_SYMS_BIN := $(DIST)/host/bin/dump_syms
+MAKE_SYM_STORE_PATH := $(DIST)/bin
endif
ifdef MOZ_SYMBOLS_EXTRA_BUILDID
EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
endif
buildsymbols:
ifdef MOZ_AIRBAG
echo building symbol store
mkdir -p $(DIST)/crashreporter-symbols/$(BUILDID)
- $(SYM_FIND_CMD) | \
- xargs $(topsrcdir)/toolkit/airbag/tools/make_symbol_store.pl \
- $(MAKE_SYM_STORE_ARGS) $(DUMP_SYMS_BIN) \
- $(DIST)/crashreporter-symbols/$(BUILDID) > \
+ $(PYTHON) $(topsrcdir)/toolkit/airbag/tools/symbolstore.py \
+ $(MAKE_SYM_STORE_ARGS) -s $(topsrcdir) $(DUMP_SYMS_BIN) \
+ $(DIST)/crashreporter-symbols/$(BUILDID) \
+ $(MAKE_SYM_STORE_PATH) > \
$(DIST)/crashreporter-symbols/$(BUILDID)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_ARCH)-$(BUILDID)$(EXTRA_BUILDID)-symbols.txt
echo packing symbols
mkdir -p $(topsrcdir)/../$(BUILDID)
cd $(DIST)/crashreporter-symbols/$(BUILDID) && \
zip -r9D ../crashreporter-symbols-$(BUILDID).zip .
mv $(DIST)/crashreporter-symbols/crashreporter-symbols-$(BUILDID).zip \
$(topsrcdir)/../$(BUILDID)
endif # MOZ_AIRBAG
@@ -198,9 +193,9 @@ ifdef MOZILLA_OFFICIAL
cd $(DIST)/bin; ./shlibsign.exe -v -i softokn3.dll
cd $(DIST)/bin; ./shlibsign.exe -v -i freebl3.dll
endif # MOZILLA_OFFICIAL
deliver: splitsymbols rebase signnss
endif # WINNT
-BUILDID = $(shell cat $(DEPTH)/config/build_number)
+BUILDID = $(shell $(PYTHON) $(srcdir)/config/printconfigsetting.py $(DIST)/bin/application.ini App BuildID)
--- a/accessible/public/nsIAccessibilityService.idl
+++ b/accessible/public/nsIAccessibilityService.idl
@@ -40,24 +40,23 @@
#include "nsIAccessibleRetrieval.idl"
interface nsIAccessibleEventListener;
interface nsIDocument;
interface nsIFrame;
interface nsObjectFrame;
interface nsIContent;
-[uuid(e4cdb7c5-d029-4bee-bff5-99455c6e0057)]
+[uuid(933f7472-cbe3-4d95-a77a-ce7ea3812b32)]
interface nsIAccessibilityService : nsIAccessibleRetrieval
{
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
nsIAccessible createRootAccessible(in nsIPresShell aShell, in nsIDocument aDocument);
nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame);
- nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent);
nsIAccessible createHyperTextAccessible(in nsISupports aFrame);
nsIAccessible createHTMLBRAccessible(in nsISupports aFrame);
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLAccessibleByMarkup(in nsIFrame aFrame, in nsIWeakReference aWeakShell, in nsIDOMNode aDOMNode, in AString aRole);
nsIAccessible createHTMLLIAccessible(in nsISupports aFrame, in nsISupports aBulletFrame, in AString aBulletText);
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
nsIAccessible createHTMLGenericAccessible(in nsISupports aFrame);
@@ -69,16 +68,17 @@ interface nsIAccessibilityService : nsIA
nsIAccessible createHTMLObjectFrameAccessible(in nsObjectFrame aFrame);
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsIWeakReference aPresShell);
nsIAccessible createHTMLTableAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTableCellAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTableHeadAccessible(in nsIDOMNode aDOMNode);
nsIAccessible createHTMLTextAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTextFieldAccessible(in nsISupports aFrame);
+ nsIAccessible createHTMLCaptionAccessible(in nsISupports aFrame);
nsIAccessible getAccessible(in nsIDOMNode aNode, in nsIPresShell aPresShell,
in nsIWeakReference aWeakShell,
inout nsIFrame frameHint, out boolean aIsHidden);
// For gtk+ native window accessible
nsIAccessible addNativeRootAccessible(in voidPtr aAtkAccessible);
void removeNativeRootAccessible(in nsIAccessible aRootAccessible);
--- a/accessible/public/nsIAccessibleDocument.idl
+++ b/accessible/public/nsIAccessibleDocument.idl
@@ -53,17 +53,17 @@ interface nsIDOMWindow;
* You can QueryInterface to nsIAccessibleDocument from
* the nsIAccessible or nsIAccessNode for the root node
* of a document. You can also get one from
* nsIAccessNode::GetAccessibleDocument() or
* nsIAccessibleEvent::GetAccessibleDocument()
*
* @status UNDER_REVIEW
*/
-[scriptable, uuid(ae5792a3-77ad-40d6-8450-d28d19b66889)]
+[scriptable, uuid(6cc11286-e02d-4a8d-960a-e7a61161b230)]
interface nsIAccessibleDocument : nsISupports
{
/**
* The URL of the document
*/
readonly attribute AString URL;
/**
@@ -115,10 +115,10 @@ interface nsIAccessibleDocument : nsISup
* Returns the first accessible parent of a DOM node.
* Guaranteed not to return nsnull if the DOM node is in a document.
* @param aDOMNode The DOM node we need an accessible for.
* @param aCanCreate Can accessibles be created or must it be the first
* cached accessible in the parent chain?
* @return An first nsIAccessible found by crawling up the DOM node
* to the document root.
*/
- nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode, in boolean aCanCreate);
+ nsIAccessible getAccessibleInParentChain(in nsIDOMNode aDOMNode);
};
--- a/accessible/public/nsIAccessibleEditableText.idl
+++ b/accessible/public/nsIAccessibleEditableText.idl
@@ -36,30 +36,83 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
-[scriptable, uuid(91F0A56C-11BE-47C7-8D02-7C15E00C05F5)]
+interface nsIEditor;
+
+[scriptable, uuid(52837507-202d-4e72-a482-5f068a1fd720)]
interface nsIAccessibleEditableText : nsISupports
{
- /**
- * Set font styles, such as italic, bold...
- */
+ /**
+ * Sets the attributes for the text between the two given indices. The old
+ * attributes are replaced by the new list of attributes. For example,
+ * sets font styles, such as italic, bold...
+ *
+ * @param startPos - start index of the text whose attributes are modified.
+ * @param endPos - end index of the text whose attributes are modified.
+ * @param attributes - set of attributes that replaces the old list of
+ * attributes of the specified text portion.
+ */
void setAttributes (in long startPos, in long endPos,
in nsISupports attributes);
+
+ /**
+ * Replaces the text represented by this object by the given text.
+ */
void setTextContents (in AString text);
+
+ /**
+ * Inserts text at the specified position.
+ *
+ * @param text - text that is inserted.
+ * @param position - index at which to insert the text.
+ */
void insertText (in AString text, in long position);
+
+ /**
+ * Copies the text range into the clipboard.
+ *
+ * @param startPos - start index of the text to moved into the clipboard.
+ * @param endPos - end index of the text to moved into the clipboard.
+ */
void copyText (in long startPos, in long endPos);
+
+ /**
+ * Deletes a range of text and copies it to the clipboard.
+ *
+ * @param startPos - start index of the text to be deleted.
+ * @param endOffset - end index of the text to be deleted.
+ */
void cutText (in long startPos, in long endPos);
+
+ /**
+ * Deletes a range of text.
+ *
+ * @param startPos - start index of the text to be deleted.
+ * @param endPos - end index of the text to be deleted.
+ */
void deleteText (in long startPos, in long endPos);
+
+ /**
+ * Pastes text from the clipboard.
+ *
+ * @param position - index at which to insert the text from the system
+ * clipboard into the text represented by this object.
+ */
void pasteText (in long position);
+
+ /**
+ * Returns an editor associated with the accessible.
+ */
+ [noscript] readonly attribute nsIEditor associatedEditor;
};
/*
Assumptions:
selectAttributes method takes an nsISupports parameter.
'set' methods throw exception on failure.
'wstring' inputs are potentially multibyte (UTF-16 for
--- a/accessible/public/nsIAccessibleEvent.idl
+++ b/accessible/public/nsIAccessibleEvent.idl
@@ -536,8 +536,17 @@ interface nsIAccessibleTextChangeEvent :
readonly attribute unsigned long length;
/**
* Returns true if text was inserted, otherwise false.
*/
boolean isInserted();
};
+[scriptable, uuid(b9076dce-4cd3-4e3d-a7f6-7f33a7f40c31)]
+interface nsIAccessibleCaretMoveEvent: nsIAccessibleEvent
+{
+ /**
+ * Return caret offset.
+ */
+ readonly attribute long caretOffset;
+};
+
--- a/accessible/public/nsIAccessibleProvider.idl
+++ b/accessible/public/nsIAccessibleProvider.idl
@@ -94,16 +94,17 @@ interface nsIAccessibleProvider : nsISup
const long XULText = 0x00001024;
const long XULTextBox = 0x00001025;
const long XULTree = 0x00001026;
const long XULTreeColumns = 0x00001027;
const long XULTreeColumnitem = 0x00001028;
const long XULToolbar = 0x00001029;
const long XULToolbarSeparator = 0x00001030;
const long XULTooltip = 0x00001031;
+ const long XULToolbarButton = 0x00001032;
/**
* Constants set is used by XForms elements.
*/
/** Used for xforms elements that provide accessible object for itself as
* well for anonymous content. This property are used for upload,
--- a/accessible/public/nsIAccessibleTable.idl
+++ b/accessible/public/nsIAccessibleTable.idl
@@ -38,43 +38,63 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIAccessible;
-[scriptable, uuid(a776fee4-c0b8-4872-9e1e-72017243383f)]
+[scriptable, uuid(dcc1e5c3-966e-45b2-b30a-839d35432b24)]
interface nsIAccessibleTable : nsISupports
{
- attribute nsIAccessible caption;
- attribute AString summary;
+ readonly attribute nsIAccessible caption;
+ readonly attribute AString summary;
readonly attribute long columns;
readonly attribute nsIAccessibleTable columnHeader;
readonly attribute long rows;
readonly attribute nsIAccessibleTable rowHeader;
/**
* Returns the accessible object at the specified row and column in the table.
* If both row and column index are valid then the corresponding accessible
* object is returned that represents the requested cell regardless of whether
* the cell is currently visible (on the screen).
*
* @param row - The row index for which to retrieve the cell.
* @param column - The column index for which to retrieve the cell.
*/
nsIAccessible cellRefAt(in long row, in long column);
- /**
- * get an index
- */
- long getIndexAt (in long row, in long column);
- long getColumnAtIndex (in long index);
- long getRowAtIndex (in long index);
+ /**
+ * Translates the given row and column indices into the corresponding cell
+ * index.
+ *
+ * @param row - index of the row of the table for which to return the cell
+ * index.
+ * @param column - index of the column of the table for which to return
+ * the cell index.
+ */
+ long getIndexAt(in long row, in long column);
+
+ /**
+ * Translates the given child index into the corresponding column index.
+ *
+ * @param index - index of the child of the table for which to return
+ * the column index.
+ */
+ long getColumnAtIndex(in long index);
+
+ /**
+ * Translates the given child index into the corresponding row index.
+ *
+ * @param index - index of the child of the table for which to return
+ * the row index.
+ */
+ long getRowAtIndex(in long index);
/**
* Returns the number of columns occupied by the accessible object
* at the specified row and column in the table. The result differs from 1
* if the specified cell spans multiple columns.
*
* @param row - Row index of the accessible for which to return
* the column extent.
@@ -132,16 +152,40 @@ interface nsIAccessibleTable : nsISuppor
* @param row - Index of the row for the cell to determine whether it is
* selected.
* @param column - Index of the column for the cell to determine whether it
* is selected.
*/
boolean isCellSelected(in long row, in long column);
/**
+ * Returns the total number of selected cells.
+ */
+ readonly attribute unsigned long selectedCellsCount;
+
+ /**
+ * Returns the total number of selected columns.
+ */
+ readonly attribute unsigned long selectedColumnsCount;
+
+ /**
+ * Returns the total number of selected rows.
+ */
+ readonly attribute unsigned long selectedRowsCount;
+
+ /**
+ * Returns a list of cells indexes currently selected.
+ *
+ * @param cellsSize - length of array
+ * @param cells - array of indexes of selected cells
+ */
+ void getSelectedCells(out unsigned long cellsSize,
+ [retval, array, size_is(cellsSize)] out long cells);
+
+ /**
* Returns a list of column indexes currently selected.
*
* @param columnsSize - Length of array
* @param columns - Array of indexes of selected columns
*/
void getSelectedColumns(out unsigned long columnsSize,
[retval, array, size_is(columnsSize)] out long columns);
--- a/accessible/public/nsPIAccessible.idl
+++ b/accessible/public/nsPIAccessible.idl
@@ -36,17 +36,17 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIAccessible;
interface nsIAccessibleEvent;
-[uuid(e4865da3-f292-4f1a-9c56-dd307f1bdc17)]
+[uuid(817ae493-b238-4fbc-a623-d20ed81eebcd)]
interface nsPIAccessible : nsISupports
{
/**
* Set accessible parent.
*/
void setParent(in nsIAccessible aAccParent);
/**
--- a/accessible/src/atk/nsAccessNodeWrap.cpp
+++ b/accessible/src/atk/nsAccessNodeWrap.cpp
@@ -67,12 +67,10 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
void nsAccessNodeWrap::InitAccessibility()
{
nsAccessNode::InitXPAccessibility();
}
void nsAccessNodeWrap::ShutdownAccessibility()
{
nsAccessNode::ShutdownXPAccessibility();
+}
- // Shutdown accessibility for ATK
- nsApplicationAccessibleWrap::Unload();
-}
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -35,17 +35,19 @@
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibleWrap.h"
-#include "nsAccessibleEventData.h"
+#include "nsRootAccessible.h"
+#include "nsDocAccessibleWrap.h"
+#include "nsIAccessibleValue.h"
#include "nsString.h"
#include "nsAutoPtr.h"
#include "prprf.h"
#include "nsRoleMap.h"
#include "nsStateMap.h"
#include "nsMaiInterfaceComponent.h"
#include "nsMaiInterfaceAction.h"
@@ -302,26 +304,31 @@ nsAccessibleWrap::~nsAccessibleWrap()
#ifdef MAI_LOGGING
++mAccWrapDeleted;
#endif
MAI_LOG_DEBUG(("==nsAccessibleWrap deleting: this=%p,total=%d left=%d\n",
(void*)this, mAccWrapDeleted,
(mAccWrapCreated-mAccWrapDeleted)));
}
-NS_IMETHODIMP nsAccessibleWrap::Shutdown()
+void nsAccessibleWrap::ShutdownAtkObject()
{
if (mAtkObject) {
if (IS_MAI_OBJECT(mAtkObject)) {
MAI_ATK_OBJECT(mAtkObject)->accWrap = nsnull;
}
SetMaiHyperlink(nsnull);
g_object_unref(mAtkObject);
mAtkObject = nsnull;
}
+}
+
+NS_IMETHODIMP nsAccessibleWrap::Shutdown()
+{
+ ShutdownAtkObject();
return nsAccessible::Shutdown();
}
MaiHyperlink* nsAccessibleWrap::GetMaiHyperlink(PRBool aCreate /* = PR_TRUE */)
{
// make sure mAtkObject is created
GetAtkObject();
@@ -364,35 +371,35 @@ NS_IMETHODIMP nsAccessibleWrap::GetNativ
if (!IsEmbeddedObject(this)) {
// We don't create ATK objects for nsIAccessible plain text leaves
return NS_ERROR_FAILURE;
}
GType type = GetMaiAtkType(CreateMaiInterfaces());
NS_ENSURE_TRUE(type, NS_ERROR_FAILURE);
mAtkObject =
- NS_REINTERPRET_CAST(AtkObject *,
- g_object_new(type, NULL));
+ reinterpret_cast<AtkObject *>
+ (g_object_new(type, NULL));
NS_ENSURE_TRUE(mAtkObject, NS_ERROR_OUT_OF_MEMORY);
atk_object_initialize(mAtkObject, this);
mAtkObject->role = ATK_ROLE_INVALID;
mAtkObject->layer = ATK_LAYER_INVALID;
}
*aOutAccessible = mAtkObject;
return NS_OK;
}
AtkObject *
nsAccessibleWrap::GetAtkObject(void)
{
void *atkObj = nsnull;
GetNativeInterface(&atkObj);
- return NS_STATIC_CAST(AtkObject *, atkObj);
+ return static_cast<AtkObject *>(atkObj);
}
// Get AtkObject from nsIAccessible interface
/* static */
AtkObject *
nsAccessibleWrap::GetAtkObject(nsIAccessible * acc)
{
void *atkObjPtr = nsnull;
@@ -678,17 +685,17 @@ initializeCB(AtkObject *aAtkObj, gpointe
* maybe it has later
*/
if (ATK_OBJECT_CLASS(parent_class)->initialize)
ATK_OBJECT_CLASS(parent_class)->initialize(aAtkObj, aData);
/* initialize object */
MAI_ATK_OBJECT(aAtkObj)->accWrap =
- NS_STATIC_CAST(nsAccessibleWrap*, aData);
+ static_cast<nsAccessibleWrap*>(aData);
#ifdef MAI_LOGGING
++sMaiAtkObjCreated;
#endif
MAI_LOG_DEBUG(("MaiAtkObj Create obj=%p for AccWrap=%p, all=%d, left=%d\n",
(void*)aAtkObj, (void*)aData, sMaiAtkObjCreated,
(sMaiAtkObjCreated-sMaiAtkObjDeleted)));
}
@@ -770,29 +777,45 @@ getRoleCB(AtkObject *aAtkObj)
if (aAtkObj->role == ATK_ROLE_INVALID) {
PRUint32 accRole, atkRole;
nsresult rv = accWrap->GetFinalRole(&accRole);
NS_ENSURE_SUCCESS(rv, ATK_ROLE_INVALID);
atkRole = atkRoleMap[accRole]; // map to the actual value
NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
- aAtkObj->role = NS_STATIC_CAST(AtkRole, atkRole);
+ aAtkObj->role = static_cast<AtkRole>(atkRole);
}
return aAtkObj->role;
}
AtkAttributeSet *
GetAttributeSet(nsIAccessible* aAccessible)
{
AtkAttributeSet *objAttributeSet = nsnull;
nsCOMPtr<nsIPersistentProperties> attributes;
aAccessible->GetAttributes(getter_AddRefs(attributes));
+
+ if (attributes) {
+ // Deal with attributes that we only need to expose in ATK
+ PRUint32 state, extraState;
+ aAccessible->GetFinalState(&state, &extraState);
+ if (state & nsIAccessibleStates::STATE_HASPOPUP) {
+ // There is no ATK state for haspopup, must use object attribute to expose the same info
+ nsAutoString oldValueUnused;
+ attributes->SetStringProperty(NS_LITERAL_CSTRING("haspopup"), NS_LITERAL_STRING("true"),
+ oldValueUnused);
+ }
+ if (state & nsIAccessibleStates::STATE_CHECKABLE) {
+ // There is no ATK state for haspopup, must use object attribute to expose the same info
+ nsAutoString oldValueUnused;
+ attributes->SetStringProperty(NS_LITERAL_CSTRING("checkable"), NS_LITERAL_STRING("true"),
+ oldValueUnused);
+ }
- if (attributes) {
nsCOMPtr<nsISimpleEnumerator> propEnum;
nsresult rv = attributes->Enumerate(getter_AddRefs(propEnum));
NS_ENSURE_SUCCESS(rv, nsnull);
PRBool hasMore;
while (NS_SUCCEEDED(propEnum->HasMoreElements(&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> sup;
rv = propEnum->GetNext(getter_AddRefs(sup));
@@ -939,17 +962,17 @@ getIndexInParentCB(AtkObject *aAtkObj)
nsCOMPtr<nsIAccessible> sibling;
parent->GetFirstChild(getter_AddRefs(sibling));
if (!sibling) {
return -1; // Error, parent has no children
}
PRInt32 currentIndex = 0;
- while (sibling != NS_STATIC_CAST(nsIAccessible*, accWrap)) {
+ while (sibling != static_cast<nsIAccessible*>(accWrap)) {
NS_ASSERTION(sibling, "Never ran into the same child that we started from");
if (!sibling) {
return -1;
}
if (nsAccessible::IsEmbeddedObject(sibling)) {
++ currentIndex;
}
@@ -1032,27 +1055,27 @@ refRelationSetCB(AtkObject *aAtkObj)
nsIAccessibleRelation::RELATION_EMBEDS,
nsIAccessibleRelation::RELATION_FLOWS_TO,
nsIAccessibleRelation::RELATION_FLOWS_FROM,
nsIAccessibleRelation::RELATION_DESCRIBED_BY,
nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
};
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(relationType); i++) {
- relation = atk_relation_set_get_relation_by_type(relation_set, NS_STATIC_CAST(AtkRelationType, relationType[i]));
+ relation = atk_relation_set_get_relation_by_type(relation_set, static_cast<AtkRelationType>(relationType[i]));
if (relation) {
atk_relation_set_remove(relation_set, relation);
}
nsIAccessible* accRelated;
nsresult rv = accWrap->GetAccessibleRelated(relationType[i], &accRelated);
if (NS_SUCCEEDED(rv) && accRelated) {
accessible_array[0] = nsAccessibleWrap::GetAtkObject(accRelated);
relation = atk_relation_new(accessible_array, 1,
- NS_STATIC_CAST(AtkRelationType, relationType[i]));
+ static_cast<AtkRelationType>(relationType[i]));
atk_relation_set_add(relation_set, relation);
g_object_unref(relation);
}
}
return relation_set;
}
@@ -1068,17 +1091,17 @@ nsAccessibleWrap *GetAccessibleWrap(AtkO
return nsnull;
}
NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, nsnull);
nsRefPtr<nsApplicationAccessibleWrap> appAccWrap =
nsAccessNode::GetApplicationAccessible();
nsAccessibleWrap* tmpAppAccWrap =
- NS_STATIC_CAST(nsAccessibleWrap*, appAccWrap.get());
+ static_cast<nsAccessibleWrap*>(appAccWrap.get());
if (tmpAppAccWrap != tmpAccWrap && !tmpAccWrap->IsValidObject())
return nsnull;
return tmpAccWrap;
}
NS_IMETHODIMP
@@ -1090,36 +1113,270 @@ nsAccessibleWrap::FireAccessibleEvent(ns
nsCOMPtr<nsIAccessible> accessible;
aEvent->GetAccessible(getter_AddRefs(accessible));
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
PRUint32 type = 0;
rv = aEvent->GetEventType(&type);
NS_ENSURE_SUCCESS(rv, rv);
+ nsAccEvent *event = reinterpret_cast<nsAccEvent*>(aEvent);
+ void *eventData = event->mEventData;
+
AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accessible);
// We don't create ATK objects for nsIAccessible plain text leaves,
// just return NS_OK in such case
if (!atkObj) {
NS_ASSERTION(type == nsIAccessibleEvent::EVENT_SHOW ||
type == nsIAccessibleEvent::EVENT_HIDE,
"Event other than SHOW and HIDE fired for plain text leaves");
return NS_OK;
}
+ nsAccessibleWrap *accWrap = GetAccessibleWrap(atkObj);
+ if (!accWrap) {
+ return NS_OK; // Node is shut down
+ }
+
+ AtkTableChange * pAtkTableChange = nsnull;
+
switch (type) {
case nsIAccessibleEvent::EVENT_STATE_CHANGE:
return FireAtkStateChangeEvent(aEvent, atkObj);
case nsIAccessibleEvent::EVENT_TEXT_CHANGED:
return FireAtkTextChangedEvent(aEvent, atkObj);
case nsIAccessibleEvent::EVENT_PROPERTY_CHANGED:
return FireAtkPropChangedEvent(aEvent, atkObj);
+
+ case nsIAccessibleEvent::EVENT_FOCUS:
+ {
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
+ nsRefPtr<nsRootAccessible> rootAccWrap = accWrap->GetRootAccessible();
+ if (rootAccWrap && rootAccWrap->mActivated) {
+ atk_focus_tracker_notify(atkObj);
+ // Fire state change event for focus
+ nsCOMPtr<nsIAccessibleStateChangeEvent> stateChangeEvent =
+ new nsAccStateChangeEvent(accessible,
+ nsIAccessibleStates::STATE_FOCUSED,
+ PR_FALSE, PR_TRUE);
+ return FireAtkStateChangeEvent(stateChangeEvent, atkObj);
+ }
+ } break;
+
+ case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
+ {
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_VALUE_CHANGE\n"));
+ nsCOMPtr<nsIAccessibleValue> value(do_QueryInterface(accessible));
+ if (value) { // Make sure this is a numeric value
+ // Don't fire for MSAA string value changes (e.g. text editing)
+ // ATK values are always numeric
+ g_object_notify( (GObject*)atkObj, "accessible-value" );
+ }
+ } break;
+
+ case nsIAccessibleEvent::EVENT_SELECTION_CHANGED:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_SELECTION_CHANGED\n"));
+ g_signal_emit_by_name(atkObj, "selection_changed");
+ break;
+
+ case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_SELECTION_CHANGED\n"));
+ g_signal_emit_by_name(atkObj, "text_selection_changed");
+ break;
+
+ case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
+ {
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
+
+ nsCOMPtr<nsIAccessibleCaretMoveEvent> caretMoveEvent(do_QueryInterface(aEvent));
+ NS_ASSERTION(caretMoveEvent, "Event needs event data");
+ if (!caretMoveEvent)
+ break;
+
+ PRInt32 caretOffset = -1;
+ caretMoveEvent->GetCaretOffset(&caretOffset);
+
+ MAI_LOG_DEBUG(("\n\nCaret postion: %d", caretOffset));
+ g_signal_emit_by_name(atkObj,
+ "text_caret_moved",
+ // Curent caret position
+ caretOffset);
+ } break;
+
+ case nsIAccessibleEvent::EVENT_TABLE_MODEL_CHANGED:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_MODEL_CHANGED\n"));
+ g_signal_emit_by_name(atkObj, "model_changed");
+ break;
+
+ case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
+ NS_ASSERTION(eventData, "Event needs event data");
+ if (!eventData)
+ break;
+
+ pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
+
+ g_signal_emit_by_name(atkObj,
+ "row_inserted",
+ // After which the rows are inserted
+ pAtkTableChange->index,
+ // The number of the inserted
+ pAtkTableChange->count);
+ break;
+
+ case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
+ NS_ASSERTION(eventData, "Event needs event data");
+ if (!eventData)
+ break;
+
+ pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
+
+ g_signal_emit_by_name(atkObj,
+ "row_deleted",
+ // After which the rows are deleted
+ pAtkTableChange->index,
+ // The number of the deleted
+ pAtkTableChange->count);
+ break;
+
+ case nsIAccessibleEvent::EVENT_TABLE_ROW_REORDER:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_REORDER\n"));
+ g_signal_emit_by_name(atkObj, "row_reordered");
+ break;
+
+ case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
+ NS_ASSERTION(eventData, "Event needs event data");
+ if (!eventData)
+ break;
+
+ pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
+
+ g_signal_emit_by_name(atkObj,
+ "column_inserted",
+ // After which the columns are inserted
+ pAtkTableChange->index,
+ // The number of the inserted
+ pAtkTableChange->count);
+ break;
+
+ case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
+ NS_ASSERTION(eventData, "Event needs event data");
+ if (!eventData)
+ break;
+
+ pAtkTableChange = reinterpret_cast<AtkTableChange *>(eventData);
+
+ g_signal_emit_by_name(atkObj,
+ "column_deleted",
+ // After which the columns are deleted
+ pAtkTableChange->index,
+ // The number of the deleted
+ pAtkTableChange->count);
+ break;
+
+ case nsIAccessibleEvent::EVENT_TABLE_COLUMN_REORDER:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_REORDER\n"));
+ g_signal_emit_by_name(atkObj, "column_reordered");
+ break;
+
+ case nsIAccessibleEvent::EVENT_SECTION_CHANGED:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_SECTION_CHANGED\n"));
+ g_signal_emit_by_name(atkObj, "visible_data_changed");
+ break;
+
+ case nsIAccessibleEvent::EVENT_HYPERTEXT_LINK_SELECTED:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_HYPERTEXT_LINK_SELECTED\n"));
+ atk_focus_tracker_notify(atkObj);
+ g_signal_emit_by_name(atkObj,
+ "link_selected",
+ // Selected link index
+ *(gint *)eventData);
+ break;
+
+ case nsIAccessibleEvent::EVENT_SHOW:
+ return FireAtkShowHideEvent(aEvent, atkObj, PR_TRUE);
+
+ case nsIAccessibleEvent::EVENT_HIDE:
+ return FireAtkShowHideEvent(aEvent, atkObj, PR_FALSE);
+
+ /*
+ * Because dealing with menu is very different between nsIAccessible
+ * and ATK, and the menu activity is important, specially transfer the
+ * following two event.
+ * Need more verification by AT test.
+ */
+ case nsIAccessibleEvent::EVENT_MENU_START:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_START\n"));
+ break;
+
+ case nsIAccessibleEvent::EVENT_MENU_END:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_END\n"));
+ break;
+
+ case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
+ {
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_ACTIVATED\n"));
+ nsDocAccessibleWrap *accDocWrap =
+ static_cast<nsDocAccessibleWrap *>(accessible.get());
+ accDocWrap->mActivated = PR_TRUE;
+ guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
+ g_signal_emit(atkObj, id, 0);
+ } break;
+
+ case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
+ {
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_DEACTIVATED\n"));
+ nsDocAccessibleWrap *accDocWrap =
+ static_cast<nsDocAccessibleWrap *>(accessible.get());
+ accDocWrap->mActivated = PR_FALSE;
+ guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
+ g_signal_emit(atkObj, id, 0);
+ } break;
+
+ case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
+ {
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_COMPLETE\n"));
+ g_signal_emit_by_name (atkObj, "load_complete");
+ } break;
+
+ case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD:
+ {
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_RELOAD\n"));
+ g_signal_emit_by_name (atkObj, "reload");
+ } break;
+
+ case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED:
+ {
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_STOPPED\n"));
+ g_signal_emit_by_name (atkObj, "load_stopped");
+ } break;
+ case nsIAccessibleEvent::EVENT_DOCUMENT_ATTRIBUTES_CHANGED:
+ {
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_ATTRIBUTES_CHANGED\n"));
+ g_signal_emit_by_name (atkObj, "attributes_changed");
+ } break;
+
+ case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUPOPUP_START\n"));
+ atk_focus_tracker_notify(atkObj); // fire extra focus event
+ atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_TRUE);
+ atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_TRUE);
+ break;
+
+ case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUPOPUP_END\n"));
+ atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_FALSE);
+ atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_FALSE);
+ break;
}
return NS_OK;
}
nsresult
nsAccessibleWrap::FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject)
@@ -1195,39 +1452,39 @@ nsAccessibleWrap::FireAtkPropChangedEven
AtkObject *aObject)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_PROPERTY_CHANGED\n"));
AtkPropertyChange *pAtkPropChange;
AtkPropertyValues values = { NULL };
nsAccessibleWrap *oldAccWrap = nsnull, *newAccWrap = nsnull;
- nsAccEvent *event = NS_REINTERPRET_CAST(nsAccEvent*, aEvent);
+ nsAccEvent *event = reinterpret_cast<nsAccEvent*>(aEvent);
- pAtkPropChange = NS_REINTERPRET_CAST(AtkPropertyChange *, event->mEventData);
+ pAtkPropChange = reinterpret_cast<AtkPropertyChange *>(event->mEventData);
values.property_name = sAtkPropertyNameArray[pAtkPropChange->type];
NS_ASSERTION(pAtkPropChange, "Event needs event data");
if (!pAtkPropChange)
return NS_OK;
MAI_LOG_DEBUG(("\n\nthe type of EVENT_PROPERTY_CHANGED: %d\n\n",
pAtkPropChange->type));
switch (pAtkPropChange->type) {
case PROP_TABLE_CAPTION:
case PROP_TABLE_SUMMARY:
if (pAtkPropChange->oldvalue)
- oldAccWrap = NS_REINTERPRET_CAST(nsAccessibleWrap *,
- pAtkPropChange->oldvalue);
+ oldAccWrap = reinterpret_cast<nsAccessibleWrap *>
+ (pAtkPropChange->oldvalue);
if (pAtkPropChange->newvalue)
- newAccWrap = NS_REINTERPRET_CAST(nsAccessibleWrap *,
- pAtkPropChange->newvalue);
+ newAccWrap = reinterpret_cast<nsAccessibleWrap *>
+ (pAtkPropChange->newvalue);
if (oldAccWrap && newAccWrap) {
g_value_init(&values.old_value, G_TYPE_POINTER);
g_value_set_pointer(&values.old_value,
oldAccWrap->GetAtkObject());
g_value_init(&values.new_value, G_TYPE_POINTER);
g_value_set_pointer(&values.new_value,
newAccWrap->GetAtkObject());
@@ -1235,18 +1492,18 @@ nsAccessibleWrap::FireAtkPropChangedEven
break;
case PROP_TABLE_COLUMN_DESCRIPTION:
case PROP_TABLE_COLUMN_HEADER:
case PROP_TABLE_ROW_HEADER:
case PROP_TABLE_ROW_DESCRIPTION:
g_value_init(&values.new_value, G_TYPE_INT);
g_value_set_int(&values.new_value,
- *NS_REINTERPRET_CAST(gint *,
- pAtkPropChange->newvalue));
+ *reinterpret_cast<gint *>
+ (pAtkPropChange->newvalue));
break;
//Perhaps need more cases in the future
default:
g_value_init (&values.old_value, G_TYPE_POINTER);
g_value_set_pointer (&values.old_value, pAtkPropChange->oldvalue);
g_value_init (&values.new_value, G_TYPE_POINTER);
g_value_set_pointer (&values.new_value, pAtkPropChange->newvalue);
@@ -1255,8 +1512,42 @@ nsAccessibleWrap::FireAtkPropChangedEven
char *signal_name = g_strconcat("property_change::",
values.property_name, NULL);
g_signal_emit_by_name(aObject, signal_name, &values, NULL);
g_free (signal_name);
return NS_OK;
}
+nsresult
+nsAccessibleWrap::FireAtkShowHideEvent(nsIAccessibleEvent *aEvent,
+ AtkObject *aObject, PRBool aIsAdded)
+{
+ if (aIsAdded)
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_SHOW\n"));
+ else
+ MAI_LOG_DEBUG(("\n\nReceived: EVENT_HIDE\n"));
+
+ nsCOMPtr<nsIAccessible> accessible;
+ aEvent->GetAccessible(getter_AddRefs(accessible));
+ NS_ENSURE_STATE(accessible);
+
+ nsCOMPtr<nsIAccessible> parentAccessible;
+ accessible->GetParent(getter_AddRefs(parentAccessible));
+ NS_ENSURE_STATE(parentAccessible);
+
+ PRInt32 indexInParent = -1;
+ accessible->GetIndexInParent(&indexInParent);
+
+ AtkObject *parentObject = GetAtkObject(parentAccessible);
+ NS_ENSURE_STATE(parentObject);
+
+ g_signal_emit_by_name(parentObject,
+ aIsAdded ? \
+ "children_changed::add" : \
+ "children_changed::remove",
+ indexInParent,
+ aObject,
+ NULL);
+
+ return NS_OK;
+}
+
--- a/accessible/src/atk/nsAccessibleWrap.h
+++ b/accessible/src/atk/nsAccessibleWrap.h
@@ -82,16 +82,17 @@ class MaiHyperlink;
* nsAccessibleWrap, and its descendents in atk directory provide the
* implementation of AtkObject.
*/
class nsAccessibleWrap: public nsAccessible
{
public:
nsAccessibleWrap(nsIDOMNode*, nsIWeakReference *aShell);
virtual ~nsAccessibleWrap();
+ void ShutdownAtkObject();
NS_IMETHOD Shutdown();
#ifdef MAI_LOGGING
virtual void DumpnsAccessibleWrapInfo(int aDepth) {}
static PRInt32 mAccWrapCreated;
static PRInt32 mAccWrapDeleted;
#endif
@@ -116,16 +117,18 @@ public:
protected:
nsresult FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject);
nsresult FireAtkTextChangedEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject);
nsresult FireAtkPropChangedEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject);
+ nsresult FireAtkShowHideEvent(nsIAccessibleEvent *aEvent,
+ AtkObject *aObject, PRBool aIsAdded);
AtkObject *mAtkObject;
private:
PRUint16 CreateMaiInterfaces(void);
};
#endif /* __NS_ACCESSIBLE_WRAP_H__ */
--- a/accessible/src/atk/nsAppRootAccessible.cpp
+++ b/accessible/src/atk/nsAppRootAccessible.cpp
@@ -564,18 +564,18 @@ nsApplicationAccessibleWrap::Unload()
NS_IMETHODIMP
nsApplicationAccessibleWrap::GetNativeInterface(void **aOutAccessible)
{
*aOutAccessible = nsnull;
if (!mAtkObject) {
mAtkObject =
- NS_REINTERPRET_CAST(AtkObject *,
- g_object_new(MAI_TYPE_ATK_OBJECT, NULL));
+ reinterpret_cast<AtkObject *>
+ (g_object_new(MAI_TYPE_ATK_OBJECT, NULL));
NS_ENSURE_TRUE(mAtkObject, NS_ERROR_OUT_OF_MEMORY);
atk_object_initialize(mAtkObject, this);
mAtkObject->role = ATK_ROLE_INVALID;
mAtkObject->layer = ATK_LAYER_INVALID;
}
*aOutAccessible = mAtkObject;
--- a/accessible/src/atk/nsDocAccessibleWrap.cpp
+++ b/accessible/src/atk/nsDocAccessibleWrap.cpp
@@ -36,341 +36,62 @@
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMai.h"
-#include "nsAutoPtr.h"
-#include "nsRootAccessible.h"
#include "nsDocAccessibleWrap.h"
-#include "nsAccessibleEventData.h"
-#include "nsIAccessibleValue.h"
-
-#include <atk/atk.h>
-#include <glib.h>
-#include <glib-object.h>
-
-#include "nsStateMap.h"
//----- nsDocAccessibleWrap -----
nsDocAccessibleWrap::nsDocAccessibleWrap(nsIDOMNode *aDOMNode,
nsIWeakReference *aShell):
nsDocAccessible(aDOMNode, aShell), mActivated(PR_FALSE)
{
}
nsDocAccessibleWrap::~nsDocAccessibleWrap()
{
}
-NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
- nsIAccessible* aAccessible,
- void* aEventData)
+void nsDocAccessibleWrap::SetEditor(nsIEditor* aEditor)
{
- NS_ENSURE_ARG_POINTER(aAccessible);
-
- // First fire nsIObserver event for internal xpcom accessibility clients
- nsDocAccessible::FireToolkitEvent(aEvent, aAccessible, aEventData);
-
- nsresult rv = NS_ERROR_FAILURE;
+ // Recreate atkobject if editable interface is changing
+ PRBool needRecreate = mAtkObject && (mEditor != aEditor)
+ && (!mEditor || !aEditor);
+ nsDocAccessible::SetEditor(aEditor);
- MAI_LOG_DEBUG(("\n\nReceived event: aEvent=%u, obj=0x%x, data=0x%x \n",
- aEvent, aAccessible, aEventData));
-
- AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(aAccessible);
+ if (needRecreate) {
+ // Get parent atkobject and index in parent
+ AtkObject* oldAtkObj = mAtkObject;
+ // getParentCB
+ AtkObject* parentAtkObj = atk_object_get_parent(oldAtkObj);
+ // getIndexInParentCB
+ PRInt32 index = atk_object_get_index_in_parent(oldAtkObj);
- // We don't create ATK objects for nsIAccessible plain text leaves,
- // just return NS_OK in such case
- if (!atkObj) {
- NS_ASSERTION(aEvent == nsIAccessibleEvent::EVENT_SHOW ||
- aEvent == nsIAccessibleEvent::EVENT_HIDE,
- "Event other than SHOW and HIDE fired for plain text leaves");
- return NS_OK;
+ // Clear old atkobject
+ ShutdownAtkObject();
+
+ // Get new atkobject
+ GetAtkObject();
+
+ // Emit children_changed events
+ if (parentAtkObj && (index >= 0)) {
+ g_signal_emit_by_name(parentAtkObj, "children_changed::remove", index,
+ oldAtkObj, NULL);
+ g_signal_emit_by_name(parentAtkObj, "children_changed::add", index,
+ mAtkObject, NULL);
}
- nsAccessibleWrap *accWrap = GetAccessibleWrap(atkObj);
-
- AtkTableChange * pAtkTableChange = nsnull;
-
- switch (aEvent) {
- case nsIAccessibleEvent::EVENT_FOCUS:
- {
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
- nsRefPtr<nsRootAccessible> rootAccWrap = accWrap->GetRootAccessible();
- if (rootAccWrap && rootAccWrap->mActivated) {
- atk_focus_tracker_notify(atkObj);
- }
- rv = NS_OK;
- } break;
-
- case nsIAccessibleEvent::EVENT_VALUE_CHANGE :
- {
- nsCOMPtr<nsIAccessibleValue> value(do_QueryInterface(aAccessible));
- if (value) { // Make sure this is a numeric value
- // Don't fire for MSAA string value changes (e.g. text editing)
- // ATK values are always numeric
- g_object_notify( (GObject*)atkObj, "accessible-value" );
- }
+ // Set every child's parent to new created atkobject
+ nsCOMPtr<nsIAccessible> accChild;
+ while (NextChild(accChild)) {
+ if (IsEmbeddedObject(accChild)) {
+ AtkObject* childAtkObj = nsAccessibleWrap::GetAtkObject(accChild);
+ atk_object_set_parent(childAtkObj, mAtkObject);
}
- break;
-
- case nsIAccessibleEvent::EVENT_SELECTION_CHANGED:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_SELECTION_CHANGED\n"));
- g_signal_emit_by_name(atkObj, "selection_changed");
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_SELECTION_CHANGED\n"));
- g_signal_emit_by_name(atkObj, "text_selection_changed");
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
- NS_ASSERTION(aEventData, "Event needs event data");
- if (!aEventData)
- break;
-
- MAI_LOG_DEBUG(("\n\nCaret postion: %d", *(gint *)aEventData ));
- g_signal_emit_by_name(atkObj,
- "text_caret_moved",
- // Curent caret position
- *(gint *)aEventData);
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_TABLE_MODEL_CHANGED:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_MODEL_CHANGED\n"));
- g_signal_emit_by_name(atkObj, "model_changed");
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
- NS_ASSERTION(aEventData, "Event needs event data");
- if (!aEventData)
- break;
-
- pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
-
- g_signal_emit_by_name(atkObj,
- "row_inserted",
- // After which the rows are inserted
- pAtkTableChange->index,
- // The number of the inserted
- pAtkTableChange->count);
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
- NS_ASSERTION(aEventData, "Event needs event data");
- if (!aEventData)
- break;
-
- pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
-
- g_signal_emit_by_name(atkObj,
- "row_deleted",
- // After which the rows are deleted
- pAtkTableChange->index,
- // The number of the deleted
- pAtkTableChange->count);
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_TABLE_ROW_REORDER:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_REORDER\n"));
- g_signal_emit_by_name(atkObj, "row_reordered");
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
- NS_ASSERTION(aEventData, "Event needs event data");
- if (!aEventData)
- break;
-
- pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
-
- g_signal_emit_by_name(atkObj,
- "column_inserted",
- // After which the columns are inserted
- pAtkTableChange->index,
- // The number of the inserted
- pAtkTableChange->count);
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
- NS_ASSERTION(aEventData, "Event needs event data");
- if (!aEventData)
- break;
-
- pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
-
- g_signal_emit_by_name(atkObj,
- "column_deleted",
- // After which the columns are deleted
- pAtkTableChange->index,
- // The number of the deleted
- pAtkTableChange->count);
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_TABLE_COLUMN_REORDER:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_REORDER\n"));
- g_signal_emit_by_name(atkObj, "column_reordered");
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_SECTION_CHANGED:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_SECTION_CHANGED\n"));
- g_signal_emit_by_name(atkObj, "visible_data_changed");
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_HYPERTEXT_LINK_SELECTED:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_HYPERTEXT_LINK_SELECTED\n"));
- atk_focus_tracker_notify(atkObj);
- g_signal_emit_by_name(atkObj,
- "link_selected",
- // Selected link index
- *(gint *)aEventData);
- rv = NS_OK;
- break;
-
- // Is a superclass of ATK event children_changed
- case nsIAccessibleEvent::EVENT_REORDER:
- AtkChildrenChange *pAtkChildrenChange;
-
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_REORDER(children_change)\n"));
-
- pAtkChildrenChange = NS_REINTERPRET_CAST(AtkChildrenChange *,
- aEventData);
- nsAccessibleWrap *childAccWrap;
- if (pAtkChildrenChange && pAtkChildrenChange->child) {
- childAccWrap = NS_STATIC_CAST(nsAccessibleWrap *,
- pAtkChildrenChange->child);
- g_signal_emit_by_name (atkObj,
- pAtkChildrenChange->add ? \
- "children_changed::add" : \
- "children_changed::remove",
- pAtkChildrenChange->index,
- childAccWrap->GetAtkObject(),
- NULL);
- }
- else {
- //
- // EVENT_REORDER is normally fired by "HTML Document".
- //
- // In GOK, [only] "children_changed::add" can cause foreground
- // window accessible to update it children, which will
- // refresh "UI-Grab" window.
- //
- g_signal_emit_by_name (atkObj,
- "children_changed::add",
- -1, NULL, NULL);
- }
-
- rv = NS_OK;
- break;
-
- /*
- * Because dealing with menu is very different between nsIAccessible
- * and ATK, and the menu activity is important, specially transfer the
- * following two event.
- * Need more verification by AT test.
- */
- case nsIAccessibleEvent::EVENT_MENU_START:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_START\n"));
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_MENU_END:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_END\n"));
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
- {
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_ACTIVATED\n"));
- nsDocAccessibleWrap *accDocWrap =
- NS_STATIC_CAST(nsDocAccessibleWrap *, aAccessible);
- accDocWrap->mActivated = PR_TRUE;
- guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
- g_signal_emit(atkObj, id, 0);
- rv = NS_OK;
- } break;
-
- case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
- {
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_DEACTIVATED\n"));
- nsDocAccessibleWrap *accDocWrap =
- NS_STATIC_CAST(nsDocAccessibleWrap *, aAccessible);
- accDocWrap->mActivated = PR_FALSE;
- guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
- g_signal_emit(atkObj, id, 0);
- rv = NS_OK;
- } break;
-
- case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
- {
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_COMPLETE\n"));
- g_signal_emit_by_name (atkObj, "load_complete");
- rv = NS_OK;
- } break;
-
- case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD:
- {
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_RELOAD\n"));
- g_signal_emit_by_name (atkObj, "reload");
- rv = NS_OK;
- } break;
-
- case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED:
- {
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_STOPPED\n"));
- g_signal_emit_by_name (atkObj, "load_stopped");
- rv = NS_OK;
- } break;
-
- case nsIAccessibleEvent::EVENT_DOCUMENT_ATTRIBUTES_CHANGED:
- {
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_ATTRIBUTES_CHANGED\n"));
- g_signal_emit_by_name (atkObj, "attributes_changed");
- rv = NS_OK;
- } break;
-
- case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
- // fire extra focus event, then go down to EVENT_SHOW
- atk_focus_tracker_notify(atkObj);
-
- case nsIAccessibleEvent::EVENT_SHOW:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_SHOW\n"));
- atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_TRUE);
- atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_TRUE);
- rv = NS_OK;
- break;
-
- case nsIAccessibleEvent::EVENT_HIDE:
- case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
- MAI_LOG_DEBUG(("\n\nReceived: EVENT_HIDE\n"));
- atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_FALSE);
- atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_FALSE);
- rv = NS_OK;
- break;
-
- default:
- // Don't transfer others
- MAI_LOG_DEBUG(("\n\nReceived an unknown event=0x%u\n", aEvent));
- break;
}
-
- return rv;
+ }
}
--- a/accessible/src/atk/nsDocAccessibleWrap.h
+++ b/accessible/src/atk/nsDocAccessibleWrap.h
@@ -49,16 +49,16 @@
#include "nsDocAccessible.h"
class nsDocAccessibleWrap: public nsDocAccessible
{
public:
nsDocAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
virtual ~nsDocAccessibleWrap();
- NS_IMETHOD FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible,
- void* aData);
+ // Override SetEditor because we need to recreate atkobject
+ // when editable interface is added/removed
+ void SetEditor(nsIEditor* aEditor);
-protected:
PRBool mActivated;
};
#endif
--- a/accessible/src/atk/nsMaiHyperlink.cpp
+++ b/accessible/src/atk/nsMaiHyperlink.cpp
@@ -145,18 +145,18 @@ MaiHyperlink::GetAtkHyperlink(void)
if (mMaiAtkHyperlink)
return mMaiAtkHyperlink;
nsCOMPtr<nsIAccessibleHyperLink> accessIf(do_QueryInterface(mHyperlink));
if (!accessIf)
return nsnull;
mMaiAtkHyperlink =
- NS_REINTERPRET_CAST(AtkHyperlink *,
- g_object_new(mai_atk_hyperlink_get_type(), NULL));
+ reinterpret_cast<AtkHyperlink *>
+ (g_object_new(mai_atk_hyperlink_get_type(), NULL));
NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
NS_ENSURE_TRUE(mMaiAtkHyperlink, nsnull);
/* be sure to initialize it with "this" */
MaiHyperlink::Initialize(mMaiAtkHyperlink, this);
return mMaiAtkHyperlink;
}
@@ -255,51 +255,51 @@ gint
getEndIndexCB(AtkHyperlink *aLink)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, -1);
PRInt32 endIndex = -1;
nsresult rv = accHyperlink->GetEndIndex(&endIndex);
- return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, endIndex);
+ return (NS_FAILED(rv)) ? -1 : static_cast<gint>(endIndex);
}
gint
getStartIndexCB(AtkHyperlink *aLink)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, -1);
PRInt32 startIndex = -1;
nsresult rv = accHyperlink->GetStartIndex(&startIndex);
- return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, startIndex);
+ return (NS_FAILED(rv)) ? -1 : static_cast<gint>(startIndex);
}
gboolean
isValidCB(AtkHyperlink *aLink)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, FALSE);
PRBool isValid = PR_FALSE;
nsresult rv = accHyperlink->IsValid(&isValid);
- return (NS_FAILED(rv)) ? FALSE : NS_STATIC_CAST(gboolean, isValid);
+ return (NS_FAILED(rv)) ? FALSE : static_cast<gboolean>(isValid);
}
gint
getAnchorCountCB(AtkHyperlink *aLink)
{
nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
NS_ENSURE_TRUE(accHyperlink, -1);
PRInt32 count = -1;
nsresult rv = accHyperlink->GetAnchors(&count);
- return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, count);
+ return (NS_FAILED(rv)) ? -1 : static_cast<gint>(count);
}
// Check if aHyperlink is a valid MaiHyperlink, and return the
// nsIAccessibleHyperLink related.
nsIAccessibleHyperLink *
get_accessible_hyperlink(AtkHyperlink *aHyperlink)
{
NS_ENSURE_TRUE(MAI_IS_ATK_HYPERLINK(aHyperlink), nsnull);
--- a/accessible/src/atk/nsMaiInterfaceAction.cpp
+++ b/accessible/src/atk/nsMaiInterfaceAction.cpp
@@ -70,17 +70,17 @@ gint
getActionCountCB(AtkAction *aAction)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
if (!accWrap)
return 0;
PRUint8 num = 0;
nsresult rv = accWrap->GetNumActions(&num);
- return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, num);
+ return (NS_FAILED(rv)) ? 0 : static_cast<gint>(num);
}
const gchar *
getActionDescriptionCB(AtkAction *aAction, gint aActionIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
if (!accWrap)
return nsnull;
--- a/accessible/src/atk/nsMaiInterfaceTable.cpp
+++ b/accessible/src/atk/nsMaiInterfaceTable.cpp
@@ -103,17 +103,17 @@ getIndexAtCB(AtkTable *aTable, gint aRow
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 index;
nsresult rv = accTable->GetIndexAt(aRow, aColumn, &index);
NS_ENSURE_SUCCESS(rv, -1);
- return NS_STATIC_CAST(gint, index);
+ return static_cast<gint>(index);
}
gint
getColumnAtIndexCB(AtkTable *aTable, gint aIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return -1;
@@ -122,17 +122,17 @@ getColumnAtIndexCB(AtkTable *aTable, gin
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 col;
nsresult rv = accTable->GetColumnAtIndex(aIndex, &col);
NS_ENSURE_SUCCESS(rv, -1);
- return NS_STATIC_CAST(gint, col);
+ return static_cast<gint>(col);
}
gint
getRowAtIndexCB(AtkTable *aTable, gint aIndex)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return -1;
@@ -141,17 +141,17 @@ getRowAtIndexCB(AtkTable *aTable, gint a
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 row;
nsresult rv = accTable->GetRowAtIndex(aIndex, &row);
NS_ENSURE_SUCCESS(rv, -1);
- return NS_STATIC_CAST(gint, row);
+ return static_cast<gint>(row);
}
gint
getColumnCountCB(AtkTable *aTable)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return -1;
@@ -160,17 +160,17 @@ getColumnCountCB(AtkTable *aTable)
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 count;
nsresult rv = accTable->GetColumns(&count);
NS_ENSURE_SUCCESS(rv, -1);
- return NS_STATIC_CAST(gint, count);
+ return static_cast<gint>(count);
}
gint
getRowCountCB(AtkTable *aTable)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return -1;
@@ -179,17 +179,17 @@ getRowCountCB(AtkTable *aTable)
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 count;
nsresult rv = accTable->GetRows(&count);
NS_ENSURE_SUCCESS(rv, -1);
- return NS_STATIC_CAST(gint, count);
+ return static_cast<gint>(count);
}
gint
getColumnExtentAtCB(AtkTable *aTable,
gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
@@ -199,17 +199,17 @@ getColumnExtentAtCB(AtkTable *aTable,
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 extent;
nsresult rv = accTable->GetColumnExtentAt(aRow, aColumn, &extent);
NS_ENSURE_SUCCESS(rv, -1);
- return NS_STATIC_CAST(gint, extent);
+ return static_cast<gint>(extent);
}
gint
getRowExtentAtCB(AtkTable *aTable,
gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
@@ -219,17 +219,17 @@ getRowExtentAtCB(AtkTable *aTable,
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, -1);
PRInt32 extent;
nsresult rv = accTable->GetRowExtentAt(aRow, aColumn, &extent);
NS_ENSURE_SUCCESS(rv, -1);
- return NS_STATIC_CAST(gint, extent);
+ return static_cast<gint>(extent);
}
AtkObject*
getCaptionCB(AtkTable *aTable)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return nsnull;
@@ -370,17 +370,17 @@ getSelectedColumnsCB(AtkTable *aTable, g
gint *atkColumns = g_new(gint, size);
if (!atkColumns) {
NS_WARNING("OUT OF MEMORY");
return nsnull;
}
//copy
for (PRUint32 index = 0; index < size; ++index)
- atkColumns[index] = NS_STATIC_CAST(gint, columns[index]);
+ atkColumns[index] = static_cast<gint>(columns[index]);
nsMemory::Free(columns);
*aSelected = atkColumns;
return size;
}
gint
getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
@@ -405,17 +405,17 @@ getSelectedRowsCB(AtkTable *aTable, gint
gint *atkRows = g_new(gint, size);
if (!atkRows) {
NS_WARNING("OUT OF MEMORY");
return nsnull;
}
//copy
for (PRUint32 index = 0; index < size; ++index)
- atkRows[index] = NS_STATIC_CAST(gint, rows[index]);
+ atkRows[index] = static_cast<gint>(rows[index]);
nsMemory::Free(rows);
*aSelected = atkRows;
return size;
}
gboolean
isColumnSelectedCB(AtkTable *aTable, gint aColumn)
@@ -426,44 +426,44 @@ isColumnSelectedCB(AtkTable *aTable, gin
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, FALSE);
PRBool outValue;
nsresult rv = accTable->IsColumnSelected(aColumn, &outValue);
- return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
+ return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}
gboolean
isRowSelectedCB(AtkTable *aTable, gint aRow)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, FALSE);
PRBool outValue;
nsresult rv = accTable->IsRowSelected(aRow, &outValue);
- return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
+ return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}
gboolean
isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, FALSE);
PRBool outValue;
nsresult rv = accTable->IsCellSelected(aRow, aColumn, &outValue);
- return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
+ return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}
--- a/accessible/src/atk/nsMaiInterfaceText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceText.cpp
@@ -74,17 +74,17 @@ textInterfaceInitCB(AtkTextIface *aIface
}
void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
{
// convert each char to "*" when it's "password text"
PRUint32 accRole;
accWrap->GetRole(&accRole);
- if (NS_STATIC_CAST(AtkRole, accRole) == ATK_ROLE_PASSWORD_TEXT) {
+ if (static_cast<AtkRole>(accRole) == ATK_ROLE_PASSWORD_TEXT) {
for (PRUint32 i = 0; i < aString.Length(); i++)
aString.Replace(i, 1, NS_LITERAL_STRING("*"));
}
}
gchar *
getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
{
@@ -182,21 +182,21 @@ getCharacterAtOffsetCB(AtkText *aText, g
/* gnuichar is guint32 in glib */
PRUnichar uniChar;
nsresult rv =
accText->GetCharacterAtOffset(aOffset, &uniChar);
// convert char to "*" when it's "password text"
PRUint32 accRole;
accWrap->GetRole(&accRole);
- if (NS_STATIC_CAST(AtkRole, accRole) == ATK_ROLE_PASSWORD_TEXT) {
+ if (static_cast<AtkRole>(accRole) == ATK_ROLE_PASSWORD_TEXT) {
uniChar = '*';
}
- return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gunichar, uniChar);
+ return (NS_FAILED(rv)) ? 0 : static_cast<gunichar>(uniChar);
}
gchar *
getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
AtkTextBoundary aBoundaryType,
gint *aStartOffset, gint *aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@@ -232,17 +232,17 @@ getCaretOffsetCB(AtkText *aText)
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, 0);
PRInt32 offset;
nsresult rv = accText->GetCaretOffset(&offset);
- return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, offset);
+ return (NS_FAILED(rv)) ? 0 : static_cast<gint>(offset);
}
AtkAttributeSet *
getRunAttributesCB(AtkText *aText, gint aOffset,
gint *aStartOffset,
gint *aEndOffset)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@@ -353,17 +353,17 @@ getCharacterCountCB(AtkText *aText)
nsCOMPtr<nsIAccessibleText> accText;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
getter_AddRefs(accText));
NS_ENSURE_TRUE(accText, 0);
PRInt32 count = 0;
nsresult rv = accText->GetCharacterCount(&count);
- return (NS_FAILED(rv)) ? 0 : NS_STATIC_CAST(gint, count);
+ return (NS_FAILED(rv)) ? 0 : static_cast<gint>(count);
}
gint
getOffsetAtPointCB(AtkText *aText,
gint aX, gint aY,
AtkCoordType aCoords)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
@@ -378,17 +378,17 @@ getOffsetAtPointCB(AtkText *aText,
PRInt32 offset = 0;
PRUint32 geckoCoordType;
if (aCoords == ATK_XY_SCREEN)
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
else
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
accText->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
- return NS_STATIC_CAST(gint, offset);
+ return static_cast<gint>(offset);
}
gint
getTextSelectionCountCB(AtkText *aText)
{
nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
if (!accWrap)
return nsnull;
--- a/accessible/src/atk/nsRoleMap.h
+++ b/accessible/src/atk/nsRoleMap.h
@@ -69,17 +69,17 @@ static const PRUint32 atkRoleMap[] = {
ATK_ROLE_PANEL, // nsIAccessibleRole::ROLE_GROUPING 20
ATK_ROLE_SEPARATOR, // nsIAccessibleRole::ROLE_SEPARATOR 21
ATK_ROLE_TOOL_BAR, // nsIAccessibleRole::ROLE_TOOLBAR 22
ATK_ROLE_STATUSBAR, // nsIAccessibleRole::ROLE_STATUSBAR 23
ATK_ROLE_TABLE, // nsIAccessibleRole::ROLE_TABLE 24
ATK_ROLE_COLUMN_HEADER, // nsIAccessibleRole::ROLE_COLUMNHEADER 25
ATK_ROLE_ROW_HEADER, // nsIAccessibleRole::ROLE_ROWHEADER 26
ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_COLUMN 27
- ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_ROW 28
+ ATK_ROLE_LIST_ITEM, // nsIAccessibleRole::ROLE_ROW 28
ATK_ROLE_TABLE_CELL, // nsIAccessibleRole::ROLE_CELL 29
ATK_ROLE_LINK, // nsIAccessibleRole::ROLE_LINK 30
ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_HELPBALLOON 31
ATK_ROLE_IMAGE, // nsIAccessibleRole::ROLE_CHARACTER 32
ATK_ROLE_LIST, // nsIAccessibleRole::ROLE_LIST 33
ATK_ROLE_LIST_ITEM, // nsIAccessibleRole::ROLE_LISTITEM 34
ATK_ROLE_TREE, // nsIAccessibleRole::ROLE_OUTLINE 35
ATK_ROLE_LIST_ITEM, // nsIAccessibleRole::ROLE_OUTLINEITEM 36
--- a/accessible/src/atk/nsXULTreeAccessibleWrap.cpp
+++ b/accessible/src/atk/nsXULTreeAccessibleWrap.cpp
@@ -45,17 +45,16 @@
// --------------------------------------------------------
// nsXULTreeAccessibleWrap Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeAccessibleWrap, nsXULTreeAccessible, nsIAccessibleTable)
nsXULTreeAccessibleWrap::nsXULTreeAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsXULTreeAccessible(aDOMNode, aShell)
{
- mCaption = nsnull;
}
// 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);
@@ -73,36 +72,23 @@ NS_IMETHODIMP nsXULTreeAccessibleWrap::G
*aAccChildCount += rowCount * colCount;
}
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetCaption(nsIAccessible **aCaption)
{
- *aCaption = mCaption;
- NS_IF_ADDREF(*aCaption);
- return NS_OK;
-}
-
-NS_IMETHODIMP nsXULTreeAccessibleWrap::SetCaption(nsIAccessible *aCaption)
-{
- mCaption = aCaption;
+ *aCaption = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetSummary(nsAString &aSummary)
{
- aSummary = mSummary;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsXULTreeAccessibleWrap::SetSummary(const nsAString &aSummary)
-{
- mSummary = aSummary;
+ aSummary.Truncate();
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessibleWrap::GetColumns(PRInt32 *aColumns)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIAccessible> acc;
@@ -138,16 +124,41 @@ NS_IMETHODIMP nsXULTreeAccessibleWrap::G
}
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;
@@ -421,42 +432,27 @@ NS_IMETHODIMP nsXULTreeAccessibleWrap::I
// --------------------------------------------------------
// nsXULTreeAccessibleWrap Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeColumnsAccessibleWrap, nsXULTreeColumnsAccessible, nsIAccessibleTable)
nsXULTreeColumnsAccessibleWrap::nsXULTreeColumnsAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsXULTreeColumnsAccessible(aDOMNode, aShell)
{
- mCaption = nsnull;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetCaption(nsIAccessible **aCaption)
{
- *aCaption = mCaption;
- NS_IF_ADDREF(*aCaption);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::SetCaption(nsIAccessible *aCaption)
-{
- mCaption = aCaption;
+ *aCaption = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetSummary(nsAString &aSummary)
{
- aSummary = mSummary;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::SetSummary(const nsAString &aSummary)
-{
- mSummary = aSummary;
+ aSummary.Truncate();
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumns(PRInt32 *aColumns)
{
nsresult rv = GetChildCount(aColumns);
return *aColumns > 0 ? rv : NS_ERROR_FAILURE;
}
@@ -476,16 +472,41 @@ NS_IMETHODIMP nsXULTreeColumnsAccessible
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRowHeader(nsIAccessibleTable * *aRowHeader)
{
// Row header not supported.
return NS_ERROR_NOT_IMPLEMENTED;
}
+NS_IMETHODIMP
+nsXULTreeColumnsAccessibleWrap::GetSelectedCellsCount(PRUint32* aCount)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsXULTreeColumnsAccessibleWrap::GetSelectedColumnsCount(PRUint32* aCount)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsXULTreeColumnsAccessibleWrap::GetSelectedRowsCount(PRUint32* aCount)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsXULTreeColumnsAccessibleWrap::GetSelectedCells(PRUint32 *aNumCells,
+ PRInt32 **aCells)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetSelectedColumns(PRUint32 *columnsSize, PRInt32 **columns)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetSelectedRows(PRUint32 *rowsSize, PRInt32 **rows)
{
--- a/accessible/src/atk/nsXULTreeAccessibleWrap.h
+++ b/accessible/src/atk/nsXULTreeAccessibleWrap.h
@@ -52,30 +52,22 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
nsXULTreeAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeAccessibleWrap() {}
NS_IMETHOD GetChildCount(PRInt32 *_retval);
NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState);
-
-private:
- nsCOMPtr<nsIAccessible> mCaption;
- nsString mSummary;
};
class nsXULTreeColumnsAccessibleWrap : public nsXULTreeColumnsAccessible,
public nsIAccessibleTable
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
nsXULTreeColumnsAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULTreeColumnsAccessibleWrap() {}
-
-private:
- nsCOMPtr<nsIAccessible> mCaption;
- nsString mSummary;
};
#endif
--- a/accessible/src/base/nsARIAMap.cpp
+++ b/accessible/src/base/nsARIAMap.cpp
@@ -60,125 +60,153 @@
static const nsStateMapEntry kEndEntry = {0, 0, 0}; // To fill in array of state mappings
nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
{
{"alert", nsIAccessibleRole::ROLE_ALERT, eNameOkFromChildren, eNoValue, kNoReqStates, kEndEntry},
{"alertdialog", nsIAccessibleRole::ROLE_ALERT, eNameOkFromChildren, eNoValue, kNoReqStates, kEndEntry},
{"application", nsIAccessibleRole::ROLE_APPLICATION, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
{"button", nsIAccessibleRole::ROLE_PUSHBUTTON, eNameOkFromChildren, eNoValue, kNoReqStates,
- {"pressed", kBoolState, nsIAccessibleStates::STATE_PRESSED},
- {"haspopup", kBoolState, nsIAccessibleStates::STATE_HASPOPUP}, kEndEntry},
- {"buttonsubmit", nsIAccessibleRole::ROLE_PUSHBUTTON, eNameOkFromChildren, eNoValue, nsIAccessibleStates::STATE_DEFAULT, kEndEntry},
- {"buttoncancel", nsIAccessibleRole::ROLE_PUSHBUTTON, eNameOkFromChildren, eNoValue, kNoReqStates, kEndEntry},
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
+ {"pressed", kBoolState, nsIAccessibleStates::STATE_PRESSED}, kEndEntry},
{"checkbox", nsIAccessibleRole::ROLE_CHECKBUTTON, eNameOkFromChildren, eNoValue, nsIAccessibleStates::STATE_CHECKABLE,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"checked", kBoolState, nsIAccessibleStates::STATE_CHECKED},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
{"checkboxtristate", nsIAccessibleRole::ROLE_CHECKBUTTON, eNameOkFromChildren, eNoValue, nsIAccessibleStates::STATE_CHECKABLE,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"checked", kBoolState, nsIAccessibleStates::STATE_CHECKED},
{"checked", "mixed", nsIAccessibleStates::STATE_MIXED},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
{"columnheader", nsIAccessibleRole::ROLE_COLUMNHEADER, eNameOkFromChildren, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"selected", kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
{"selected", "false", nsIAccessibleStates::STATE_SELECTABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
{"combobox", nsIAccessibleRole::ROLE_COMBOBOX, eNameLabelOrTitle, eHasValueMinMax, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY},
{"expanded", kBoolState, nsIAccessibleStates::STATE_EXPANDED},
{"multiselectable", kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, kEndEntry},
{"description", nsIAccessibleRole::ROLE_TEXT_CONTAINER, eNameOkFromChildren, eNoValue, kNoReqStates, kEndEntry},
{"dialog", nsIAccessibleRole::ROLE_DIALOG, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
{"document", nsIAccessibleRole::ROLE_DOCUMENT, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
{"grid", nsIAccessibleRole::ROLE_TABLE, eNameLabelOrTitle, eNoValue, nsIAccessibleStates::STATE_FOCUSABLE,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"multiselectable", kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
{"gridcell", nsIAccessibleRole::ROLE_CELL, eNameOkFromChildren, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
+ {"expanded", kBoolState, nsIAccessibleStates::STATE_EXPANDED},
+ {"expanded", "false", nsIAccessibleStates::STATE_COLLAPSED},
{"selected", kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
{"selected", "false", nsIAccessibleStates::STATE_SELECTABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
{"group", nsIAccessibleRole::ROLE_GROUPING, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
{"label", nsIAccessibleRole::ROLE_LABEL, eNameOkFromChildren, eNoValue, kNoReqStates, kEndEntry},
- {"link", nsIAccessibleRole::ROLE_LINK, eNameOkFromChildren, eNoValue, nsIAccessibleStates::STATE_LINKED, kEndEntry},
+ {"link", nsIAccessibleRole::ROLE_LINK, eNameOkFromChildren, eNoValue, nsIAccessibleStates::STATE_LINKED,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE}, kEndEntry},
{"list", nsIAccessibleRole::ROLE_LIST, eNameLabelOrTitle, eNoValue, kNoReqStates,
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY},
{"multiselectable", kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, kEndEntry},
{"listbox", nsIAccessibleRole::ROLE_LIST, eNameLabelOrTitle, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY},
{"multiselectable", kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, kEndEntry},
{"listitem", nsIAccessibleRole::ROLE_LISTITEM, eNameOkFromChildren, eNoValue, kNoReqStates,
{"selected", kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
{"selected", "false", nsIAccessibleStates::STATE_SELECTABLE},
{"checked", kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE},
{"checked", "false", nsIAccessibleStates::STATE_CHECKABLE}, kEndEntry},
- {"menu", nsIAccessibleRole::ROLE_MENUPOPUP, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
- {"menubar", nsIAccessibleRole::ROLE_MENUBAR, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
+ {"menu", nsIAccessibleRole::ROLE_MENUPOPUP, eNameLabelOrTitle, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE}, kEndEntry},
+ {"menubar", nsIAccessibleRole::ROLE_MENUBAR, eNameLabelOrTitle, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE}, kEndEntry},
{"menuitem", nsIAccessibleRole::ROLE_MENUITEM, eNameOkFromChildren, eNoValue, kNoReqStates,
- {"haspopup", kBoolState, nsIAccessibleStates::STATE_HASPOPUP},
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"checked", kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE},
{"checked", "mixed", nsIAccessibleStates::STATE_MIXED},
{"checked", "false", nsIAccessibleStates::STATE_CHECKABLE}, kEndEntry},
{"menuitemcheckbox", nsIAccessibleRole::ROLE_MENUITEM, eNameOkFromChildren, eNoValue, nsIAccessibleStates::STATE_CHECKABLE,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"checked", kBoolState, nsIAccessibleStates::STATE_CHECKED }, kEndEntry},
{"menuitemradio", nsIAccessibleRole::ROLE_MENUITEM, eNameOkFromChildren, eNoValue, nsIAccessibleStates::STATE_CHECKABLE,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"checked", kBoolState, nsIAccessibleStates::STATE_CHECKED }, kEndEntry},
{"option", nsIAccessibleRole::ROLE_LISTITEM, eNameOkFromChildren, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"selected", kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
{"selected", "false", nsIAccessibleStates::STATE_SELECTABLE},
{"checked", kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE},
{"checked", "false", nsIAccessibleStates::STATE_CHECKABLE}, kEndEntry},
{"progressbar", nsIAccessibleRole::ROLE_PROGRESSBAR, eNameLabelOrTitle, eHasValueMinMax, nsIAccessibleStates::STATE_READONLY,
- {"valuenow", "unknown", nsIAccessibleStates::STATE_MIXED}, kEndEntry},
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE}, kEndEntry},
{"radio", nsIAccessibleRole::ROLE_RADIOBUTTON, eNameOkFromChildren, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"checked", kBoolState, nsIAccessibleStates::STATE_CHECKED}, kEndEntry},
- {"radiogroup", nsIAccessibleRole::ROLE_GROUPING, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
+ {"radiogroup", nsIAccessibleRole::ROLE_GROUPING, eNameLabelOrTitle, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE}, kEndEntry},
+ {"row", nsIAccessibleRole::ROLE_ROW, eNameOkFromChildren, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
+ {"selected", kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
+ {"selected", "false", nsIAccessibleStates::STATE_SELECTABLE},
+ {"expanded", kBoolState, nsIAccessibleStates::STATE_EXPANDED},
+ {"expanded", "false", nsIAccessibleStates::STATE_COLLAPSED}, kEndEntry},
{"rowheader", nsIAccessibleRole::ROLE_ROWHEADER, eNameOkFromChildren, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"selected", kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
{"selected", "false", nsIAccessibleStates::STATE_SELECTABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
{"secret", nsIAccessibleRole::ROLE_PASSWORD_TEXT, eNameLabelOrTitle, eNoValue, nsIAccessibleStates::STATE_PROTECTED,
- kEndEntry}, // nsIAccessibleStates::EXT_STATE_SINGLE_LINE manually supported in code
+ // Manually map EXT_STATE_SINGLE_LINE and EXT_STATE_MULTI_LINE FROM aaa:multiline
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE}, kEndEntry},
{"separator", nsIAccessibleRole::ROLE_SEPARATOR, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
{"slider", nsIAccessibleRole::ROLE_SLIDER, eNameLabelOrTitle, eHasValueMinMax, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
{"spinbutton", nsIAccessibleRole::ROLE_SPINBUTTON, eNameLabelOrTitle, eHasValueMinMax, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
- {"spreadsheet", nsIAccessibleRole::ROLE_TABLE, eNameLabelOrTitle, eNoValue, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE | nsIAccessibleStates::STATE_FOCUSABLE,
- {"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry}, // Still supported, but deprecated in favor of grid
{"status", nsIAccessibleRole::ROLE_STATUSBAR, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
- {"tab", nsIAccessibleRole::ROLE_PAGETAB, eNameOkFromChildren, eNoValue, kNoReqStates, kEndEntry},
- {"table", nsIAccessibleRole::ROLE_TABLE, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
- {"td", nsIAccessibleRole::ROLE_CELL, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
- {"th", nsIAccessibleRole::ROLE_CELL, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
+ {"tab", nsIAccessibleRole::ROLE_PAGETAB, eNameOkFromChildren, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE}, kEndEntry},
{"tablist", nsIAccessibleRole::ROLE_PAGETABLIST, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
{"tabpanel", nsIAccessibleRole::ROLE_PROPERTYPAGE, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
- {"textarea", nsIAccessibleRole::ROLE_ENTRY, eNameLabelOrTitle, eHasValueMinMax, kNoReqStates,
- {"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry}, // XXX nsIAccessibleStates::EXT_STATE_MULTI_LINE supported in code
- {"textfield", nsIAccessibleRole::ROLE_ENTRY, eNameLabelOrTitle, eHasValueMinMax, kNoReqStates,
- {"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY},
- {"haspopup", kBoolState, nsIAccessibleStates::STATE_HASPOPUP}, kEndEntry}, // XXX nsIAccessibleStates::EXT_STATE_SINGLE_LINE supported in code
- {"toolbar", nsIAccessibleRole::ROLE_TOOLBAR, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
+ {"textbox", nsIAccessibleRole::ROLE_ENTRY, eNameLabelOrTitle, eHasValueMinMax, kNoReqStates,
+ // Manually map EXT_STATE_SINGLE_LINE and EXT_STATE_MULTI_LINE FROM aaa:multiline
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
+ {"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY}, kEndEntry},
+ {"toolbar", nsIAccessibleRole::ROLE_TOOLBAR, eNameLabelOrTitle, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE}, kEndEntry},
{"tree", nsIAccessibleRole::ROLE_OUTLINE, eNameLabelOrTitle, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
+ {"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY},
+ {"multiselectable", kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, kEndEntry},
+ {"treegrid", nsIAccessibleRole::ROLE_TREE_TABLE, eNameLabelOrTitle, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"readonly", kBoolState, nsIAccessibleStates::STATE_READONLY},
{"multiselectable", kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE}, kEndEntry},
{"treeitem", nsIAccessibleRole::ROLE_OUTLINEITEM, eNameOkFromChildren, eNoValue, kNoReqStates,
+ {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"selected", kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
{"selected", "false", nsIAccessibleStates::STATE_SELECTABLE},
{"expanded", kBoolState, nsIAccessibleStates::STATE_EXPANDED},
{"expanded", "false", nsIAccessibleStates::STATE_COLLAPSED},
{"checked", kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE},
{"checked", "mixed", nsIAccessibleStates::STATE_MIXED},
{"checked", "false", nsIAccessibleStates::STATE_CHECKABLE},},
- {"treegroup", nsIAccessibleRole::ROLE_GROUPING, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry},
{nsnull, nsIAccessibleRole::ROLE_NOTHING, eNameLabelOrTitle, eNoValue, kNoReqStates, kEndEntry} // Last item
};
/**
* Universal states:
* The following state rules are applied to any accessible element,
* whether there is an ARIA role or not:
*/
nsStateMapEntry nsARIAMap::gWAIUnivStateMap[] = {
- {"disabled", kBoolState, nsIAccessibleStates::STATE_UNAVAILABLE},
{"required", kBoolState, nsIAccessibleStates::STATE_REQUIRED},
- {"invalid", kBoolState, nsIAccessibleStates::STATE_INVALID},
+ {"invalid", kBoolState, nsIAccessibleStates::STATE_INVALID},
+ {"haspopup", kBoolState, nsIAccessibleStates::STATE_HASPOPUP},
+ {"busy", "true", nsIAccessibleStates::STATE_BUSY},
+ {"busy", "error", nsIAccessibleStates::STATE_INVALID},
kEndEntry
};
--- a/accessible/src/base/nsARIAMap.h
+++ b/accessible/src/base/nsARIAMap.h
@@ -109,16 +109,17 @@ struct nsRoleMapEntry
// C++'s struct initialization feature.
nsStateMapEntry attributeMap1;
nsStateMapEntry attributeMap2;
nsStateMapEntry attributeMap3;
nsStateMapEntry attributeMap4;
nsStateMapEntry attributeMap5;
nsStateMapEntry attributeMap6;
nsStateMapEntry attributeMap7;
+ nsStateMapEntry attributeMap8;
};
/**
* These are currently initialized (hardcoded) in nsARIAMap.cpp,
* and provide the mappings for WAI-ARIA roles and properties using the
* structs defined in this file.
*/
struct nsARIAMap
--- a/accessible/src/base/nsAccessNode.cpp
+++ b/accessible/src/base/nsAccessNode.cpp
@@ -82,17 +82,17 @@
nsIStringBundle *nsAccessNode::gStringBundle = 0;
nsIStringBundle *nsAccessNode::gKeyStringBundle = 0;
nsITimer *nsAccessNode::gDoCommandTimer = 0;
nsIDOMNode *nsAccessNode::gLastFocusedNode = 0;
PRBool nsAccessNode::gIsAccessibilityActive = PR_FALSE;
PRBool nsAccessNode::gIsCacheDisabled = PR_FALSE;
PRBool nsAccessNode::gIsFormFillEnabled = PR_FALSE;
-nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> nsAccessNode::gGlobalDocAccessibleCache;
+nsAccessNodeHashtable nsAccessNode::gGlobalDocAccessibleCache;
nsApplicationAccessibleWrap *nsAccessNode::gApplicationAccessible = nsnull;
nsIAccessibilityService *nsAccessNode::sAccService = nsnull;
nsIAccessibilityService *nsAccessNode::GetAccService()
{
if (!sAccService) {
nsresult rv = CallGetService("@mozilla.org/accessibilityService;1",
@@ -193,17 +193,17 @@ NS_IMETHODIMP nsAccessNode::Shutdown()
mDOMNode = nsnull;
mWeakShell = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsAccessNode::GetUniqueID(void **aUniqueID)
{
- *aUniqueID = NS_STATIC_CAST(void*, mDOMNode);
+ *aUniqueID = static_cast<void*>(mDOMNode);
return NS_OK;
}
NS_IMETHODIMP nsAccessNode::GetOwnerWindow(void **aWindow)
{
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
NS_ASSERTION(docAccessible, "No root accessible pointer back, Init() not called.");
return docAccessible->GetWindowHandle(aWindow);
@@ -288,16 +288,18 @@ void nsAccessNode::ShutdownXPAccessibili
if (!gIsAccessibilityActive) {
return;
}
NS_IF_RELEASE(gStringBundle);
NS_IF_RELEASE(gKeyStringBundle);
NS_IF_RELEASE(gDoCommandTimer);
NS_IF_RELEASE(gLastFocusedNode);
NS_IF_RELEASE(sAccService);
+
+ nsApplicationAccessibleWrap::Unload();
NS_IF_RELEASE(gApplicationAccessible);
ClearCache(gGlobalDocAccessibleCache);
gIsAccessibilityActive = PR_FALSE;
NotifyA11yInitOrShutdown();
}
@@ -652,17 +654,17 @@ void nsAccessNode::GetComputedStyleDecla
/***************** Hashtable of nsIAccessNode's *****************/
already_AddRefed<nsIAccessibleDocument>
nsAccessNode::GetDocAccessibleFor(nsIWeakReference *aPresShell)
{
nsIAccessibleDocument *docAccessible = nsnull;
nsCOMPtr<nsIAccessNode> accessNode;
- gGlobalDocAccessibleCache.Get(NS_STATIC_CAST(void*, aPresShell), getter_AddRefs(accessNode));
+ gGlobalDocAccessibleCache.Get(static_cast<void*>(aPresShell), getter_AddRefs(accessNode));
if (accessNode) {
CallQueryInterface(accessNode, &docAccessible);
}
return docAccessible;
}
already_AddRefed<nsIAccessibleDocument>
nsAccessNode::GetDocAccessibleFor(nsISupports *aContainer, PRBool aCanCreate)
@@ -755,44 +757,47 @@ nsAccessNode::GetDOMNodeForContainer(nsI
CallQueryInterface(doc.get(), &node);
}
}
}
return node;
}
-void nsAccessNode::PutCacheEntry(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> &aCache,
- void* aUniqueID,
- nsIAccessNode *aAccessNode)
+void
+nsAccessNode::PutCacheEntry(nsAccessNodeHashtable& aCache,
+ void* aUniqueID,
+ nsIAccessNode *aAccessNode)
{
#ifdef DEBUG_A11Y
nsCOMPtr<nsIAccessNode> oldAccessNode;
GetCacheEntry(aCache, aUniqueID, getter_AddRefs(oldAccessNode));
NS_ASSERTION(!oldAccessNode, "This cache entry shouldn't exist already");
#endif
aCache.Put(aUniqueID, aAccessNode);
}
-void nsAccessNode::GetCacheEntry(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> &aCache,
- void* aUniqueID,
- nsIAccessNode **aAccessNode)
+void
+nsAccessNode::GetCacheEntry(nsAccessNodeHashtable& aCache,
+ void* aUniqueID,
+ nsIAccessNode **aAccessNode)
{
aCache.Get(aUniqueID, aAccessNode); // AddRefs for us
}
PLDHashOperator nsAccessNode::ClearCacheEntry(const void* aKey, nsCOMPtr<nsIAccessNode>& aAccessNode, void* aUserArg)
{
nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(aAccessNode));
privateAccessNode->Shutdown();
return PL_DHASH_REMOVE;
}
-void nsAccessNode::ClearCache(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> &aCache)
+void
+nsAccessNode::ClearCache(nsAccessNodeHashtable& aCache)
{
aCache.Enumerate(ClearCacheEntry, nsnull);
}
already_AddRefed<nsIDOMNode> nsAccessNode::GetCurrentFocus()
{
nsCOMPtr<nsIPresShell> shell = GetPresShellFor(mDOMNode);
NS_ENSURE_TRUE(shell, nsnull);
--- a/accessible/src/base/nsAccessNode.h
+++ b/accessible/src/base/nsAccessNode.h
@@ -64,40 +64,18 @@ class nsIFrame;
class nsIDOMNodeList;
class nsITimer;
class nsRootAccessible;
class nsApplicationAccessibleWrap;
#define ACCESSIBLE_BUNDLE_URL "chrome://global-platform/locale/accessible.properties"
#define PLATFORM_KEYS_BUNDLE_URL "chrome://global-platform/locale/platformKeys.properties"
-/* hashkey wrapper using void* KeyType
- *
- * @see nsTHashtable::EntryType for specification
- */
-class nsVoidHashKey : public PLDHashEntryHdr
-{
-public:
- typedef const void* KeyType;
- typedef const void* KeyTypePointer;
-
- nsVoidHashKey(KeyTypePointer aKey) : mValue(aKey) { }
- nsVoidHashKey(const nsVoidHashKey& toCopy) : mValue(toCopy.mValue) { }
- ~nsVoidHashKey() { }
-
- KeyType GetKey() const { return mValue; }
- PRBool KeyEquals(KeyTypePointer aKey) const { return aKey == mValue; }
-
- static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; }
- static PLDHashNumber HashKey(KeyTypePointer aKey) { return NS_PTR_TO_INT32(aKey) >> 2; }
- enum { ALLOW_MEMMOVE = PR_TRUE };
-
-private:
- const void* mValue;
-};
+typedef nsInterfaceHashtable<nsVoidPtrHashKey, nsIAccessNode>
+ nsAccessNodeHashtable;
class nsAccessNode: public nsIAccessNode, public nsPIAccessNode
{
public: // construction, destruction
nsAccessNode(nsIDOMNode *, nsIWeakReference* aShell);
virtual ~nsAccessNode();
NS_DECL_ISUPPORTS
@@ -108,21 +86,21 @@ class nsAccessNode: public nsIAccessNode
static void ShutdownXPAccessibility();
/**
* Return an application accessible.
*/
static already_AddRefed<nsApplicationAccessibleWrap> GetApplicationAccessible();
// Static methods for handling per-document cache
- static void PutCacheEntry(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode>& aCache,
+ static void PutCacheEntry(nsAccessNodeHashtable& aCache,
void* aUniqueID, nsIAccessNode *aAccessNode);
- static void GetCacheEntry(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode>& aCache, void* aUniqueID,
- nsIAccessNode **aAccessNode);
- static void ClearCache(nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode>& aCache);
+ static void GetCacheEntry(nsAccessNodeHashtable& aCache,
+ void* aUniqueID, nsIAccessNode **aAccessNode);
+ static void ClearCache(nsAccessNodeHashtable& aCache);
static PLDHashOperator PR_CALLBACK ClearCacheEntry(const void* aKey, nsCOMPtr<nsIAccessNode>& aAccessNode, void* aUserArg);
// Static cache methods for global document cache
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsIWeakReference *aPresShell);
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsISupports *aContainer, PRBool aCanCreate = PR_FALSE);
static already_AddRefed<nsIAccessibleDocument> GetDocAccessibleFor(nsIDOMNode *aNode);
@@ -179,17 +157,17 @@ protected:
// Static data, we do our own refcounting for our static data
static nsIStringBundle *gStringBundle;
static nsIStringBundle *gKeyStringBundle;
static nsITimer *gDoCommandTimer;
static PRBool gIsAccessibilityActive;
static PRBool gIsCacheDisabled;
static PRBool gIsFormFillEnabled;
- static nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> gGlobalDocAccessibleCache;
+ static nsAccessNodeHashtable gGlobalDocAccessibleCache;
private:
static nsIAccessibilityService *sAccService;
static nsApplicationAccessibleWrap *gApplicationAccessible;
};
#endif
--- a/accessible/src/base/nsAccessibilityAtomList.h
+++ b/accessible/src/base/nsAccessibilityAtomList.h
@@ -72,30 +72,30 @@ ACCESSIBILITY_ATOM(headerContentLanguage
ACCESSIBILITY_ATOM(areaFrame, "AreaFrame")
ACCESSIBILITY_ATOM(blockFrame, "BlockFrame")
ACCESSIBILITY_ATOM(boxFrame, "BoxFrame")
ACCESSIBILITY_ATOM(brFrame, "BRFrame")
ACCESSIBILITY_ATOM(deckFrame, "DeckFrame")
ACCESSIBILITY_ATOM(inlineBlockFrame, "InlineBlockFrame")
ACCESSIBILITY_ATOM(inlineFrame, "InlineFrame")
ACCESSIBILITY_ATOM(objectFrame, "ObjectFrame")
+ACCESSIBILITY_ATOM(placeholderFrame, "PlaceholderFrame")
ACCESSIBILITY_ATOM(scrollFrame, "ScrollFrame")
ACCESSIBILITY_ATOM(textFrame, "TextFrame")
ACCESSIBILITY_ATOM(tableCellFrame, "TableCellFrame")
ACCESSIBILITY_ATOM(tableOuterFrame, "TableOuterFrame")
// Alphabetical list of tag names
ACCESSIBILITY_ATOM(a, "a")
ACCESSIBILITY_ATOM(abbr, "abbr")
ACCESSIBILITY_ATOM(acronym, "acronym")
ACCESSIBILITY_ATOM(area, "area")
ACCESSIBILITY_ATOM(blockquote, "blockquote")
ACCESSIBILITY_ATOM(br, "br")
ACCESSIBILITY_ATOM(body, "body")
-ACCESSIBILITY_ATOM(caption, "caption")
ACCESSIBILITY_ATOM(choices, "choices") // XForms
ACCESSIBILITY_ATOM(description, "description") // XUL
ACCESSIBILITY_ATOM(dd, "dd")
ACCESSIBILITY_ATOM(div, "div")
ACCESSIBILITY_ATOM(dl, "dl")
ACCESSIBILITY_ATOM(dt, "dt")
ACCESSIBILITY_ATOM(form, "form")
ACCESSIBILITY_ATOM(h1, "h1")
@@ -104,16 +104,17 @@ ACCESSIBILITY_ATOM(h3, "h3")
ACCESSIBILITY_ATOM(h4, "h4")
ACCESSIBILITY_ATOM(h5, "h5")
ACCESSIBILITY_ATOM(h6, "h6")
ACCESSIBILITY_ATOM(item, "item") // XForms
ACCESSIBILITY_ATOM(itemset, "itemset") // XForms
ACCESSIBILITY_ATOM(img, "img")
ACCESSIBILITY_ATOM(input, "input")
ACCESSIBILITY_ATOM(label, "label")
+ACCESSIBILITY_ATOM(legend, "legend")
ACCESSIBILITY_ATOM(li, "li")
ACCESSIBILITY_ATOM(link, "link")
ACCESSIBILITY_ATOM(map, "map")
ACCESSIBILITY_ATOM(math, "math")
ACCESSIBILITY_ATOM(menu, "menu") // XUL
ACCESSIBILITY_ATOM(menupopup, "menupopup") // XUL
ACCESSIBILITY_ATOM(object, "object")
ACCESSIBILITY_ATOM(ol, "ol")
@@ -127,16 +128,19 @@ ACCESSIBILITY_ATOM(table, "table")
ACCESSIBILITY_ATOM(tbody, "tbody")
ACCESSIBILITY_ATOM(td, "td")
ACCESSIBILITY_ATOM(th, "th")
ACCESSIBILITY_ATOM(tfoot, "tfoot")
ACCESSIBILITY_ATOM(thead, "thead")
ACCESSIBILITY_ATOM(textarea, "textarea") // XForms
ACCESSIBILITY_ATOM(textbox, "textbox") // XUL
ACCESSIBILITY_ATOM(toolbaritem, "toolbaritem") // XUL
+ACCESSIBILITY_ATOM(toolbarseparator, "toolbarseparator") // XUL
+ACCESSIBILITY_ATOM(toolbarspring, "toolbarspring") // XUL
+ACCESSIBILITY_ATOM(toolbarspacer, "toolbarspacer") // XUL
ACCESSIBILITY_ATOM(tooltip, "tooltip") // XUL
ACCESSIBILITY_ATOM(tr, "tr")
ACCESSIBILITY_ATOM(ul, "ul")
// DHTML accessibility relationship attributes
ACCESSIBILITY_ATOM(controls, "controls")
ACCESSIBILITY_ATOM(describedby, "describedby")
ACCESSIBILITY_ATOM(flowto, "flowto")
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -37,17 +37,16 @@
* ***** END LICENSE BLOCK ***** */
// NOTE: alphabetically ordered
#include "nsAccessibilityAtoms.h"
#include "nsAccessibilityService.h"
#include "nsAccessibilityUtils.h"
#include "nsCURILoader.h"
#include "nsDocAccessible.h"
-#include "nsHTMLAreaAccessible.h"
#include "nsHTMLImageAccessibleWrap.h"
#include "nsHTMLLinkAccessible.h"
#include "nsHTMLSelectAccessible.h"
#include "nsHTMLTableAccessibleWrap.h"
#include "nsHTMLTextAccessible.h"
#include "nsHyperTextAccessibleWrap.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessibleProvider.h"
@@ -120,17 +119,17 @@ nsAccessibilityService::nsAccessibilityS
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (!observerService)
return;
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
nsCOMPtr<nsIWebProgress> progress(do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID));
if (progress) {
- progress->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this),
+ progress->AddProgressListener(static_cast<nsIWebProgressListener*>(this),
nsIWebProgress::NOTIFY_STATE_DOCUMENT |
nsIWebProgress::NOTIFY_LOCATION);
}
nsAccessNodeWrap::InitAccessibility();
}
nsAccessibilityService::~nsAccessibilityService()
{
@@ -150,17 +149,17 @@ nsAccessibilityService::Observe(nsISuppo
if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (observerService) {
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
}
nsCOMPtr<nsIWebProgress> progress(do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID));
if (progress) {
- progress->RemoveProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this));
+ progress->RemoveProgressListener(static_cast<nsIWebProgressListener*>(this));
}
nsAccessNodeWrap::ShutdownAccessibility();
}
return NS_OK;
}
// nsIWebProgressListener
NS_IMETHODIMP nsAccessibilityService::OnStateChange(nsIWebProgress *aWebProgress,
@@ -274,17 +273,17 @@ NS_IMETHODIMP nsAccessibilityService::On
return NS_OK;
}
nsresult
nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
{
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
- *aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
+ *aRealFrame = static_cast<nsIFrame*>(aFrame);
nsCOMPtr<nsIContent> content = (*aRealFrame)->GetContent();
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
if (!content || !node)
return NS_ERROR_FAILURE;
*aNode = node;
NS_IF_ADDREF(*aNode);
nsCOMPtr<nsIDocument> document = content->GetDocument();
@@ -408,29 +407,16 @@ nsAccessibilityService::CreateHTML4Butto
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
-nsAccessibilityService::CreateHTMLAreaAccessible(nsIWeakReference *aShell, nsIDOMNode *aDOMNode, nsIAccessible *aParent,
- nsIAccessible **_retval)
-{
- *_retval = new nsHTMLAreaAccessible(aDOMNode, aParent, aShell);
-
- if (! *_retval)
- return NS_ERROR_OUT_OF_MEMORY;
-
- NS_ADDREF(*_retval);
- return NS_OK;
-}
-
-NS_IMETHODIMP
nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@@ -449,37 +435,39 @@ nsAccessibilityService::CreateHTMLAccess
nsIDOMNode *aNode,
const nsAString& aRole,
nsIAccessible **aAccessible)
{
// This method assumes we're in an HTML namespace.
*aAccessible = nsnull;
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
nsIAtom *tag = content->Tag();
- if (tag == nsAccessibilityAtoms::option) {
+ if (tag == nsAccessibilityAtoms::legend) {
+ *aAccessible = new nsHTMLLegendAccessible(aNode, aWeakShell);
+ }
+ else if (tag == nsAccessibilityAtoms::option) {
*aAccessible = new nsHTMLSelectOptionAccessible(aNode, aWeakShell);
}
else if (tag == nsAccessibilityAtoms::optgroup) {
*aAccessible = new nsHTMLSelectOptGroupAccessible(aNode, aWeakShell);
}
else if (tag == nsAccessibilityAtoms::ul || tag == nsAccessibilityAtoms::ol) {
*aAccessible = new nsHTMLListAccessible(aNode, aWeakShell);
}
else if (tag == nsAccessibilityAtoms::a) {
- *aAccessible = new nsHTMLLinkAccessible(aNode, aWeakShell, aFrame);
+ *aAccessible = new nsHTMLLinkAccessible(aNode, aWeakShell);
}
else if (tag == nsAccessibilityAtoms::li && aFrame->GetType() != nsAccessibilityAtoms::blockFrame) {
// Normally this is created by the list item frame which knows about the bullet frame
// However, in this case the list item must have been styled using display: foo
- *aAccessible = new nsHTMLLIAccessible(aNode, aWeakShell, nsnull, EmptyString());
+ *aAccessible = new nsHTMLLIAccessible(aNode, aWeakShell, EmptyString());
}
else if (tag == nsAccessibilityAtoms::abbr ||
tag == nsAccessibilityAtoms::acronym ||
tag == nsAccessibilityAtoms::blockquote ||
- tag == nsAccessibilityAtoms::caption ||
tag == nsAccessibilityAtoms::dd ||
tag == nsAccessibilityAtoms::dl ||
tag == nsAccessibilityAtoms::dt ||
tag == nsAccessibilityAtoms::form ||
tag == nsAccessibilityAtoms::h1 ||
tag == nsAccessibilityAtoms::h2 ||
tag == nsAccessibilityAtoms::h3 ||
tag == nsAccessibilityAtoms::h4 ||
@@ -504,20 +492,18 @@ nsAccessibilityService::CreateHTMLLIAcce
nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- nsIFrame *bulletFrame = NS_STATIC_CAST(nsIFrame*, aBulletFrame);
- NS_ASSERTION(bulletFrame, "bullet frame argument not a frame");
- *_retval = new nsHTMLLIAccessible(node, weakShell, bulletFrame, aBulletText);
+ *_retval = new nsHTMLLIAccessible(node, weakShell, aBulletText);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
@@ -528,17 +514,17 @@ nsAccessibilityService::CreateHyperTextA
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
- if (nsAccessibilityUtils::HasListener(content, NS_LITERAL_STRING("click"))) {
+ if (nsAccUtils::HasListener(content, NS_LITERAL_STRING("click"))) {
// nsLinkableAccessible inherits from nsHyperTextAccessible, but
// it also includes code for dealing with the onclick
*aAccessible = new nsLinkableAccessible(node, weakShell);
}
else {
*aAccessible = new nsHyperTextAccessibleWrap(node, weakShell);
}
if (nsnull == *aAccessible)
@@ -646,17 +632,17 @@ nsAccessibilityService::CreateHTMLListbo
*/
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
nsIAccessible **aAccessible)
{
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsIFrame *frame;
- GetInfo(NS_STATIC_CAST(nsIFrame*, aFrame), &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
+ GetInfo(static_cast<nsIFrame*>(aFrame), &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
*aAccessible = nsnull;
if (!frame || frame->GetRect().IsEmpty()) {
return NS_ERROR_FAILURE;
}
// 1) for object elements containing either HTML or TXT documents
nsCOMPtr<nsIDOMDocument> domDoc;
nsCOMPtr<nsIDOMHTMLObjectElement> obj(do_QueryInterface(node));
@@ -758,17 +744,17 @@ nsAccessibilityService::CreateHTMLTableH
rv = GetShellFromNode(aDOMNode, getter_AddRefs(weakShell));
NS_ENSURE_SUCCESS(rv, rv);
nsHTMLTableHeadAccessibleWrap* accTableHead =
new nsHTMLTableHeadAccessibleWrap(aDOMNode, weakShell);
NS_ENSURE_TRUE(accTableHead, NS_ERROR_OUT_OF_MEMORY);
- *_retval = NS_STATIC_CAST(nsIAccessible *, accTableHead);
+ *_retval = static_cast<nsIAccessible *>(accTableHead);
NS_IF_ADDREF(*_retval);
return rv;
#endif
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLTableCellAccessible(nsISupports *aFrame, nsIAccessible **_retval)
@@ -796,17 +782,17 @@ nsAccessibilityService::CreateHTMLTextAc
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
// XXX Don't create ATK objects for these
- *_retval = new nsHTMLTextAccessible(node, weakShell, frame);
+ *_retval = new nsHTMLTextAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
@@ -876,16 +862,34 @@ nsAccessibilityService::CreateHTMLBRAcce
*_retval = new nsHTMLBRAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
+NS_IMETHODIMP
+nsAccessibilityService::CreateHTMLCaptionAccessible(nsISupports *aFrame, nsIAccessible **_retval)
+{
+ nsIFrame* frame;
+ nsCOMPtr<nsIDOMNode> node;
+ nsCOMPtr<nsIWeakReference> weakShell;
+ nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
+ if (NS_FAILED(rv))
+ return rv;
+
+ *_retval = new nsHTMLCaptionAccessible(node, weakShell);
+ if (! *_retval)
+ return NS_ERROR_OUT_OF_MEMORY;
+
+ NS_ADDREF(*_retval);
+ return NS_OK;
+}
+
NS_IMETHODIMP nsAccessibilityService::GetCachedAccessible(nsIDOMNode *aNode,
nsIWeakReference *aWeakShell,
nsIAccessible **aAccessible)
{
nsCOMPtr<nsIAccessNode> accessNode;
nsresult rv = GetCachedAccessNode(aNode, aWeakShell, getter_AddRefs(accessNode));
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(accessNode));
NS_IF_ADDREF(*aAccessible = accessible);
@@ -899,17 +903,17 @@ NS_IMETHODIMP nsAccessibilityService::Ge
nsCOMPtr<nsIAccessibleDocument> accessibleDoc =
nsAccessNode::GetDocAccessibleFor(aWeakShell);
if (!accessibleDoc) {
*aAccessNode = nsnull;
return NS_ERROR_FAILURE;
}
- return accessibleDoc->GetCachedAccessNode(NS_STATIC_CAST(void*, aNode), aAccessNode);
+ return accessibleDoc->GetCachedAccessNode(static_cast<void*>(aNode), aAccessNode);
}
NS_IMETHODIMP
nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
{
if ( aRole >= NS_ARRAY_LENGTH(kRoleNames)) {
aString.AssignLiteral("unknown");
return NS_OK;
@@ -986,36 +990,48 @@ nsAccessibilityService::GetStringStates(
if (aStates & nsIAccessibleStates::STATE_IMPORTANT)
stringStates->Add(NS_LITERAL_STRING("important"));
if (aStates & nsIAccessibleStates::STATE_INVALID)
stringStates->Add(NS_LITERAL_STRING("invalid"));
if (aStates & nsIAccessibleStates::STATE_CHECKABLE)
stringStates->Add(NS_LITERAL_STRING("checkable"));
//extraStates
+ if (aExtraStates & nsIAccessibleStates::EXT_STATE_SUPPORTS_AUTOCOMPLETION)
+ stringStates->Add(NS_LITERAL_STRING("autocompletion"));
+ if (aExtraStates & nsIAccessibleStates::EXT_STATE_DEFUNCT)
+ stringStates->Add(NS_LITERAL_STRING("defunct"));
if (aExtraStates & nsIAccessibleStates::EXT_STATE_SELECTABLE_TEXT)
stringStates->Add(NS_LITERAL_STRING("selectable text"));
if (aExtraStates & nsIAccessibleStates::EXT_STATE_EDITABLE)
stringStates->Add(NS_LITERAL_STRING("editable"));
if (aExtraStates & nsIAccessibleStates::EXT_STATE_ACTIVE)
stringStates->Add(NS_LITERAL_STRING("active"));
- if (aExtraStates & nsIAccessibleStates::EXT_STATE_EXPANDABLE)
- stringStates->Add(NS_LITERAL_STRING("expandable"));
if (aExtraStates & nsIAccessibleStates::EXT_STATE_MODAL)
stringStates->Add(NS_LITERAL_STRING("modal"));
if (aExtraStates & nsIAccessibleStates::EXT_STATE_MULTI_LINE)
stringStates->Add(NS_LITERAL_STRING("multi line"));
- if (aExtraStates & nsIAccessibleStates::EXT_STATE_SENSITIVE)
- stringStates->Add(NS_LITERAL_STRING("sensitive"));
+ if (aExtraStates & nsIAccessibleStates::EXT_STATE_HORIZONTAL)
+ stringStates->Add(NS_LITERAL_STRING("horizontal"));
+ if (aExtraStates & nsIAccessibleStates::EXT_STATE_OPAQUE)
+ stringStates->Add(NS_LITERAL_STRING("opaque"));
if (aExtraStates & nsIAccessibleStates::EXT_STATE_SINGLE_LINE)
stringStates->Add(NS_LITERAL_STRING("single line"));
if (aExtraStates & nsIAccessibleStates::EXT_STATE_TRANSIENT)
stringStates->Add(NS_LITERAL_STRING("transient"));
if (aExtraStates & nsIAccessibleStates::EXT_STATE_VERTICAL)
stringStates->Add(NS_LITERAL_STRING("vertical"));
+ if (aExtraStates & nsIAccessibleStates::EXT_STATE_STALE)
+ stringStates->Add(NS_LITERAL_STRING("stale"));
+ if (aExtraStates & nsIAccessibleStates::EXT_STATE_ENABLED)
+ stringStates->Add(NS_LITERAL_STRING("enabled"));
+ if (aExtraStates & nsIAccessibleStates::EXT_STATE_SENSITIVE)
+ stringStates->Add(NS_LITERAL_STRING("sensitive"));
+ if (aExtraStates & nsIAccessibleStates::EXT_STATE_EXPANDABLE)
+ stringStates->Add(NS_LITERAL_STRING("expandable"));
//unknown states
PRUint32 stringStatesLength = 0;
stringStates->GetLength(&stringStatesLength);
if (!stringStatesLength)
stringStates->Add(NS_LITERAL_STRING("unknown"));
@@ -1363,31 +1379,36 @@ NS_IMETHODIMP nsAccessibilityService::Ge
break;
}
}
}
}
if (tryFrame) {
+ if (frame->GetType() != nsAccessibilityAtoms::placeholderFrame &&
+ frame->GetRect().IsEmpty()) {
+ *aIsHidden = PR_TRUE;
+ return NS_OK;
+ }
frame->GetAccessible(getter_AddRefs(newAcc)); // Try using frame to do it
}
}
if (!newAcc) {
GetAccessibleForDeckChildren(aNode, getter_AddRefs(newAcc));
}
// If no accessible, see if we need to create a generic accessible because
// of some property that makes this object interesting
// We don't do this for <body>, <html>, <window>, <dialog> etc. which
// correspond to the doc accessible and will be created in any case
if (!newAcc && content->Tag() != nsAccessibilityAtoms::body && content->GetParent() &&
(content->IsFocusable() ||
- (isHTML && nsAccessibilityUtils::HasListener(content, NS_LITERAL_STRING("click"))) ||
+ (isHTML && nsAccUtils::HasListener(content, NS_LITERAL_STRING("click"))) ||
content->HasAttr(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::describedby) ||
content->HasAttr(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::labelledby) ||
content->HasAttr(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::required) ||
content->HasAttr(kNameSpaceID_WAIProperties, nsAccessibilityAtoms::invalid) ||
!role.IsEmpty())) {
// This content is focusable or has an interesting dynamic content accessibility property.
// If it's interesting we need it in the accessibility hierarchy so that events or
// other accessibles can point to it, or so that it can hold a state, etc.
@@ -1615,16 +1636,19 @@ nsresult nsAccessibilityService::GetAcce
*aAccessible = new nsXULToolbarAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULToolbarSeparator:
*aAccessible = new nsXULToolbarSeparatorAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULTooltip:
*aAccessible = new nsXULTooltipAccessible(aNode, weakShell);
break;
+ case nsIAccessibleProvider::XULToolbarButton:
+ *aAccessible = new nsXULToolbarButtonAccessible(aNode, weakShell);
+ break;
#endif // MOZ_XUL
#ifndef DISABLE_XFORMS_HOOKS
// XForms elements
case nsIAccessibleProvider::XFormsContainer:
*aAccessible = new nsXFormsContainerAccessible(aNode, weakShell);
break;
@@ -1697,17 +1721,17 @@ nsresult nsAccessibilityService::GetAcce
}
NS_IMETHODIMP nsAccessibilityService::AddNativeRootAccessible(void * aAtkAccessible, nsIAccessible **aRootAccessible)
{
#ifdef MOZ_ACCESSIBILITY_ATK
nsNativeRootAccessibleWrap* rootAccWrap =
new nsNativeRootAccessibleWrap((AtkObject*)aAtkAccessible);
- *aRootAccessible = NS_STATIC_CAST(nsIAccessible*, rootAccWrap);
+ *aRootAccessible = static_cast<nsIAccessible*>(rootAccWrap);
NS_ADDREF(*aRootAccessible);
nsRefPtr<nsApplicationAccessibleWrap> appRoot =
nsAccessNode::GetApplicationAccessible();
NS_ENSURE_STATE(appRoot);
appRoot->AddRootAccessible(*aRootAccessible);
--- a/accessible/src/base/nsAccessibilityUtils.cpp
+++ b/accessible/src/base/nsAccessibilityUtils.cpp
@@ -32,47 +32,48 @@
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibilityUtils.h"
+
+#include "nsPIAccessible.h"
+#include "nsAccessibleEventData.h"
+
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIEventListenerManager.h"
void
-nsAccessibilityUtils::GetAccAttr(nsIPersistentProperties *aAttributes,
- nsIAtom *aAttrName,
- nsAString& aAttrValue)
+nsAccUtils::GetAccAttr(nsIPersistentProperties *aAttributes, nsIAtom *aAttrName,
+ nsAString& aAttrValue)
{
nsCAutoString attrName;
aAttrName->ToUTF8String(attrName);
aAttributes->GetStringProperty(attrName, aAttrValue);
}
void
-nsAccessibilityUtils::SetAccAttr(nsIPersistentProperties *aAttributes,
- nsIAtom *aAttrName,
- const nsAString& aAttrValue)
+nsAccUtils::SetAccAttr(nsIPersistentProperties *aAttributes, nsIAtom *aAttrName,
+ const nsAString& aAttrValue)
{
nsAutoString oldValue;
nsCAutoString attrName;
aAttrName->ToUTF8String(attrName);
aAttributes->SetStringProperty(attrName, aAttrValue, oldValue);
}
void
-nsAccessibilityUtils::GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
- PRInt32 *aLevel,
- PRInt32 *aPosInSet,
- PRInt32 *aSetSize)
+nsAccUtils::GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
+ PRInt32 *aLevel, PRInt32 *aPosInSet,
+ PRInt32 *aSetSize)
{
*aLevel = 0;
*aPosInSet = 0;
*aSetSize = 0;
nsAutoString value;
PRInt32 error = NS_OK;
@@ -94,34 +95,33 @@ nsAccessibilityUtils::GetAccGroupAttrs(n
if (!value.IsEmpty()) {
PRInt32 sizeSet = value.ToInteger(&error);
if (NS_SUCCEEDED(error))
*aSetSize = sizeSet;
}
}
PRBool
-nsAccessibilityUtils::HasAccGroupAttrs(nsIPersistentProperties *aAttributes)
+nsAccUtils::HasAccGroupAttrs(nsIPersistentProperties *aAttributes)
{
nsAutoString value;
GetAccAttr(aAttributes, nsAccessibilityAtoms::setsize, value);
if (!value.IsEmpty()) {
GetAccAttr(aAttributes, nsAccessibilityAtoms::posinset, value);
return !value.IsEmpty();
}
return PR_FALSE;
}
void
-nsAccessibilityUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
- PRInt32 aLevel,
- PRInt32 aPosInSet,
- PRInt32 aSetSize)
+nsAccUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
+ PRInt32 aLevel, PRInt32 aPosInSet,
+ PRInt32 aSetSize)
{
nsAutoString value;
if (aLevel) {
value.AppendInt(aLevel);
SetAccAttr(aAttributes, nsAccessibilityAtoms::level, value);
}
@@ -132,18 +132,18 @@ nsAccessibilityUtils::SetAccGroupAttrs(n
value.Truncate();
value.AppendInt(aSetSize);
SetAccAttr(aAttributes, nsAccessibilityAtoms::setsize, value);
}
}
void
-nsAccessibilityUtils::SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
- nsIPersistentProperties *aAttributes)
+nsAccUtils::SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
+ nsIPersistentProperties *aAttributes)
{
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(aNode));
if (!item)
return;
nsCOMPtr<nsIDOMXULSelectControlElement> control;
item->GetControl(getter_AddRefs(control));
if (!control)
@@ -152,17 +152,33 @@ nsAccessibilityUtils::SetAccAttrsForXULS
PRUint32 itemsCount;
control->GetItemCount(&itemsCount);
PRInt32 indexOf;
control->GetIndexOfItem(item, &indexOf);
SetAccGroupAttrs(aAttributes, 0, indexOf + 1, itemsCount);
}
-PRBool nsAccessibilityUtils::HasListener(nsIContent *aContent, const nsAString& aEventType)
+PRBool
+nsAccUtils::HasListener(nsIContent *aContent, const nsAString& aEventType)
{
NS_ENSURE_ARG_POINTER(aContent);
nsCOMPtr<nsIEventListenerManager> listenerManager;
aContent->GetListenerManager(PR_FALSE, getter_AddRefs(listenerManager));
return listenerManager && listenerManager->HasListenersFor(aEventType);
}
+nsresult
+nsAccUtils::FireAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible)
+{
+ NS_ENSURE_ARG(aAccessible);
+
+ nsCOMPtr<nsPIAccessible> pAccessible(do_QueryInterface(aAccessible));
+ NS_ASSERTION(pAccessible, "Accessible doesn't implement nsPIAccessible");
+
+ nsCOMPtr<nsIAccessibleEvent> event =
+ new nsAccEvent(aEventType, aAccessible, nsnull);
+ NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
+
+ return pAccessible->FireAccessibleEvent(event);
+}
+
--- a/accessible/src/base/nsAccessibilityUtils.h
+++ b/accessible/src/base/nsAccessibilityUtils.h
@@ -35,22 +35,23 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsAccessibilityUtils_h_
#define nsAccessibilityUtils_h_
#include "nsAccessibilityAtoms.h"
+#include "nsIAccessible.h"
#include "nsIDOMNode.h"
#include "nsIPersistentProperties2.h"
#include "nsIContent.h"
-class nsAccessibilityUtils
+class nsAccUtils
{
public:
/**
* Returns value of attribute from the given attributes container.
*
* @param aAttributes - attributes container
* @param aAttrName - the name of requested attribute
* @param aAttrValue - value of attribute
@@ -96,12 +97,21 @@ public:
*
* @param aNode - XUL element that implements
* nsIDOMXULSelectControlItemElement interface
* @param aAttributes - attributes container
*/
static void SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
nsIPersistentProperties *aAttributes);
+ /**
+ * Return true if the given node has registered event listener of the given
+ * type.
+ */
static PRBool HasListener(nsIContent *aContent, const nsAString& aEventType);
+
+ /**
+ * Fire accessible event of the given type for the given accessible.
+ */
+ static nsresult FireAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible);
};
#endif
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -187,23 +187,23 @@ PRBool nsAccessible::IsTextInterfaceSupp
nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
// Custom-built QueryInterface() knows when we support nsIAccessibleSelectable
// based on role attribute and waistate:multiselectable
*aInstancePtr = nsnull;
if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
- *aInstancePtr = NS_STATIC_CAST(nsIAccessible*, this);
+ *aInstancePtr = static_cast<nsIAccessible*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
if(aIID.Equals(NS_GET_IID(nsPIAccessible))) {
- *aInstancePtr = NS_STATIC_CAST(nsPIAccessible*, this);
+ *aInstancePtr = static_cast<nsPIAccessible*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAccessibleSelectable))) {
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
if (!content) {
return NS_ERROR_FAILURE; // This accessible has been shut down
@@ -215,34 +215,34 @@ nsresult nsAccessible::QueryInterface(RE
// If either attribute (role or multiselectable) change, then we'll
// destroy this accessible so that we can follow COM identity rules.
static nsIContent::AttrValuesArray strings[] =
{&nsAccessibilityAtoms::_empty, &nsAccessibilityAtoms::_false, nsnull};
if (content->FindAttrValueIn(kNameSpaceID_WAIProperties ,
nsAccessibilityAtoms::multiselectable,
strings, eCaseMatters) ==
nsIContent::ATTR_VALUE_NO_MATCH) {
- *aInstancePtr = NS_STATIC_CAST(nsIAccessibleSelectable*, this);
+ *aInstancePtr = static_cast<nsIAccessibleSelectable*>(this);
NS_ADDREF_THIS();
}
}
}
if (aIID.Equals(NS_GET_IID(nsIAccessibleValue))) {
if (mRoleMapEntry && mRoleMapEntry->valueRule != eNoValue) {
- *aInstancePtr = NS_STATIC_CAST(nsIAccessibleValue*, this);
+ *aInstancePtr = static_cast<nsIAccessibleValue*>(this);
NS_ADDREF_THIS();
}
}
if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperLink))) {
nsCOMPtr<nsIAccessible> parent(GetParent());
nsCOMPtr<nsIAccessibleHyperText> hyperTextParent(do_QueryInterface(parent));
if (hyperTextParent) {
- *aInstancePtr = NS_STATIC_CAST(nsIAccessibleHyperLink*, this);
+ *aInstancePtr = static_cast<nsIAccessibleHyperLink*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_ERROR_NO_INTERFACE;
}
return nsAccessNode::QueryInterface(aIID, aInstancePtr);
}
@@ -250,17 +250,17 @@ nsresult nsAccessible::QueryInterface(RE
nsAccessible::nsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): nsAccessNodeWrap(aNode, aShell),
mParent(nsnull), mFirstChild(nsnull), mNextSibling(nsnull), mRoleMapEntry(nsnull),
mAccChildCount(eChildCountUninitialized)
{
#ifdef NS_DEBUG_X
{
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aShell));
printf(">>> %p Created Acc - DOM: %p PS: %p",
- (void*)NS_STATIC_CAST(nsIAccessible*, this), (void*)aNode,
+ (void*)static_cast<nsIAccessible*>(this), (void*)aNode,
(void*)shell.get());
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
if (content) {
nsAutoString buf;
if (content->NodeInfo())
content->NodeInfo()->GetQualifiedName(buf);
printf(" Con: %s@%p", NS_ConvertUTF16toUTF8(buf).get(), (void *)content.get());
if (NS_SUCCEEDED(GetName(buf))) {
@@ -592,17 +592,17 @@ NS_IMETHODIMP nsAccessible::GetParent(ns
nsresult rv = GetCachedParent(aParent);
if (NS_FAILED(rv) || *aParent) {
return rv;
}
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
NS_ENSURE_TRUE(docAccessible, NS_ERROR_FAILURE);
- return docAccessible->GetAccessibleInParentChain(mDOMNode, PR_TRUE, aParent);
+ return docAccessible->GetAccessibleInParentChain(mDOMNode, aParent);
}
NS_IMETHODIMP nsAccessible::GetCachedParent(nsIAccessible ** aParent)
{
*aParent = nsnull;
if (!mWeakShell) {
// This node has been shut down
return NS_ERROR_FAILURE;
@@ -1072,36 +1072,25 @@ nsAccessible::GetState(PRUint32 *aState,
*aExtraState |= nsIAccessibleStates::EXT_STATE_HORIZONTAL;
}
}
}
// XXX We can remove this hack once we support RDF-based role & state maps
if (mRoleMapEntry && (mRoleMapEntry->role == nsIAccessibleRole::ROLE_ENTRY ||
mRoleMapEntry->role == nsIAccessibleRole::ROLE_PASSWORD_TEXT)) {
- PRBool isEqual =
- NS_LITERAL_CSTRING("textarea").Equals(mRoleMapEntry->roleString);
- if (isEqual) {
+ if (content->AttrValueIs(kNameSpaceID_WAIProperties , nsAccessibilityAtoms::multiline,
+ nsAccessibilityAtoms::_true, eCaseMatters)) {
*aExtraState |= nsIAccessibleStates::EXT_STATE_MULTI_LINE;
}
else {
*aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
}
}
- if (!(state & nsIAccessibleStates::STATE_UNAVAILABLE)) { // If not disabled
- *aExtraState |= nsIAccessibleStates::EXT_STATE_ENABLED |
- nsIAccessibleStates::EXT_STATE_SENSITIVE;
- }
-
- if (state & (nsIAccessibleStates::STATE_COLLAPSED |
- nsIAccessibleStates::STATE_EXPANDED)) {
- *aExtraState |= nsIAccessibleStates::EXT_STATE_EXPANDABLE;
- }
-
return NS_OK;
}
/* readonly attribute boolean focusedChild; */
NS_IMETHODIMP nsAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
{
nsCOMPtr<nsIAccessible> focusedChild;
if (gLastFocusedNode == mDOMNode) {
@@ -1503,17 +1492,17 @@ nsresult nsAccessible::AppendFlatStringF
nsCOMPtr<nsIContent> appendedSubtreeStart(do_QueryInterface(mDOMNode));
if (parentContent && parentContent != appendedSubtreeStart) {
nsIFrame *frame = shell->GetPrimaryFrameFor(parentContent);
if (frame) {
// If this text is inside a block level frame (as opposed to span level), we need to add spaces around that
// block's text, so we don't get words jammed together in final name
// Extra spaces will be trimmed out later
const nsStyleDisplay* display = frame->GetStyleDisplay();
- if (display->IsBlockLevel() ||
+ if (display->IsBlockOutside() ||
display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL) {
isHTMLBlock = PR_TRUE;
if (!aFlatString->IsEmpty()) {
aFlatString->Append(PRUnichar(' '));
}
}
}
}
@@ -1725,17 +1714,18 @@ nsresult nsAccessible::GetTextFromRelati
}
}
return rv;
}
nsIContent*
nsAccessible::FindNeighbourPointingToNode(nsIContent *aForNode,
- nsIAtom *aTagName, nsIAtom *aAttr,
+ nsIAtom *aTagName, nsIAtom *aRelationAttr,
+ PRUint32 aRelationNameSpaceID,
PRUint32 aAncestorLevelsToSearch)
{
nsCOMPtr<nsIContent> binding;
nsAutoString controlID;
aForNode->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::id, controlID);
if (controlID.IsEmpty()) {
binding = aForNode->GetBindingParent();
@@ -1780,47 +1770,47 @@ nsAccessible::FindNeighbourPointingToNod
if (NS_FAILED(rv))
return nsnull;
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
if (!content)
return nsnull;
if (content != prevSearched) {
- labelContent = FindDescendantPointingToID(&controlID, content, aAttr,
- nsnull, kNameSpaceID_None,
+ labelContent = FindDescendantPointingToID(&controlID, content, aRelationAttr,
+ aRelationNameSpaceID, nsnull,
aTagName);
}
}
break;
}
labelContent = FindDescendantPointingToID(&controlID, aForNode,
- aAttr, prevSearched,
- kNameSpaceID_None, aTagName);
+ aRelationAttr, aRelationNameSpaceID,
+ prevSearched, aTagName);
prevSearched = aForNode;
}
return labelContent;
}
-// Pass in aForAttrib == nsnull if any <label> will do
+// Pass in aRelationAttr == nsnull if any <label> will do
nsIContent*
nsAccessible::FindDescendantPointingToID(const nsAString *aId,
nsIContent *aLookContent,
- nsIAtom *aForAttrib,
+ nsIAtom *aRelationAttr,
+ PRUint32 aRelationNameSpaceID,
nsIContent *aExcludeContent,
- PRUint32 aForAttribNameSpace,
nsIAtom *aTagType)
{
if (!aTagType || aLookContent->Tag() == aTagType) {
- if (aForAttrib) {
- // Check for ID in the attribute aForAttrib, which can be a list
+ if (aRelationAttr) {
+ // Check for ID in the attribute aRelationAttr, which can be a list
nsAutoString idList;
- if (aLookContent->GetAttr(aForAttribNameSpace, aForAttrib, idList)) {
+ if (aLookContent->GetAttr(aRelationNameSpaceID, aRelationAttr, idList)) {
idList.Insert(' ', 0); // Surround idlist with spaces for search
idList.Append(' ');
nsAutoString id(*aId);
id.Insert(' ', 0); // Surround id with spaces for search
id.Append(' ');
// idList is now a set of id's with spaces around each,
// and id also has spaces around it.
// If id is a substring of idList then we have a match
@@ -1836,22 +1826,22 @@ nsAccessible::FindDescendantPointingToID
// Recursively search descendants for labels
PRUint32 count = 0;
nsIContent *child;
nsIContent *labelContent = nsnull;
while ((child = aLookContent->GetChildAt(count++)) != nsnull) {
if (child != aExcludeContent) {
- labelContent = FindDescendantPointingToID(aId, child, aForAttrib,
- aExcludeContent,
- aForAttribNameSpace, aTagType);
- }
- if (labelContent) {
- return labelContent;
+ labelContent = FindDescendantPointingToID(aId, child, aRelationAttr,
+ aRelationNameSpaceID, aExcludeContent,
+ aTagType);
+ if (labelContent) {
+ return labelContent;
+ }
}
}
return nsnull;
}
/**
* Only called if the element is not a nsIDOMXULControlElement. Initially walks up
* the DOM tree to the form, concatonating label elements as it goes. Then checks for
@@ -2001,30 +1991,29 @@ PRBool nsAccessible::IsNodeRelevant(nsID
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
NS_ENSURE_TRUE(accService, PR_FALSE);
nsCOMPtr<nsIDOMNode> relevantNode;
accService->GetRelevantContentNodeFor(aNode, getter_AddRefs(relevantNode));
return aNode == relevantNode;
}
-NS_IMETHODIMP nsAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget, void * aData)
+NS_IMETHODIMP
+nsAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget,
+ void * aData)
{
- // Don't fire event for accessible that has been shut down
+ // Don't fire event for accessible that has been shut down.
if (!mWeakShell)
return NS_ERROR_FAILURE;
- NS_ENSURE_TRUE(IsNodeRelevant(mDOMNode), NS_ERROR_FAILURE);
-
- nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
- nsCOMPtr<nsPIAccessible> eventHandlingAccessible(do_QueryInterface(docAccessible));
- if (eventHandlingAccessible)
- return eventHandlingAccessible->FireToolkitEvent(aEvent, aTarget, aData);
-
- return NS_ERROR_FAILURE;
+ nsCOMPtr<nsIAccessibleEvent> accEvent =
+ new nsAccEvent(aEvent, aTarget, aData);
+ NS_ENSURE_TRUE(accEvent, NS_ERROR_OUT_OF_MEMORY);
+
+ return FireAccessibleEvent(accEvent);
}
NS_IMETHODIMP
nsAccessible::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
{
NS_ENSURE_ARG_POINTER(aEvent);
nsCOMPtr<nsIDOMNode> eventNode;
aEvent->GetDOMNode(getter_AddRefs(eventNode));
@@ -2072,29 +2061,30 @@ nsAccessible::GetAttributes(nsIPersisten
}
// XXX In the future we may need to expose the dynamic content role inheritance chain
// through this attribute
nsAutoString xmlRole;
if (GetRoleAttribute(content, xmlRole)) {
attributes->SetStringProperty(NS_LITERAL_CSTRING("xml-roles"), xmlRole, oldValueUnused);
}
- char *ariaProperties[] = { "live", "atomic", "relevant", "datatype", "level", "posinset", "setsize", "sort" };
+ char *ariaProperties[] = { "live", "channel", "atomic", "relevant", "datatype", "level",
+ "posinset", "setsize", "sort", "grab", "dropeffect"};
for (PRUint32 index = 0; index < NS_ARRAY_LENGTH(ariaProperties); index ++) {
nsAutoString value;
nsCOMPtr<nsIAtom> attr = do_GetAtom(ariaProperties[index]);
if (content->GetAttr(kNameSpaceID_WAIProperties, attr, value)) {
ToLowerCase(value);
attributes->SetStringProperty(nsDependentCString(ariaProperties[index]), value, oldValueUnused);
}
}
}
- if (!nsAccessibilityUtils::HasAccGroupAttrs(attributes)) {
+ if (!nsAccUtils::HasAccGroupAttrs(attributes)) {
// The role of an accessible can be pointed by ARIA attribute but ARIA
// posinset, level, setsize may be skipped. Therefore we calculate here
// these properties to map them into description.
// If accessible is invisible we don't want to calculate group ARIA
// attributes for it.
PRUint32 state = State(this);
if (state & nsIAccessibleStates::STATE_INVISIBLE)
@@ -2146,19 +2136,18 @@ nsAccessible::GetAttributes(nsIPersisten
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM)
++ groupLevel;
parent->GetParent(getter_AddRefs(nextParent));
parent.swap(nextParent);
}
}
- nsAccessibilityUtils::SetAccGroupAttrs(attributes, groupLevel,
- positionInGroup,
- setSize);
+ nsAccUtils::SetAccGroupAttrs(attributes, groupLevel, positionInGroup,
+ setSize);
}
}
attributes.swap(*aAttributes);
return NS_OK;
}
@@ -2201,18 +2190,17 @@ nsAccessible::GroupPosition(PRInt32 *aGr
nsCOMPtr<nsIPersistentProperties> attributes;
nsresult rv = GetAttributes(getter_AddRefs(attributes));
NS_ENSURE_SUCCESS(rv, rv);
if (!attributes) {
return NS_ERROR_FAILURE;
}
PRInt32 level, posInSet, setSize;
- nsAccessibilityUtils::GetAccGroupAttrs(attributes,
- &level, &posInSet, &setSize);
+ nsAccUtils::GetAccGroupAttrs(attributes, &level, &posInSet, &setSize);
if (!posInSet && !setSize)
return NS_OK;
*aGroupLevel = level;
*aPositionInGroup = posInSet;
*aSimilarItemsInGroup = setSize - 1;
@@ -2249,16 +2237,29 @@ PRBool nsAccessible::MappedAttrState(nsI
NS_IMETHODIMP
nsAccessible::GetFinalState(PRUint32 *aState, PRUint32 *aExtraState)
{
NS_ENSURE_ARG_POINTER(aState);
nsresult rv = GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
+ // Set additional states which presence depends on another states.
+ if (aExtraState) {
+ if (!(*aState & nsIAccessibleStates::STATE_UNAVAILABLE)) {
+ *aExtraState |= nsIAccessibleStates::EXT_STATE_ENABLED |
+ nsIAccessibleStates::EXT_STATE_SENSITIVE;
+ }
+
+ if (*aState & (nsIAccessibleStates::STATE_COLLAPSED |
+ nsIAccessibleStates::STATE_EXPANDED)) {
+ *aExtraState |= nsIAccessibleStates::EXT_STATE_EXPANDABLE;
+ }
+ }
+
// Apply ARIA states to be sure accessible states will be overriden.
return GetARIAState(aState);
}
nsresult
nsAccessible::GetARIAState(PRUint32 *aState)
{
if (!mDOMNode) {
@@ -2289,18 +2290,19 @@ nsAccessible::GetARIAState(PRUint32 *aSt
}
(*aState) |= mRoleMapEntry->state;
if (MappedAttrState(content, aState, &mRoleMapEntry->attributeMap1) &&
MappedAttrState(content, aState, &mRoleMapEntry->attributeMap2) &&
MappedAttrState(content, aState, &mRoleMapEntry->attributeMap3) &&
MappedAttrState(content, aState, &mRoleMapEntry->attributeMap4) &&
MappedAttrState(content, aState, &mRoleMapEntry->attributeMap5) &&
- MappedAttrState(content, aState, &mRoleMapEntry->attributeMap6)) {
- MappedAttrState(content, aState, &mRoleMapEntry->attributeMap7);
+ MappedAttrState(content, aState, &mRoleMapEntry->attributeMap6) &&
+ MappedAttrState(content, aState, &mRoleMapEntry->attributeMap7)) {
+ MappedAttrState(content, aState, &mRoleMapEntry->attributeMap8);
}
return NS_OK;
}
// Not implemented by this class
/* DOMString getValue (); */
@@ -2526,24 +2528,26 @@ NS_IMETHODIMP nsAccessible::GetAccessibl
/* nsIAccessible getAccessibleBelow(); */
NS_IMETHODIMP nsAccessible::GetAccessibleBelow(nsIAccessible **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
already_AddRefed<nsIDOMNode>
nsAccessible::FindNeighbourPointingToThis(nsIAtom *aRelationAttr,
+ PRUint32 aRelationNameSpaceID,
PRUint32 aAncestorLevelsToSearch)
{
nsIContent *content = GetRoleContent(mDOMNode);
if (!content)
return nsnull; // Node shut down
nsIContent* description = FindNeighbourPointingToNode(content, nsnull,
aRelationAttr,
+ aRelationNameSpaceID,
aAncestorLevelsToSearch);
if (!description)
return nsnull;
nsIDOMNode *relatedNode;
CallQueryInterface(description, &relatedNode);
return relatedNode;
@@ -2575,16 +2579,17 @@ NS_IMETHODIMP nsAccessible::GetAccessibl
if (content->Tag() == nsAccessibilityAtoms::label) {
nsIAtom *relatedIDAttr = content->IsNodeOfType(nsINode::eHTML) ?
nsAccessibilityAtoms::_for : nsAccessibilityAtoms::control;
content->GetAttr(kNameSpaceID_None, relatedIDAttr, relatedID);
}
if (relatedID.IsEmpty()) {
const PRUint32 kAncestorLevelsToSearch = 3;
relatedNode = FindNeighbourPointingToThis(nsAccessibilityAtoms::labelledby,
+ kNameSpaceID_WAIProperties,
kAncestorLevelsToSearch);
}
break;
}
case nsIAccessibleRelation::RELATION_LABELLED_BY:
{
content->GetAttr(kNameSpaceID_WAIProperties,
nsAccessibilityAtoms::labelledby, relatedID);
@@ -2607,53 +2612,57 @@ NS_IMETHODIMP nsAccessible::GetAccessibl
}
break;
}
case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR:
{
const PRUint32 kAncestorLevelsToSearch = 3;
relatedNode =
FindNeighbourPointingToThis(nsAccessibilityAtoms::describedby,
+ kNameSpaceID_WAIProperties,
kAncestorLevelsToSearch);
if (!relatedNode && content->Tag() == nsAccessibilityAtoms::description &&
content->IsNodeOfType(nsINode::eXUL)) {
// This affectively adds an optional control attribute to xul:description,
// which only affects accessibility, by allowing the description to be
// tied to a control.
content->GetAttr(kNameSpaceID_None,
nsAccessibilityAtoms::control, relatedID);
}
break;
}
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF:
{
- relatedNode = FindNeighbourPointingToThis(nsAccessibilityAtoms::owns);
+ relatedNode = FindNeighbourPointingToThis(nsAccessibilityAtoms::owns,
+ kNameSpaceID_WAIProperties);
break;
}
case nsIAccessibleRelation::RELATION_CONTROLLED_BY:
{
- relatedNode = FindNeighbourPointingToThis(nsAccessibilityAtoms::controls);
+ relatedNode = FindNeighbourPointingToThis(nsAccessibilityAtoms::controls,
+ kNameSpaceID_WAIProperties);
break;
}
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR:
{
content->GetAttr(kNameSpaceID_WAIProperties,
nsAccessibilityAtoms::controls, relatedID);
break;
}
case nsIAccessibleRelation::RELATION_FLOWS_TO:
{
content->GetAttr(kNameSpaceID_WAIProperties,
nsAccessibilityAtoms::flowto, relatedID);
break;
}
case nsIAccessibleRelation::RELATION_FLOWS_FROM:
{
- relatedNode = FindNeighbourPointingToThis(nsAccessibilityAtoms::flowto);
+ relatedNode = FindNeighbourPointingToThis(nsAccessibilityAtoms::flowto,
+ kNameSpaceID_WAIProperties);
break;
}
case nsIAccessibleRelation::RELATION_DEFAULT_BUTTON:
{
if (content->IsNodeOfType(nsINode::eHTML)) {
nsCOMPtr<nsIForm> form;
while ((form = do_QueryInterface(content)) == nsnull &&
@@ -2717,19 +2726,19 @@ NS_IMETHODIMP nsAccessible::GetAccessibl
domDoc->GetElementById(relatedID, getter_AddRefs(relatedEl));
relatedNode = do_QueryInterface(relatedEl);
}
// Return the corresponding accessible if the related DOM node is found
if (relatedNode) {
nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
- return accService->GetAccessibleInWeakShell(relatedNode, mWeakShell, aRelated);
+ accService->GetAccessibleInWeakShell(relatedNode, mWeakShell, aRelated);
}
- return NS_ERROR_FAILURE;
+ return NS_OK;
}
NS_IMETHODIMP
nsAccessible::GetRelationsCount(PRUint32 *aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
@@ -2799,17 +2808,17 @@ NS_IMETHODIMP nsAccessible::GetNativeInt
return NS_ERROR_NOT_IMPLEMENTED;
}
void nsAccessible::DoCommandCallback(nsITimer *aTimer, void *aClosure)
{
NS_ASSERTION(gDoCommandTimer, "How did we get here if there was no gDoCommandTimer?");
NS_RELEASE(gDoCommandTimer);
- nsIContent *content = NS_REINTERPRET_CAST(nsIContent*, aClosure);
+ nsIContent *content = reinterpret_cast<nsIContent*>(aClosure);
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(content));
if (xulElement) {
xulElement->Click();
}
else {
nsIDocument *doc = content->GetDocument();
if (!doc) {
return;
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -63,17 +63,17 @@ struct nsRect;
class nsIContent;
class nsIFrame;
class nsIPresShell;
class nsIDOMNode;
class nsIAtom;
class nsIView;
// When mNextSibling is set to this, it indicates there ar eno more siblings
-#define DEAD_END_ACCESSIBLE NS_STATIC_CAST(nsIAccessible*, (void*)1)
+#define DEAD_END_ACCESSIBLE static_cast<nsIAccessible*>((void*)1)
// Saves a data member -- if child count equals this value we haven't
// cached children or child count yet
enum { eChildCountUninitialized = -1 };
class nsAccessibleDOMStringList : public nsIDOMDOMStringList
{
public:
@@ -162,54 +162,71 @@ public:
protected:
PRBool MappedAttrState(nsIContent *aContent, PRUint32 *aStateInOut, nsStateMapEntry *aStateMapEntry);
virtual nsIFrame* GetBoundsFrame();
virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
PRBool IsVisible(PRBool *aIsOffscreen);
// Relation helpers
nsresult GetTextFromRelationID(nsIAtom *aIDAttrib, nsString &aName);
+
+ /**
+ * Search element in neighborhood of the given element by tag name and
+ * attribute value that equals to ID attribute of the current element.
+ * ID attribute can be either 'id' attribute or 'anonid' if the element is
+ * anonymous.
+ *
+ * @param aRelationAttr - attribute name of searched element
+ * @param aRelationNamespaceID - namespace id of searched attribute, by default
+ * empty namespace
+ * @param aAncestorLevelsToSearch - points how is the neighborhood of the
+ * given element big.
+ */
already_AddRefed<nsIDOMNode> FindNeighbourPointingToThis(nsIAtom *aRelationAttr,
+ PRUint32 aRelationNameSpaceID = kNameSpaceID_None,
PRUint32 aAncestorLevelsToSearch = 0);
/**
* Search element in neighborhood of the given element by tag name and
* attribute value that equals to ID attribute of the given element.
* ID attribute can be either 'id' attribute or 'anonid' if the element is
* anonymous.
*
* @param aForNode - the given element the search is performed for
* @param aTagName - tag name of searched element
- * @param aAttr - attribute name of searched element
+ * @param aRelationAttr - attribute name of searched element
+ * @param aRelationNamespaceID - namespace id of searched attribute, by default
+ * empty namespace
* @param aAncestorLevelsToSearch - points how is the neighborhood of the
* given element big.
*/
static nsIContent *FindNeighbourPointingToNode(nsIContent *aForNode,
nsIAtom *aTagName,
- nsIAtom *aAttr,
+ nsIAtom *aRelationAttr,
+ PRUint32 aRelationNameSpaceID = kNameSpaceID_None,
PRUint32 aAncestorLevelsToSearch = 5);
/**
* Search for element that satisfies the requirements in subtree of the given
* element. The requirements are tag name, attribute name and value of
* attribute.
*
* @param aId - value of searched attribute
* @param aLookContent - element that search is performed inside
- * @param aForAttrib - searched attribute
+ * @param aRelationAttr - searched attribute
+ * @param aRelationNamespaceID - namespace id of searched attribute, by default
+ * empty namespace
* @param aExcludeContent - element that is skiped for search
- * @param aForAttribNamespace - namespace id of searched attribute, by default
- * empty namespace
* @param aTagType - tag name of searched element, by default it is 'label'
*/
static nsIContent *FindDescendantPointingToID(const nsAString *aId,
nsIContent *aLookContent,
- nsIAtom *forAttrib,
+ nsIAtom *aRelationAttr,
+ PRUint32 aRelationNamespaceID = kNameSpaceID_None,
nsIContent *aExcludeContent = nsnull,
- PRUint32 aForAttribNamespace = kNameSpaceID_None,
nsIAtom *aTagType = nsAccessibilityAtoms::label);
static nsIContent *GetHTMLLabelContent(nsIContent *aForNode);
static nsIContent *GetLabelContent(nsIContent *aForNode);
static nsIContent *GetRoleContent(nsIDOMNode *aDOMNode);
// Name helpers
nsresult GetHTMLName(nsAString& _retval, PRBool aCanAggregateSubtree = PR_TRUE);
--- a/accessible/src/base/nsAccessibleEventData.cpp
+++ b/accessible/src/base/nsAccessibleEventData.cpp
@@ -35,16 +35,20 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibleEventData.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessNode.h"
#include "nsIServiceManager.h"
+#ifdef MOZ_XUL
+#include "nsIDOMXULMultSelectCntrlEl.h"
+#include "nsXULTreeAccessible.h"
+#endif
NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible,
void *aEventData):
mEventType(aEventType), mAccessible(aAccessible), mEventData(aEventData)
{
}
@@ -120,16 +124,47 @@ nsAccEvent::GetAccessibleByNode()
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
if (!accService)
return nsnull;
nsIAccessible *accessible = nsnull;
accService->GetAccessibleFor(mDOMNode, &accessible);
+#ifdef MOZ_XUL
+ // hack for xul tree table. We need a better way for firing delayed event
+ // against xul tree table. see bug 386821.
+ // There will be problem if some day we want to fire delayed event against
+ // the xul tree itself or an unselected treeitem.
+ nsAutoString localName;
+ mDOMNode->GetLocalName(localName);
+ if (localName.EqualsLiteral("tree")) {
+ nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect =
+ do_QueryInterface(mDOMNode);
+ if (multiSelect) {
+ PRInt32 treeIndex = -1;
+ multiSelect->GetCurrentIndex(&treeIndex);
+ if (treeIndex >= 0) {
+ nsCOMPtr<nsIAccessibleTreeCache> treeCache(do_QueryInterface(accessible));
+ NS_IF_RELEASE(accessible);
+ nsCOMPtr<nsIAccessible> treeItemAccessible;
+ if (!treeCache ||
+ NS_FAILED(treeCache->GetCachedTreeitemAccessible(
+ treeIndex,
+ nsnull,
+ getter_AddRefs(treeItemAccessible))) ||
+ !treeItemAccessible) {
+ return nsnull;
+ }
+ NS_IF_ADDREF(accessible = treeItemAccessible);
+ }
+ }
+ }
+#endif
+
return accessible;
}
// nsAccStateChangeEvent
NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
nsIAccessibleStateChangeEvent)
@@ -220,8 +255,35 @@ nsAccTextChangeEvent::GetLength(PRUint32
NS_IMETHODIMP
nsAccTextChangeEvent::IsInserted(PRBool *aIsInserted)
{
*aIsInserted = mIsInserted;
return NS_OK;
}
+// nsAccCaretMoveEvent
+NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
+ nsIAccessibleCaretMoveEvent)
+
+nsAccCaretMoveEvent::
+ nsAccCaretMoveEvent(nsIAccessible *aAccessible, PRInt32 aCaretOffset) :
+ nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, nsnull),
+ mCaretOffset(aCaretOffset)
+{
+}
+
+nsAccCaretMoveEvent::
+ nsAccCaretMoveEvent(nsIDOMNode *aNode) :
+ nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, nsnull),
+ mCaretOffset(-1)
+{
+}
+
+NS_IMETHODIMP
+nsAccCaretMoveEvent::GetCaretOffset(PRInt32* aCaretOffset)
+{
+ NS_ENSURE_ARG_POINTER(aCaretOffset);
+
+ *aCaretOffset = mCaretOffset;
+ return NS_OK;
+}
+
--- a/accessible/src/base/nsAccessibleEventData.h
+++ b/accessible/src/base/nsAccessibleEventData.h
@@ -17,16 +17,17 @@
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Kyle Yuan (kyle.yuan@sun.com)
* John Sun (john.sun@sun.com)
+ * Alexander Surkov <surkov.alexander@gmail.com>
*
* 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
@@ -108,23 +109,33 @@ public:
NS_DECL_NSIACCESSIBLETEXTCHANGEEVENT
private:
PRInt32 mStart;
PRUint32 mLength;
PRBool mIsInserted;
};
-// XXX todo: We might want to use XPCOM interfaces instead of structs
-// e.g., nsAccessibleTextChangeEvent: public nsIAccessibleTextChangeEvent
+class nsAccCaretMoveEvent: public nsAccEvent,
+ public nsIAccessibleCaretMoveEvent
+{
+public:
+ nsAccCaretMoveEvent(nsIAccessible *aAccessible, PRInt32 aCaretOffset);
+ nsAccCaretMoveEvent(nsIDOMNode *aNode);
-struct AtkChildrenChange {
- PRInt32 index; // index of child in parent
- nsIAccessible *child;
- PRBool add; // true for add, false for delete
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_FORWARD_NSIACCESSIBLEEVENT(nsAccEvent::)
+ NS_DECL_NSIACCESSIBLECARETMOVEEVENT
+
+private:
+ PRInt32 mCaretOffset;
};
+// XXX todo: We might want to use XPCOM interfaces instead of struct
+// e.g., nsAccessibleTableChangeEvent: public nsIAccessibleTableChangeEvent
+
struct AtkTableChange {
PRUint32 index; // the start row/column after which the rows are inserted/deleted.
PRUint32 count; // the number of inserted/deleted rows/columns
};
-#endif
+#endif
+
--- a/accessible/src/base/nsApplicationAccessible.cpp
+++ b/accessible/src/base/nsApplicationAccessible.cpp
@@ -138,17 +138,17 @@ nsApplicationAccessible::GetChildAt(PRIn
PRUint32 count = 0;
nsresult rv = NS_OK;
if (mChildren) {
rv = mChildren->GetLength(&count);
NS_ENSURE_SUCCESS(rv, rv);
}
- if (aChildNum >= NS_STATIC_CAST(PRInt32, count) || count == 0)
+ if (aChildNum >= static_cast<PRInt32>(count) || count == 0)
return NS_ERROR_INVALID_ARG;
if (aChildNum < 0)
aChildNum = count - 1;
nsCOMPtr<nsIWeakReference> childWeakRef;
rv = mChildren->QueryElementAt(aChildNum, NS_GET_IID(nsIWeakReference),
getter_AddRefs(childWeakRef));
@@ -208,17 +208,17 @@ nsApplicationAccessible::CacheChildren()
previousAccessible = do_QueryInterface(accessible);
previousAccessible->SetParent(this);
}
}
PRUint32 count = 0;
mChildren->GetLength(&count);
- mAccChildCount = NS_STATIC_CAST(PRInt32, count);
+ mAccChildCount = static_cast<PRInt32>(count);
}
}
// nsApplicationAccessible
nsresult
nsApplicationAccessible::AddRootAccessible(nsIAccessible *aRootAccessible)
{
--- a/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ b/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -238,17 +238,17 @@ void nsLinkableAccessible::CacheActionCo
link->GetHrefURI(getter_AddRefs(uri));
if (uri) {
mActionContent = walkUpContent;
mIsLink = PR_TRUE;
break;
}
}
}
- if (nsAccessibilityUtils::HasListener(walkUpContent, NS_LITERAL_STRING("click"))) {
+ if (nsAccUtils::HasListener(walkUpContent, NS_LITERAL_STRING("click"))) {
mActionContent = walkUpContent;
mIsOnclick = PR_TRUE;
break;
}
}
}
// nsIAccessibleHyperLink::GetURI()
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -212,18 +212,21 @@ NS_IMETHODIMP nsCaretAccessible::NotifyS
textAcc->GetSelectionCount(&selectionCount); // Don't swallow similar events when selecting text
if (!selectionCount) {
return NS_OK; // Swallow duplicate caret event
}
}
mLastCaretOffset = caretOffset;
mLastTextAccessible = textAcc;
- return mRootAccessible->FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED,
- focusNode, nsnull, PR_FALSE);
+ nsCOMPtr<nsIAccessibleCaretMoveEvent> event =
+ new nsAccCaretMoveEvent(focusNode);
+ NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
+
+ return mRootAccessible->FireDelayedAccessibleEvent(event, PR_FALSE);
}
nsRect
nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
{
nsRect caretRect;
NS_ENSURE_TRUE(aOutWidget, caretRect);
*aOutWidget = nsnull;
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -196,16 +196,23 @@ NS_IMETHODIMP nsDocAccessible::GetRole(P
return NS_OK;
}
NS_IMETHODIMP nsDocAccessible::GetValue(nsAString& aValue)
{
return GetURL(aValue);
}
+NS_IMETHODIMP
+nsDocAccessible::GetDescription(nsAString& aDescription)
+{
+ aDescription.Truncate();
+ return NS_OK;
+}
+
NS_IMETHODIMP
nsDocAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
// nsAccessible::GetState() always fail for document accessible.
nsAccessible::GetState(aState, aExtraState);
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
if (!xulDoc) {
@@ -504,17 +511,17 @@ NS_IMETHODIMP nsDocAccessible::Init()
return rv;
}
NS_IMETHODIMP nsDocAccessible::Destroy()
{
if (mWeakShell) {
- gGlobalDocAccessibleCache.Remove(NS_STATIC_CAST(void*, mWeakShell));
+ gGlobalDocAccessibleCache.Remove(static_cast<void*>(mWeakShell));
}
return Shutdown();
}
NS_IMETHODIMP nsDocAccessible::Shutdown()
{
if (!mWeakShell) {
return NS_OK; // Already shutdown
@@ -745,18 +752,18 @@ NS_IMETHODIMP nsDocAccessible::FireAncho
if (currentAnchor.Equals(lastAnchor)) {
mIsAnchorJumped = PR_FALSE;
} else {
mIsAnchorJumped = PR_TRUE;
lastAnchor.Assign(currentAnchor);
}
if (mIsAnchorJumped) {
- FireToolkitEvent(nsIAccessibleEvent::EVENT_DOCUMENT_ATTRIBUTES_CHANGED,
- this, nsnull);
+ nsAccUtils::
+ FireAccEvent(nsIAccessibleEvent::EVENT_DOCUMENT_ATTRIBUTES_CHANGED, this);
}
return NS_OK;
}
NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
{
if (!mDocument || !mWeakShell) {
@@ -804,32 +811,32 @@ NS_IMETHODIMP nsDocAccessible::FireDocLo
// Loading document: fire EVENT_STATE_CHANGE to set STATE_BUSY
nsCOMPtr<nsIAccessibleStateChangeEvent> accEvent =
new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_BUSY,
PR_FALSE, PR_TRUE);
FireAccessibleEvent(accEvent);
}
- FireToolkitEvent(aEventType, this, nsnull);
+ nsAccUtils::FireAccEvent(aEventType, this);
return NS_OK;
}
void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure)
{
- nsDocAccessible *docAcc = NS_REINTERPRET_CAST(nsDocAccessible*, aClosure);
+ nsDocAccessible *docAcc = reinterpret_cast<nsDocAccessible*>(aClosure);
if (docAcc && docAcc->mScrollPositionChangedTicks &&
++docAcc->mScrollPositionChangedTicks > 2) {
// Whenever scroll position changes, mScrollPositionChangeTicks gets reset to 1
// We only want to fire accessibilty scroll event when scrolling stops or pauses
// Therefore, we wait for no scroll events to occur between 2 ticks of this timer
// That indicates a pause in scrolling, so we fire the accessibilty scroll event
- docAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_SCROLLING_END, docAcc,
- nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SCROLLING_END, docAcc);
+
docAcc->mScrollPositionChangedTicks = 0;
if (docAcc->mScrollWatchTimer) {
docAcc->mScrollWatchTimer->Cancel();
docAcc->mScrollWatchTimer = nsnull;
}
}
}
@@ -906,17 +913,17 @@ NS_IMETHODIMP nsDocAccessible::Observe(n
NS_IMPL_NSIDOCUMENTOBSERVER_CORE_STUB(nsDocAccessible)
NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(nsDocAccessible)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(nsDocAccessible)
void
nsDocAccessible::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
PRInt32 aNameSpaceID, nsIAtom* aAttribute,
- PRInt32 aModType)
+ PRInt32 aModType, PRUint32 aStateMask)
{
// Fire accessible event after short timer, because we need to wait for
// DOM attribute & resulting layout to actually change. Otherwise,
// assistive technology will retrieve the wrong state/value/selection info.
// XXX todo
// We still need to handle special HTML cases here
// For example, if an <img>'s usemap attribute is modified
@@ -946,16 +953,18 @@ nsDocAccessible::AttributeChanged(nsIDoc
}
// Universal boolean properties that don't require a role.
if (aAttribute == nsAccessibilityAtoms::disabled) {
// Fire the state change whether disabled attribute is
// set for XUL, HTML or ARIA namespace.
// Checking the namespace would not seem to gain us anything, because
// disabled really is going to mean the same thing in any namespace.
+ // We use the attribute instead of the disabled state bit because
+ // ARIA's aaa:disabled does not affect the disabled state bit
nsCOMPtr<nsIAccessibleStateChangeEvent> enabledChangeEvent =
new nsAccStateChangeEvent(targetNode,
nsIAccessibleStates::EXT_STATE_ENABLED,
PR_TRUE);
FireDelayedAccessibleEvent(enabledChangeEvent);
nsCOMPtr<nsIAccessibleStateChangeEvent> sensitiveChangeEvent =
new nsAccStateChangeEvent(targetNode,
nsIAccessibleStates::EXT_STATE_SENSITIVE,
@@ -1223,17 +1232,17 @@ nsDocAccessible::FireDelayedAccessibleEv
}
}
mEventsToFire.AppendObject(aEvent);
if (!isTimerStarted) {
// This is be the first delayed event in queue, start timer
// so that event gets fired via FlushEventsCallback
mFireEventTimer->InitWithFuncCallback(FlushEventsCallback,
- NS_STATIC_CAST(nsPIAccessibleDocument*, this),
+ static_cast<nsPIAccessibleDocument*>(this),
0, nsITimer::TYPE_ONE_SHOT);
}
return NS_OK;
}
NS_IMETHODIMP nsDocAccessible::FlushPendingEvents()
{
@@ -1257,82 +1266,86 @@ NS_IMETHODIMP nsDocAccessible::FlushPend
if (docAccessible) {
docAccessible->FireDocLoadEvents(nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE);
}
}
else if (eventType == nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED) {
nsCOMPtr<nsIAccessibleText> accessibleText = do_QueryInterface(accessible);
PRInt32 caretOffset;
if (accessibleText && NS_SUCCEEDED(accessibleText->GetCaretOffset(&caretOffset))) {
- FireToolkitEvent(nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED,
- accessible, &caretOffset);
+#ifdef DEBUG
+ PRUnichar chAtOffset;
+ accessibleText->GetCharacterAtOffset(caretOffset, &chAtOffset);
+ printf("\nCaret moved to %d with char %c", caretOffset, chAtOffset);
+#endif
+ nsCOMPtr<nsIAccessibleCaretMoveEvent> caretMoveEvent =
+ new nsAccCaretMoveEvent(accessible, caretOffset);
+ NS_ENSURE_TRUE(caretMoveEvent, NS_ERROR_OUT_OF_MEMORY);
+
+ FireAccessibleEvent(caretMoveEvent);
+
PRInt32 selectionCount;
accessibleText->GetSelectionCount(&selectionCount);
if (selectionCount) { // There's a selection so fire selection change as well
- FireToolkitEvent(nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED,
- accessible, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED,
+ accessible);
}
}
}
else {
FireAccessibleEvent(accessibleEvent);
}
}
}
mEventsToFire.Clear(); // Clear out array
return NS_OK;
}
void nsDocAccessible::FlushEventsCallback(nsITimer *aTimer, void *aClosure)
{
- nsPIAccessibleDocument *accessibleDoc = NS_STATIC_CAST(nsPIAccessibleDocument*, aClosure);
+ nsPIAccessibleDocument *accessibleDoc = static_cast<nsPIAccessibleDocument*>(aClosure);
NS_ASSERTION(accessibleDoc, "How did we get here without an accessible document?");
accessibleDoc->FlushPendingEvents();
}
void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode, PRUint32 aChangeEvent)
{
+ NS_ASSERTION(aChangeEvent != nsIAccessibleEvent::EVENT_SHOW,
+ "nsDocAccessible::RefreshNodes isn't supposed to work with show event.");
+
nsCOMPtr<nsIDOMNode> iterNode(aStartNode), nextNode;
nsCOMPtr<nsIAccessNode> accessNode;
do {
GetCachedAccessNode(iterNode, getter_AddRefs(accessNode));
if (accessNode) {
// Accessibles that implement their own subtrees,
// like html combo boxes and xul trees must shutdown all of their own
// children when they override Shutdown()
// Don't shutdown our doc object!
- if (accessNode != NS_STATIC_CAST(nsIAccessNode*, this)) {
- if (aChangeEvent != nsIAccessibleEvent::EVENT_SHOW) {
- nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(accessNode));
- if (accessible) {
- // Fire menupopupend events for menu popups that go away
- PRUint32 role, event = 0;
- accessible->GetFinalRole(&role);
- if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
- nsCOMPtr<nsIDOMNode> domNode;
- accessNode->GetDOMNode(getter_AddRefs(domNode));
- nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(domNode));
- if (!popup) {
- // Popup elements already fire these via DOMMenuInactive
- // handling in nsRootAccessible::HandleEvent
- event = nsIAccessibleEvent::EVENT_MENUPOPUP_END;
- }
- }
- else if (role == nsIAccessibleRole::ROLE_PROGRESSBAR &&
- iterNode != aStartNode) {
- // Make sure EVENT_HIDE gets fired for progress meters
- event = nsIAccessibleEvent::EVENT_HIDE;
- }
- if (event) {
- FireToolkitEvent(event, accessible, nsnull);
+ if (accessNode != static_cast<nsIAccessNode*>(this)) {
+
+ nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(accessNode));
+ if (accessible) {
+ // Fire menupopupend events for menu popups that go away
+ PRUint32 role = Role(accessible);
+ if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
+ nsCOMPtr<nsIDOMNode> domNode;
+ accessNode->GetDOMNode(getter_AddRefs(domNode));
+ nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(domNode));
+ if (!popup) {
+ // Popup elements already fire these via DOMMenuInactive
+ // handling in nsRootAccessible::HandleEvent
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
+ accessible);
}
}
}
+
void *uniqueID;
accessNode->GetUniqueID(&uniqueID);
nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(accessNode));
privateAccessNode->Shutdown();
// Remove from hash table as well
mAccessNodeCache.Remove(uniqueID);
}
}
@@ -1378,109 +1391,99 @@ NS_IMETHODIMP nsDocAccessible::Invalidat
// instead of just the accessible tree, although that would be faster
// Otherwise we might miss the nsAccessNode's that are not nsAccessible's.
NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> childNode = aChild ? do_QueryInterface(aChild) : mDOMNode;
if (!IsNodeRelevant(childNode)) {
return NS_OK; // Don't fire event unless it can be for an attached accessible
}
- if (!mIsContentLoaded && mAccessNodeCache.Count() <= 1 &&
- mAccChildCount == eChildCountUninitialized) {
- return NS_OK; // Still loading and nothing to invalidate yet
+ if (!mIsContentLoaded && mAccessNodeCache.Count() <= 1) {
+ // Still loading and no accessibles has yet been created other than this
+ // doc accessible. In this case we optimize
+ // by not firing SHOW/HIDE/REORDER events for every document mutation
+ // caused by page load, since AT is not going to want to grab the
+ // document and listen to these changes until after the page is first loaded
+ // Leave early, and ensure mAccChildCount stays uninitialized instead of 0,
+ // which it is if anyone asks for its children right now.
+ return InvalidateChildren();
}
nsCOMPtr<nsIAccessNode> childAccessNode;
GetCachedAccessNode(childNode, getter_AddRefs(childAccessNode));
nsCOMPtr<nsIAccessible> childAccessible = do_QueryInterface(childAccessNode);
- if (!childAccessible && mIsContentLoaded && aChangeEventType != nsIAccessibleEvent::EVENT_HIDE) {
+ if (!childAccessible && aChangeEventType != nsIAccessibleEvent::EVENT_HIDE) {
// If not about to hide it, make sure there's an accessible so we can fire an
// event for it
GetAccService()->GetAccessibleFor(childNode, getter_AddRefs(childAccessible));
}
- nsCOMPtr<nsPIAccessible> privateChildAccessible =
- do_QueryInterface(childAccessible);
+
#ifdef DEBUG_A11Y
nsAutoString localName;
childNode->GetLocalName(localName);
const char *hasAccessible = childAccessible ? " (acc)" : "";
if (aChangeEventType == nsIAccessibleEvent::EVENT_HIDE) {
printf("[Hide %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
else if (aChangeEventType == nsIAccessibleEvent::EVENT_SHOW) {
printf("[Show %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
else if (aChangeEventType == nsIAccessibleEvent::EVENT_REORDER) {
printf("[Reorder %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
#endif
- if (aChangeEventType == nsIAccessibleEvent::EVENT_HIDE) {
- // Fire EVENT_HIDE or EVENT_MENUPOPUP_END if previous accessible existed
- // for node being hidden. Fire this before the accessible goes away
- if (privateChildAccessible) {
- privateChildAccessible->FireToolkitEvent(nsIAccessibleEvent::EVENT_HIDE,
- childAccessible, nsnull);
- }
+ if (aChangeEventType == nsIAccessibleEvent::EVENT_HIDE ||
+ aChangeEventType == nsIAccessibleEvent::EVENT_REORDER) {
+ // Fire EVENT_HIDE if previous accessible existed for node being hidden.
+ // Fire this before the accessible goes away.
+ if (childAccessible)
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_HIDE, childAccessible);
}
// Shutdown nsIAccessNode's or nsIAccessibles for any DOM nodes in this subtree
if (aChangeEventType != nsIAccessibleEvent::EVENT_SHOW) {
RefreshNodes(childNode, aChangeEventType);
}
// We need to get an accessible for the mutation event's container node
// If there is no accessible for that node, we need to keep moving up the parent
// chain so there is some accessible.
// We will use this accessible to fire the accessible mutation event.
// We're guaranteed success, because we will eventually end up at the doc accessible,
// and there is always one of those.
nsCOMPtr<nsIAccessible> containerAccessible;
- if (childNode == mDOMNode) {
- // Don't get parent accessible if already at the root of a docshell chain like UI or content
- // Don't fire any other events if doc is still loading
- nsCOMPtr<nsISupports> container = mDocument->GetContainer();
- nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(do_QueryInterface(container));
- NS_ENSURE_TRUE(docShellTreeItem, NS_ERROR_FAILURE);
- nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
- docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
- if (sameTypeRoot == docShellTreeItem) {
- containerAccessible = this; // At the root of UI or content
- }
- }
+ GetAccessibleInParentChain(childNode, getter_AddRefs(containerAccessible));
if (!containerAccessible) {
- GetAccessibleInParentChain(childNode, mIsContentLoaded, getter_AddRefs(containerAccessible));
+ containerAccessible = this;
}
nsCOMPtr<nsPIAccessible> privateContainerAccessible =
do_QueryInterface(containerAccessible);
if (privateContainerAccessible) {
privateContainerAccessible->InvalidateChildren();
}
- if (!mIsContentLoaded) {
- return NS_OK;
- }
-
// Fire an event so the assistive technology knows the objects it is holding onto
// in this part of the subtree are no longer useful and should be released.
// However, they still won't crash if the AT tries to use them, because a stub of the
// object still exists as long as it is refcounted, even from outside of Gecko.
nsCOMPtr<nsIAccessNode> containerAccessNode =
do_QueryInterface(containerAccessible);
if (containerAccessNode) {
nsCOMPtr<nsIDOMNode> containerNode;
containerAccessNode->GetDOMNode(getter_AddRefs(containerNode));
if (containerNode) {
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_REORDER,
containerNode, nsnull);
}
}
- if (aChangeEventType == nsIAccessibleEvent::EVENT_SHOW && aChild) {
+ if (aChild && (aChangeEventType == nsIAccessibleEvent::EVENT_SHOW ||
+ aChangeEventType == nsIAccessibleEvent::EVENT_REORDER)) {
// Fire EVENT_SHOW, EVENT_MENUPOPUP_START for newly visible content.
// Fire after a short timer, because we want to make sure the view has been
// updated to make this accessible content visible. If we don't wait,
// the assistive technology may receive the event and then retrieve
// nsIAccessibleStates::STATE_INVISIBLE for the event's accessible object.
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_SHOW, childNode, nsnull);
nsAutoString role;
if (GetRoleAttribute(aChild, role) &&
@@ -1504,17 +1507,17 @@ NS_IMETHODIMP nsDocAccessible::Invalidat
ancestor = ancestor->GetParent();
}
}
return NS_OK;
}
NS_IMETHODIMP
-nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode, PRBool aCanCreate,
+nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
nsIAccessible **aAccessible)
{
// Find accessible in parent chain of DOM nodes, or return null
*aAccessible = nsnull;
nsCOMPtr<nsIDOMNode> currentNode(aNode), parentNode;
nsCOMPtr<nsIAccessNode> accessNode;
nsIAccessibilityService *accService = GetAccService();
@@ -1529,52 +1532,32 @@ nsDocAccessible::GetAccessibleInParentCh
break;
}
nsCOMPtr<nsIDOMNode> relevantNode;
if (NS_SUCCEEDED(accService->GetRelevantContentNodeFor(currentNode, getter_AddRefs(relevantNode))) && relevantNode) {
currentNode = relevantNode;
}
- if (aCanCreate) {
- accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
- }
- else {
- accService->GetCachedAccessible(currentNode, mWeakShell, aAccessible);
- }
+ accService->GetAccessibleInWeakShell(currentNode, mWeakShell, aAccessible);
} while (!*aAccessible);
return NS_OK;
}
-NS_IMETHODIMP
-nsDocAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget,
- void * aData)
-{
- // Don't fire event for accessible that has been shut down.
- if (!mWeakShell)
- return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIAccessibleEvent> accEvent =
- new nsAccEvent(aEvent, aTarget, aData);
- NS_ENSURE_TRUE(accEvent, NS_ERROR_OUT_OF_MEMORY);
-
- return FireAccessibleEvent(accEvent);
-}
-
void nsDocAccessible::DocLoadCallback(nsITimer *aTimer, void *aClosure)
{
// Doc has finished loading, fire "load finished" event
// By using short timer we can wait make the window visible,
// which it does asynchronously. This avoids confusing the screen reader with a
// hidden window. Waiting also allows us to see of the document has focus,
// which is important because we only fire doc loaded events for focused documents.
nsDocAccessible *docAcc =
- NS_REINTERPRET_CAST(nsDocAccessible*, aClosure);
+ reinterpret_cast<nsDocAccessible*>(aClosure);
if (!docAcc) {
return;
}
// Fire doc finished event
nsCOMPtr<nsIDOMNode> docDomNode;
docAcc->GetDOMNode(getter_AddRefs(docDomNode));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(docDomNode));
--- a/accessible/src/base/nsDocAccessible.h
+++ b/accessible/src/base/nsDocAccessible.h
@@ -71,32 +71,30 @@ class nsDocAccessible : public nsHyperTe
public:
nsDocAccessible(nsIDOMNode *aNode, nsIWeakReference* aShell);
virtual ~nsDocAccessible();
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetValue(nsAString& aValue);
+ NS_IMETHOD GetDescription(nsAString& aDescription);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
NS_IMETHOD GetParent(nsIAccessible **aParent);
NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
NS_IMETHOD TakeFocus(void);
// ----- nsIScrollPositionListener ---------------------------
NS_IMETHOD ScrollPositionWillChange(nsIScrollableView *aView, nscoord aX, nscoord aY);
NS_IMETHOD ScrollPositionDidChange(nsIScrollableView *aView, nscoord aX, nscoord aY);
// nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER
- NS_IMETHOD FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible,
- void* aData);
-
static void FlushEventsCallback(nsITimer *aTimer, void *aClosure);
// nsIAccessNode
NS_IMETHOD Shutdown();
NS_IMETHOD Init();
// nsPIAccessNode
NS_IMETHOD_(nsIFrame *) GetFrame(void);
@@ -132,17 +130,17 @@ class nsDocAccessible : public nsHyperTe
/**
* Fires accessible events when ARIA attribute is chaned.
*
* @param aContent - node that attribute is changed for
* @param aAttribute - changed attribute
*/
void ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute);
- nsInterfaceHashtable<nsVoidHashKey, nsIAccessNode> mAccessNodeCache;
+ nsAccessNodeHashtable mAccessNodeCache;
void *mWnd;
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsITimer> mScrollWatchTimer;
nsCOMPtr<nsITimer> mFireEventTimer;
PRUint16 mScrollPositionChangedTicks; // Used for tracking scroll events
PRPackedBool mIsContentLoaded;
nsCOMArray<nsIAccessibleEvent> mEventsToFire;
nsCOMPtr<nsIEditor> mEditor;
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -57,16 +57,17 @@
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULPopupElement.h"
#include "nsIDocument.h"
#include "nsIEventListenerManager.h"
#include "nsIFocusController.h"
#include "nsIFrame.h"
+#include "nsIMenuFrame.h"
#include "nsIHTMLDocument.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIMenuParent.h"
#include "nsIScrollableView.h"
#include "nsISelectionPrivate.h"
#include "nsIServiceManager.h"
#include "nsIViewManager.h"
#include "nsPIDOMWindow.h"
@@ -88,17 +89,17 @@
#include "nsApplicationAccessibleWrap.h"
#endif
// Expanded version of NS_IMPL_ISUPPORTS_INHERITED2
// so we can QI directly to concrete nsRootAccessible
NS_IMPL_QUERY_HEAD(nsRootAccessible)
NS_IMPL_QUERY_BODY(nsIDOMEventListener)
if (aIID.Equals(NS_GET_IID(nsRootAccessible)))
- foundInterface = NS_REINTERPRET_CAST(nsISupports*, this);
+ foundInterface = reinterpret_cast<nsISupports*>(this);
else
NS_IMPL_QUERY_TAIL_INHERITING(nsDocAccessible)
NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsDocAccessible)
NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsDocAccessible)
//-----------------------------------------------------
// construction
@@ -471,64 +472,50 @@ PRBool nsRootAccessible::FireAccessibleF
}
}
// Fire focus only if it changes, but always fire focus events when aForceEvent == PR_TRUE
if (gLastFocusedNode == finalFocusNode && !aForceEvent) {
return PR_FALSE;
}
- nsCOMPtr<nsPIAccessible> privateAccessible =
- do_QueryInterface(finalFocusAccessible);
- NS_ASSERTION(privateAccessible , "No nsPIAccessible for nsIAccessible");
- if (!privateAccessible) {
- return PR_FALSE;
- }
-
PRUint32 role = Role(finalFocusAccessible);
if (role == nsIAccessibleRole::ROLE_MENUITEM) {
if (!mIsInDHTMLMenu) { // Entering menus
PRUint32 naturalRole; // The natural role is the role that this type of element normally has
finalFocusAccessible->GetRole(&naturalRole);
if (role != naturalRole) { // Must be a DHTML menuitem
- FireToolkitEvent(nsIAccessibleEvent::EVENT_MENU_START, this, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_START, this);
mIsInDHTMLMenu = nsIAccessibleRole::ROLE_MENUITEM;
}
}
}
else if (mIsInDHTMLMenu) {
- FireToolkitEvent(nsIAccessibleEvent::EVENT_MENU_END, this, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_END, this);
mIsInDHTMLMenu = PR_FALSE;
}
NS_IF_RELEASE(gLastFocusedNode);
gLastFocusedNode = finalFocusNode;
NS_IF_ADDREF(gLastFocusedNode);
- nsCOMPtr<nsIAccessibleDocument> docAccessible = do_QueryInterface(privateAccessible);
+ nsCOMPtr<nsIAccessibleDocument> docAccessible = do_QueryInterface(finalFocusAccessible);
if (docAccessible) {
// Doc is gaining focus, but actual focus may be on an element within document
nsCOMPtr<nsIDOMNode> realFocusedNode = GetCurrentFocus();
if (realFocusedNode != aNode || realFocusedNode == mDOMNode) {
// Suppress document focus, because real DOM focus will be fired next,
// and that's what we care about
// Make sure we never fire focus for the nsRootAccessible (mDOMNode)
return PR_FALSE;
}
}
- privateAccessible->FireToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS,
- finalFocusAccessible, nsnull);
-
- // Fire state change event for focus
- nsCOMPtr<nsIAccessibleStateChangeEvent> accEvent =
- new nsAccStateChangeEvent(finalFocusAccessible,
- nsIAccessibleStates::STATE_FOCUSED,
- PR_FALSE, PR_TRUE);
- FireAccessibleEvent(accEvent);
+ FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS,
+ finalFocusNode, nsnull);
return PR_TRUE;
}
void nsRootAccessible::FireCurrentFocusEvent()
{
nsCOMPtr<nsIDOMNode> focusedNode = GetCurrentFocus();
if (!focusedNode) {
@@ -712,22 +699,22 @@ nsresult nsRootAccessible::HandleEventWi
do_QueryInterface(aTargetNode);
nsAutoString selType;
multiSel->GetSelType(selType);
if (selType.IsEmpty() || !selType.EqualsLiteral("single")) {
// XXX: We need to fire EVENT_SELECTION_ADD and EVENT_SELECTION_REMOVE
// for each tree item. Perhaps each tree item will need to cache its
// selection state and fire an event after a DOM "select" event when
// that state changes. nsXULTreeAccessible::UpdateTreeSelection();
- return privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
- accessible, nsnull);
+ return nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
+ accessible);
}
- return privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_SELECTION,
- treeItemAccessible, nsnull);
+ return nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION,
+ treeItemAccessible);
}
}
else
#endif
if (eventType.EqualsLiteral("focus")) {
// Keep a reference to the target node. We might want to change
// it to the individual radio button or selected item, and send
// the focus event to that.
@@ -755,39 +742,37 @@ nsresult nsRootAccessible::HandleEventWi
if (!accessible)
return NS_OK;
}
}
}
FireAccessibleFocusEvent(accessible, focusedItem, aEvent);
}
else if (eventType.EqualsLiteral("NameChange")) {
- privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE,
- accessible, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, accessible);
}
else if (eventType.EqualsLiteral("AlertActive")) {
- privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_ALERT,
- accessible, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
}
else if (eventType.EqualsLiteral("popupshown")) {
// Don't fire menupopup events for combobox and autocomplete lists
PRUint32 role = Role(accessible);
PRInt32 event = 0;
if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
event = nsIAccessibleEvent::EVENT_MENUPOPUP_START;
}
else if (role == nsIAccessibleRole::ROLE_TOOLTIP) {
// There is a single <xul:tooltip> node which Mozilla moves around.
// The accessible for it stays the same no matter where it moves.
// AT's expect to get an EVENT_SHOW for the tooltip.
// In event callback the tooltip's accessible will be ready.
event = nsIAccessibleEvent::EVENT_SHOW;
}
if (event) {
- privAcc->FireToolkitEvent(event, accessible, nsnull);
+ nsAccUtils::FireAccEvent(event, accessible);
}
}
else if (eventType.EqualsLiteral("popuphiding")) {
// If accessible focus was on or inside popup that closes,
// then restore it to true current focus.
// This is the case when we've been getting DOMMenuItemActive events
// inside of a combo box that closes. The real focus is on the combo box.
@@ -804,69 +789,56 @@ nsresult nsRootAccessible::HandleEventWi
return NS_OK; // And was not focused on an item inside the popup
}
}
// Focus was on or inside of a popup that's being hidden
FireCurrentFocusEvent();
}
else if (eventType.EqualsLiteral("DOMMenuInactive")) {
if (Role(accessible) == nsIAccessibleRole::ROLE_MENUPOPUP) {
- privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
- accessible, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
+ accessible);
}
}
else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
if (!treeItemAccessible) {
- nsCOMPtr<nsIAccessible> containerAccessible;
- accessible->GetParent(getter_AddRefs(containerAccessible));
- NS_ENSURE_TRUE(containerAccessible, NS_OK);
- if (Role(containerAccessible) == nsIAccessibleRole::ROLE_MENUBAR) {
- nsCOMPtr<nsPIAccessNode> menuBarAccessNode(do_QueryInterface(containerAccessible));
- NS_ENSURE_TRUE(menuBarAccessNode, NS_ERROR_FAILURE);
- nsCOMPtr<nsIMenuParent> menuParent = do_QueryInterface(menuBarAccessNode->GetFrame());
- NS_ENSURE_TRUE(menuParent, NS_ERROR_FAILURE);
- PRBool isActive;
- menuParent->GetIsActive(isActive);
- if (!isActive) {
+ nsCOMPtr<nsPIAccessNode> menuAccessNode = do_QueryInterface(accessible);
+ NS_ENSURE_TRUE(menuAccessNode, NS_ERROR_FAILURE);
+ nsIFrame* menuFrame = menuAccessNode->GetFrame();
+ NS_ENSURE_TRUE(menuFrame, NS_ERROR_FAILURE);
+ nsIMenuFrame* imenuFrame;
+ CallQueryInterface(menuFrame, &imenuFrame);
+ NS_ENSURE_TRUE(imenuFrame, NS_ERROR_FAILURE);
+ if (imenuFrame->IsOnMenuBar()) {
+ if (!imenuFrame->IsOnActiveMenuBar()) {
// It is a top level menuitem. Only fire a focus event when the menu bar
// is active.
return NS_OK;
}
} else {
+ nsCOMPtr<nsIAccessible> containerAccessible;
+ accessible->GetParent(getter_AddRefs(containerAccessible));
+ NS_ENSURE_TRUE(containerAccessible, NS_ERROR_FAILURE);
// It is not top level menuitem
// Only fire focus event if it is not inside collapsed popup
if (State(containerAccessible) & nsIAccessibleStates::STATE_COLLAPSED)
return NS_OK;
}
}
FireAccessibleFocusEvent(accessible, aTargetNode, aEvent, PR_TRUE);
}
else if (eventType.EqualsLiteral("DOMMenuBarActive")) {
- privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_MENU_START,
- accessible, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_START, accessible);
}
else if (eventType.EqualsLiteral("DOMMenuBarInactive")) {
- privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_MENU_END,
- accessible, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_END, accessible);
FireCurrentFocusEvent();
}
else if (eventType.EqualsLiteral("ValueChange")) {
- PRUint32 role;
- accessible->GetFinalRole(&role);
- if (role == nsIAccessibleRole::ROLE_PROGRESSBAR) {
- // For progressmeter, fire EVENT_SHOW on 1st value change
- nsAutoString value;
- accessible->GetValue(value);
- if (value.EqualsLiteral("0%")) {
- privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_SHOW,
- accessible, nsnull);
- }
- }
- privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
- accessible, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, accessible);
}
return NS_OK;
}
void nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsIDOMNode **aTargetNode)
{
*aTargetNode = nsnull;
@@ -889,17 +861,17 @@ void nsRootAccessible::GetTargetNode(nsI
return;
}
NS_ADDREF(*aTargetNode = eventTarget);
}
void nsRootAccessible::FireFocusCallback(nsITimer *aTimer, void *aClosure)
{
- nsRootAccessible *rootAccessible = NS_STATIC_CAST(nsRootAccessible*, aClosure);
+ nsRootAccessible *rootAccessible = static_cast<nsRootAccessible*>(aClosure);
NS_ASSERTION(rootAccessible, "How did we get here without a root accessible?");
rootAccessible->FireCurrentFocusEvent();
}
NS_IMETHODIMP
nsRootAccessible::Init()
{
nsresult rv = nsDocAccessibleWrap::Init();
--- a/accessible/src/html/nsHTMLFormControlAccessible.cpp
+++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp
@@ -202,18 +202,17 @@ nsHTMLRadioButtonAccessible::GetAttribut
count++;
if (itemNode == mDOMNode)
indexOf = count;
}
}
- nsAccessibilityUtils::
- SetAccGroupAttrs(aAttributes, 0, indexOf, count);
+ nsAccUtils::SetAccGroupAttrs(aAttributes, 0, indexOf, count);
return NS_OK;
}
// ----- Button -----
nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
nsHyperTextAccessibleWrap(aNode, aShell)
@@ -567,94 +566,123 @@ void nsHTMLTextFieldAccessible::CheckFor
// --- groupbox -----
/*
* The HTML for this is <fieldset> <legend>box-title</legend> form elements </fieldset>
*/
nsHTMLGroupboxAccessible::nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
-nsAccessibleWrap(aNode, aShell)
+nsHyperTextAccessibleWrap(aNode, aShell)
{
}
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetRole(PRUint32 *_retval)
{
*_retval = nsIAccessibleRole::ROLE_GROUPING;
return NS_OK;
}
-NS_IMETHODIMP
-nsHTMLGroupboxAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
+nsIContent* nsHTMLGroupboxAccessible::GetLegend()
{
- // Groupbox doesn't support any states!
- *aState = 0;
- if (aExtraState)
- *aExtraState = 0;
+ nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
+ NS_ENSURE_TRUE(content, nsnull);
- return NS_OK;
+ nsresult count = 0;
+ nsIContent *testLegendContent;
+ while ((testLegendContent = content->GetChildAt(count ++ )) != nsnull) {
+ if (testLegendContent->NodeInfo()->Equals(nsAccessibilityAtoms::legend,
+ content->GetNameSpaceID())) {
+ // Either XHTML namespace or no namespace
+ return testLegendContent;
+ }
+ }
+
+ return nsnull;
}
NS_IMETHODIMP nsHTMLGroupboxAccessible::GetName(nsAString& aName)
{
+ if (!mDOMNode) {
+ return NS_ERROR_FAILURE;
+ }
+ aName.Truncate();
if (mRoleMapEntry) {
nsAccessible::GetName(aName);
if (!aName.IsEmpty()) {
return NS_OK;
}
}
- nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
- if (element) {
- nsCOMPtr<nsIDOMNodeList> legends;
- nsAutoString nameSpaceURI;
- element->GetNamespaceURI(nameSpaceURI);
- element->GetElementsByTagNameNS(nameSpaceURI, NS_LITERAL_STRING("legend"),
- getter_AddRefs(legends));
- if (legends) {
- nsCOMPtr<nsIDOMNode> legendNode;
- legends->Item(0, getter_AddRefs(legendNode));
- nsCOMPtr<nsIContent> legendContent(do_QueryInterface(legendNode));
- if (legendContent) {
- aName.Truncate(); // Default name is blank
- return AppendFlatStringFromSubtree(legendContent, &aName);
- }
+ nsIContent *legendContent = GetLegend();
+ if (legendContent) {
+ return AppendFlatStringFromSubtree(legendContent, &aName);
+ }
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLGroupboxAccessible::GetAccessibleRelated(PRUint32 aRelationType,
+ nsIAccessible **aRelated)
+{
+ if (!mDOMNode) {
+ return NS_ERROR_FAILURE;
+ }
+ NS_ENSURE_ARG_POINTER(aRelated);
+
+ *aRelated = nsnull;
+
+ nsresult rv = nsHyperTextAccessibleWrap::GetAccessibleRelated(aRelationType, aRelated);
+ if (NS_FAILED(rv) || *aRelated) {
+ // Either the node is shut down, or another relation mechanism has been used
+ return rv;
+ }
+
+ if (aRelationType == nsIAccessibleRelation::RELATION_LABELLED_BY) {
+ // No override for label, so use <legend> for this <fieldset>
+ nsCOMPtr<nsIDOMNode> legendNode = do_QueryInterface(GetLegend());
+ if (legendNode) {
+ GetAccService()->GetAccessibleInWeakShell(legendNode, mWeakShell, aRelated);
}
}
+
return NS_OK;
}
-void nsHTMLGroupboxAccessible::CacheChildren()
+nsHTMLLegendAccessible::nsHTMLLegendAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
+nsHyperTextAccessibleWrap(aNode, aShell)
+{
+}
+
+NS_IMETHODIMP
+nsHTMLLegendAccessible::GetAccessibleRelated(PRUint32 aRelationType,
+ nsIAccessible **aRelated)
{
- if (!mWeakShell) {
- // This node has been shut down
- mAccChildCount = eChildCountUninitialized;
- return;
+ *aRelated = nsnull;
+
+ nsresult rv = nsHyperTextAccessibleWrap::GetAccessibleRelated(aRelationType, aRelated);
+ if (NS_FAILED(rv) || *aRelated) {
+ // Either the node is shut down, or another relation mechanism has been used
+ return rv;
}
- if (mAccChildCount == eChildCountUninitialized) {
- PRBool allowsAnonChildren = PR_FALSE;
- GetAllowsAnonChildAccessibles(&allowsAnonChildren);
- nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, allowsAnonChildren);
- walker.mState.frame = GetFrame();
- PRInt32 childCount = 0;
- walker.GetFirstChild();
- // Check for <legend> and skip it if it's there
- if (walker.mState.accessible && walker.mState.domNode) {
- nsCOMPtr<nsIDOMNode> mightBeLegendNode;
- walker.mState.domNode->GetParentNode(getter_AddRefs(mightBeLegendNode));
- nsCOMPtr<nsIDOMHTMLLegendElement> legend(do_QueryInterface(mightBeLegendNode));
- if (legend) {
- walker.GetNextSibling(); // Skip the legend
+ if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
+ // Look for groupbox parent
+ nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
+ if (!content) {
+ return NS_ERROR_FAILURE; // Node already shut down
+ }
+ nsCOMPtr<nsIAccessible> groupboxAccessible = GetParent();
+ if (groupboxAccessible &&
+ Role(groupboxAccessible) == nsIAccessibleRole::ROLE_GROUPING) {
+ nsCOMPtr<nsIAccessible> testLabelAccessible;
+ groupboxAccessible->GetAccessibleRelated(nsIAccessibleRelation::RELATION_LABELLED_BY,
+ getter_AddRefs(testLabelAccessible));
+ if (testLabelAccessible == this) {
+ // We're the first child of the parent groupbox
+ NS_ADDREF(*aRelated = groupboxAccessible);
}
}
- SetFirstChild(walker.mState.accessible);
- nsCOMPtr<nsPIAccessible> privatePrevAccessible;
- while (walker.mState.accessible) {
- ++ childCount;
- privatePrevAccessible = do_QueryInterface(walker.mState.accessible);
- privatePrevAccessible->SetParent(this);
- walker.GetNextSibling();
- privatePrevAccessible->SetNextSibling(walker.mState.accessible);
- }
- mAccChildCount = childCount;
}
+
+ return NS_OK;
}
--- a/accessible/src/html/nsHTMLFormControlAccessible.h
+++ b/accessible/src/html/nsHTMLFormControlAccessible.h
@@ -119,19 +119,28 @@ public:
protected:
// Editor helpers, subclasses of nsHyperTextAccessible may have editor
virtual void SetEditor(nsIEditor *aEditor);
virtual already_AddRefed<nsIEditor> GetEditor() { nsIEditor *editor = mEditor; NS_IF_ADDREF(editor); return editor; }
void CheckForEditor();
nsCOMPtr<nsIEditor> mEditor;
};
-class nsHTMLGroupboxAccessible : public nsAccessibleWrap
+class nsHTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
{
public:
nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
- NS_IMETHOD GetRole(PRUint32 *_retval);
- NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
- NS_IMETHOD GetName(nsAString& _retval);
- void CacheChildren();
+ NS_IMETHOD GetRole(PRUint32 *aRole);
+ NS_IMETHOD GetName(nsAString& aName);
+ NS_IMETHOD GetAccessibleRelated(PRUint32 aRelationType, nsIAccessible **aRelated);
+protected:
+ nsIContent* GetLegend();
+};
+
+class nsHTMLLegendAccessible : public nsHyperTextAccessibleWrap
+{
+public:
+ nsHTMLLegendAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
+ NS_IMETHOD GetAccessibleRelated(PRUint32 aRelationType, nsIAccessible **aRelated);
+ NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = nsIAccessibleRole::ROLE_LABEL; return NS_OK; }
};
#endif
--- a/accessible/src/html/nsHTMLImageAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageAccessible.cpp
@@ -33,33 +33,37 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "imgIContainer.h"
#include "imgIRequest.h"
+
#include "nsHTMLImageAccessible.h"
#include "nsAccessibilityAtoms.h"
-#include "nsIAccessibilityService.h"
+#include "nsHTMLAreaAccessible.h"
+
#include "nsIDOMHTMLCollection.h"
#include "nsIDocument.h"
#include "nsIHTMLDocument.h"
#include "nsIImageLoadingContent.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMDocument.h"
#include "nsPIDOMWindow.h"
// --- image -----
+const PRUint32 kDefaultImageCacheSize = 256;
+
nsHTMLImageAccessible::nsHTMLImageAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
-nsLinkableAccessible(aDOMNode, aShell)
+nsLinkableAccessible(aDOMNode, aShell), mAccessNodeCache(nsnull)
{
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(aDOMNode));
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
if (!shell)
return;
nsIDocument *doc = shell->GetDocument();
nsAutoString mapElementName;
@@ -68,16 +72,21 @@ nsLinkableAccessible(aDOMNode, aShell)
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(doc));
element->GetAttribute(NS_LITERAL_STRING("usemap"),mapElementName);
if (htmlDoc && !mapElementName.IsEmpty()) {
if (mapElementName.CharAt(0) == '#')
mapElementName.Cut(0,1);
mMapElement = htmlDoc->GetImageMap(mapElementName);
}
}
+
+ if (mMapElement) {
+ mAccessNodeCache = new nsAccessNodeHashtable();
+ mAccessNodeCache->Init(kDefaultImageCacheSize);
+ }
}
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLImageAccessible, nsLinkableAccessible, nsIAccessibleImage)
NS_IMETHODIMP
nsHTMLImageAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
// The state is a bitfield, get our inherited state, then logically OR it with
@@ -135,47 +144,56 @@ NS_IMETHODIMP nsHTMLImageAccessible::Get
/* wstring getRole (); */
NS_IMETHODIMP nsHTMLImageAccessible::GetRole(PRUint32 *_retval)
{
*_retval = nsIAccessibleRole::ROLE_GRAPHIC;
return NS_OK;
}
-already_AddRefed<nsIAccessible> nsHTMLImageAccessible::CreateAreaAccessible(PRInt32 areaNum)
+already_AddRefed<nsIAccessible>
+nsHTMLImageAccessible::GetAreaAccessible(PRInt32 aAreaNum)
{
- if (!mMapElement)
+ if (!mMapElement)
return nsnull;
nsCOMPtr<nsIDOMHTMLCollection> mapAreas;
mMapElement->GetAreas(getter_AddRefs(mapAreas));
- if (!mapAreas)
+ if (!mapAreas)
return nsnull;
nsCOMPtr<nsIDOMNode> domNode;
- mapAreas->Item(areaNum,getter_AddRefs(domNode));
+ mapAreas->Item(aAreaNum,getter_AddRefs(domNode));
if (!domNode)
return nsnull;
- nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
- if (!accService)
- return nsnull;
- if (accService) {
- nsIAccessible* acc = nsnull;
- accService->GetCachedAccessible(domNode, mWeakShell, &acc);
- if (!acc) {
- accService->CreateHTMLAreaAccessible(mWeakShell, domNode, this, &acc);
- nsCOMPtr<nsPIAccessNode> accessNode(do_QueryInterface(acc));
- if (accessNode) {
- accessNode->Init();
- }
- }
- return acc;
+ nsCOMPtr<nsIAccessNode> accessNode;
+ GetCacheEntry(*mAccessNodeCache, (void*)(aAreaNum),
+ getter_AddRefs(accessNode));
+
+ if (!accessNode) {
+ accessNode = new nsHTMLAreaAccessible(domNode, this, mWeakShell);
+ if (!accessNode)
+ return nsnull;
+
+ nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(accessNode));
+ NS_ASSERTION(privateAccessNode,
+ "Accessible doesn't implement nsPIAccessNode");
+
+ nsresult rv = privateAccessNode->Init();
+ if (NS_FAILED(rv))
+ return nsnull;
+
+ PutCacheEntry(*mAccessNodeCache, (void*)(aAreaNum), accessNode);
}
- return nsnull;
+
+ nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(accessNode));
+ nsIAccessible *accPtr;
+ NS_IF_ADDREF(accPtr = accessible);
+ return accPtr;
}
void nsHTMLImageAccessible::CacheChildren()
{
if (!mWeakShell) {
// This node has been shut down
mAccChildCount = eChildCountUninitialized;
@@ -197,17 +215,17 @@ void nsHTMLImageAccessible::CacheChildre
PRUint32 numMapAreas;
mapAreas->GetLength(&numMapAreas);
PRInt32 childCount = 0;
nsCOMPtr<nsIAccessible> areaAccessible;
nsCOMPtr<nsPIAccessible> privatePrevAccessible;
while (childCount < (PRInt32)numMapAreas &&
- (areaAccessible = CreateAreaAccessible(childCount)) != nsnull) {
+ (areaAccessible = GetAreaAccessible(childCount)) != nsnull) {
if (privatePrevAccessible) {
privatePrevAccessible->SetNextSibling(areaAccessible);
}
else {
SetFirstChild(areaAccessible);
}
++ childCount;
@@ -241,8 +259,23 @@ NS_IMETHODIMP nsHTMLImageAccessible::DoA
}
return nsLinkableAccessible::DoAction(index);
}
NS_IMETHODIMP nsHTMLImageAccessible::GetImageBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
{
return GetBounds(x, y, width, height);
}
+
+NS_IMETHODIMP
+nsHTMLImageAccessible::Shutdown()
+{
+ nsLinkableAccessible::Shutdown();
+
+ if (mAccessNodeCache) {
+ ClearCache(*mAccessNodeCache);
+ delete mAccessNodeCache;
+ mAccessNodeCache = nsnull;
+ }
+
+ return NS_OK;
+}
+
--- a/accessible/src/html/nsHTMLImageAccessible.h
+++ b/accessible/src/html/nsHTMLImageAccessible.h
@@ -55,22 +55,32 @@ class nsHTMLImageAccessible : public nsL
NS_DECL_ISUPPORTS_INHERITED
public:
//action0 may exist depends on whether an onclick is associated with it
enum { eAction_ShowLongDescription = 1 };
nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
+ // nsIAccessible
NS_IMETHOD GetName(nsAString& _retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetRole(PRUint32 *_retval);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetImageBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
+ // nsPIAccessNode
+ NS_IMETHOD Shutdown();
+
protected:
virtual void CacheChildren();
- already_AddRefed<nsIAccessible> CreateAreaAccessible(PRInt32 areaNum);
+ already_AddRefed<nsIAccessible> GetAreaAccessible(PRInt32 aAreaNum);
nsCOMPtr<nsIDOMHTMLMapElement> mMapElement;
+
+ // Cache of area accessibles. We do not use common cache because images can
+ // share area elements but we need to have separate area accessibles for
+ // each image accessible.
+ nsAccessNodeHashtable *mAccessNodeCache;
};
-#endif
+#endif
+
--- a/accessible/src/html/nsHTMLLinkAccessible.cpp
+++ b/accessible/src/html/nsHTMLLinkAccessible.cpp
@@ -38,17 +38,17 @@
#include "nsHTMLLinkAccessible.h"
#include "nsAccessibilityAtoms.h"
#include "nsIAccessibleEvent.h"
#include "nsINameSpaceManager.h"
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLinkAccessible, nsLinkableAccessible)
-nsHTMLLinkAccessible::nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell, nsIFrame *aFrame):
+nsHTMLLinkAccessible::nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsLinkableAccessible(aDomNode, aShell)
{
}
/* wstring getName (); */
NS_IMETHODIMP nsHTMLLinkAccessible::GetName(nsAString& aName)
{
if (!mActionContent)
--- a/accessible/src/html/nsHTMLLinkAccessible.h
+++ b/accessible/src/html/nsHTMLLinkAccessible.h
@@ -41,17 +41,17 @@
#include "nsBaseWidgetAccessible.h"
class nsHTMLLinkAccessible : public nsLinkableAccessible
{
NS_DECL_ISUPPORTS_INHERITED
public:
- nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell, nsIFrame *aFrame);
+ nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
// nsIAccessible
NS_IMETHOD GetName(nsAString& _retval);
NS_IMETHOD GetRole(PRUint32 *_retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
};
#endif
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -127,17 +127,17 @@ void nsHTMLSelectableAccessible::iterato
mOption->GetSelected(&isSelected);
if (isSelected) {
nsCOMPtr<nsIDOMNode> optionNode(do_QueryInterface(mOption));
aAccService->GetAccessibleInWeakShell(optionNode, mWeakShell, getter_AddRefs(tempAccess));
}
}
if (tempAccess)
- aSelectedAccessibles->AppendElement(NS_STATIC_CAST(nsISupports*, tempAccess), PR_FALSE);
+ aSelectedAccessibles->AppendElement(static_cast<nsISupports*>(tempAccess), PR_FALSE);
}
PRBool nsHTMLSelectableAccessible::iterator::GetAccessibleIfSelected(PRInt32 aIndex,
nsIAccessibilityService *aAccService,
nsPresContext *aContext,
nsIAccessible **aAccessible)
{
PRBool isSelected = PR_FALSE;
@@ -559,18 +559,18 @@ nsHTMLSelectOptionAccessible::GetAttribu
siblings->GetLength(&setSize);
nsCOMPtr<nsIDOMNode> itemNode;
while (NS_SUCCEEDED(siblings->Item(posInSet ++, getter_AddRefs(itemNode))) &&
itemNode != mDOMNode) {
// Keep looping, to increment posInSet
}
}
- nsAccessibilityUtils::
- SetAccGroupAttrs(aAttributes, level, posInSet, NS_STATIC_CAST(PRInt32, setSize));
+ nsAccUtils::SetAccGroupAttrs(aAttributes, level, posInSet,
+ static_cast<PRInt32>(setSize));
return NS_OK;
}
nsIFrame* nsHTMLSelectOptionAccessible::GetBoundsFrame()
{
PRUint32 state;
nsCOMPtr<nsIContent> content = GetSelectState(&state);
if (state & nsIAccessibleStates::STATE_COLLAPSED) {
@@ -814,27 +814,29 @@ void nsHTMLSelectOptionAccessible::Selec
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
nsCOMPtr<nsIAccessible> optionAccessible;
accService->GetAccessibleFor(optionNode, getter_AddRefs(optionAccessible));
if (!optionAccessible) {
return;
}
- privateMultiSelect->FireToolkitEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
- multiSelect, nsnull);
+ nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
+ multiSelect);
+
PRUint32 state = State(optionAccessible);
PRUint32 eventType;
if (state & nsIAccessibleStates::STATE_SELECTED) {
eventType = nsIAccessibleEvent::EVENT_SELECTION_ADD;
}
else {
eventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
- }
- privateMultiSelect->FireToolkitEvent(eventType, optionAccessible, nsnull);
+ }
+
+ nsAccUtils::FireAccEvent(eventType, optionAccessible);
}
nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
PRUint32* aExtraState)
{
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
while (content && content->Tag() != nsAccessibilityAtoms::select) {
content = content->GetParent();
@@ -1163,17 +1165,17 @@ nsHTMLComboboxTextFieldAccessible::nsHTM
nsIWeakReference* aShell):
nsHTMLTextFieldAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same as for our parent, use |this| pointer as the unique Id
- *aUniqueID = NS_STATIC_CAST(void*, this);
+ *aUniqueID = static_cast<void*>(this);
return NS_OK;
}
/**
* Gets the bounds for the BlockFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsHTMLComboboxTextFieldAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame)
@@ -1283,17 +1285,17 @@ NS_IMETHODIMP nsHTMLComboboxButtonAccess
aName.AssignLiteral("open");
return NS_OK;
}
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same for all tree item, use |this| pointer as the unique Id
- *aUniqueID = NS_STATIC_CAST(void*, this);
+ *aUniqueID = static_cast<void*>(this);
return NS_OK;
}
/**
* Gets the bounds for the gfxButtonControlFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsHTMLComboboxButtonAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame)
@@ -1415,17 +1417,17 @@ NS_IMETHODIMP nsHTMLComboboxListAccessib
{
NS_IF_ADDREF(*aParent = mParent);
return NS_OK;
}
NS_IMETHODIMP nsHTMLComboboxListAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same for all tree item, use |this| pointer as the unique Id
- *aUniqueID = NS_STATIC_CAST(void*, this);
+ *aUniqueID = static_cast<void*>(this);
return NS_OK;
}
/**
* Gets the bounds for the areaFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame)
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -44,17 +44,16 @@
#include "nsIDOMDocumentRange.h"
#include "nsIDOMRange.h"
#include "nsISelection2.h"
#include "nsISelectionPrivate.h"
#include "nsINameSpaceManager.h"
#include "nsIAccessibilityService.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMHTMLCollection.h"
-#include "nsIDOMHTMLTableCaptionElem.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIDOMHTMLTableElement.h"
#include "nsIDOMHTMLTableRowElement.h"
#include "nsIDOMHTMLTableSectionElem.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsITableLayout.h"
@@ -87,71 +86,56 @@ nsHTMLTableCellAccessible::GetState(PRUi
return NS_OK;
}
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableAccessible, nsAccessible, nsIAccessibleTable)
nsHTMLTableAccessible::nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsAccessibleWrap(aDomNode, aShell)
{
- mHasCaption = PR_FALSE;
}
void nsHTMLTableAccessible::CacheChildren()
{
if (!mWeakShell) {
// This node has been shut down
mAccChildCount = eChildCountUninitialized;
return;
}
-
+
if (mAccChildCount == eChildCountUninitialized) {
- PRInt32 childCount = 0;
- nsCOMPtr<nsPIAccessible> privatePrevAccessible;
+ nsAccessible::CacheChildren();
nsCOMPtr<nsIAccessible> captionAccessible;
- GetCaption(getter_AddRefs(captionAccessible));
- if (captionAccessible) {
- mHasCaption = PR_TRUE;
- SetFirstChild(captionAccessible);
- ++ childCount;
- privatePrevAccessible = do_QueryInterface(captionAccessible);
- privatePrevAccessible->SetParent(this);
- }
- else {
- mHasCaption = PR_FALSE;
+ while (NextChild(captionAccessible)) {
+ if (Role(captionAccessible) == nsIAccessibleRole::ROLE_CAPTION) {
+ nsCOMPtr<nsIAccessible> captionParentAccessible;
+ captionAccessible->GetParent(getter_AddRefs(captionParentAccessible));
+ if (captionParentAccessible != this) {
+ NS_WARNING("Should not happen: parser ensures caption is the table's child, not the tbody's");
+ return;
+ }
+ nsCOMPtr<nsIAccessible> beforeCaptionAccessible;
+ captionAccessible->GetPreviousSibling(getter_AddRefs(beforeCaptionAccessible));
+ if (beforeCaptionAccessible) {
+ // Move caption accessible so that it's the first child
+ nsCOMPtr<nsIAccessible> afterCaptionAccessible;
+ captionAccessible->GetNextSibling(getter_AddRefs(afterCaptionAccessible));
+ nsCOMPtr<nsPIAccessible> privateAcc = do_QueryInterface(beforeCaptionAccessible);
+ privateAcc->SetNextSibling(afterCaptionAccessible);
+ GetFirstChild(getter_AddRefs(afterCaptionAccessible));
+ SetFirstChild(captionAccessible);
+ privateAcc = do_QueryInterface(captionAccessible);
+ privateAcc->SetNextSibling(afterCaptionAccessible);
+ }
+ // Don't check for more captions, because nsAccessibilityService ensures
+ // we don't create accessibles for the other captions, since only the
+ // first is actually visible
+ break;
+ }
}
-
- PRBool allowsAnonChildren = PR_FALSE;
- GetAllowsAnonChildAccessibles(&allowsAnonChildren);
- nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, allowsAnonChildren);
- walker.mState.frame = GetFrame();
-
- walker.GetFirstChild();
- while (walker.mState.accessible) {
- nsCOMPtr<nsIContent> content(do_QueryInterface(walker.mState.domNode));
- NS_ASSERTION(content, "Creating accessible for node in HTMLTable with no content");
- if (content && content->IsNodeOfType(nsINode::eHTML) &&
- content->Tag() == nsAccessibilityAtoms::caption) {
- // We have already dealt with caption, ignore this one
- walker.GetNextSibling();
- continue;
- }
-
- ++ childCount;
- if (privatePrevAccessible) {
- privatePrevAccessible->SetNextSibling(walker.mState.accessible);
- }
- else {
- SetFirstChild(walker.mState.accessible);
- }
- privatePrevAccessible = do_QueryInterface(walker.mState.accessible);
- privatePrevAccessible->SetParent(this);
- walker.GetNextSibling();
- }
- mAccChildCount = childCount;
}
}
/* unsigned long getRole (); */
NS_IMETHODIMP nsHTMLTableAccessible::GetRole(PRUint32 *aResult)
{
*aResult = nsIAccessibleRole::ROLE_TABLE;
return NS_OK;
@@ -168,44 +152,24 @@ nsHTMLTableAccessible::GetState(PRUint32
*aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
return NS_OK;
}
NS_IMETHODIMP nsHTMLTableAccessible::GetName(nsAString& aName)
{
aName.Truncate(); // Default name is blank
- if (mRoleMapEntry) {
- nsAccessible::GetName(aName);
- if (!aName.IsEmpty()) {
- return NS_OK;
+ nsAccessible::GetName(aName);
+ if (aName.IsEmpty()) {
+ nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
+ if (content) {
+ content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, aName);
}
}
- nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
- if (element) {
- nsCOMPtr<nsIDOMNodeList> captions;
- nsAutoString nameSpaceURI;
- element->GetNamespaceURI(nameSpaceURI);
- element->GetElementsByTagNameNS(nameSpaceURI, NS_LITERAL_STRING("caption"),
- getter_AddRefs(captions));
- if (captions) {
- nsCOMPtr<nsIDOMNode> captionNode;
- captions->Item(0, getter_AddRefs(captionNode));
- if (captionNode) {
- nsCOMPtr<nsIContent> captionContent(do_QueryInterface(captionNode));
- AppendFlatStringFromSubtree(captionContent, &aName);
- }
- }
- if (aName.IsEmpty()) {
- nsCOMPtr<nsIContent> content(do_QueryInterface(element));
- NS_ASSERTION(content, "No content for DOM element");
- content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::summary, aName);
- }
- }
return NS_OK;
}
nsresult
nsHTMLTableAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
if (!mDOMNode) {
return NS_ERROR_FAILURE; // Node already shut down
@@ -221,96 +185,61 @@ nsHTMLTableAccessible::GetAttributesInte
aAttributes->SetStringProperty(NS_LITERAL_CSTRING("layout-guess"),
NS_LITERAL_STRING("true"), oldValueUnused);
}
return NS_OK;
}
NS_IMETHODIMP
-nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption)
+nsHTMLTableAccessible::GetAccessibleRelated(PRUint32 aRelationType,
+ nsIAccessible **aRelated)
{
- *aCaption = nsnull;
- nsresult rv = NS_OK;
-
- nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
- NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
+ NS_ENSURE_ARG_POINTER(aRelated);
+ *aRelated = nsnull;
- nsCOMPtr<nsIDOMHTMLTableCaptionElement> caption;
- rv = table->GetCaption(getter_AddRefs(caption));
- NS_ENSURE_SUCCESS(rv, rv);
+ if (!mDOMNode) {
+ return NS_ERROR_FAILURE;
+ }
- nsCOMPtr<nsIDOMNode> captionNode(do_QueryInterface(caption));
- if (!captionNode) {
- return NS_OK;
+ nsresult rv = nsAccessibleWrap::GetAccessibleRelated(aRelationType, aRelated);
+ if (NS_FAILED(rv) || *aRelated) {
+ // Either the node is shut down, or another relation mechanism has been used
+ return rv;
}
- nsCOMPtr<nsIAccessibilityService> accService = GetAccService();
- NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
-
- accService->GetCachedAccessible(captionNode, mWeakShell, aCaption);
- if (*aCaption)
- return NS_OK;
+ if (aRelationType == nsIAccessibleRelation::RELATION_DESCRIBED_BY) {
+ return GetCaption(aRelated);
+ }
- nsCOMPtr<nsIPresShell> presShell(GetPresShell());
- nsCOMPtr<nsIContent> content(do_QueryInterface(captionNode));
- NS_ENSURE_TRUE(presShell && content, NS_ERROR_FAILURE);
- nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
- if (!frame) {
- return NS_OK;
- }
- accService->CreateHyperTextAccessible(frame, aCaption);
- nsCOMPtr<nsPIAccessNode> accessNode(do_QueryInterface(*aCaption));
- return accessNode ? accessNode->Init() : NS_ERROR_FAILURE;
+ return NS_OK;
}
+
NS_IMETHODIMP
-nsHTMLTableAccessible::SetCaption(nsIAccessible *aCaption)
+nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption)
{
- nsresult rv = NS_OK;
-
- nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
- NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
-
- nsCOMPtr<nsIAccessNode> accessNode(do_QueryInterface(aCaption));
- NS_ASSERTION(accessNode, "Unable to QI to nsIAccessNode");
- nsCOMPtr<nsIDOMNode> domNode;
- rv = accessNode->GetDOMNode(getter_AddRefs(domNode));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIDOMNode> newDOMNode;
- rv = domNode->CloneNode(PR_TRUE, getter_AddRefs(newDOMNode));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsIDOMHTMLTableCaptionElement>
- captionElement(do_QueryInterface(newDOMNode));
- NS_ENSURE_TRUE(captionElement, NS_ERROR_FAILURE);
-
- return table->SetCaption(captionElement);
+ nsCOMPtr<nsIAccessible> firstChild;
+ GetFirstChild(getter_AddRefs(firstChild));
+ if (firstChild && Role(firstChild) == nsIAccessibleRole::ROLE_CAPTION) {
+ NS_ADDREF(*aCaption = firstChild);
+ }
+ return NS_OK;
}
NS_IMETHODIMP
nsHTMLTableAccessible::GetSummary(nsAString &aSummary)
{
nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
return table->GetSummary(aSummary);
}
NS_IMETHODIMP
-nsHTMLTableAccessible::SetSummary(const nsAString &aSummary)
-{
- nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mDOMNode));
- NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
-
- return table->SetSummary(aSummary);
-}
-
-NS_IMETHODIMP
nsHTMLTableAccessible::GetColumns(PRInt32 *aColumns)
{
nsITableLayout *tableLayout;
nsresult rv = GetTableLayout(&tableLayout);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rows;
return tableLayout->GetTableSize(rows, *aColumns);
@@ -373,16 +302,145 @@ nsHTMLTableAccessible::GetRows(PRInt32 *
NS_IMETHODIMP
nsHTMLTableAccessible::GetRowHeader(nsIAccessibleTable **aRowHeader)
{
// Can not implement because there is no row header in html table
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
+nsHTMLTableAccessible::GetSelectedCellsCount(PRUint32* aCount)
+{
+ NS_ENSURE_ARG_POINTER(aCount);
+ *aCount = 0;
+
+ PRInt32 rowsCount = 0;
+ nsresult rv = GetRows(&rowsCount);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ PRInt32 columnsCount = 0;
+ rv = GetColumns(&columnsCount);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ PRInt32 rowIndex;
+ for (rowIndex = 0; rowIndex < rowsCount; rowIndex++) {
+ PRInt32 columnIndex;
+ for (columnIndex = 0; columnIndex < columnsCount; columnIndex++) {
+ PRBool state = PR_FALSE;
+ rv = IsCellSelected(rowIndex, columnIndex, &state);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (state)
+ (*aCount)++;
+ }
+ }
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLTableAccessible::GetSelectedColumnsCount(PRUint32* aCount)
+{
+ NS_ENSURE_ARG_POINTER(aCount);
+ *aCount = 0;
+
+ PRInt32 count = 0;
+ nsresult rv = GetColumns(&count);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ PRInt32 index;
+ for (index = 0; index < count; index++) {
+ PRBool state = PR_FALSE;
+ rv = IsColumnSelected(index, &state);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (state)
+ (*aCount)++;
+ }
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLTableAccessible::GetSelectedRowsCount(PRUint32* aCount)
+{
+ NS_ENSURE_ARG_POINTER(aCount);
+ *aCount = 0;
+
+ PRInt32 count = 0;
+ nsresult rv = GetRows(&count);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ PRInt32 index;
+ for (index = 0; index < count; index++) {
+ PRBool state = PR_FALSE;
+ rv = IsRowSelected(index, &state);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (state)
+ (*aCount)++;
+ }
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLTableAccessible::GetSelectedCells(PRUint32 *aNumCells,
+ PRInt32 **aCells)
+{
+ NS_ENSURE_ARG_POINTER(aNumCells);
+ *aNumCells = 0;
+ NS_ENSURE_ARG_POINTER(aCells);
+ *aCells = nsnull;
+
+ PRInt32 rowsCount = 0;
+ nsresult rv = GetRows(&rowsCount);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ PRInt32 columnsCount = 0;
+ rv = GetColumns(&columnsCount);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ PRInt32 cellsCount = columnsCount * rowsCount;
+ nsAutoArrayPtr<PRBool> states(new PRBool[cellsCount]);
+ NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
+
+ PRInt32 rowIndex, index;
+ for (rowIndex = 0, index = 0; rowIndex < rowsCount; rowIndex++) {
+ PRInt32 columnIndex;
+ for (columnIndex = 0; columnIndex < columnsCount; columnIndex++, index++) {
+ rv = IsCellSelected(rowIndex, columnIndex, &states[index]);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (states[index])
+ (*aNumCells)++;
+ }
+ }
+
+ PRInt32 *cellsArray =
+ (PRInt32 *)nsMemory::Alloc((*aNumCells) * sizeof(PRInt32));
+ NS_ENSURE_TRUE(cellsArray, NS_ERROR_OUT_OF_MEMORY);
+
+ PRInt32 curr = 0;
+ for (rowIndex = 0, index = 0; rowIndex < rowsCount; rowIndex++) {
+ PRInt32 columnIndex;
+ for (columnIndex = 0; columnIndex < columnsCount; columnIndex++, index++) {
+ if (states[index]) {
+ PRInt32 cellIndex = -1;
+ GetIndexAt(rowIndex, columnIndex, &cellIndex);
+ cellsArray[curr++] = cellIndex;
+ }
+ }
+ }
+
+ *aCells = cellsArray;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
nsHTMLTableAccessible::GetSelectedColumns(PRUint32 *aNumColumns,
PRInt32 **aColumns)
{
nsresult rv = NS_OK;
PRInt32 columnCount;
rv = GetColumns(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
@@ -815,30 +873,49 @@ nsHTMLTableAccessible::GetCellAt(PRInt32
return tableLayout->GetCellDataAt(aRowIndex, aColIndex, aCell,
startRowIndex, startColIndex,
rowSpan, colSpan,
actualRowSpan, actualColSpan,
isSelected);
}
-#ifdef SHOW_LAYOUT_HEURISTIC
NS_IMETHODIMP nsHTMLTableAccessible::GetDescription(nsAString& aDescription)
{
// Helpful for debugging layout vs. data tables
aDescription.Truncate();
- PRBool isProbablyForLayout;
- IsProbablyForLayout(&isProbablyForLayout);
- aDescription = mLayoutHeuristic;
+ nsAccessible::GetDescription(aDescription);
+ if (!aDescription.IsEmpty()) {
+ return NS_OK;
+ }
+
+ nsCOMPtr<nsIAccessible> captionAccessible;
+ GetCaption(getter_AddRefs(captionAccessible));
+ nsCOMPtr<nsIAccessNode> captionAccessNode = do_QueryInterface(captionAccessible);
+ if (captionAccessNode) {
+ nsCOMPtr<nsIDOMNode> captionNode;
+ captionAccessNode->GetDOMNode(getter_AddRefs(captionNode));
+ nsCOMPtr<nsIContent> captionContent = do_QueryInterface(captionNode);
+ if (captionContent) {
+ AppendFlatStringFromSubtree(captionContent, &aDescription);
+ }
+ }
+#ifdef SHOW_LAYOUT_HEURISTIC
+ if (aDescription.IsEmpty()) {
+ PRBool isProbablyForLayout;
+ IsProbablyForLayout(&isProbablyForLayout);
+ aDescription = mLayoutHeuristic;
+ }
#ifdef DEBUG_A11Y
printf("\nTABLE: %s\n", NS_ConvertUTF16toUTF8(mLayoutHeuristic).get());
#endif
+#endif
+
return NS_OK;
}
-#endif
PRBool nsHTMLTableAccessible::HasDescendant(char *aTagName, PRBool aAllowEmpty)
{
nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mDOMNode));
NS_ENSURE_TRUE(tableElt, PR_FALSE);
nsCOMPtr<nsIDOMNodeList> nodeList;
nsAutoString tagName;
@@ -1055,34 +1132,22 @@ nsHTMLTableHeadAccessible::GetRole(PRUin
NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetCaption(nsIAccessible **aCaption)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-nsHTMLTableHeadAccessible::SetCaption(nsIAccessible *aCaption)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetSummary(nsAString &aSummary)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-nsHTMLTableHeadAccessible::SetSummary(const nsAString &aSummary)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHTMLTableHeadAccessible::GetRows(PRInt32 *aRows)
{
@@ -1093,8 +1158,34 @@ nsHTMLTableHeadAccessible::GetRows(PRInt
nsCOMPtr<nsIDOMHTMLCollection> rows;
rv = head->GetRows(getter_AddRefs(rows));
NS_ENSURE_SUCCESS(rv, rv);
return rows->GetLength((PRUint32 *)aRows);
}
+NS_IMETHODIMP
+nsHTMLCaptionAccessible::GetAccessibleRelated(PRUint32 aRelationType,
+ nsIAccessible **aRelated)
+{
+ NS_ENSURE_ARG_POINTER(aRelated);
+ *aRelated = nsnull;
+
+ if (!mDOMNode) {
+ return NS_ERROR_FAILURE;
+ }
+
+ nsresult rv = nsHyperTextAccessible::GetAccessibleRelated(aRelationType, aRelated);
+ if (NS_FAILED(rv) || *aRelated) {
+ // Either the node is shut down, or another relation mechanism has been used
+ return rv;
+ }
+
+ if (aRelationType == nsIAccessibleRelation::RELATION_DESCRIPTION_FOR) {
+ return GetParent(aRelated);
+ }
+
+ return NS_OK;
+}
+
+
+
--- a/accessible/src/html/nsHTMLTableAccessible.h
+++ b/accessible/src/html/nsHTMLTableAccessible.h
@@ -66,19 +66,18 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_IMETHOD GetRole(PRUint32 *aResult);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetName(nsAString& aResult);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
-#ifdef SHOW_LAYOUT_HEURISTIC
NS_IMETHOD GetDescription(nsAString& aDescription);
-#endif
+ NS_IMETHOD GetAccessibleRelated(PRUint32 aRelationType, nsIAccessible **aRelated);
protected:
/**
* Selects or unselects row or column.
*
* @param aIndex - index of row or column to be selected
* @param aTarget - indicates what should be selected, either row or column
@@ -101,17 +100,16 @@ protected:
virtual void CacheChildren();
nsresult GetTableNode(nsIDOMNode **_retval);
nsresult GetTableLayout(nsITableLayout **aLayoutObject);
nsresult GetCellAt(PRInt32 aRowIndex,
PRInt32 aColIndex,
nsIDOMElement* &aCell);
PRBool HasDescendant(char *aTagName, PRBool aAllowEmpty = PR_TRUE);
- PRBool mHasCaption;
#ifdef SHOW_LAYOUT_HEURISTIC
nsAutoString mLayoutHeuristic;
#endif
};
class nsHTMLTableHeadAccessible : public nsHTMLTableAccessible
{
public:
@@ -119,16 +117,26 @@ public:
nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell);
/* nsIAccessible */
NS_IMETHOD GetRole(PRUint32 *aResult);
/* nsIAccessibleTable */
NS_IMETHOD GetCaption(nsIAccessible **aCaption);
- NS_IMETHOD SetCaption(nsIAccessible *aCaption);
NS_IMETHOD GetSummary(nsAString &aSummary);
- NS_IMETHOD SetSummary(const nsAString &aSummary);
NS_IMETHOD GetColumnHeader(nsIAccessibleTable **aColumnHeader);
NS_IMETHOD GetRows(PRInt32 *aRows);
};
+class nsHTMLCaptionAccessible : public nsHyperTextAccessibleWrap
+{
+public:
+ nsHTMLCaptionAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell) :
+ nsHyperTextAccessibleWrap(aDomNode, aShell) { }
+
+ // nsIAccessible
+ NS_IMETHOD GetRole(PRUint32 *aRole)
+ { *aRole = nsIAccessibleRole::ROLE_CAPTION; return NS_OK; }
+ NS_IMETHOD GetAccessibleRelated(PRUint32 aRelationType, nsIAccessible **aRelated);
+};
+
#endif
--- a/accessible/src/html/nsHTMLTextAccessible.cpp
+++ b/accessible/src/html/nsHTMLTextAccessible.cpp
@@ -34,27 +34,26 @@
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsHTMLTextAccessible.h"
#include "nsAccessibleTreeWalker.h"
-#include "nsBulletFrame.h"
#include "nsIAccessibleDocument.h"
#include "nsIAccessibleEvent.h"
#include "nsIFrame.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsISelection.h"
#include "nsISelectionController.h"
#include "nsComponentManagerUtils.h"
-nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell, nsIFrame *aFrame):
+nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsTextAccessibleWrap(aDomNode, aShell)
{
}
NS_IMETHODIMP nsHTMLTextAccessible::GetName(nsAString& aName)
{
aName.Truncate();
if (!mDOMNode) {
@@ -163,17 +162,17 @@ NS_IMETHODIMP
nsHTMLBRAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
{
*aState = nsIAccessibleStates::STATE_READONLY;
return NS_OK;
}
NS_IMETHODIMP nsHTMLBRAccessible::GetName(nsAString& aName)
{
- aName = NS_STATIC_CAST(PRUnichar, '\n'); // Newline char
+ aName = static_cast<PRUnichar>('\n'); // Newline char
return NS_OK;
}
nsHTMLLabelAccessible::nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsTextAccessible(aDomNode, aShell)
{
}
@@ -228,22 +227,22 @@ NS_IMETHODIMP nsHTMLLabelAccessible::Get
/* readonly attribute long accChildCount; */
NS_IMETHODIMP nsHTMLLabelAccessible::GetChildCount(PRInt32 *aAccChildCount)
{
// A <label> is not necessarily a leaf!
return nsAccessible::GetChildCount(aAccChildCount);
}
nsHTMLLIAccessible::nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
- nsIFrame *aBulletFrame, const nsAString& aBulletText):
+ const nsAString& aBulletText):
nsLinkableAccessible(aDOMNode, aShell)
{
if (!aBulletText.IsEmpty()) {
mBulletAccessible = new nsHTMLListBulletAccessible(mDOMNode, mWeakShell,
- aBulletFrame, aBulletText);
+ aBulletText);
nsCOMPtr<nsPIAccessNode> bulletANode(mBulletAccessible);
if (bulletANode) {
bulletANode->Init();
}
}
}
NS_IMETHODIMP nsHTMLLIAccessible::Shutdown()
@@ -252,16 +251,26 @@ NS_IMETHODIMP nsHTMLLIAccessible::Shutdo
// Ensure that weak pointer to this is nulled out
mBulletAccessible->Shutdown();
}
nsresult rv = nsLinkableAccessible::Shutdown();
mBulletAccessible = nsnull;
return rv;
}
+NS_IMETHODIMP
+nsHTMLLIAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
+{
+ nsresult rv = nsAccessibleWrap::GetState(aState, aExtraState);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ *aState |= nsIAccessibleStates::STATE_READONLY;
+ return NS_OK;
+}
+
NS_IMETHODIMP nsHTMLLIAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
{
nsresult rv = nsAccessibleWrap::GetBounds(x, y, width, height);
if (NS_FAILED(rv) || !mBulletAccessible) {
return rv;
}
PRInt32 bulletX, bulletY, bulletWidth, bulletHeight;
@@ -288,28 +297,28 @@ void nsHTMLLIAccessible::CacheChildren()
++ mAccChildCount;
}
}
// nsHTMLListBulletAccessible
nsHTMLListBulletAccessible::
nsHTMLListBulletAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell,
- nsIFrame *aFrame, const nsAString& aBulletText) :
+ const nsAString& aBulletText) :
nsLeafAccessible(aDomNode, aShell), mWeakParent(nsnull),
mBulletText(aBulletText)
{
mBulletText += ' '; // Otherwise bullets are jammed up against list text
}
NS_IMETHODIMP
nsHTMLListBulletAccessible::GetUniqueID(void **aUniqueID)
{
// Since mDOMNode is same as for list item, use |this| pointer as the unique Id
- *aUniqueID = NS_STATIC_CAST(void*, this);
+ *aUniqueID = static_cast<void*>(this);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLListBulletAccessible::Shutdown()
{
mBulletText.Truncate();
mWeakParent = nsnull;
@@ -371,20 +380,8 @@ nsHTMLListAccessible::GetState(PRUint32
{
nsresult rv = nsHyperTextAccessibleWrap::GetState(aState, aExtraState);
NS_ENSURE_SUCCESS(rv, rv);
*aState |= nsIAccessibleStates::STATE_READONLY;
return NS_OK;
}
-// nsHTMLLIAccessible
-
-NS_IMETHODIMP
-nsHTMLLIAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
-{
- nsresult rv = nsAccessibleWrap::GetState(aState, aExtraState);
- NS_ENSURE_SUCCESS(rv, rv);
-
- *aState |= nsIAccessibleStates::STATE_READONLY;
- return NS_OK;
-}
-
--- a/accessible/src/html/nsHTMLTextAccessible.h
+++ b/accessible/src/html/nsHTMLTextAccessible.h
@@ -44,17 +44,17 @@
#include "nsAutoPtr.h"
#include "nsBaseWidgetAccessible.h"
class nsIWeakReference;
class nsHTMLTextAccessible : public nsTextAccessibleWrap
{
public:
- nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell, nsIFrame *aFrame);
+ nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
// nsIAccessible
NS_IMETHOD GetName(nsAString& _retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetRole(PRUint32 *aRole);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
};
@@ -86,17 +86,17 @@ public:
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
NS_IMETHOD GetChildCount(PRInt32 *aAccChildCount);
};
class nsHTMLListBulletAccessible : public nsLeafAccessible
{
public:
nsHTMLListBulletAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
- nsIFrame *aFrame, const nsAString& aBulletText);
+ const nsAString& aBulletText);
// nsIAccessNode
NS_IMETHOD GetUniqueID(void **aUniqueID);
// nsPIAccessNode
NS_IMETHOD Shutdown();
// nsIAccessible
@@ -132,17 +132,17 @@ public:
NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = nsIAccessibleRole::ROLE_LIST; return NS_OK; }
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
};
class nsHTMLLIAccessible : public nsLinkableAccessible
{
public:
nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
- nsIFrame *aBulletFrame, const nsAString& aBulletText);
+ const nsAString& aBulletText);
NS_IMETHOD Shutdown();
NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = nsIAccessibleRole::ROLE_LISTITEM; return NS_OK; }
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetName(nsAString& aName) { aName.SetIsVoid(PR_TRUE); return mRoleMapEntry ? nsAccessible::GetName(aName) : NS_OK; }
NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
void CacheChildren(); // Include bullet accessible
protected:
nsRefPtr<nsHTMLListBulletAccessible> mBulletAccessible;
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -76,39 +76,39 @@ nsresult nsHyperTextAccessible::QueryInt
// in order for HTML document accessibles to get support for these interfaces
// However at some point we may push <body> to implement the interfaces and
// return nsDocAccessible to inherit from nsAccessibleWrap
if (aIID.Equals(NS_GET_IID(nsIAccessibleText))) {
// If |this| contains any children
PRInt32 numChildren;
GetChildCount(&numChildren);
if (numChildren > 0) {
- *aInstancePtr = NS_STATIC_CAST(nsIAccessibleText*, this);
+ *aInstancePtr = static_cast<nsIAccessibleText*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_ERROR_NO_INTERFACE;
}
if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperText))) {
if (IsHyperText()) {
// If |this| contains text and embedded objects
- *aInstancePtr = NS_STATIC_CAST(nsIAccessibleHyperText*, this);
+ *aInstancePtr = static_cast<nsIAccessibleHyperText*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_ERROR_NO_INTERFACE;
}
if (aIID.Equals(NS_GET_IID(nsIAccessibleEditableText))) {
// If this contains editable text
PRUint32 state, extState;
GetState(&state, &extState);
if (extState & nsIAccessibleStates::EXT_STATE_EDITABLE) {
- *aInstancePtr = NS_STATIC_CAST(nsIAccessibleEditableText*, this);
+ *aInstancePtr = static_cast<nsIAccessibleEditableText*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_ERROR_NO_INTERFACE;
}
}
return nsAccessible::QueryInterface(aIID, aInstancePtr);
@@ -135,20 +135,17 @@ NS_IMETHODIMP nsHyperTextAccessible::Get
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
if (!content) {
return NS_ERROR_FAILURE;
}
nsIAtom *tag = content->Tag();
- if (tag == nsAccessibilityAtoms::caption) {
- *aRole = nsIAccessibleRole::ROLE_CAPTION;
- }
- else if (tag == nsAccessibilityAtoms::form) {
+ if (tag == nsAccessibilityAtoms::form) {
*aRole = nsIAccessibleRole::ROLE_FORM;
}
else if (tag == nsAccessibilityAtoms::div ||
tag == nsAccessibilityAtoms::blockquote) {
*aRole = nsIAccessibleRole::ROLE_SECTION;
}
else if (tag == nsAccessibilityAtoms::h1 ||
tag == nsAccessibilityAtoms::h2 ||
@@ -846,19 +843,18 @@ nsHyperTextAccessible::GetAttributesInte
else if (tag == nsAccessibilityAtoms::h5)
headLevel = 5;
else if (tag == nsAccessibilityAtoms::h6)
headLevel = 6;
if (headLevel) {
nsAutoString strHeadLevel;
strHeadLevel.AppendInt(headLevel);
- nsAccessibilityUtils::SetAccAttr(aAttributes,
- nsAccessibilityAtoms::level,
- strHeadLevel);
+ nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::level,
+ strHeadLevel);
}
return NS_OK;
}
/*
* Given an offset, the x, y, width, and height values are filled appropriately.
*/
@@ -1133,16 +1129,27 @@ NS_IMETHODIMP nsHyperTextAccessible::Pas
{
nsCOMPtr<nsIEditor> editor = GetEditor();
if (editor && NS_SUCCEEDED(SetCaretOffset(aPosition)))
return editor->Paste(nsIClipboard::kGlobalClipboard);
return NS_ERROR_FAILURE;
}
+NS_IMETHODIMP
+nsHyperTextAccessible::GetAssociatedEditor(nsIEditor **aEditor)
+{
+ NS_ENSURE_ARG_POINTER(aEditor);
+
+ nsCOMPtr<nsIEditor> editor(GetEditor());
+ NS_IF_ADDREF(*aEditor = editor);
+
+ return NS_OK;
+}
+
/**
* nsIEditActionListener impl.
*/
NS_IMETHODIMP nsHyperTextAccessible::WillCreateNode(const nsAString& aTag,
nsIDOMNode *aParent, PRInt32 aPosition)
{
return NS_OK;
}
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -58,17 +58,16 @@ REQUIRES = content \
view \
widget \
xpcom \
necko \
$(NULL)
CMMSRCS = nsAccessNodeWrap.mm \
- nsDocAccessibleWrap.mm \
nsRootAccessibleWrap.mm \
nsAccessibleWrap.mm \
mozAccessible.mm \
mozDocAccessible.mm \
mozActionElements.mm \
mozTextAccessible.mm \
$(NULL)
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -323,17 +323,17 @@ GetNativeFromGeckoAccessible(nsIAccessib
}
// GetUnignoredParent() returns null when there is no unignored accessible all the way up to
// the root accessible. so we'll have to return whatever native accessible is above our root accessible
// (which might be the owning NSWindow in the application, for example).
//
// get the native root accessible, and tell it to return its first parent unignored accessible.
nsRefPtr<nsRootAccessible> root(mGeckoAccessible->GetRootAccessible());
- id nativeParent = GetNativeFromGeckoAccessible(NS_STATIC_CAST(nsIAccessible*, root));
+ id nativeParent = GetNativeFromGeckoAccessible(static_cast<nsIAccessible*>(root));
NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self);
return GetClosestInterestingAccessible(nativeParent);
}
- (BOOL)hasRepresentedView
{
return NO;
@@ -505,17 +505,17 @@ GetNativeFromGeckoAccessible(nsIAccessib
#endif
NSAssert1(![self accessibilityIsIgnored], @"trying to set focus to ignored element! (%@)", self);
NSAccessibilityPostNotification(GetObjectOrRepresentedView(self),
NSAccessibilityFocusedUIElementChangedNotification);
}
- (NSWindow*)window
{
- nsAccessibleWrap *accWrap = NS_STATIC_CAST (nsAccessibleWrap*, mGeckoAccessible);
+ nsAccessibleWrap *accWrap = static_cast<nsAccessibleWrap*>(mGeckoAccessible);
NSWindow *nativeWindow = nil;
accWrap->GetNativeWindow ((void**)&nativeWindow);
NSAssert1(nativeWindow, @"Could not get native window for %@", self);
return nativeWindow;
}
- (void)invalidateChildren
--- a/accessible/src/mac/mozDocAccessible.mm
+++ b/accessible/src/mac/mozDocAccessible.mm
@@ -39,17 +39,17 @@
#include "nsRootAccessibleWrap.h"
#import "mozDocAccessible.h"
#import "mozView.h"
static id <mozAccessible, mozView> getNativeViewFromRootAccessible (nsAccessible *accessible)
{
- nsRootAccessibleWrap *root = NS_STATIC_CAST (nsRootAccessibleWrap*, accessible);
+ nsRootAccessibleWrap *root = static_cast<nsRootAccessibleWrap*>(accessible);
id <mozAccessible, mozView> nativeView = nil;
root->GetNativeWidget ((void**)&nativeView);
return nativeView;
}
#pragma mark -
@implementation mozRootAccessible
--- a/accessible/src/mac/nsAccessibleWrap.h
+++ b/accessible/src/mac/nsAccessibleWrap.h
@@ -71,17 +71,19 @@ class nsAccessibleWrap : public nsAccess
// right type for this accessible's associated native object.
virtual objc_class* GetNativeType ();
// returns a pointer to the native window for this accessible tree.
void GetNativeWindow (void **aOutNativeWindow);
virtual nsresult Shutdown ();
virtual nsresult InvalidateChildren ();
-
+
+ NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent);
+
// we'll flatten buttons and checkboxes. usually they have a text node
// child, that is their title. Works in conjunction with IsPruned() below.
PRBool IsFlat() {
PRUint32 role = Role(this);
return (role == nsIAccessibleRole::ROLE_CHECKBUTTON ||
role == nsIAccessibleRole::ROLE_PUSHBUTTON ||
role == nsIAccessibleRole::ROLE_TOGGLE_BUTTON ||
role == nsIAccessibleRole::ROLE_SPLITBUTTON ||
@@ -110,20 +112,20 @@ class nsAccessibleWrap : public nsAccess
// we don't create a native object if we're child of a "flat" accessible; for example, on OS X buttons
// shouldn't have any children, because that makes the OS confused.
//
// to maintain a scripting environment where the XPCOM accessible hierarchy look the same
// on all platforms, we still let the C++ objects be created though.
nsCOMPtr<nsIAccessible> curParent = GetParent();
while (curParent) {
- nsAccessibleWrap *ancestorWrap = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)curParent.get());
+ nsAccessibleWrap *ancestorWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curParent.get());
if (ancestorWrap->IsFlat())
return PR_TRUE;
- curParent = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)curParent.get())->GetParent();
+ curParent = static_cast<nsAccessibleWrap*>((nsIAccessible*)curParent.get())->GetParent();
}
// no parent was flat
return PR_FALSE;
}
// Wrapper around our native object.
AccessibleWrapper *mNativeWrapper;
};
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -149,16 +149,54 @@ nsAccessibleWrap::Shutdown ()
if (mNativeWrapper) {
delete mNativeWrapper;
mNativeWrapper = nsnull;
}
return nsAccessible::Shutdown();
}
+NS_IMETHODIMP
+nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
+{
+ NS_ENSURE_ARG_POINTER(aEvent);
+
+ nsresult rv = nsAccessible::FireAccessibleEvent(aEvent);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ PRUint32 eventType;
+ rv = aEvent->GetEventType(&eventType);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // ignore everything but focus-changed and value-changed events for now.
+ if (eventType != nsIAccessibleEvent::EVENT_FOCUS &&
+ eventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE)
+ return NS_OK;
+
+ nsCOMPtr<nsIAccessible> accessible;
+ rv = aEvent->GetAccessible(getter_AddRefs(accessible));
+ NS_ENSURE_STATE(accessible);
+
+ mozAccessible *nativeAcc = nil;
+ accessible->GetNativeInterface((void**)&nativeAcc);
+ if (!nativeAcc)
+ return NS_ERROR_FAILURE;
+
+ switch (eventType) {
+ case nsIAccessibleEvent::EVENT_FOCUS:
+ [nativeAcc didReceiveFocus];
+ break;
+ case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
+ [nativeAcc valueDidChange];
+ break;
+ }
+
+ return NS_OK;
+}
+
nsresult
nsAccessibleWrap::InvalidateChildren ()
{
if (mNativeWrapper) {
mozAccessible *object = mNativeWrapper->getNativeObject();
[object invalidateChildren];
}
return nsAccessible::InvalidateChildren();
@@ -172,17 +210,17 @@ nsAccessibleWrap::GetUnignoredChildCount
return 0;
PRInt32 childCount = 0;
GetChildCount(&childCount);
nsCOMPtr<nsIAccessible> curAcc;
while (NextChild(curAcc)) {
- nsAccessibleWrap *childWrap = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)curAcc.get());
+ nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curAcc.get());
// if the current child is not ignored, count it.
if (!childWrap->IsIgnored())
++childCount;
// if it's flat, we don't care to inspect its children.
if (childWrap->IsFlat())
continue;
@@ -214,17 +252,17 @@ nsAccessibleWrap::GetUnignoredChildren(n
{
nsCOMPtr<nsIAccessible> curAcc;
// we're flat; there are no children.
if (IsFlat())
return;
while (NextChild(curAcc)) {
- nsAccessibleWrap *childWrap = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)curAcc.get());
+ nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curAcc.get());
if (childWrap->IsIgnored()) {
// element is ignored, so try adding its children as substitutes, if it has any.
if (!childWrap->IsFlat()) {
nsTArray<nsRefPtr<nsAccessibleWrap> > children;
childWrap->GetUnignoredChildren(children);
if (!children.IsEmpty()) {
// add the found unignored descendants to the array.
aChildrenArray.AppendElements(children);
@@ -235,17 +273,17 @@ nsAccessibleWrap::GetUnignoredChildren(n
aChildrenArray.AppendElement(childWrap);
}
}
already_AddRefed<nsIAccessible>
nsAccessibleWrap::GetUnignoredParent()
{
nsCOMPtr<nsIAccessible> parent(GetParent());
- nsAccessibleWrap *parentWrap = NS_STATIC_CAST(nsAccessibleWrap*, (nsIAccessible*)parent.get());
+ nsAccessibleWrap *parentWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)parent.get());
if (!parentWrap)
return nsnull;
// recursively return the parent, until we find one that is not ignored.
if (parentWrap->IsIgnored())
return parentWrap->GetUnignoredParent();
nsIAccessible *outValue = nsnull;
--- a/accessible/src/mac/nsApplicationAccessibleWrap.h
+++ b/accessible/src/mac/nsApplicationAccessibleWrap.h
@@ -42,12 +42,13 @@
#define __NS_APPLICATION_ACCESSIBLE_WRAP_H__
#include "nsApplicationAccessible.h"
class nsApplicationAccessibleWrap: public nsApplicationAccessible
{
public:
static void PreCreate() {}
+ static void Unload() {}
};
#endif
--- a/accessible/src/mac/nsDocAccessibleWrap.h
+++ b/accessible/src/mac/nsDocAccessibleWrap.h
@@ -36,22 +36,12 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef _nsDocAccessibleWrap_H_
#define _nsDocAccessibleWrap_H_
#include "nsDocAccessible.h"
-struct objc_class;
-
-class nsDocAccessibleWrap: public nsDocAccessible
-{
- public:
- nsDocAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
- virtual ~nsDocAccessibleWrap();
-
- NS_IMETHOD FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible,
- void* aData);
-};
+typedef nsDocAccessible nsDocAccessibleWrap;
#endif
deleted file mode 100644
--- a/accessible/src/mac/nsDocAccessibleWrap.mm
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Original Author: HÃ¥kan Waara <hwaara@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsDocAccessibleWrap.h"
-
-#import "mozAccessible.h"
-#import "mozAccessibleWrapper.h"
-
-nsDocAccessibleWrap::nsDocAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
- nsDocAccessible(aDOMNode, aShell)
-{
-}
-
-nsDocAccessibleWrap::~nsDocAccessibleWrap()
-{
-}
-
-NS_IMETHODIMP
-nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible, void* aData)
-{
- NS_ENSURE_ARG_POINTER(aAccessible);
-
- // this will notify xpcom observers, before we notify the OS
- nsDocAccessible::FireToolkitEvent(aEvent, aAccessible, aData);
-
- // ignore everything but focus-changed and value-changed events for now.
- if (aEvent != nsIAccessibleEvent::EVENT_FOCUS &&
- aEvent != nsIAccessibleEvent::EVENT_VALUE_CHANGE)
- return NS_OK;
-
- mozAccessible *nativeAcc = nil;
- aAccessible->GetNativeInterface((void**)&nativeAcc);
- if (!nativeAcc)
- return NS_ERROR_FAILURE;
-
- switch (aEvent) {
- case nsIAccessibleEvent::EVENT_FOCUS:
- [nativeAcc didReceiveFocus];
- break;
- case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
- [nativeAcc valueDidChange];
- break;
- }
-
- return NS_OK;
-}
-
--- a/accessible/src/msaa/CAccessibleAction.cpp
+++ b/accessible/src/msaa/CAccessibleAction.cpp
@@ -51,18 +51,18 @@
// IUnknown
STDMETHODIMP
CAccessibleAction::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleAction == iid) {
- *ppv = NS_STATIC_CAST(IAccessibleAction*, this);
- (NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
+ *ppv = static_cast<IAccessibleAction*>(this);
+ (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
// IAccessibleAction
@@ -84,33 +84,33 @@ CAccessibleAction::nActions(long *aNumAc
STDMETHODIMP
CAccessibleAction::doAction(long aActionIndex)
{
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
if (!acc)
return E_FAIL;
- PRUint8 index = NS_STATIC_CAST(PRUint8, aActionIndex);
+ PRUint8 index = static_cast<PRUint8>(aActionIndex);
if (NS_SUCCEEDED(acc->DoAction(index)))
return S_OK;
return E_FAIL;
}
STDMETHODIMP
CAccessibleAction::get_description(long aActionIndex, BSTR *aDescription)
{
*aDescription = NULL;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
if (!acc)
return E_FAIL;
nsAutoString description;
- PRUint8 index = NS_STATIC_CAST(PRUint8, aActionIndex);
+ PRUint8 index = static_cast<PRUint8>(aActionIndex);
if (NS_FAILED(acc->GetActionDescription(index, description)))
return E_FAIL;
if (!description.IsVoid()) {
return ::SysReAllocStringLen(aDescription, description.get(),
description.Length());
}
@@ -125,27 +125,27 @@ CAccessibleAction::get_keyBinding(long a
*aKeyBinding = NULL;
aNumBinding = 0;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
if (!acc)
return E_FAIL;
nsCOMPtr<nsIDOMDOMStringList> keys;
- PRUint8 index = NS_STATIC_CAST(PRUint8, aActionIndex);
+ PRUint8 index = static_cast<PRUint8>(aActionIndex);
nsresult rv = acc->GetKeyBindings(index, getter_AddRefs(keys));
if (NS_FAILED(rv))
return E_FAIL;
PRUint32 length = 0;
keys->GetLength(&length);
- PRBool aUseNumMaxBinding = length > NS_STATIC_CAST(PRUint32, aNumMaxBinding);
+ PRBool aUseNumMaxBinding = length > static_cast<PRUint32>(aNumMaxBinding);
- PRUint32 maxBinding = NS_STATIC_CAST(PRUint32, aNumMaxBinding);
+ PRUint32 maxBinding = static_cast<PRUint32>(aNumMaxBinding);
PRUint32 numBinding = length > maxBinding ? maxBinding : length;
*aNumBinding = numBinding;
*aKeyBinding = new BSTR[numBinding];
if (!*aKeyBinding)
return E_OUTOFMEMORY;
@@ -166,17 +166,17 @@ CAccessibleAction::get_name(long aAction
{
*aName = NULL;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
if (!acc)
return E_FAIL;
nsAutoString name;
- PRUint8 index = NS_STATIC_CAST(PRUint8, aActionIndex);
+ PRUint8 index = static_cast<PRUint8>(aActionIndex);
if (NS_FAILED(acc->GetActionName(index, name)))
return E_FAIL;
if (!name.IsVoid())
return ::SysReAllocStringLen(aName, name.get(), name.Length());
return S_OK;
}
--- a/accessible/src/msaa/CAccessibleComponent.cpp
+++ b/accessible/src/msaa/CAccessibleComponent.cpp
@@ -62,18 +62,18 @@ enum {
// IUnknown
STDMETHODIMP
CAccessibleComponent::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleComponent == iid) {
- *ppv = NS_STATIC_CAST(IAccessibleComponent*, this);
- (NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
+ *ppv = static_cast<IAccessibleComponent*>(this);
+ (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
// IAccessibleComponent
--- a/accessible/src/msaa/CAccessibleEditableText.cpp
+++ b/accessible/src/msaa/CAccessibleEditableText.cpp
@@ -59,18 +59,18 @@ STDMETHODIMP
CAccessibleEditableText::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleEditableText == iid) {
nsCOMPtr<nsIAccessibleEditableText> editTextAcc(do_QueryInterface(this));
if (!editTextAcc)
return E_NOINTERFACE;
- *ppv = NS_STATIC_CAST(IAccessibleEditableText*, this);
- (NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
+ *ppv = static_cast<IAccessibleEditableText*>(this);
+ (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
// IAccessibleEditableText
--- a/accessible/src/msaa/CAccessibleHyperlink.cpp
+++ b/accessible/src/msaa/CAccessibleHyperlink.cpp
@@ -60,18 +60,18 @@ CAccessibleHyperlink::QueryInterface(REF
{
*ppv = NULL;
if (IID_IAccessibleHyperlink == iid) {
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
if (!acc)
return E_NOINTERFACE;
- *ppv = NS_STATIC_CAST(IAccessibleHyperlink*, this);
- (NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
+ *ppv = static_cast<IAccessibleHyperlink*>(this);
+ (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return CAccessibleAction::QueryInterface(iid, ppv);
}
// IAccessibleHyperlink
@@ -94,17 +94,17 @@ CAccessibleHyperlink::get_anchor(long aI
return E_FAIL;
void *instancePtr = NULL;
nsresult rv = winAccessNode->QueryNativeInterface(IID_IUnknown,
&instancePtr);
if (NS_FAILED(rv))
return E_FAIL;
- IUnknown *unknownPtr = NS_STATIC_CAST(IUnknown*, instancePtr);
+ IUnknown *unknownPtr = static_cast<IUnknown*>(instancePtr);
aAnchor->ppunkVal = &unknownPtr;
aAnchor->vt = VT_UNKNOWN;
return S_OK;
}
STDMETHODIMP
CAccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT *aAnchorTarget)
--- a/accessible/src/msaa/CAccessibleHypertext.cpp
+++ b/accessible/src/msaa/CAccessibleHypertext.cpp
@@ -54,18 +54,18 @@ CAccessibleHypertext::QueryInterface(REF
{
*ppv = NULL;
if (IID_IAccessibleHypertext == iid) {
nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryInterface(this));
if (!hyperAcc)
return E_NOINTERFACE;
- *ppv = NS_STATIC_CAST(IAccessibleHypertext*, this);
- (NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
+ *ppv = static_cast<IAccessibleHypertext*>(this);
+ (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return CAccessibleText::QueryInterface(iid, ppv);
}
// IAccessibleHypertext
@@ -102,17 +102,17 @@ CAccessibleHypertext::get_hyperlink(long
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryInterface(hyperLink));
if (!winAccessNode)
return E_FAIL;
void *instancePtr = NULL;
nsresult rv = winAccessNode->QueryNativeInterface(IID_IAccessibleHyperlink,
&instancePtr);
- *aHyperlink = NS_STATIC_CAST(IAccessibleHyperlink*, instancePtr);
+ *aHyperlink = static_cast<IAccessibleHyperlink*>(instancePtr);
return NS_FAILED(rv) ? E_FAIL : S_OK;
}
STDMETHODIMP
CAccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long *aHyperlinkIndex)
{
*aHyperlinkIndex = 0;
--- a/accessible/src/msaa/CAccessibleImage.cpp
+++ b/accessible/src/msaa/CAccessibleImage.cpp
@@ -55,18 +55,18 @@ CAccessibleImage::QueryInterface(REFIID
{
*ppv = NULL;
if (IID_IAccessibleImage == iid) {
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryInterface(this));
if (!imageAcc)
return E_FAIL;
- *ppv = NS_STATIC_CAST(IAccessibleImage*, this);
- (NS_REINTERPRET_CAST(IUnknown*, *ppv))->AddRef();
+ *ppv = static_cast<IAccessibleImage*>(this);
+ (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;