summaryrefslogtreecommitdiffstats
path: root/accessible/ipc/other
diff options
context:
space:
mode:
Diffstat (limited to 'accessible/ipc/other')
-rw-r--r--accessible/ipc/other/DocAccessibleChild.cpp1998
-rw-r--r--accessible/ipc/other/DocAccessibleChild.h489
-rw-r--r--accessible/ipc/other/PDocAccessible.ipdl264
-rw-r--r--accessible/ipc/other/ProxyAccessible.cpp1080
-rw-r--r--accessible/ipc/other/ProxyAccessible.h50
-rw-r--r--accessible/ipc/other/moz.build47
6 files changed, 3928 insertions, 0 deletions
diff --git a/accessible/ipc/other/DocAccessibleChild.cpp b/accessible/ipc/other/DocAccessibleChild.cpp
new file mode 100644
index 000000000..045b78939
--- /dev/null
+++ b/accessible/ipc/other/DocAccessibleChild.cpp
@@ -0,0 +1,1998 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "DocAccessibleChild.h"
+
+#include "Accessible-inl.h"
+#include "ProxyAccessible.h"
+#include "Relation.h"
+#include "HyperTextAccessible-inl.h"
+#include "TextLeafAccessible.h"
+#include "ImageAccessible.h"
+#include "TableAccessible.h"
+#include "TableCellAccessible.h"
+#include "nsIPersistentProperties2.h"
+#include "nsISimpleEnumerator.h"
+#include "nsAccUtils.h"
+#ifdef MOZ_ACCESSIBILITY_ATK
+#include "AccessibleWrap.h"
+#endif
+
+namespace mozilla {
+namespace a11y {
+
+Accessible*
+DocAccessibleChild::IdToAccessible(const uint64_t& aID) const
+{
+ if (!aID)
+ return mDoc;
+
+ if (!mDoc)
+ return nullptr;
+
+ return mDoc->GetAccessibleByUniqueID(reinterpret_cast<void*>(aID));
+}
+
+Accessible*
+DocAccessibleChild::IdToAccessibleLink(const uint64_t& aID) const
+{
+ Accessible* acc = IdToAccessible(aID);
+ return acc && acc->IsLink() ? acc : nullptr;
+}
+
+Accessible*
+DocAccessibleChild::IdToAccessibleSelect(const uint64_t& aID) const
+{
+ Accessible* acc = IdToAccessible(aID);
+ return acc && acc->IsSelect() ? acc : nullptr;
+}
+
+HyperTextAccessible*
+DocAccessibleChild::IdToHyperTextAccessible(const uint64_t& aID) const
+{
+ Accessible* acc = IdToAccessible(aID);
+ return acc && acc->IsHyperText() ? acc->AsHyperText() : nullptr;
+}
+
+TextLeafAccessible*
+DocAccessibleChild::IdToTextLeafAccessible(const uint64_t& aID) const
+{
+ Accessible* acc = IdToAccessible(aID);
+ return acc && acc->IsTextLeaf() ? acc->AsTextLeaf() : nullptr;
+}
+
+ImageAccessible*
+DocAccessibleChild::IdToImageAccessible(const uint64_t& aID) const
+{
+ Accessible* acc = IdToAccessible(aID);
+ return (acc && acc->IsImage()) ? acc->AsImage() : nullptr;
+}
+
+TableCellAccessible*
+DocAccessibleChild::IdToTableCellAccessible(const uint64_t& aID) const
+{
+ Accessible* acc = IdToAccessible(aID);
+ return (acc && acc->IsTableCell()) ? acc->AsTableCell() : nullptr;
+}
+
+TableAccessible*
+DocAccessibleChild::IdToTableAccessible(const uint64_t& aID) const
+{
+ Accessible* acc = IdToAccessible(aID);
+ return (acc && acc->IsTable()) ? acc->AsTable() : nullptr;
+}
+
+bool
+DocAccessibleChild::RecvState(const uint64_t& aID, uint64_t* aState)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ *aState = states::DEFUNCT;
+ return true;
+ }
+
+ *aState = acc->State();
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvNativeState(const uint64_t& aID, uint64_t* aState)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ *aState = states::DEFUNCT;
+ return true;
+ }
+
+ *aState = acc->NativeState();
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvName(const uint64_t& aID, nsString* aName)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc)
+ return true;
+
+ acc->Name(*aName);
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvValue(const uint64_t& aID, nsString* aValue)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return true;
+ }
+
+ acc->Value(*aValue);
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvHelp(const uint64_t& aID, nsString* aHelp)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return true;
+ }
+
+ acc->Help(*aHelp);
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvDescription(const uint64_t& aID, nsString* aDesc)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc)
+ return true;
+
+ acc->Description(*aDesc);
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAttributes(const uint64_t& aID, nsTArray<Attribute>* aAttributes)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc)
+ return true;
+
+ nsCOMPtr<nsIPersistentProperties> props = acc->Attributes();
+ return PersistentPropertiesToArray(props, aAttributes);
+}
+
+bool
+DocAccessibleChild::PersistentPropertiesToArray(nsIPersistentProperties* aProps,
+ nsTArray<Attribute>* aAttributes)
+{
+ if (!aProps) {
+ return true;
+ }
+ nsCOMPtr<nsISimpleEnumerator> propEnum;
+ nsresult rv = aProps->Enumerate(getter_AddRefs(propEnum));
+ NS_ENSURE_SUCCESS(rv, false);
+
+ bool hasMore;
+ while (NS_SUCCEEDED(propEnum->HasMoreElements(&hasMore)) && hasMore) {
+ nsCOMPtr<nsISupports> sup;
+ rv = propEnum->GetNext(getter_AddRefs(sup));
+ NS_ENSURE_SUCCESS(rv, false);
+
+ nsCOMPtr<nsIPropertyElement> propElem(do_QueryInterface(sup));
+ NS_ENSURE_TRUE(propElem, false);
+
+ nsAutoCString name;
+ rv = propElem->GetKey(name);
+ NS_ENSURE_SUCCESS(rv, false);
+
+ nsAutoString value;
+ rv = propElem->GetValue(value);
+ NS_ENSURE_SUCCESS(rv, false);
+
+ aAttributes->AppendElement(Attribute(name, value));
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvRelationByType(const uint64_t& aID,
+ const uint32_t& aType,
+ nsTArray<uint64_t>* aTargets)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc)
+ return true;
+
+ auto type = static_cast<RelationType>(aType);
+ Relation rel = acc->RelationByType(type);
+ while (Accessible* target = rel.Next())
+ aTargets->AppendElement(reinterpret_cast<uintptr_t>(target));
+
+ return true;
+}
+
+static void
+AddRelation(Accessible* aAcc, RelationType aType,
+ nsTArray<RelationTargets>* aTargets)
+{
+ Relation rel = aAcc->RelationByType(aType);
+ nsTArray<uint64_t> targets;
+ while (Accessible* target = rel.Next())
+ targets.AppendElement(reinterpret_cast<uintptr_t>(target));
+
+ if (!targets.IsEmpty()) {
+ RelationTargets* newRelation =
+ aTargets->AppendElement(RelationTargets(static_cast<uint32_t>(aType),
+ nsTArray<uint64_t>()));
+ newRelation->Targets().SwapElements(targets);
+ }
+}
+
+bool
+DocAccessibleChild::RecvRelations(const uint64_t& aID,
+ nsTArray<RelationTargets>* aRelations)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc)
+ return true;
+
+#define RELATIONTYPE(gecko, s, a, m, i) AddRelation(acc, RelationType::gecko, aRelations);
+
+#include "RelationTypeMap.h"
+#undef RELATIONTYPE
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvIsSearchbox(const uint64_t& aID, bool* aRetVal)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc)
+ return true;
+
+ *aRetVal = acc->IsSearchbox();
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvLandmarkRole(const uint64_t& aID, nsString* aLandmark)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return true;
+ }
+
+ if (nsIAtom* roleAtom = acc->LandmarkRole()) {
+ roleAtom->ToString(*aLandmark);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvARIARoleAtom(const uint64_t& aID, nsString* aRole)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return true;
+ }
+
+ if (const nsRoleMapEntry* roleMap = acc->ARIARoleMap()) {
+ if (nsIAtom* roleAtom = *(roleMap->roleAtom)) {
+ roleAtom->ToString(*aRole);
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvGetLevelInternal(const uint64_t& aID, int32_t* aLevel)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aLevel = acc->GetLevelInternal();
+ }
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvScrollTo(const uint64_t& aID,
+ const uint32_t& aScrollType)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
+ aScrollType);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvScrollToPoint(const uint64_t& aID, const uint32_t& aScrollType, const int32_t& aX, const int32_t& aY)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->ScrollToPoint(aScrollType, aX, aY);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvCaretLineNumber(const uint64_t& aID, int32_t* aLineNumber)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aLineNumber = acc && acc->IsTextRole() ? acc->CaretLineNumber() : 0;
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvCaretOffset(const uint64_t& aID, int32_t* aOffset)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aOffset = acc && acc->IsTextRole() ? acc->CaretOffset() : 0;
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvSetCaretOffset(const uint64_t& aID,
+ const int32_t& aOffset)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole() && acc->IsValidOffset(aOffset)) {
+ acc->SetCaretOffset(aOffset);
+ }
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvCharacterCount(const uint64_t& aID, int32_t* aCount)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aCount = acc ? acc->CharacterCount() : 0;
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvSelectionCount(const uint64_t& aID, int32_t* aCount)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aCount = acc ? acc->SelectionCount() : 0;
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTextSubstring(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ nsString* aText, bool* aValid)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (!acc) {
+ return true;
+ }
+
+ *aValid = acc->IsValidRange(aStartOffset, aEndOffset);
+ acc->TextSubstring(aStartOffset, aEndOffset, *aText);
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvGetTextAfterOffset(const uint64_t& aID,
+ const int32_t& aOffset,
+ const int32_t& aBoundaryType,
+ nsString* aText,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ *aStartOffset = 0;
+ *aEndOffset = 0;
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc) {
+ acc->TextAfterOffset(aOffset, aBoundaryType,
+ aStartOffset, aEndOffset, *aText);
+ }
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvGetTextAtOffset(const uint64_t& aID,
+ const int32_t& aOffset,
+ const int32_t& aBoundaryType,
+ nsString* aText,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ *aStartOffset = 0;
+ *aEndOffset = 0;
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc) {
+ acc->TextAtOffset(aOffset, aBoundaryType,
+ aStartOffset, aEndOffset, *aText);
+ }
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvGetTextBeforeOffset(const uint64_t& aID,
+ const int32_t& aOffset,
+ const int32_t& aBoundaryType,
+ nsString* aText,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ *aStartOffset = 0;
+ *aEndOffset = 0;
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc) {
+ acc->TextBeforeOffset(aOffset, aBoundaryType,
+ aStartOffset, aEndOffset, *aText);
+ }
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvCharAt(const uint64_t& aID,
+ const int32_t& aOffset,
+ uint16_t* aChar)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aChar = acc && acc->IsTextRole() ?
+ static_cast<uint16_t>(acc->CharAt(aOffset)) : 0;
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTextAttributes(const uint64_t& aID,
+ const bool& aIncludeDefAttrs,
+ const int32_t& aOffset,
+ nsTArray<Attribute>* aAttributes,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (!acc || !acc->IsTextRole()) {
+ return true;
+ }
+
+ nsCOMPtr<nsIPersistentProperties> props =
+ acc->TextAttributes(aIncludeDefAttrs, aOffset, aStartOffset, aEndOffset);
+ return PersistentPropertiesToArray(props, aAttributes);
+}
+
+bool
+DocAccessibleChild::RecvDefaultTextAttributes(const uint64_t& aID,
+ nsTArray<Attribute> *aAttributes)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (!acc || !acc->IsTextRole()) {
+ return true;
+ }
+
+ nsCOMPtr<nsIPersistentProperties> props = acc->DefaultTextAttributes();
+ return PersistentPropertiesToArray(props, aAttributes);
+}
+
+bool
+DocAccessibleChild::RecvTextBounds(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ const uint32_t& aCoordType,
+ nsIntRect* aRetVal)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aRetVal = acc->TextBounds(aStartOffset, aEndOffset, aCoordType);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvCharBounds(const uint64_t& aID,
+ const int32_t& aOffset,
+ const uint32_t& aCoordType,
+ nsIntRect* aRetVal)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aRetVal = acc->CharBounds(aOffset, aCoordType);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvOffsetAtPoint(const uint64_t& aID,
+ const int32_t& aX,
+ const int32_t& aY,
+ const uint32_t& aCoordType,
+ int32_t* aRetVal)
+{
+ *aRetVal = -1;
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aRetVal = acc->OffsetAtPoint(aX, aY, aCoordType);
+ }
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvSelectionBoundsAt(const uint64_t& aID,
+ const int32_t& aSelectionNum,
+ bool* aSucceeded,
+ nsString* aData,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ *aSucceeded = false;
+ *aStartOffset = 0;
+ *aEndOffset = 0;
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aSucceeded =
+ acc->SelectionBoundsAt(aSelectionNum, aStartOffset, aEndOffset);
+ if (*aSucceeded) {
+ acc->TextSubstring(*aStartOffset, *aEndOffset, *aData);
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvSetSelectionBoundsAt(const uint64_t& aID,
+ const int32_t& aSelectionNum,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ bool* aSucceeded)
+{
+ *aSucceeded = false;
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aSucceeded =
+ acc->SetSelectionBoundsAt(aSelectionNum, aStartOffset, aEndOffset);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAddToSelection(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ bool* aSucceeded)
+{
+ *aSucceeded = false;
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aSucceeded = acc->AddToSelection(aStartOffset, aEndOffset);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvRemoveFromSelection(const uint64_t& aID,
+ const int32_t& aSelectionNum,
+ bool* aSucceeded)
+{
+ *aSucceeded = false;
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aSucceeded = acc->RemoveFromSelection(aSelectionNum);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvScrollSubstringTo(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ const uint32_t& aScrollType)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc) {
+ acc->ScrollSubstringTo(aStartOffset, aEndOffset, aScrollType);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvScrollSubstringToPoint(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ const uint32_t& aCoordinateType,
+ const int32_t& aX,
+ const int32_t& aY)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc) {
+ acc->ScrollSubstringToPoint(aStartOffset, aEndOffset, aCoordinateType,
+ aX, aY);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvText(const uint64_t& aID,
+ nsString* aText)
+{
+ TextLeafAccessible* acc = IdToTextLeafAccessible(aID);
+ if (acc) {
+ *aText = acc->Text();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvReplaceText(const uint64_t& aID,
+ const nsString& aText)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ acc->ReplaceText(aText);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvInsertText(const uint64_t& aID,
+ const nsString& aText,
+ const int32_t& aPosition, bool* aValid)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aValid = acc->IsValidOffset(aPosition);
+ acc->InsertText(aText, aPosition);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvCopyText(const uint64_t& aID,
+ const int32_t& aStartPos,
+ const int32_t& aEndPos, bool* aValid)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ acc->CopyText(aStartPos, aEndPos);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvCutText(const uint64_t& aID,
+ const int32_t& aStartPos,
+ const int32_t& aEndPos, bool* aValid)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aValid = acc->IsValidRange(aStartPos, aEndPos);
+ acc->CutText(aStartPos, aEndPos);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvDeleteText(const uint64_t& aID,
+ const int32_t& aStartPos,
+ const int32_t& aEndPos, bool* aValid)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aValid = acc->IsValidRange(aStartPos, aEndPos);
+ acc->DeleteText(aStartPos, aEndPos);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvPasteText(const uint64_t& aID,
+ const int32_t& aPosition, bool* aValid)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aValid = acc->IsValidOffset(aPosition);
+ acc->PasteText(aPosition);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvImagePosition(const uint64_t& aID,
+ const uint32_t& aCoordType,
+ nsIntPoint* aRetVal)
+{
+ ImageAccessible* acc = IdToImageAccessible(aID);
+ if (acc) {
+ *aRetVal = acc->Position(aCoordType);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvImageSize(const uint64_t& aID,
+ nsIntSize* aRetVal)
+{
+
+ ImageAccessible* acc = IdToImageAccessible(aID);
+ if (acc) {
+ *aRetVal = acc->Size();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvStartOffset(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk)
+{
+ Accessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ *aRetVal = acc->StartOffset();
+ *aOk = true;
+ } else {
+ *aRetVal = 0;
+ *aOk = false;
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvEndOffset(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk)
+{
+ Accessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ *aRetVal = acc->EndOffset();
+ *aOk = true;
+ } else {
+ *aRetVal = 0;
+ *aOk = false;
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvIsLinkValid(const uint64_t& aID,
+ bool* aRetVal)
+{
+ Accessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ *aRetVal = acc->IsLinkValid();
+ } else {
+ *aRetVal = false;
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAnchorCount(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk)
+{
+ Accessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ *aRetVal = acc->AnchorCount();
+ *aOk = true;
+ } else {
+ *aRetVal = 0;
+ *aOk = false;
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAnchorURIAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ nsCString* aURI,
+ bool* aOk)
+{
+ Accessible* acc = IdToAccessibleLink(aID);
+ *aOk = false;
+ if (acc) {
+ nsCOMPtr<nsIURI> uri = acc->AnchorURIAt(aIndex);
+ if (uri) {
+ uri->GetSpec(*aURI);
+ *aOk = true;
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAnchorAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aIDOfAnchor,
+ bool* aOk)
+{
+ *aIDOfAnchor = 0;
+ *aOk = false;
+ Accessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ Accessible* anchor = acc->AnchorAt(aIndex);
+ if (anchor) {
+ *aIDOfAnchor = reinterpret_cast<uint64_t>(anchor->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvLinkCount(const uint64_t& aID,
+ uint32_t* aCount)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aCount = acc ? acc->LinkCount() : 0;
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvLinkAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aIDOfLink,
+ bool* aOk)
+{
+ *aIDOfLink = 0;
+ *aOk = false;
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc) {
+ Accessible* link = acc->LinkAt(aIndex);
+ if (link) {
+ *aIDOfLink = reinterpret_cast<uint64_t>(link->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvLinkIndexOf(const uint64_t& aID,
+ const uint64_t& aLinkID,
+ int32_t* aIndex)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ Accessible* link = IdToAccessible(aLinkID);
+ *aIndex = -1;
+ if (acc && link) {
+ *aIndex = acc->LinkIndexOf(link);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvLinkIndexAtOffset(const uint64_t& aID,
+ const uint32_t& aOffset,
+ int32_t* aIndex)
+{
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aIndex = acc ? acc->LinkIndexAtOffset(aOffset) : -1;
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableOfACell(const uint64_t& aID,
+ uint64_t* aTableID,
+ bool* aOk)
+{
+ *aTableID = 0;
+ *aOk = false;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ TableAccessible* table = acc->Table();
+ if (table) {
+ *aTableID = reinterpret_cast<uint64_t>(table->AsAccessible()->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvColIdx(const uint64_t& aID,
+ uint32_t* aIndex)
+{
+ *aIndex = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aIndex = acc->ColIdx();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvRowIdx(const uint64_t& aID,
+ uint32_t* aIndex)
+{
+ *aIndex = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aIndex = acc->RowIdx();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvGetPosition(const uint64_t& aID,
+ uint32_t* aColIdx, uint32_t* aRowIdx)
+{
+ *aColIdx = 0;
+ *aRowIdx = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aColIdx = acc->ColIdx();
+ *aRowIdx = acc->RowIdx();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvGetColRowExtents(const uint64_t& aID,
+ uint32_t* aColIdx, uint32_t* aRowIdx,
+ uint32_t* aColExtent, uint32_t* aRowExtent)
+{
+ *aColIdx = 0;
+ *aRowIdx = 0;
+ *aColExtent = 0;
+ *aRowExtent = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aColIdx = acc->ColIdx();
+ *aRowIdx = acc->RowIdx();
+ *aColExtent = acc->ColExtent();
+ *aRowExtent = acc->RowExtent();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvColExtent(const uint64_t& aID,
+ uint32_t* aExtent)
+{
+ *aExtent = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aExtent = acc->ColExtent();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvRowExtent(const uint64_t& aID,
+ uint32_t* aExtent)
+{
+ *aExtent = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aExtent = acc->RowExtent();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvColHeaderCells(const uint64_t& aID,
+ nsTArray<uint64_t>* aCells)
+{
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ AutoTArray<Accessible*, 10> headerCells;
+ acc->ColHeaderCells(&headerCells);
+ aCells->SetCapacity(headerCells.Length());
+ for (uint32_t i = 0; i < headerCells.Length(); ++i) {
+ aCells->AppendElement(
+ reinterpret_cast<uint64_t>(headerCells[i]->UniqueID()));
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvRowHeaderCells(const uint64_t& aID,
+ nsTArray<uint64_t>* aCells)
+{
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ AutoTArray<Accessible*, 10> headerCells;
+ acc->RowHeaderCells(&headerCells);
+ aCells->SetCapacity(headerCells.Length());
+ for (uint32_t i = 0; i < headerCells.Length(); ++i) {
+ aCells->AppendElement(
+ reinterpret_cast<uint64_t>(headerCells[i]->UniqueID()));
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvIsCellSelected(const uint64_t& aID,
+ bool* aSelected)
+{
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ *aSelected = acc && acc->Selected();
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableCaption(const uint64_t& aID,
+ uint64_t* aCaptionID,
+ bool* aOk)
+{
+ *aCaptionID = 0;
+ *aOk = false;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ Accessible* caption = acc->Caption();
+ if (caption) {
+ *aCaptionID = reinterpret_cast<uint64_t>(caption->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSummary(const uint64_t& aID,
+ nsString* aSummary)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->Summary(*aSummary);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableColumnCount(const uint64_t& aID,
+ uint32_t* aColCount)
+{
+ *aColCount = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aColCount = acc->ColCount();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableRowCount(const uint64_t& aID,
+ uint32_t* aRowCount)
+{
+ *aRowCount = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aRowCount = acc->RowCount();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableCellAt(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ uint64_t* aCellID,
+ bool* aOk)
+{
+ *aCellID = 0;
+ *aOk = false;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ Accessible* cell = acc->CellAt(aRow, aCol);
+ if (cell) {
+ *aCellID = reinterpret_cast<uint64_t>(cell->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableCellIndexAt(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ int32_t* aIndex)
+{
+ *aIndex = -1;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aIndex = acc->CellIndexAt(aRow, aCol);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableColumnIndexAt(const uint64_t& aID,
+ const uint32_t& aCellIndex,
+ int32_t* aCol)
+{
+ *aCol = -1;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aCol = acc->ColIndexAt(aCellIndex);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableRowIndexAt(const uint64_t& aID,
+ const uint32_t& aCellIndex,
+ int32_t* aRow)
+{
+ *aRow = -1;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aRow = acc->RowIndexAt(aCellIndex);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableRowAndColumnIndicesAt(const uint64_t& aID,
+ const uint32_t& aCellIndex,
+ int32_t* aRow,
+ int32_t* aCol)
+{
+ *aRow = -1;
+ *aCol = -1;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->RowAndColIndicesAt(aCellIndex, aRow, aCol);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableColumnExtentAt(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ uint32_t* aExtent)
+{
+ *aExtent = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aExtent = acc->ColExtentAt(aRow, aCol);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableRowExtentAt(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ uint32_t* aExtent)
+{
+ *aExtent = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aExtent = acc->RowExtentAt(aRow, aCol);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableColumnDescription(const uint64_t& aID,
+ const uint32_t& aCol,
+ nsString* aDescription)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->ColDescription(aCol, *aDescription);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableRowDescription(const uint64_t& aID,
+ const uint32_t& aRow,
+ nsString* aDescription)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->RowDescription(aRow, *aDescription);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableColumnSelected(const uint64_t& aID,
+ const uint32_t& aCol,
+ bool* aSelected)
+{
+ *aSelected = false;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aSelected = acc->IsColSelected(aCol);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableRowSelected(const uint64_t& aID,
+ const uint32_t& aRow,
+ bool* aSelected)
+{
+ *aSelected = false;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aSelected = acc->IsRowSelected(aRow);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableCellSelected(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ bool* aSelected)
+{
+ *aSelected = false;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aSelected = acc->IsCellSelected(aRow, aCol);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSelectedCellCount(const uint64_t& aID,
+ uint32_t* aSelectedCells)
+{
+ *aSelectedCells = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aSelectedCells = acc->SelectedCellCount();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSelectedColumnCount(const uint64_t& aID,
+ uint32_t* aSelectedColumns)
+{
+ *aSelectedColumns = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aSelectedColumns = acc->SelectedColCount();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSelectedRowCount(const uint64_t& aID,
+ uint32_t* aSelectedRows)
+{
+ *aSelectedRows = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aSelectedRows = acc->SelectedRowCount();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSelectedCells(const uint64_t& aID,
+ nsTArray<uint64_t>* aCellIDs)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ AutoTArray<Accessible*, 30> cells;
+ acc->SelectedCells(&cells);
+ aCellIDs->SetCapacity(cells.Length());
+ for (uint32_t i = 0; i < cells.Length(); ++i) {
+ aCellIDs->AppendElement(
+ reinterpret_cast<uint64_t>(cells[i]->UniqueID()));
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSelectedCellIndices(const uint64_t& aID,
+ nsTArray<uint32_t>* aCellIndices)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectedCellIndices(aCellIndices);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSelectedColumnIndices(const uint64_t& aID,
+ nsTArray<uint32_t>* aColumnIndices)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectedColIndices(aColumnIndices);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSelectedRowIndices(const uint64_t& aID,
+ nsTArray<uint32_t>* aRowIndices)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectedRowIndices(aRowIndices);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSelectColumn(const uint64_t& aID,
+ const uint32_t& aCol)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectCol(aCol);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableSelectRow(const uint64_t& aID,
+ const uint32_t& aRow)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectRow(aRow);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableUnselectColumn(const uint64_t& aID,
+ const uint32_t& aCol)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->UnselectCol(aCol);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableUnselectRow(const uint64_t& aID,
+ const uint32_t& aRow)
+{
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->UnselectRow(aRow);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTableIsProbablyForLayout(const uint64_t& aID,
+ bool* aForLayout)
+{
+ *aForLayout = false;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aForLayout = acc->IsProbablyLayoutTable();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAtkTableColumnHeader(const uint64_t& aID,
+ const int32_t& aCol,
+ uint64_t* aHeader,
+ bool* aOk)
+{
+ *aHeader = 0;
+ *aOk = false;
+
+#ifdef MOZ_ACCESSIBILITY_ATK
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ Accessible* header = AccessibleWrap::GetColumnHeader(acc, aCol);
+ if (header) {
+ *aHeader = reinterpret_cast<uint64_t>(header->UniqueID());
+ *aOk = true;
+ }
+ }
+#endif
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAtkTableRowHeader(const uint64_t& aID,
+ const int32_t& aRow,
+ uint64_t* aHeader,
+ bool* aOk)
+{
+ *aHeader = 0;
+ *aOk = false;
+
+#ifdef MOZ_ACCESSIBILITY_ATK
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ Accessible* header = AccessibleWrap::GetRowHeader(acc, aRow);
+ if (header) {
+ *aHeader = reinterpret_cast<uint64_t>(header->UniqueID());
+ *aOk = true;
+ }
+ }
+#endif
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvSelectedItems(const uint64_t& aID,
+ nsTArray<uint64_t>* aSelectedItemIDs)
+{
+ Accessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ AutoTArray<Accessible*, 10> selectedItems;
+ acc->SelectedItems(&selectedItems);
+ aSelectedItemIDs->SetCapacity(selectedItems.Length());
+ for (size_t i = 0; i < selectedItems.Length(); ++i) {
+ aSelectedItemIDs->AppendElement(
+ reinterpret_cast<uint64_t>(selectedItems[i]->UniqueID()));
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvSelectedItemCount(const uint64_t& aID,
+ uint32_t* aCount)
+{
+ *aCount = 0;
+ Accessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aCount = acc->SelectedItemCount();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvGetSelectedItem(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aSelected,
+ bool* aOk)
+{
+ *aSelected = 0;
+ *aOk = false;
+ Accessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ Accessible* item = acc->GetSelectedItem(aIndex);
+ if (item) {
+ *aSelected = reinterpret_cast<uint64_t>(item->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvIsItemSelected(const uint64_t& aID,
+ const uint32_t& aIndex,
+ bool* aSelected)
+{
+ *aSelected = false;
+ Accessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSelected = acc->IsItemSelected(aIndex);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAddItemToSelection(const uint64_t& aID,
+ const uint32_t& aIndex,
+ bool* aSuccess)
+{
+ *aSuccess = false;
+ Accessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSuccess = acc->AddItemToSelection(aIndex);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvRemoveItemFromSelection(const uint64_t& aID,
+ const uint32_t& aIndex,
+ bool* aSuccess)
+{
+ *aSuccess = false;
+ Accessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSuccess = acc->RemoveItemFromSelection(aIndex);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvSelectAll(const uint64_t& aID,
+ bool* aSuccess)
+{
+ *aSuccess = false;
+ Accessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSuccess = acc->SelectAll();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvUnselectAll(const uint64_t& aID,
+ bool* aSuccess)
+{
+ *aSuccess = false;
+ Accessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSuccess = acc->UnselectAll();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTakeSelection(const uint64_t& aID)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->TakeSelection();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvSetSelected(const uint64_t& aID, const bool& aSelect)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->SetSelected(aSelect);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvDoAction(const uint64_t& aID,
+ const uint8_t& aIndex,
+ bool* aSuccess)
+{
+ *aSuccess = false;
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aSuccess = acc->DoAction(aIndex);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvActionCount(const uint64_t& aID,
+ uint8_t* aCount)
+{
+ *aCount = 0;
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aCount = acc->ActionCount();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvActionDescriptionAt(const uint64_t& aID,
+ const uint8_t& aIndex,
+ nsString* aDescription)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->ActionDescriptionAt(aIndex, *aDescription);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvActionNameAt(const uint64_t& aID,
+ const uint8_t& aIndex,
+ nsString* aName)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->ActionNameAt(aIndex, *aName);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAccessKey(const uint64_t& aID,
+ uint32_t* aKey,
+ uint32_t* aModifierMask)
+{
+ *aKey = 0;
+ *aModifierMask = 0;
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ KeyBinding kb = acc->AccessKey();
+ *aKey = kb.Key();
+ *aModifierMask = kb.ModifierMask();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvKeyboardShortcut(const uint64_t& aID,
+ uint32_t* aKey,
+ uint32_t* aModifierMask)
+{
+ *aKey = 0;
+ *aModifierMask = 0;
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ KeyBinding kb = acc->KeyboardShortcut();
+ *aKey = kb.Key();
+ *aModifierMask = kb.ModifierMask();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAtkKeyBinding(const uint64_t& aID,
+ nsString* aResult)
+{
+#ifdef MOZ_ACCESSIBILITY_ATK
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ AccessibleWrap::GetKeyBinding(acc, *aResult);
+ }
+#endif
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvCurValue(const uint64_t& aID,
+ double* aValue)
+{
+ *aValue = UnspecifiedNaN<double>();
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aValue = acc->CurValue();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvSetCurValue(const uint64_t& aID,
+ const double& aValue,
+ bool* aRetVal)
+{
+ *aRetVal = false;
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aRetVal = acc->SetCurValue(aValue);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvMinValue(const uint64_t& aID,
+ double* aValue)
+{
+ *aValue = UnspecifiedNaN<double>();
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aValue = acc->MinValue();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvMaxValue(const uint64_t& aID,
+ double* aValue)
+{
+ *aValue = UnspecifiedNaN<double>();
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aValue = acc->MaxValue();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvStep(const uint64_t& aID,
+ double* aStep)
+{
+ *aStep = UnspecifiedNaN<double>();
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aStep = acc->Step();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTakeFocus(const uint64_t& aID)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->TakeFocus();
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvFocusedChild(const uint64_t& aID,
+ uint64_t* aChild,
+ bool* aOk)
+{
+ *aChild = 0;
+ *aOk = false;
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ Accessible* child = acc->FocusedChild();
+ if (child) {
+ *aChild = reinterpret_cast<uint64_t>(child->UniqueID());
+ *aOk = true;
+ }
+ }
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvLanguage(const uint64_t& aID,
+ nsString* aLocale)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->Language(*aLocale);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvDocType(const uint64_t& aID,
+ nsString* aType)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc && acc->IsDoc()) {
+ acc->AsDoc()->DocType(*aType);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvTitle(const uint64_t& aID,
+ nsString* aTitle)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc) {
+ mozilla::ErrorResult rv;
+ acc->GetContent()->GetTextContent(*aTitle, rv);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvURL(const uint64_t& aID,
+ nsString* aURL)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc && acc->IsDoc()) {
+ acc->AsDoc()->URL(*aURL);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvMimeType(const uint64_t& aID,
+ nsString* aMime)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc && acc->IsDoc()) {
+ acc->AsDoc()->MimeType(*aMime);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvURLDocTypeMimeType(const uint64_t& aID,
+ nsString* aURL,
+ nsString* aDocType,
+ nsString* aMimeType)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (acc && acc->IsDoc()) {
+ DocAccessible* doc = acc->AsDoc();
+ doc->URL(*aURL);
+ doc->DocType(*aDocType);
+ doc->MimeType(*aMimeType);
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvAccessibleAtPoint(const uint64_t& aID,
+ const int32_t& aX,
+ const int32_t& aY,
+ const bool& aNeedsScreenCoords,
+ const uint32_t& aWhich,
+ uint64_t* aResult,
+ bool* aOk)
+{
+ *aResult = 0;
+ *aOk = false;
+ Accessible* acc = IdToAccessible(aID);
+ if (acc && !acc->IsDefunct() && !nsAccUtils::MustPrune(acc)) {
+ int32_t x = aX;
+ int32_t y = aY;
+ if (aNeedsScreenCoords) {
+ nsIntPoint winCoords =
+ nsCoreUtils::GetScreenCoordsForWindow(acc->GetNode());
+ x += winCoords.x;
+ y += winCoords.y;
+ }
+
+ Accessible* result =
+ acc->ChildAtPoint(x, y,
+ static_cast<Accessible::EWhichChildAtPoint>(aWhich));
+ if (result) {
+ *aResult = reinterpret_cast<uint64_t>(result->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvExtents(const uint64_t& aID,
+ const bool& aNeedsScreenCoords,
+ int32_t* aX,
+ int32_t* aY,
+ int32_t* aWidth,
+ int32_t* aHeight)
+{
+ *aX = 0;
+ *aY = 0;
+ *aWidth = 0;
+ *aHeight = 0;
+ Accessible* acc = IdToAccessible(aID);
+ if (acc && !acc->IsDefunct()) {
+ nsIntRect screenRect = acc->Bounds();
+ if (!screenRect.IsEmpty()) {
+ if (aNeedsScreenCoords) {
+ nsIntPoint winCoords =
+ nsCoreUtils::GetScreenCoordsForWindow(acc->GetNode());
+ screenRect.x -= winCoords.x;
+ screenRect.y -= winCoords.y;
+ }
+
+ *aX = screenRect.x;
+ *aY = screenRect.y;
+ *aWidth = screenRect.width;
+ *aHeight = screenRect.height;
+ }
+ }
+ return true;
+}
+
+bool
+DocAccessibleChild::RecvDOMNodeID(const uint64_t& aID, nsString* aDOMNodeID)
+{
+ Accessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return true;
+ }
+
+ nsIContent* content = acc->GetContent();
+ if (!content) {
+ return true;
+ }
+
+ nsIAtom* id = content->GetID();
+ if (id) {
+ id->ToString(*aDOMNodeID);
+ }
+
+ return true;
+}
+
+}
+}
diff --git a/accessible/ipc/other/DocAccessibleChild.h b/accessible/ipc/other/DocAccessibleChild.h
new file mode 100644
index 000000000..7c9d61da7
--- /dev/null
+++ b/accessible/ipc/other/DocAccessibleChild.h
@@ -0,0 +1,489 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_a11y_DocAccessibleChild_h
+#define mozilla_a11y_DocAccessibleChild_h
+
+#include "mozilla/a11y/DocAccessibleChildBase.h"
+
+namespace mozilla {
+namespace a11y {
+
+class Accessible;
+class HyperTextAccessible;
+class TextLeafAccessible;
+class ImageAccessible;
+class TableAccessible;
+class TableCellAccessible;
+
+/*
+ * These objects handle content side communication for an accessible document,
+ * and their lifetime is the same as the document they represent.
+ */
+class DocAccessibleChild : public DocAccessibleChildBase
+{
+public:
+ explicit DocAccessibleChild(DocAccessible* aDoc)
+ : DocAccessibleChildBase(aDoc)
+ {
+ MOZ_COUNT_CTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
+ }
+
+ ~DocAccessibleChild()
+ {
+ MOZ_COUNT_DTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
+ }
+
+ /*
+ * Return the state for the accessible with given ID.
+ */
+ virtual bool RecvState(const uint64_t& aID, uint64_t* aState) override;
+
+ /*
+ * Return the native state for the accessible with given ID.
+ */
+ virtual bool RecvNativeState(const uint64_t& aID, uint64_t* aState) override;
+
+ /*
+ * Get the name for the accessible with given id.
+ */
+ virtual bool RecvName(const uint64_t& aID, nsString* aName) override;
+
+ virtual bool RecvValue(const uint64_t& aID, nsString* aValue) override;
+
+ virtual bool RecvHelp(const uint64_t& aID, nsString* aHelp) override;
+
+ /*
+ * Get the description for the accessible with given id.
+ */
+ virtual bool RecvDescription(const uint64_t& aID, nsString* aDesc) override;
+ virtual bool RecvRelationByType(const uint64_t& aID, const uint32_t& aType,
+ nsTArray<uint64_t>* aTargets) override;
+ virtual bool RecvRelations(const uint64_t& aID,
+ nsTArray<RelationTargets>* aRelations)
+ override;
+
+ virtual bool RecvIsSearchbox(const uint64_t& aID, bool* aRetVal) override;
+
+ virtual bool RecvLandmarkRole(const uint64_t& aID, nsString* aLandmark) override;
+
+ virtual bool RecvARIARoleAtom(const uint64_t& aID, nsString* aRole) override;
+
+ virtual bool RecvGetLevelInternal(const uint64_t& aID, int32_t* aLevel) override;
+
+ virtual bool RecvAttributes(const uint64_t& aID,
+ nsTArray<Attribute> *aAttributes) override;
+ virtual bool RecvScrollTo(const uint64_t& aID, const uint32_t& aScrollType)
+ override;
+ virtual bool RecvScrollToPoint(const uint64_t& aID,
+ const uint32_t& aScrollType,
+ const int32_t& aX, const int32_t& aY) override;
+
+ virtual bool RecvCaretLineNumber(const uint64_t& aID, int32_t* aLineNumber)
+ override;
+ virtual bool RecvCaretOffset(const uint64_t& aID, int32_t* aOffset)
+ override;
+ virtual bool RecvSetCaretOffset(const uint64_t& aID, const int32_t& aOffset)
+ override;
+
+ virtual bool RecvCharacterCount(const uint64_t& aID, int32_t* aCount)
+ override;
+ virtual bool RecvSelectionCount(const uint64_t& aID, int32_t* aCount)
+ override;
+
+ virtual bool RecvTextSubstring(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset, nsString* aText,
+ bool* aValid) override;
+
+ virtual bool RecvGetTextAfterOffset(const uint64_t& aID,
+ const int32_t& aOffset,
+ const int32_t& aBoundaryType,
+ nsString* aText, int32_t* aStartOffset,
+ int32_t* aEndOffset) override;
+ virtual bool RecvGetTextAtOffset(const uint64_t& aID,
+ const int32_t& aOffset,
+ const int32_t& aBoundaryType,
+ nsString* aText, int32_t* aStartOffset,
+ int32_t* aEndOffset) override;
+ virtual bool RecvGetTextBeforeOffset(const uint64_t& aID,
+ const int32_t& aOffset,
+ const int32_t& aBoundaryType,
+ nsString* aText, int32_t* aStartOffset,
+ int32_t* aEndOffset) override;
+
+ virtual bool RecvCharAt(const uint64_t& aID,
+ const int32_t& aOffset,
+ uint16_t* aChar) override;
+
+ virtual bool RecvTextAttributes(const uint64_t& aID,
+ const bool& aIncludeDefAttrs,
+ const int32_t& aOffset,
+ nsTArray<Attribute>* aAttributes,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset)
+ override;
+
+ virtual bool RecvDefaultTextAttributes(const uint64_t& aID,
+ nsTArray<Attribute>* aAttributes)
+ override;
+
+ virtual bool RecvTextBounds(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ const uint32_t& aCoordType,
+ nsIntRect* aRetVal) override;
+
+ virtual bool RecvCharBounds(const uint64_t& aID,
+ const int32_t& aOffset,
+ const uint32_t& aCoordType,
+ nsIntRect* aRetVal) override;
+
+ virtual bool RecvOffsetAtPoint(const uint64_t& aID,
+ const int32_t& aX,
+ const int32_t& aY,
+ const uint32_t& aCoordType,
+ int32_t* aRetVal) override;
+
+ virtual bool RecvSelectionBoundsAt(const uint64_t& aID,
+ const int32_t& aSelectionNum,
+ bool* aSucceeded,
+ nsString* aData,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset) override;
+
+ virtual bool RecvSetSelectionBoundsAt(const uint64_t& aID,
+ const int32_t& aSelectionNum,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ bool* aSucceeded) override;
+
+ virtual bool RecvAddToSelection(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ bool* aSucceeded) override;
+
+ virtual bool RecvRemoveFromSelection(const uint64_t& aID,
+ const int32_t& aSelectionNum,
+ bool* aSucceeded) override;
+
+ virtual bool RecvScrollSubstringTo(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ const uint32_t& aScrollType) override;
+
+ virtual bool RecvScrollSubstringToPoint(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ const uint32_t& aCoordinateType,
+ const int32_t& aX,
+ const int32_t& aY) override;
+
+ virtual bool RecvText(const uint64_t& aID,
+ nsString* aText) override;
+
+ virtual bool RecvReplaceText(const uint64_t& aID,
+ const nsString& aText) override;
+
+ virtual bool RecvInsertText(const uint64_t& aID,
+ const nsString& aText,
+ const int32_t& aPosition, bool* aValid) override;
+
+ virtual bool RecvCopyText(const uint64_t& aID,
+ const int32_t& aStartPos,
+ const int32_t& aEndPos, bool* aValid) override;
+
+ virtual bool RecvCutText(const uint64_t& aID,
+ const int32_t& aStartPos,
+ const int32_t& aEndPos, bool* aValid) override;
+
+ virtual bool RecvDeleteText(const uint64_t& aID,
+ const int32_t& aStartPos,
+ const int32_t& aEndPos, bool* aValid) override;
+
+ virtual bool RecvPasteText(const uint64_t& aID,
+ const int32_t& aPosition, bool* aValid) override;
+
+ virtual bool RecvImagePosition(const uint64_t& aID,
+ const uint32_t& aCoordType,
+ nsIntPoint* aRetVal) override;
+
+ virtual bool RecvImageSize(const uint64_t& aID,
+ nsIntSize* aRetVal) override;
+
+ virtual bool RecvStartOffset(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk) override;
+ virtual bool RecvEndOffset(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk) override;
+ virtual bool RecvIsLinkValid(const uint64_t& aID,
+ bool* aRetVal) override;
+ virtual bool RecvAnchorCount(const uint64_t& aID,
+ uint32_t* aRetVal, bool* aOk) override;
+ virtual bool RecvAnchorURIAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ nsCString* aURI,
+ bool* aOk) override;
+ virtual bool RecvAnchorAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aIDOfAnchor,
+ bool* aOk) override;
+
+ virtual bool RecvLinkCount(const uint64_t& aID,
+ uint32_t* aCount) override;
+
+ virtual bool RecvLinkAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aIDOfLink,
+ bool* aOk) override;
+
+ virtual bool RecvLinkIndexOf(const uint64_t& aID,
+ const uint64_t& aLinkID,
+ int32_t* aIndex) override;
+
+ virtual bool RecvLinkIndexAtOffset(const uint64_t& aID,
+ const uint32_t& aOffset,
+ int32_t* aIndex) override;
+
+ virtual bool RecvTableOfACell(const uint64_t& aID,
+ uint64_t* aTableID,
+ bool* aOk) override;
+
+ virtual bool RecvColIdx(const uint64_t& aID, uint32_t* aIndex) override;
+
+ virtual bool RecvRowIdx(const uint64_t& aID, uint32_t* aIndex) override;
+
+ virtual bool RecvColExtent(const uint64_t& aID, uint32_t* aExtent) override;
+
+ virtual bool RecvGetPosition(const uint64_t& aID,
+ uint32_t* aColIdx, uint32_t* aRowIdx) override;
+
+ virtual bool RecvGetColRowExtents(const uint64_t& aID,
+ uint32_t* aColIdx, uint32_t* aRowIdx,
+ uint32_t* aColExtent, uint32_t* aRowExtent) override;
+
+ virtual bool RecvRowExtent(const uint64_t& aID, uint32_t* aExtent) override;
+
+ virtual bool RecvColHeaderCells(const uint64_t& aID,
+ nsTArray<uint64_t>* aCells) override;
+
+ virtual bool RecvRowHeaderCells(const uint64_t& aID,
+ nsTArray<uint64_t>* aCells) override;
+
+ virtual bool RecvIsCellSelected(const uint64_t& aID,
+ bool* aSelected) override;
+
+ virtual bool RecvTableCaption(const uint64_t& aID,
+ uint64_t* aCaptionID,
+ bool* aOk) override;
+ virtual bool RecvTableSummary(const uint64_t& aID,
+ nsString* aSummary) override;
+ virtual bool RecvTableColumnCount(const uint64_t& aID,
+ uint32_t* aColCount) override;
+ virtual bool RecvTableRowCount(const uint64_t& aID,
+ uint32_t* aRowCount) override;
+ virtual bool RecvTableCellAt(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ uint64_t* aCellID,
+ bool* aOk) override;
+ virtual bool RecvTableCellIndexAt(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ int32_t* aIndex) override;
+ virtual bool RecvTableColumnIndexAt(const uint64_t& aID,
+ const uint32_t& aCellIndex,
+ int32_t* aCol) override;
+ virtual bool RecvTableRowIndexAt(const uint64_t& aID,
+ const uint32_t& aCellIndex,
+ int32_t* aRow) override;
+ virtual bool RecvTableRowAndColumnIndicesAt(const uint64_t& aID,
+ const uint32_t& aCellIndex,
+ int32_t* aRow,
+ int32_t* aCol) override;
+ virtual bool RecvTableColumnExtentAt(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ uint32_t* aExtent) override;
+ virtual bool RecvTableRowExtentAt(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ uint32_t* aExtent) override;
+ virtual bool RecvTableColumnDescription(const uint64_t& aID,
+ const uint32_t& aCol,
+ nsString* aDescription) override;
+ virtual bool RecvTableRowDescription(const uint64_t& aID,
+ const uint32_t& aRow,
+ nsString* aDescription) override;
+ virtual bool RecvTableColumnSelected(const uint64_t& aID,
+ const uint32_t& aCol,
+ bool* aSelected) override;
+ virtual bool RecvTableRowSelected(const uint64_t& aID,
+ const uint32_t& aRow,
+ bool* aSelected) override;
+ virtual bool RecvTableCellSelected(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ bool* aSelected) override;
+ virtual bool RecvTableSelectedCellCount(const uint64_t& aID,
+ uint32_t* aSelectedCells) override;
+ virtual bool RecvTableSelectedColumnCount(const uint64_t& aID,
+ uint32_t* aSelectedColumns) override;
+ virtual bool RecvTableSelectedRowCount(const uint64_t& aID,
+ uint32_t* aSelectedRows) override;
+ virtual bool RecvTableSelectedCells(const uint64_t& aID,
+ nsTArray<uint64_t>* aCellIDs) override;
+ virtual bool RecvTableSelectedCellIndices(const uint64_t& aID,
+ nsTArray<uint32_t>* aCellIndices) override;
+ virtual bool RecvTableSelectedColumnIndices(const uint64_t& aID,
+ nsTArray<uint32_t>* aColumnIndices) override;
+ virtual bool RecvTableSelectedRowIndices(const uint64_t& aID,
+ nsTArray<uint32_t>* aRowIndices) override;
+ virtual bool RecvTableSelectColumn(const uint64_t& aID,
+ const uint32_t& aCol) override;
+ virtual bool RecvTableSelectRow(const uint64_t& aID,
+ const uint32_t& aRow) override;
+ virtual bool RecvTableUnselectColumn(const uint64_t& aID,
+ const uint32_t& aCol) override;
+ virtual bool RecvTableUnselectRow(const uint64_t& aID,
+ const uint32_t& aRow) override;
+ virtual bool RecvTableIsProbablyForLayout(const uint64_t& aID,
+ bool* aForLayout) override;
+ virtual bool RecvAtkTableColumnHeader(const uint64_t& aID,
+ const int32_t& aCol,
+ uint64_t* aHeader,
+ bool* aOk) override;
+ virtual bool RecvAtkTableRowHeader(const uint64_t& aID,
+ const int32_t& aRow,
+ uint64_t* aHeader,
+ bool* aOk) override;
+
+ virtual bool RecvSelectedItems(const uint64_t& aID,
+ nsTArray<uint64_t>* aSelectedItemIDs) override;
+
+ virtual bool RecvSelectedItemCount(const uint64_t& aID,
+ uint32_t* aCount) override;
+
+ virtual bool RecvGetSelectedItem(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aSelected,
+ bool* aOk) override;
+
+ virtual bool RecvIsItemSelected(const uint64_t& aID,
+ const uint32_t& aIndex,
+ bool* aSelected) override;
+
+ virtual bool RecvAddItemToSelection(const uint64_t& aID,
+ const uint32_t& aIndex,
+ bool* aSuccess) override;
+
+ virtual bool RecvRemoveItemFromSelection(const uint64_t& aID,
+ const uint32_t& aIndex,
+ bool* aSuccess) override;
+
+ virtual bool RecvSelectAll(const uint64_t& aID,
+ bool* aSuccess) override;
+
+ virtual bool RecvUnselectAll(const uint64_t& aID,
+ bool* aSuccess) override;
+
+ virtual bool RecvTakeSelection(const uint64_t& aID) override;
+ virtual bool RecvSetSelected(const uint64_t& aID,
+ const bool& aSelect) override;
+
+ virtual bool RecvDoAction(const uint64_t& aID,
+ const uint8_t& aIndex,
+ bool* aSuccess) override;
+
+ virtual bool RecvActionCount(const uint64_t& aID,
+ uint8_t* aCount) override;
+
+ virtual bool RecvActionDescriptionAt(const uint64_t& aID,
+ const uint8_t& aIndex,
+ nsString* aDescription) override;
+
+ virtual bool RecvActionNameAt(const uint64_t& aID,
+ const uint8_t& aIndex,
+ nsString* aName) override;
+
+ virtual bool RecvAccessKey(const uint64_t& aID,
+ uint32_t* aKey,
+ uint32_t* aModifierMask) override;
+
+ virtual bool RecvKeyboardShortcut(const uint64_t& aID,
+ uint32_t* aKey,
+ uint32_t* aModifierMask) override;
+
+ virtual bool RecvAtkKeyBinding(const uint64_t& aID,
+ nsString* aResult) override;
+
+ virtual bool RecvCurValue(const uint64_t& aID,
+ double* aValue) override;
+
+ virtual bool RecvSetCurValue(const uint64_t& aID,
+ const double& aValue,
+ bool* aRetVal) override;
+
+ virtual bool RecvMinValue(const uint64_t& aID,
+ double* aValue) override;
+
+ virtual bool RecvMaxValue(const uint64_t& aID,
+ double* aValue) override;
+
+ virtual bool RecvStep(const uint64_t& aID,
+ double* aStep) override;
+
+ virtual bool RecvTakeFocus(const uint64_t& aID) override;
+
+ virtual bool RecvFocusedChild(const uint64_t& aID,
+ uint64_t* aChild,
+ bool* aOk) override;
+
+ virtual bool RecvLanguage(const uint64_t& aID, nsString* aLocale) override;
+ virtual bool RecvDocType(const uint64_t& aID, nsString* aType) override;
+ virtual bool RecvTitle(const uint64_t& aID, nsString* aTitle) override;
+ virtual bool RecvURL(const uint64_t& aID, nsString* aURL) override;
+ virtual bool RecvMimeType(const uint64_t& aID, nsString* aMime) override;
+ virtual bool RecvURLDocTypeMimeType(const uint64_t& aID,
+ nsString* aURL,
+ nsString* aDocType,
+ nsString* aMimeType) override;
+
+ virtual bool RecvAccessibleAtPoint(const uint64_t& aID,
+ const int32_t& aX,
+ const int32_t& aY,
+ const bool& aNeedsScreenCoords,
+ const uint32_t& aWhich,
+ uint64_t* aResult,
+ bool* aOk) override;
+
+ virtual bool RecvExtents(const uint64_t& aID,
+ const bool& aNeedsScreenCoords,
+ int32_t* aX,
+ int32_t* aY,
+ int32_t* aWidth,
+ int32_t* aHeight) override;
+ virtual bool RecvDOMNodeID(const uint64_t& aID, nsString* aDOMNodeID) override;
+private:
+
+ Accessible* IdToAccessible(const uint64_t& aID) const;
+ Accessible* IdToAccessibleLink(const uint64_t& aID) const;
+ Accessible* IdToAccessibleSelect(const uint64_t& aID) const;
+ HyperTextAccessible* IdToHyperTextAccessible(const uint64_t& aID) const;
+ TextLeafAccessible* IdToTextLeafAccessible(const uint64_t& aID) const;
+ ImageAccessible* IdToImageAccessible(const uint64_t& aID) const;
+ TableCellAccessible* IdToTableCellAccessible(const uint64_t& aID) const;
+ TableAccessible* IdToTableAccessible(const uint64_t& aID) const;
+
+ bool PersistentPropertiesToArray(nsIPersistentProperties* aProps,
+ nsTArray<Attribute>* aAttributes);
+};
+
+}
+}
+
+#endif
diff --git a/accessible/ipc/other/PDocAccessible.ipdl b/accessible/ipc/other/PDocAccessible.ipdl
new file mode 100644
index 000000000..1885ed786
--- /dev/null
+++ b/accessible/ipc/other/PDocAccessible.ipdl
@@ -0,0 +1,264 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+include protocol PFileDescriptorSet;
+include protocol PBrowser;
+
+include "mozilla/GfxMessageUtils.h";
+
+using nsIntRect from "nsRect.h";
+using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
+using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
+
+namespace mozilla {
+namespace a11y {
+
+struct AccessibleData
+{
+ uint64_t ID;
+ uint32_t Role;
+ uint32_t ChildrenCount;
+ uint32_t Interfaces;
+};
+
+struct ShowEventData
+{
+ uint64_t ID;
+ uint32_t Idx;
+ AccessibleData[] NewTree;
+};
+
+struct Attribute
+{
+ nsCString Name;
+ nsString Value;
+};
+
+struct RelationTargets
+{
+ uint32_t Type;
+ uint64_t[] Targets;
+};
+
+nested(upto inside_sync) sync protocol PDocAccessible
+{
+ manager PBrowser;
+
+parent:
+ async Shutdown();
+
+ /*
+ * Notify the parent process the document in the child process is firing an
+ * event.
+ */
+ async Event(uint64_t aID, uint32_t type);
+ async ShowEvent(ShowEventData data, bool aFromuser);
+ async HideEvent(uint64_t aRootID, bool aFromUser);
+ async StateChangeEvent(uint64_t aID, uint64_t aState, bool aEnabled);
+ async CaretMoveEvent(uint64_t aID, int32_t aOffset);
+ async TextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart, uint32_t aLen,
+ bool aIsInsert, bool aFromUser);
+ async SelectionEvent(uint64_t aID, uint64_t aWidgetID, uint32_t aType);
+ async RoleChangedEvent(uint32_t aRole);
+
+ /*
+ * Tell the parent document to bind the existing document as a new child
+ * document.
+ */
+ async BindChildDoc(PDocAccessible aChildDoc, uint64_t aID);
+
+child:
+ async __delete__();
+
+ // Accessible
+ nested(inside_sync) sync State(uint64_t aID) returns(uint64_t states);
+ nested(inside_sync) sync NativeState(uint64_t aID) returns(uint64_t states);
+ nested(inside_sync) sync Name(uint64_t aID) returns(nsString name);
+ nested(inside_sync) sync Value(uint64_t aID) returns(nsString value);
+ nested(inside_sync) sync Help(uint64_t aID) returns(nsString help);
+ nested(inside_sync) sync Description(uint64_t aID) returns(nsString desc);
+ nested(inside_sync) sync Attributes(uint64_t aID) returns(Attribute[] attributes);
+ nested(inside_sync) sync RelationByType(uint64_t aID, uint32_t aRelationType)
+ returns(uint64_t[] targets);
+ nested(inside_sync) sync Relations(uint64_t aID) returns(RelationTargets[] relations);
+ nested(inside_sync) sync IsSearchbox(uint64_t aID) returns(bool retval);
+ nested(inside_sync) sync LandmarkRole(uint64_t aID) returns(nsString landmark);
+ nested(inside_sync) sync ARIARoleAtom(uint64_t aID) returns(nsString role);
+ nested(inside_sync) sync GetLevelInternal(uint64_t aID) returns(int32_t aLevel);
+ async ScrollTo(uint64_t aID, uint32_t aScrollType);
+ async ScrollToPoint(uint64_t aID, uint32_t aScrollType, int32_t aX,
+ int32_t aY);
+
+ // AccessibleText
+
+ // TextSubstring is getText in IDL.
+ nested(inside_sync) sync CaretLineNumber(uint64_t aID) returns(int32_t aLineNumber);
+ nested(inside_sync) sync CaretOffset(uint64_t aID) returns(int32_t aOffset);
+ async SetCaretOffset(uint64_t aID, int32_t aOffset);
+ nested(inside_sync) sync CharacterCount(uint64_t aID) returns(int32_t aCount);
+ nested(inside_sync) sync SelectionCount(uint64_t aID) returns(int32_t aCount);
+ nested(inside_sync) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t
+ aEndOffset) returns(nsString aText, bool aValid);
+ nested(inside_sync) sync GetTextAfterOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
+ returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
+ nested(inside_sync) sync GetTextAtOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
+ returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
+
+ nested(inside_sync) sync GetTextBeforeOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
+ returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
+ nested(inside_sync) sync CharAt(uint64_t aID, int32_t aOffset) returns(uint16_t aChar);
+
+ nested(inside_sync) sync TextAttributes(uint64_t aID, bool aIncludeDefAttrs, int32_t aOffset)
+ returns(Attribute[] aAttributes, int32_t aStartOffset, int32_t aEndOffset);
+ nested(inside_sync) sync DefaultTextAttributes(uint64_t aID) returns(Attribute[] aAttributes);
+
+ nested(inside_sync) sync TextBounds(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset,
+ uint32_t aCoordType)
+ returns(nsIntRect aRetVal);
+ nested(inside_sync) sync CharBounds(uint64_t aID, int32_t aOffset, uint32_t aCoordType)
+ returns(nsIntRect aRetVal);
+
+ nested(inside_sync) sync OffsetAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aCoordType)
+ returns(int32_t aRetVal);
+
+ nested(inside_sync) sync SelectionBoundsAt(uint64_t aID, int32_t aSelectionNum)
+ returns(bool aSucceeded, nsString aData, int32_t aStartOffset, int32_t aEndOffset);
+ nested(inside_sync) sync SetSelectionBoundsAt(uint64_t aID, int32_t aSelectionNum,
+ int32_t aStartOffset, int32_t aEndOffset)
+ returns(bool aSucceeded);
+ nested(inside_sync) sync AddToSelection(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset)
+ returns(bool aSucceeded);
+ nested(inside_sync) sync RemoveFromSelection(uint64_t aID, int32_t aSelectionNum)
+ returns(bool aSucceeded);
+
+ async ScrollSubstringTo(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset,
+ uint32_t aScrollType);
+ async ScrollSubstringToPoint(uint64_t aID,
+ int32_t aStartOffset,
+ int32_t aEndOffset,
+ uint32_t aCoordinateType,
+ int32_t aX, int32_t aY);
+
+ nested(inside_sync) sync Text(uint64_t aID) returns(nsString aText);
+ nested(inside_sync) sync ReplaceText(uint64_t aID, nsString aText);
+ nested(inside_sync) sync InsertText(uint64_t aID, nsString aText, int32_t aPosition)
+ returns(bool aValid);
+ nested(inside_sync) sync CopyText(uint64_t aID, int32_t aStartPos, int32_t aEndPos)
+ returns(bool aValid);
+ nested(inside_sync) sync CutText(uint64_t aID, int32_t aStartPos, int32_t aEndPos)
+ returns(bool aValid);
+ nested(inside_sync) sync DeleteText(uint64_t aID, int32_t aStartPos, int32_t aEndPos)
+ returns(bool aValid);
+ nested(inside_sync) sync PasteText(uint64_t aID, int32_t aPosition)
+ returns(bool aValid);
+
+ nested(inside_sync) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal);
+ nested(inside_sync) sync ImageSize(uint64_t aID) returns(IntSize aRetVal);
+
+ nested(inside_sync) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);
+ nested(inside_sync) sync EndOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);
+ nested(inside_sync) sync IsLinkValid(uint64_t aID) returns(bool aRetVal);
+ nested(inside_sync) sync AnchorCount(uint64_t aID) returns(uint32_t aRetVal, bool aOk);
+ nested(inside_sync) sync AnchorURIAt(uint64_t aID, uint32_t aIndex) returns(nsCString aURI, bool aOk);
+ nested(inside_sync) sync AnchorAt(uint64_t aID, uint32_t aIndex) returns(uint64_t aIDOfAnchor, bool aOk);
+
+ nested(inside_sync) sync LinkCount(uint64_t aID) returns(uint32_t aCount);
+ nested(inside_sync) sync LinkAt(uint64_t aID, uint32_t aIndex) returns(uint64_t aIDOfLink, bool aOk);
+ nested(inside_sync) sync LinkIndexOf(uint64_t aID, uint64_t aLinkID) returns(int32_t aIndex);
+ nested(inside_sync) sync LinkIndexAtOffset(uint64_t aID, uint32_t aOffset) returns(int32_t aIndex);
+
+ nested(inside_sync) sync TableOfACell(uint64_t aID) returns(uint64_t aTableID, bool aOk);
+ nested(inside_sync) sync ColIdx(uint64_t aID) returns(uint32_t aIndex);
+ nested(inside_sync) sync RowIdx(uint64_t aID) returns(uint32_t aIndex);
+ nested(inside_sync) sync GetPosition(uint64_t aID) returns(uint32_t aRow, uint32_t aCol);
+ nested(inside_sync) sync ColExtent(uint64_t aID) returns(uint32_t aExtent);
+ nested(inside_sync) sync RowExtent(uint64_t aID) returns(uint32_t aExtent);
+ nested(inside_sync) sync GetColRowExtents(uint64_t aID)
+ returns(uint32_t aCol, uint32_t aRow, uint32_t aColExtent, uint32_t aRowExtent);
+ nested(inside_sync) sync ColHeaderCells(uint64_t aID) returns(uint64_t[] aCells);
+ nested(inside_sync) sync RowHeaderCells(uint64_t aID) returns(uint64_t[] aCells);
+ nested(inside_sync) sync IsCellSelected(uint64_t aID) returns(bool aSelected);
+
+ nested(inside_sync) sync TableCaption(uint64_t aID) returns(uint64_t aCaptionID, bool aOk);
+ nested(inside_sync) sync TableSummary(uint64_t aID) returns(nsString aSummary);
+ nested(inside_sync) sync TableColumnCount(uint64_t aID) returns(uint32_t aColCount);
+ nested(inside_sync) sync TableRowCount(uint64_t aID) returns(uint32_t aRowCount);
+ nested(inside_sync) sync TableCellAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint64_t aCellID, bool aOk);
+ nested(inside_sync) sync TableCellIndexAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(int32_t aIndex);
+ nested(inside_sync) sync TableColumnIndexAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aCol);
+ nested(inside_sync) sync TableRowIndexAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aRow);
+ nested(inside_sync) sync TableRowAndColumnIndicesAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aRow, int32_t aCol);
+ nested(inside_sync) sync TableColumnExtentAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint32_t aExtent);
+ nested(inside_sync) sync TableRowExtentAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint32_t aExtent);
+ nested(inside_sync) sync TableColumnDescription(uint64_t aID, uint32_t aCol) returns(nsString aDescription);
+ nested(inside_sync) sync TableRowDescription(uint64_t aID, uint32_t aRow) returns(nsString aDescription);
+ nested(inside_sync) sync TableColumnSelected(uint64_t aID, uint32_t aCol) returns(bool aSelected);
+ nested(inside_sync) sync TableRowSelected(uint64_t aID, uint32_t aRow) returns(bool aSelected);
+ nested(inside_sync) sync TableCellSelected(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(bool aSelected);
+ nested(inside_sync) sync TableSelectedCellCount(uint64_t aID) returns(uint32_t aSelectedCells);
+ nested(inside_sync) sync TableSelectedColumnCount(uint64_t aID) returns(uint32_t aSelectedColumns);
+ nested(inside_sync) sync TableSelectedRowCount(uint64_t aID) returns(uint32_t aSelectedRows);
+ nested(inside_sync) sync TableSelectedCells(uint64_t aID) returns(uint64_t[] aCellIDs);
+ nested(inside_sync) sync TableSelectedCellIndices(uint64_t aID) returns(uint32_t[] aCellIndeces);
+ nested(inside_sync) sync TableSelectedColumnIndices(uint64_t aID) returns(uint32_t[] aColumnIndeces);
+ nested(inside_sync) sync TableSelectedRowIndices(uint64_t aID) returns(uint32_t[] aRowIndeces);
+ nested(inside_sync) sync TableSelectColumn(uint64_t aID, uint32_t aCol);
+ nested(inside_sync) sync TableSelectRow(uint64_t aID, uint32_t aRow);
+ nested(inside_sync) sync TableUnselectColumn(uint64_t aID, uint32_t aCol);
+ nested(inside_sync) sync TableUnselectRow(uint64_t aID, uint32_t aRow);
+ nested(inside_sync) sync TableIsProbablyForLayout(uint64_t aID) returns(bool aForLayout);
+ nested(inside_sync) sync AtkTableColumnHeader(uint64_t aID, int32_t aCol)
+ returns(uint64_t aHeaderID, bool aOk);
+ nested(inside_sync) sync AtkTableRowHeader(uint64_t aID, int32_t aRow)
+ returns(uint64_t aHeaderID, bool aOk);
+
+ nested(inside_sync) sync SelectedItems(uint64_t aID) returns(uint64_t[] aSelectedItemIDs);
+ nested(inside_sync) sync SelectedItemCount(uint64_t aID) returns(uint32_t aCount);
+ nested(inside_sync) sync GetSelectedItem(uint64_t aID, uint32_t aIndex) returns(uint64_t aSelected, bool aOk);
+ nested(inside_sync) sync IsItemSelected(uint64_t aID, uint32_t aIndex) returns(bool aSelected);
+ nested(inside_sync) sync AddItemToSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess);
+ nested(inside_sync) sync RemoveItemFromSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess);
+ nested(inside_sync) sync SelectAll(uint64_t aID) returns(bool aSuccess);
+ nested(inside_sync) sync UnselectAll(uint64_t aID) returns(bool aSuccess);
+
+ async TakeSelection(uint64_t aID);
+ async SetSelected(uint64_t aID, bool aSelected);
+
+ nested(inside_sync) sync DoAction(uint64_t aID, uint8_t aIndex) returns(bool aSuccess);
+ nested(inside_sync) sync ActionCount(uint64_t aID) returns(uint8_t aCount);
+ nested(inside_sync) sync ActionDescriptionAt(uint64_t aID, uint8_t aIndex) returns(nsString aDescription);
+ nested(inside_sync) sync ActionNameAt(uint64_t aID, uint8_t aIndex) returns(nsString aName);
+ nested(inside_sync) sync AccessKey(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask);
+ nested(inside_sync) sync KeyboardShortcut(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask);
+ nested(inside_sync) sync AtkKeyBinding(uint64_t aID) returns(nsString aResult);
+
+ nested(inside_sync) sync CurValue(uint64_t aID) returns(double aValue);
+ nested(inside_sync) sync SetCurValue(uint64_t aID, double aValue) returns(bool aRetVal);
+ nested(inside_sync) sync MinValue(uint64_t aID) returns(double aValue);
+ nested(inside_sync) sync MaxValue(uint64_t aID) returns(double aValue);
+ nested(inside_sync) sync Step(uint64_t aID) returns(double aStep);
+
+ async TakeFocus(uint64_t aID);
+ nested(inside_sync) sync FocusedChild(uint64_t aID)
+ returns(uint64_t aChild, bool aOk);
+
+ nested(inside_sync) sync Language(uint64_t aID) returns(nsString aLocale);
+ nested(inside_sync) sync DocType(uint64_t aID) returns(nsString aType);
+ nested(inside_sync) sync Title(uint64_t aID) returns(nsString aTitle);
+ nested(inside_sync) sync URL(uint64_t aID) returns(nsString aURL);
+ nested(inside_sync) sync MimeType(uint64_t aID) returns(nsString aMime);
+ nested(inside_sync) sync URLDocTypeMimeType(uint64_t aID) returns(nsString aURL, nsString aDocType, nsString aMimeType);
+
+ nested(inside_sync) sync AccessibleAtPoint(uint64_t aID, int32_t aX, int32_t aY, bool aNeedsScreenCoords, uint32_t aWhich)
+ returns(uint64_t aResult, bool aOk);
+
+ nested(inside_sync) sync Extents(uint64_t aID, bool aNeedsScreenCoords)
+ returns(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight);
+ nested(inside_sync) sync DOMNodeID(uint64_t aID) returns(nsString aDOMNodeID);
+};
+
+}
+}
diff --git a/accessible/ipc/other/ProxyAccessible.cpp b/accessible/ipc/other/ProxyAccessible.cpp
new file mode 100644
index 000000000..2eb93dfda
--- /dev/null
+++ b/accessible/ipc/other/ProxyAccessible.cpp
@@ -0,0 +1,1080 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "ProxyAccessible.h"
+#include "mozilla/a11y/DocAccessibleParent.h"
+#include "DocAccessible.h"
+#include "mozilla/a11y/DocManager.h"
+#include "mozilla/dom/Element.h"
+#include "mozilla/dom/TabParent.h"
+#include "mozilla/Unused.h"
+#include "mozilla/a11y/Platform.h"
+#include "RelationType.h"
+#include "mozilla/a11y/Role.h"
+#include "xpcAccessibleDocument.h"
+
+namespace mozilla {
+namespace a11y {
+
+uint64_t
+ProxyAccessible::State() const
+{
+ uint64_t state = 0;
+ Unused << mDoc->SendState(mID, &state);
+ return state;
+}
+
+uint64_t
+ProxyAccessible::NativeState() const
+{
+ uint64_t state = 0;
+ Unused << mDoc->SendNativeState(mID, &state);
+ return state;
+}
+
+void
+ProxyAccessible::Name(nsString& aName) const
+{
+ Unused << mDoc->SendName(mID, &aName);
+}
+
+void
+ProxyAccessible::Value(nsString& aValue) const
+{
+ Unused << mDoc->SendValue(mID, &aValue);
+}
+
+void
+ProxyAccessible::Help(nsString& aHelp) const
+{
+ Unused << mDoc->SendHelp(mID, &aHelp);
+}
+
+void
+ProxyAccessible::Description(nsString& aDesc) const
+{
+ Unused << mDoc->SendDescription(mID, &aDesc);
+}
+
+void
+ProxyAccessible::Attributes(nsTArray<Attribute> *aAttrs) const
+{
+ Unused << mDoc->SendAttributes(mID, aAttrs);
+}
+
+nsTArray<ProxyAccessible*>
+ProxyAccessible::RelationByType(RelationType aType) const
+{
+ nsTArray<uint64_t> targetIDs;
+ Unused << mDoc->SendRelationByType(mID, static_cast<uint32_t>(aType),
+ &targetIDs);
+
+ size_t targetCount = targetIDs.Length();
+ nsTArray<ProxyAccessible*> targets(targetCount);
+ for (size_t i = 0; i < targetCount; i++)
+ if (ProxyAccessible* proxy = mDoc->GetAccessible(targetIDs[i]))
+ targets.AppendElement(proxy);
+
+ return Move(targets);
+}
+
+void
+ProxyAccessible::Relations(nsTArray<RelationType>* aTypes,
+ nsTArray<nsTArray<ProxyAccessible*>>* aTargetSets)
+ const
+{
+ nsTArray<RelationTargets> ipcRelations;
+ Unused << mDoc->SendRelations(mID, &ipcRelations);
+
+ size_t relationCount = ipcRelations.Length();
+ aTypes->SetCapacity(relationCount);
+ aTargetSets->SetCapacity(relationCount);
+ for (size_t i = 0; i < relationCount; i++) {
+ uint32_t type = ipcRelations[i].Type();
+ if (type > static_cast<uint32_t>(RelationType::LAST))
+ continue;
+
+ size_t targetCount = ipcRelations[i].Targets().Length();
+ nsTArray<ProxyAccessible*> targets(targetCount);
+ for (size_t j = 0; j < targetCount; j++)
+ if (ProxyAccessible* proxy = mDoc->GetAccessible(ipcRelations[i].Targets()[j]))
+ targets.AppendElement(proxy);
+
+ if (targets.IsEmpty())
+ continue;
+
+ aTargetSets->AppendElement(Move(targets));
+ aTypes->AppendElement(static_cast<RelationType>(type));
+ }
+}
+
+bool
+ProxyAccessible::IsSearchbox() const
+{
+ bool retVal = false;
+ Unused << mDoc->SendIsSearchbox(mID, &retVal);
+ return retVal;
+}
+
+nsIAtom*
+ProxyAccessible::LandmarkRole() const
+{
+ nsString landmark;
+ Unused << mDoc->SendLandmarkRole(mID, &landmark);
+ return NS_GetStaticAtom(landmark);
+}
+
+nsIAtom*
+ProxyAccessible::ARIARoleAtom() const
+{
+ nsString role;
+ Unused << mDoc->SendARIARoleAtom(mID, &role);
+ return NS_GetStaticAtom(role);
+}
+
+int32_t
+ProxyAccessible::GetLevelInternal()
+{
+ int32_t level = 0;
+ Unused << mDoc->SendGetLevelInternal(mID, &level);
+ return level;
+}
+
+void
+ProxyAccessible::ScrollTo(uint32_t aScrollType)
+{
+ Unused << mDoc->SendScrollTo(mID, aScrollType);
+}
+
+void
+ProxyAccessible::ScrollToPoint(uint32_t aScrollType, int32_t aX, int32_t aY)
+{
+ Unused << mDoc->SendScrollToPoint(mID, aScrollType, aX, aY);
+}
+
+int32_t
+ProxyAccessible::CaretLineNumber()
+{
+ int32_t line = -1;
+ Unused << mDoc->SendCaretOffset(mID, &line);
+ return line;
+}
+
+int32_t
+ProxyAccessible::CaretOffset()
+{
+ int32_t offset = 0;
+ Unused << mDoc->SendCaretOffset(mID, &offset);
+ return offset;
+}
+
+void
+ProxyAccessible::SetCaretOffset(int32_t aOffset)
+{
+ Unused << mDoc->SendSetCaretOffset(mID, aOffset);
+}
+
+int32_t
+ProxyAccessible::CharacterCount()
+{
+ int32_t count = 0;
+ Unused << mDoc->SendCharacterCount(mID, &count);
+ return count;
+}
+
+int32_t
+ProxyAccessible::SelectionCount()
+{
+ int32_t count = 0;
+ Unused << mDoc->SendSelectionCount(mID, &count);
+ return count;
+}
+
+bool
+ProxyAccessible::TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
+ nsString& aText) const
+{
+ bool valid;
+ Unused << mDoc->SendTextSubstring(mID, aStartOffset, aEndOfset, &aText, &valid);
+ return valid;
+}
+
+void
+ProxyAccessible::GetTextAfterOffset(int32_t aOffset,
+ AccessibleTextBoundary aBoundaryType,
+ nsString& aText, int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ Unused << mDoc->SendGetTextAfterOffset(mID, aOffset, aBoundaryType,
+ &aText, aStartOffset, aEndOffset);
+}
+
+void
+ProxyAccessible::GetTextAtOffset(int32_t aOffset,
+ AccessibleTextBoundary aBoundaryType,
+ nsString& aText, int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ Unused << mDoc->SendGetTextAtOffset(mID, aOffset, aBoundaryType,
+ &aText, aStartOffset, aEndOffset);
+}
+
+void
+ProxyAccessible::GetTextBeforeOffset(int32_t aOffset,
+ AccessibleTextBoundary aBoundaryType,
+ nsString& aText, int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ Unused << mDoc->SendGetTextBeforeOffset(mID, aOffset, aBoundaryType,
+ &aText, aStartOffset, aEndOffset);
+}
+
+char16_t
+ProxyAccessible::CharAt(int32_t aOffset)
+{
+ uint16_t retval = 0;
+ Unused << mDoc->SendCharAt(mID, aOffset, &retval);
+ return static_cast<char16_t>(retval);
+}
+
+void
+ProxyAccessible::TextAttributes(bool aIncludeDefAttrs,
+ int32_t aOffset,
+ nsTArray<Attribute>* aAttributes,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ Unused << mDoc->SendTextAttributes(mID, aIncludeDefAttrs, aOffset,
+ aAttributes, aStartOffset, aEndOffset);
+}
+
+void
+ProxyAccessible::DefaultTextAttributes(nsTArray<Attribute>* aAttrs)
+{
+ Unused << mDoc->SendDefaultTextAttributes(mID, aAttrs);
+}
+
+nsIntRect
+ProxyAccessible::TextBounds(int32_t aStartOffset, int32_t aEndOffset,
+ uint32_t aCoordType)
+{
+ nsIntRect rect;
+ Unused <<
+ mDoc->SendTextBounds(mID, aStartOffset, aEndOffset, aCoordType, &rect);
+ return rect;
+}
+
+nsIntRect
+ProxyAccessible::CharBounds(int32_t aOffset, uint32_t aCoordType)
+{
+ nsIntRect rect;
+ Unused <<
+ mDoc->SendCharBounds(mID, aOffset, aCoordType, &rect);
+ return rect;
+}
+
+int32_t
+ProxyAccessible::OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType)
+{
+ int32_t retVal = -1;
+ Unused << mDoc->SendOffsetAtPoint(mID, aX, aY, aCoordType, &retVal);
+ return retVal;
+}
+
+bool
+ProxyAccessible::SelectionBoundsAt(int32_t aSelectionNum,
+ nsString& aData,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset)
+{
+ bool retVal = false;
+ Unused << mDoc->SendSelectionBoundsAt(mID, aSelectionNum, &retVal, &aData,
+ aStartOffset, aEndOffset);
+ return retVal;
+}
+
+bool
+ProxyAccessible::SetSelectionBoundsAt(int32_t aSelectionNum,
+ int32_t aStartOffset,
+ int32_t aEndOffset)
+{
+ bool retVal = false;
+ Unused << mDoc->SendSetSelectionBoundsAt(mID, aSelectionNum, aStartOffset,
+ aEndOffset, &retVal);
+ return retVal;
+}
+
+bool
+ProxyAccessible::AddToSelection(int32_t aStartOffset,
+ int32_t aEndOffset)
+{
+ bool retVal = false;
+ Unused << mDoc->SendAddToSelection(mID, aStartOffset, aEndOffset, &retVal);
+ return retVal;
+}
+
+bool
+ProxyAccessible::RemoveFromSelection(int32_t aSelectionNum)
+{
+ bool retVal = false;
+ Unused << mDoc->SendRemoveFromSelection(mID, aSelectionNum, &retVal);
+ return retVal;
+}
+
+void
+ProxyAccessible::ScrollSubstringTo(int32_t aStartOffset, int32_t aEndOffset,
+ uint32_t aScrollType)
+{
+ Unused << mDoc->SendScrollSubstringTo(mID, aStartOffset, aEndOffset, aScrollType);
+}
+
+void
+ProxyAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
+ int32_t aEndOffset,
+ uint32_t aCoordinateType,
+ int32_t aX, int32_t aY)
+{
+ Unused << mDoc->SendScrollSubstringToPoint(mID, aStartOffset, aEndOffset,
+ aCoordinateType, aX, aY);
+}
+
+void
+ProxyAccessible::Text(nsString* aText)
+{
+ Unused << mDoc->SendText(mID, aText);
+}
+
+void
+ProxyAccessible::ReplaceText(const nsString& aText)
+{
+ Unused << mDoc->SendReplaceText(mID, aText);
+}
+
+bool
+ProxyAccessible::InsertText(const nsString& aText, int32_t aPosition)
+{
+ bool valid;
+ Unused << mDoc->SendInsertText(mID, aText, aPosition, &valid);
+ return valid;
+}
+
+bool
+ProxyAccessible::CopyText(int32_t aStartPos, int32_t aEndPos)
+{
+ bool valid;
+ Unused << mDoc->SendCopyText(mID, aStartPos, aEndPos, &valid);
+ return valid;
+}
+
+bool
+ProxyAccessible::CutText(int32_t aStartPos, int32_t aEndPos)
+{
+ bool valid;
+ Unused << mDoc->SendCutText(mID, aStartPos, aEndPos, &valid);
+ return valid;
+}
+
+bool
+ProxyAccessible::DeleteText(int32_t aStartPos, int32_t aEndPos)
+{
+ bool valid;
+ Unused << mDoc->SendDeleteText(mID, aStartPos, aEndPos, &valid);
+ return valid;
+}
+
+bool
+ProxyAccessible::PasteText(int32_t aPosition)
+{
+ bool valid;
+ Unused << mDoc->SendPasteText(mID, aPosition, &valid);
+ return valid;
+}
+
+nsIntPoint
+ProxyAccessible::ImagePosition(uint32_t aCoordType)
+{
+ nsIntPoint retVal;
+ Unused << mDoc->SendImagePosition(mID, aCoordType, &retVal);
+ return retVal;
+}
+
+nsIntSize
+ProxyAccessible::ImageSize()
+{
+ nsIntSize retVal;
+ Unused << mDoc->SendImageSize(mID, &retVal);
+ return retVal;
+}
+
+uint32_t
+ProxyAccessible::StartOffset(bool* aOk)
+{
+ uint32_t retVal = 0;
+ Unused << mDoc->SendStartOffset(mID, &retVal, aOk);
+ return retVal;
+}
+
+uint32_t
+ProxyAccessible::EndOffset(bool* aOk)
+{
+ uint32_t retVal = 0;
+ Unused << mDoc->SendEndOffset(mID, &retVal, aOk);
+ return retVal;
+}
+
+bool
+ProxyAccessible::IsLinkValid()
+{
+ bool retVal = false;
+ Unused << mDoc->SendIsLinkValid(mID, &retVal);
+ return retVal;
+}
+
+uint32_t
+ProxyAccessible::AnchorCount(bool* aOk)
+{
+ uint32_t retVal = 0;
+ Unused << mDoc->SendAnchorCount(mID, &retVal, aOk);
+ return retVal;
+}
+
+void
+ProxyAccessible::AnchorURIAt(uint32_t aIndex, nsCString& aURI, bool* aOk)
+{
+ Unused << mDoc->SendAnchorURIAt(mID, aIndex, &aURI, aOk);
+}
+
+ProxyAccessible*
+ProxyAccessible::AnchorAt(uint32_t aIndex)
+{
+ uint64_t id = 0;
+ bool ok = false;
+ Unused << mDoc->SendAnchorAt(mID, aIndex, &id, &ok);
+ return ok ? mDoc->GetAccessible(id) : nullptr;
+}
+
+uint32_t
+ProxyAccessible::LinkCount()
+{
+ uint32_t retVal = 0;
+ Unused << mDoc->SendLinkCount(mID, &retVal);
+ return retVal;
+}
+
+ProxyAccessible*
+ProxyAccessible::LinkAt(const uint32_t& aIndex)
+{
+ uint64_t linkID = 0;
+ bool ok = false;
+ Unused << mDoc->SendLinkAt(mID, aIndex, &linkID, &ok);
+ return ok ? mDoc->GetAccessible(linkID) : nullptr;
+}
+
+int32_t
+ProxyAccessible::LinkIndexOf(ProxyAccessible* aLink)
+{
+ int32_t retVal = -1;
+ if (aLink) {
+ Unused << mDoc->SendLinkIndexOf(mID, aLink->ID(), &retVal);
+ }
+
+ return retVal;
+}
+
+int32_t
+ProxyAccessible::LinkIndexAtOffset(uint32_t aOffset)
+{
+ int32_t retVal = -1;
+ Unused << mDoc->SendLinkIndexAtOffset(mID, aOffset, &retVal);
+ return retVal;
+}
+
+ProxyAccessible*
+ProxyAccessible::TableOfACell()
+{
+ uint64_t tableID = 0;
+ bool ok = false;
+ Unused << mDoc->SendTableOfACell(mID, &tableID, &ok);
+ return ok ? mDoc->GetAccessible(tableID) : nullptr;
+}
+
+uint32_t
+ProxyAccessible::ColIdx()
+{
+ uint32_t index = 0;
+ Unused << mDoc->SendColIdx(mID, &index);
+ return index;
+}
+
+uint32_t
+ProxyAccessible::RowIdx()
+{
+ uint32_t index = 0;
+ Unused << mDoc->SendRowIdx(mID, &index);
+ return index;
+}
+
+void
+ProxyAccessible::GetColRowExtents(uint32_t* aColIdx, uint32_t* aRowIdx,
+ uint32_t* aColExtent, uint32_t* aRowExtent)
+{
+ Unused << mDoc->SendGetColRowExtents(mID, aColIdx, aRowIdx, aColExtent, aRowExtent);
+}
+
+void
+ProxyAccessible::GetPosition(uint32_t* aColIdx, uint32_t* aRowIdx)
+{
+ Unused << mDoc->SendGetPosition(mID, aColIdx, aRowIdx);
+}
+
+uint32_t
+ProxyAccessible::ColExtent()
+{
+ uint32_t extent = 0;
+ Unused << mDoc->SendColExtent(mID, &extent);
+ return extent;
+}
+
+uint32_t
+ProxyAccessible::RowExtent()
+{
+ uint32_t extent = 0;
+ Unused << mDoc->SendRowExtent(mID, &extent);
+ return extent;
+}
+
+void
+ProxyAccessible::ColHeaderCells(nsTArray<ProxyAccessible*>* aCells)
+{
+ nsTArray<uint64_t> targetIDs;
+ Unused << mDoc->SendColHeaderCells(mID, &targetIDs);
+
+ size_t targetCount = targetIDs.Length();
+ for (size_t i = 0; i < targetCount; i++) {
+ aCells->AppendElement(mDoc->GetAccessible(targetIDs[i]));
+ }
+}
+
+void
+ProxyAccessible::RowHeaderCells(nsTArray<ProxyAccessible*>* aCells)
+{
+ nsTArray<uint64_t> targetIDs;
+ Unused << mDoc->SendRowHeaderCells(mID, &targetIDs);
+
+ size_t targetCount = targetIDs.Length();
+ for (size_t i = 0; i < targetCount; i++) {
+ aCells->AppendElement(mDoc->GetAccessible(targetIDs[i]));
+ }
+}
+
+bool
+ProxyAccessible::IsCellSelected()
+{
+ bool selected = false;
+ Unused << mDoc->SendIsCellSelected(mID, &selected);
+ return selected;
+}
+
+ProxyAccessible*
+ProxyAccessible::TableCaption()
+{
+ uint64_t captionID = 0;
+ bool ok = false;
+ Unused << mDoc->SendTableCaption(mID, &captionID, &ok);
+ return ok ? mDoc->GetAccessible(captionID) : nullptr;
+}
+
+void
+ProxyAccessible::TableSummary(nsString& aSummary)
+{
+ Unused << mDoc->SendTableSummary(mID, &aSummary);
+}
+
+uint32_t
+ProxyAccessible::TableColumnCount()
+{
+ uint32_t count = 0;
+ Unused << mDoc->SendTableColumnCount(mID, &count);
+ return count;
+}
+
+uint32_t
+ProxyAccessible::TableRowCount()
+{
+ uint32_t count = 0;
+ Unused << mDoc->SendTableRowCount(mID, &count);
+ return count;
+}
+
+ProxyAccessible*
+ProxyAccessible::TableCellAt(uint32_t aRow, uint32_t aCol)
+{
+ uint64_t cellID = 0;
+ bool ok = false;
+ Unused << mDoc->SendTableCellAt(mID, aRow, aCol, &cellID, &ok);
+ return ok ? mDoc->GetAccessible(cellID) : nullptr;
+}
+
+int32_t
+ProxyAccessible::TableCellIndexAt(uint32_t aRow, uint32_t aCol)
+{
+ int32_t index = 0;
+ Unused << mDoc->SendTableCellIndexAt(mID, aRow, aCol, &index);
+ return index;
+}
+
+int32_t
+ProxyAccessible::TableColumnIndexAt(uint32_t aCellIndex)
+{
+ int32_t index = 0;
+ Unused << mDoc->SendTableColumnIndexAt(mID, aCellIndex, &index);
+ return index;
+}
+
+int32_t
+ProxyAccessible::TableRowIndexAt(uint32_t aCellIndex)
+{
+ int32_t index = 0;
+ Unused << mDoc->SendTableRowIndexAt(mID, aCellIndex, &index);
+ return index;
+}
+
+void
+ProxyAccessible::TableRowAndColumnIndicesAt(uint32_t aCellIndex,
+ int32_t* aRow, int32_t* aCol)
+{
+ Unused << mDoc->SendTableRowAndColumnIndicesAt(mID, aCellIndex, aRow, aCol);
+}
+
+uint32_t
+ProxyAccessible::TableColumnExtentAt(uint32_t aRow, uint32_t aCol)
+{
+ uint32_t extent = 0;
+ Unused << mDoc->SendTableColumnExtentAt(mID, aRow, aCol, &extent);
+ return extent;
+}
+
+uint32_t
+ProxyAccessible::TableRowExtentAt(uint32_t aRow, uint32_t aCol)
+{
+ uint32_t extent = 0;
+ Unused << mDoc->SendTableRowExtentAt(mID, aRow, aCol, &extent);
+ return extent;
+}
+
+void
+ProxyAccessible::TableColumnDescription(uint32_t aCol, nsString& aDescription)
+{
+ Unused << mDoc->SendTableColumnDescription(mID, aCol, &aDescription);
+}
+
+void
+ProxyAccessible::TableRowDescription(uint32_t aRow, nsString& aDescription)
+{
+ Unused << mDoc->SendTableRowDescription(mID, aRow, &aDescription);
+}
+
+bool
+ProxyAccessible::TableColumnSelected(uint32_t aCol)
+{
+ bool selected = false;
+ Unused << mDoc->SendTableColumnSelected(mID, aCol, &selected);
+ return selected;
+}
+
+bool
+ProxyAccessible::TableRowSelected(uint32_t aRow)
+{
+ bool selected = false;
+ Unused << mDoc->SendTableRowSelected(mID, aRow, &selected);
+ return selected;
+}
+
+bool
+ProxyAccessible::TableCellSelected(uint32_t aRow, uint32_t aCol)
+{
+ bool selected = false;
+ Unused << mDoc->SendTableCellSelected(mID, aRow, aCol, &selected);
+ return selected;
+}
+
+uint32_t
+ProxyAccessible::TableSelectedCellCount()
+{
+ uint32_t count = 0;
+ Unused << mDoc->SendTableSelectedCellCount(mID, &count);
+ return count;
+}
+
+uint32_t
+ProxyAccessible::TableSelectedColumnCount()
+{
+ uint32_t count = 0;
+ Unused << mDoc->SendTableSelectedColumnCount(mID, &count);
+ return count;
+}
+
+uint32_t
+ProxyAccessible::TableSelectedRowCount()
+{
+ uint32_t count = 0;
+ Unused << mDoc->SendTableSelectedRowCount(mID, &count);
+ return count;
+}
+
+void
+ProxyAccessible::TableSelectedCells(nsTArray<ProxyAccessible*>* aCellIDs)
+{
+ AutoTArray<uint64_t, 30> cellIDs;
+ Unused << mDoc->SendTableSelectedCells(mID, &cellIDs);
+ aCellIDs->SetCapacity(cellIDs.Length());
+ for (uint32_t i = 0; i < cellIDs.Length(); ++i) {
+ aCellIDs->AppendElement(mDoc->GetAccessible(cellIDs[i]));
+ }
+}
+
+void
+ProxyAccessible::TableSelectedCellIndices(nsTArray<uint32_t>* aCellIndices)
+{
+ Unused << mDoc->SendTableSelectedCellIndices(mID, aCellIndices);
+}
+
+void
+ProxyAccessible::TableSelectedColumnIndices(nsTArray<uint32_t>* aColumnIndices)
+{
+ Unused << mDoc->SendTableSelectedColumnIndices(mID, aColumnIndices);
+}
+
+void
+ProxyAccessible::TableSelectedRowIndices(nsTArray<uint32_t>* aRowIndices)
+{
+ Unused << mDoc->SendTableSelectedRowIndices(mID, aRowIndices);
+}
+
+void
+ProxyAccessible::TableSelectColumn(uint32_t aCol)
+{
+ Unused << mDoc->SendTableSelectColumn(mID, aCol);
+}
+
+void
+ProxyAccessible::TableSelectRow(uint32_t aRow)
+{
+ Unused << mDoc->SendTableSelectRow(mID, aRow);
+}
+
+void
+ProxyAccessible::TableUnselectColumn(uint32_t aCol)
+{
+ Unused << mDoc->SendTableUnselectColumn(mID, aCol);
+}
+
+void
+ProxyAccessible::TableUnselectRow(uint32_t aRow)
+{
+ Unused << mDoc->SendTableUnselectRow(mID, aRow);
+}
+
+bool
+ProxyAccessible::TableIsProbablyForLayout()
+{
+ bool forLayout = false;
+ Unused << mDoc->SendTableIsProbablyForLayout(mID, &forLayout);
+ return forLayout;
+}
+
+ProxyAccessible*
+ProxyAccessible::AtkTableColumnHeader(int32_t aCol)
+{
+ uint64_t headerID = 0;
+ bool ok = false;
+ Unused << mDoc->SendAtkTableColumnHeader(mID, aCol, &headerID, &ok);
+ return ok ? mDoc->GetAccessible(headerID) : nullptr;
+}
+
+ProxyAccessible*
+ProxyAccessible::AtkTableRowHeader(int32_t aRow)
+{
+ uint64_t headerID = 0;
+ bool ok = false;
+ Unused << mDoc->SendAtkTableRowHeader(mID, aRow, &headerID, &ok);
+ return ok ? mDoc->GetAccessible(headerID) : nullptr;
+}
+
+void
+ProxyAccessible::SelectedItems(nsTArray<ProxyAccessible*>* aSelectedItems)
+{
+ AutoTArray<uint64_t, 10> itemIDs;
+ Unused << mDoc->SendSelectedItems(mID, &itemIDs);
+ aSelectedItems->SetCapacity(itemIDs.Length());
+ for (size_t i = 0; i < itemIDs.Length(); ++i) {
+ aSelectedItems->AppendElement(mDoc->GetAccessible(itemIDs[i]));
+ }
+}
+
+uint32_t
+ProxyAccessible::SelectedItemCount()
+{
+ uint32_t count = 0;
+ Unused << mDoc->SendSelectedItemCount(mID, &count);
+ return count;
+}
+
+ProxyAccessible*
+ProxyAccessible::GetSelectedItem(uint32_t aIndex)
+{
+ uint64_t selectedItemID = 0;
+ bool ok = false;
+ Unused << mDoc->SendGetSelectedItem(mID, aIndex, &selectedItemID, &ok);
+ return ok ? mDoc->GetAccessible(selectedItemID) : nullptr;
+}
+
+bool
+ProxyAccessible::IsItemSelected(uint32_t aIndex)
+{
+ bool selected = false;
+ Unused << mDoc->SendIsItemSelected(mID, aIndex, &selected);
+ return selected;
+}
+
+bool
+ProxyAccessible::AddItemToSelection(uint32_t aIndex)
+{
+ bool success = false;
+ Unused << mDoc->SendAddItemToSelection(mID, aIndex, &success);
+ return success;
+}
+
+bool
+ProxyAccessible::RemoveItemFromSelection(uint32_t aIndex)
+{
+ bool success = false;
+ Unused << mDoc->SendRemoveItemFromSelection(mID, aIndex, &success);
+ return success;
+}
+
+bool
+ProxyAccessible::SelectAll()
+{
+ bool success = false;
+ Unused << mDoc->SendSelectAll(mID, &success);
+ return success;
+}
+
+bool
+ProxyAccessible::UnselectAll()
+{
+ bool success = false;
+ Unused << mDoc->SendUnselectAll(mID, &success);
+ return success;
+}
+
+void
+ProxyAccessible::TakeSelection()
+{
+ Unused << mDoc->SendTakeSelection(mID);
+}
+
+void
+ProxyAccessible::SetSelected(bool aSelect)
+{
+ Unused << mDoc->SendSetSelected(mID, aSelect);
+}
+
+bool
+ProxyAccessible::DoAction(uint8_t aIndex)
+{
+ bool success = false;
+ Unused << mDoc->SendDoAction(mID, aIndex, &success);
+ return success;
+}
+
+uint8_t
+ProxyAccessible::ActionCount()
+{
+ uint8_t count = 0;
+ Unused << mDoc->SendActionCount(mID, &count);
+ return count;
+}
+
+void
+ProxyAccessible::ActionDescriptionAt(uint8_t aIndex, nsString& aDescription)
+{
+ Unused << mDoc->SendActionDescriptionAt(mID, aIndex, &aDescription);
+}
+
+void
+ProxyAccessible::ActionNameAt(uint8_t aIndex, nsString& aName)
+{
+ Unused << mDoc->SendActionNameAt(mID, aIndex, &aName);
+}
+
+KeyBinding
+ProxyAccessible::AccessKey()
+{
+ uint32_t key = 0;
+ uint32_t modifierMask = 0;
+ Unused << mDoc->SendAccessKey(mID, &key, &modifierMask);
+ return KeyBinding(key, modifierMask);
+}
+
+KeyBinding
+ProxyAccessible::KeyboardShortcut()
+{
+ uint32_t key = 0;
+ uint32_t modifierMask = 0;
+ Unused << mDoc->SendKeyboardShortcut(mID, &key, &modifierMask);
+ return KeyBinding(key, modifierMask);
+}
+
+void
+ProxyAccessible::AtkKeyBinding(nsString& aBinding)
+{
+ Unused << mDoc->SendAtkKeyBinding(mID, &aBinding);
+}
+
+double
+ProxyAccessible::CurValue()
+{
+ double val = UnspecifiedNaN<double>();
+ Unused << mDoc->SendCurValue(mID, &val);
+ return val;
+}
+
+bool
+ProxyAccessible::SetCurValue(double aValue)
+{
+ bool success = false;
+ Unused << mDoc->SendSetCurValue(mID, aValue, &success);
+ return success;
+}
+
+double
+ProxyAccessible::MinValue()
+{
+ double val = UnspecifiedNaN<double>();
+ Unused << mDoc->SendMinValue(mID, &val);
+ return val;
+}
+
+double
+ProxyAccessible::MaxValue()
+{
+ double val = UnspecifiedNaN<double>();
+ Unused << mDoc->SendMaxValue(mID, &val);
+ return val;
+}
+
+double
+ProxyAccessible::Step()
+{
+ double step = UnspecifiedNaN<double>();
+ Unused << mDoc->SendStep(mID, &step);
+ return step;
+}
+
+void
+ProxyAccessible::TakeFocus()
+{
+ Unused << mDoc->SendTakeFocus(mID);
+}
+
+ProxyAccessible*
+ProxyAccessible::FocusedChild()
+{
+ uint64_t childID = 0;
+ bool ok = false;
+ Unused << mDoc->SendFocusedChild(mID, &childID, &ok);
+ return ok ? mDoc->GetAccessible(childID) : nullptr;
+}
+
+ProxyAccessible*
+ProxyAccessible::ChildAtPoint(int32_t aX, int32_t aY,
+ Accessible::EWhichChildAtPoint aWhichChild)
+{
+ uint64_t childID = 0;
+ bool ok = false;
+ Unused << mDoc->SendAccessibleAtPoint(mID, aX, aY, false,
+ static_cast<uint32_t>(aWhichChild),
+ &childID, &ok);
+ return ok ? mDoc->GetAccessible(childID) : nullptr;
+}
+
+nsIntRect
+ProxyAccessible::Bounds()
+{
+ nsIntRect rect;
+ Unused << mDoc->SendExtents(mID, false,
+ &(rect.x), &(rect.y),
+ &(rect.width), &(rect.height));
+ return rect;
+}
+
+void
+ProxyAccessible::Language(nsString& aLocale)
+{
+ Unused << mDoc->SendLanguage(mID, &aLocale);
+}
+
+void
+ProxyAccessible::DocType(nsString& aType)
+{
+ Unused << mDoc->SendDocType(mID, &aType);
+}
+
+void
+ProxyAccessible::Title(nsString& aTitle)
+{
+ Unused << mDoc->SendTitle(mID, &aTitle);
+}
+
+void
+ProxyAccessible::URL(nsString& aURL)
+{
+ Unused << mDoc->SendURL(mID, &aURL);
+}
+
+void
+ProxyAccessible::MimeType(nsString aMime)
+{
+ Unused << mDoc->SendMimeType(mID, &aMime);
+}
+
+void
+ProxyAccessible::URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
+ nsString& aMimeType)
+{
+ Unused << mDoc->SendURLDocTypeMimeType(mID, &aURL, &aDocType, &aMimeType);
+}
+
+ProxyAccessible*
+ProxyAccessible::AccessibleAtPoint(int32_t aX, int32_t aY,
+ bool aNeedsScreenCoords)
+{
+ uint64_t childID = 0;
+ bool ok = false;
+ Unused <<
+ mDoc->SendAccessibleAtPoint(mID, aX, aY, aNeedsScreenCoords,
+ static_cast<uint32_t>(Accessible::eDirectChild),
+ &childID, &ok);
+ return ok ? mDoc->GetAccessible(childID) : nullptr;
+}
+
+void
+ProxyAccessible::Extents(bool aNeedsScreenCoords, int32_t* aX, int32_t* aY,
+ int32_t* aWidth, int32_t* aHeight)
+{
+ Unused << mDoc->SendExtents(mID, aNeedsScreenCoords, aX, aY, aWidth, aHeight);
+}
+
+void
+ProxyAccessible::DOMNodeID(nsString& aID)
+{
+ Unused << mDoc->SendDOMNodeID(mID, &aID);
+}
+
+}
+}
diff --git a/accessible/ipc/other/ProxyAccessible.h b/accessible/ipc/other/ProxyAccessible.h
new file mode 100644
index 000000000..25fd71fbf
--- /dev/null
+++ b/accessible/ipc/other/ProxyAccessible.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_a11y_ProxyAccessible_h
+#define mozilla_a11y_ProxyAccessible_h
+
+#include "Accessible.h"
+#include "mozilla/a11y/ProxyAccessibleBase.h"
+#include "mozilla/a11y/Role.h"
+#include "nsIAccessibleText.h"
+#include "nsIAccessibleTypes.h"
+#include "nsString.h"
+#include "nsTArray.h"
+#include "nsRect.h"
+
+namespace mozilla {
+namespace a11y {
+
+class ProxyAccessible : public ProxyAccessibleBase<ProxyAccessible>
+{
+public:
+
+ ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
+ DocAccessibleParent* aDoc, role aRole, uint32_t aInterfaces)
+ : ProxyAccessibleBase(aID, aParent, aDoc, aRole, aInterfaces)
+
+ {
+ MOZ_COUNT_CTOR(ProxyAccessible);
+ }
+
+ ~ProxyAccessible()
+ {
+ MOZ_COUNT_DTOR(ProxyAccessible);
+ }
+
+#include "mozilla/a11y/ProxyAccessibleShared.h"
+
+protected:
+ explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc)
+ : ProxyAccessibleBase(aThisAsDoc)
+ { MOZ_COUNT_CTOR(ProxyAccessible); }
+};
+
+}
+}
+
+#endif
diff --git a/accessible/ipc/other/moz.build b/accessible/ipc/other/moz.build
new file mode 100644
index 000000000..65021145c
--- /dev/null
+++ b/accessible/ipc/other/moz.build
@@ -0,0 +1,47 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# With --disable-accessibility, we need to compile PDocAccessible.ipdl, but
+# not the C++.
+IPDL_SOURCES += ['PDocAccessible.ipdl']
+
+if CONFIG['ACCESSIBILITY']:
+ EXPORTS.mozilla.a11y += [
+ 'DocAccessibleChild.h',
+ 'ProxyAccessible.h',
+ ]
+
+ SOURCES += [
+ 'DocAccessibleChild.cpp',
+ 'ProxyAccessible.cpp',
+ ]
+
+ LOCAL_INCLUDES += [
+ '../../base',
+ '../../generic',
+ '../../xpcom',
+ ]
+
+ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+ LOCAL_INCLUDES += [
+ '/accessible/atk',
+ ]
+ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ LOCAL_INCLUDES += [
+ '/accessible/mac',
+ ]
+ else:
+ LOCAL_INCLUDES += [
+ '/accessible/other',
+ ]
+
+include('/ipc/chromium/chromium-config.mozbuild')
+
+if CONFIG['GNU_CXX']:
+ CXXFLAGS += ['-Wno-error=shadow']
+
+FINAL_LIBRARY = 'xul'
+