summaryrefslogtreecommitdiffstats
path: root/accessible/ipc/other
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /accessible/ipc/other
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/ipc/other')
-rw-r--r--accessible/ipc/other/DocAccessibleChild.cpp1590
-rw-r--r--accessible/ipc/other/DocAccessibleChild.h465
-rw-r--r--accessible/ipc/other/PDocAccessible.ipdl357
-rw-r--r--accessible/ipc/other/RemoteAccessible.cpp989
-rw-r--r--accessible/ipc/other/RemoteAccessible.h107
-rw-r--r--accessible/ipc/other/moz.build51
6 files changed, 3559 insertions, 0 deletions
diff --git a/accessible/ipc/other/DocAccessibleChild.cpp b/accessible/ipc/other/DocAccessibleChild.cpp
new file mode 100644
index 0000000000..6a0987d07b
--- /dev/null
+++ b/accessible/ipc/other/DocAccessibleChild.cpp
@@ -0,0 +1,1590 @@
+/* -*- 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 "AccAttributes.h"
+#include "nsAccessibilityService.h"
+#include "LocalAccessible-inl.h"
+#include "RemoteAccessible.h"
+#include "Relation.h"
+#include "HyperTextAccessible-inl.h"
+#include "TextLeafAccessible.h"
+#include "ImageAccessible.h"
+#include "TableAccessible.h"
+#include "TableCellAccessible.h"
+#include "nsAccUtils.h"
+#ifdef MOZ_ACCESSIBILITY_ATK
+# include "AccessibleWrap.h"
+#endif
+#include "AccAttributes.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/a11y/DocAccessiblePlatformExtChild.h"
+
+namespace mozilla {
+namespace a11y {
+
+LocalAccessible* DocAccessibleChild::IdToAccessibleLink(
+ const uint64_t& aID) const {
+ LocalAccessible* acc = IdToAccessible(aID);
+ return acc && acc->IsLink() ? acc : nullptr;
+}
+
+LocalAccessible* DocAccessibleChild::IdToAccessibleSelect(
+ const uint64_t& aID) const {
+ LocalAccessible* acc = IdToAccessible(aID);
+ return acc && acc->IsSelect() ? acc : nullptr;
+}
+
+TextLeafAccessible* DocAccessibleChild::IdToTextLeafAccessible(
+ const uint64_t& aID) const {
+ LocalAccessible* acc = IdToAccessible(aID);
+ return acc && acc->IsTextLeaf() ? acc->AsTextLeaf() : nullptr;
+}
+
+ImageAccessible* DocAccessibleChild::IdToImageAccessible(
+ const uint64_t& aID) const {
+ LocalAccessible* acc = IdToAccessible(aID);
+ return (acc && acc->IsImage()) ? acc->AsImage() : nullptr;
+}
+
+TableCellAccessible* DocAccessibleChild::IdToTableCellAccessible(
+ const uint64_t& aID) const {
+ LocalAccessible* acc = IdToAccessible(aID);
+ return (acc && acc->IsTableCell()) ? acc->AsTableCell() : nullptr;
+}
+
+TableAccessible* DocAccessibleChild::IdToTableAccessible(
+ const uint64_t& aID) const {
+ LocalAccessible* acc = IdToAccessible(aID);
+ return (acc && acc->IsTable()) ? acc->AsTable() : nullptr;
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvState(const uint64_t& aID,
+ uint64_t* aState) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ *aState = states::DEFUNCT;
+ return IPC_OK();
+ }
+
+ *aState = acc->State();
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvNativeState(const uint64_t& aID,
+ uint64_t* aState) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ *aState = states::DEFUNCT;
+ return IPC_OK();
+ }
+
+ *aState = acc->NativeState();
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvName(const uint64_t& aID,
+ nsString* aName,
+ uint32_t* aFlag) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) return IPC_OK();
+
+ *aFlag = acc->Name(*aName);
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvValue(const uint64_t& aID,
+ nsString* aValue) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return IPC_OK();
+ }
+
+ acc->Value(*aValue);
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvHelp(const uint64_t& aID,
+ nsString* aHelp) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return IPC_OK();
+ }
+
+ acc->Help(*aHelp);
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvDescription(const uint64_t& aID,
+ nsString* aDesc) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) return IPC_OK();
+
+ acc->Description(*aDesc);
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvAttributes(
+ const uint64_t& aID, RefPtr<AccAttributes>* aAttributes) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) return IPC_OK();
+
+ *aAttributes = acc->Attributes();
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvRelationByType(
+ const uint64_t& aID, const uint32_t& aType, nsTArray<uint64_t>* aTargets) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) return IPC_OK();
+
+ auto type = static_cast<RelationType>(aType);
+ Relation rel = acc->RelationByType(type);
+ while (LocalAccessible* target = rel.LocalNext()) {
+ aTargets->AppendElement(reinterpret_cast<uint64_t>(target->UniqueID()));
+ }
+
+ return IPC_OK();
+}
+
+static void AddRelation(LocalAccessible* aAcc, RelationType aType,
+ nsTArray<RelationTargets>* aTargets) {
+ Relation rel = aAcc->RelationByType(aType);
+ nsTArray<uint64_t> targets;
+ while (LocalAccessible* target = rel.LocalNext()) {
+ targets.AppendElement(reinterpret_cast<uint64_t>(target->UniqueID()));
+ }
+
+ if (!targets.IsEmpty()) {
+ RelationTargets* newRelation = aTargets->AppendElement(
+ RelationTargets(static_cast<uint32_t>(aType), nsTArray<uint64_t>()));
+ newRelation->Targets() = std::move(targets);
+ }
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvRelations(
+ const uint64_t& aID, nsTArray<RelationTargets>* aRelations) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) return IPC_OK();
+
+#define RELATIONTYPE(gecko, s, a, m, i) \
+ AddRelation(acc, RelationType::gecko, aRelations);
+
+#include "RelationTypeMap.h"
+#undef RELATIONTYPE
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvIsSearchbox(const uint64_t& aID,
+ bool* aRetVal) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) return IPC_OK();
+
+ *aRetVal = acc->IsSearchbox();
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvLandmarkRole(
+ const uint64_t& aID, nsString* aLandmark) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return IPC_OK();
+ }
+
+ if (nsAtom* roleAtom = acc->LandmarkRole()) {
+ roleAtom->ToString(*aLandmark);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvGroupPosition(
+ const uint64_t& aID, int32_t* aLevel, int32_t* aSimilarItemsInGroup,
+ int32_t* aPositionInGroup) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ GroupPos groupPos = acc->GroupPosition();
+ *aLevel = groupPos.level;
+ *aSimilarItemsInGroup = groupPos.setSize;
+ *aPositionInGroup = groupPos.posInSet;
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvScrollToPoint(
+ const uint64_t& aID, const uint32_t& aScrollType, const int32_t& aX,
+ const int32_t& aY) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->ScrollToPoint(aScrollType, aX, aY);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvAnnounce(
+ const uint64_t& aID, const nsAString& aAnnouncement,
+ const uint16_t& aPriority) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->Announce(aAnnouncement, aPriority);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvCaretLineNumber(
+ const uint64_t& aID, int32_t* aLineNumber) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aLineNumber = acc && acc->IsTextRole() ? acc->CaretLineNumber() : 0;
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvCaretOffset(const uint64_t& aID,
+ int32_t* aOffset) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aOffset = acc && acc->IsTextRole() ? acc->CaretOffset() : 0;
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvCharacterCount(
+ const uint64_t& aID, int32_t* aCount) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aCount = acc ? acc->CharacterCount() : 0;
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvSelectionCount(
+ const uint64_t& aID, int32_t* aCount) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aCount = acc ? acc->SelectionCount() : 0;
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTextSubstring(
+ const uint64_t& aID, const int32_t& aStartOffset, const int32_t& aEndOffset,
+ nsString* aText, bool* aValid) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return IPC_OK();
+ }
+
+ TextLeafAccessible* leaf = acc->AsTextLeaf();
+ if (leaf) {
+ if (aStartOffset != 0 || aEndOffset != -1) {
+ // We don't support fetching partial text from a leaf.
+ *aValid = false;
+ return IPC_OK();
+ }
+ *aValid = true;
+ *aText = leaf->Text();
+ return IPC_OK();
+ }
+
+ HyperTextAccessible* hyper = acc->AsHyperText();
+ if (!hyper) {
+ return IPC_OK();
+ }
+
+ *aValid = hyper->IsValidRange(aStartOffset, aEndOffset);
+ hyper->TextSubstring(aStartOffset, aEndOffset, *aText);
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTextAttributes(
+ const uint64_t& aID, const bool& aIncludeDefAttrs, const int32_t& aOffset,
+ RefPtr<AccAttributes>* aAttributes, int32_t* aStartOffset,
+ int32_t* aEndOffset) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (!acc || !acc->IsTextRole()) {
+ return IPC_OK();
+ }
+
+ *aAttributes =
+ acc->TextAttributes(aIncludeDefAttrs, aOffset, aStartOffset, aEndOffset);
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvDefaultTextAttributes(
+ const uint64_t& aID, RefPtr<AccAttributes>* aAttributes) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (!acc || !acc->IsTextRole()) {
+ return IPC_OK();
+ }
+
+ *aAttributes = acc->DefaultTextAttributes();
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTextBounds(
+ const uint64_t& aID, const int32_t& aStartOffset, const int32_t& aEndOffset,
+ const uint32_t& aCoordType, LayoutDeviceIntRect* aRetVal) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aRetVal = acc->TextBounds(aStartOffset, aEndOffset, aCoordType);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvCharBounds(
+ const uint64_t& aID, const int32_t& aOffset, const uint32_t& aCoordType,
+ LayoutDeviceIntRect* aRetVal) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aRetVal = acc->CharBounds(aOffset, aCoordType);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvText(const uint64_t& aID,
+ nsString* aText) {
+ TextLeafAccessible* acc = IdToTextLeafAccessible(aID);
+ if (acc) {
+ *aText = acc->Text();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvReplaceText(
+ const uint64_t& aID, const nsAString& aText) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ acc->ReplaceText(aText);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvInsertText(
+ const uint64_t& aID, const nsAString& aText, const int32_t& aPosition,
+ bool* aValid) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aValid = acc->IsValidOffset(aPosition);
+ acc->InsertText(aText, aPosition);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvPasteText(
+ const uint64_t& aID, const int32_t& aPosition, bool* aValid) {
+ RefPtr<HyperTextAccessible> acc = IdToHyperTextAccessible(aID);
+ if (acc && acc->IsTextRole()) {
+ *aValid = acc->IsValidOffset(aPosition);
+ acc->PasteText(aPosition);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvImagePosition(
+ const uint64_t& aID, const uint32_t& aCoordType,
+ LayoutDeviceIntPoint* aRetVal) {
+ ImageAccessible* acc = IdToImageAccessible(aID);
+ if (acc) {
+ *aRetVal = acc->Position(aCoordType);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvImageSize(
+ const uint64_t& aID, LayoutDeviceIntSize* aRetVal) {
+ ImageAccessible* acc = IdToImageAccessible(aID);
+ if (acc) {
+ *aRetVal = acc->Size();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvStartOffset(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk) {
+ LocalAccessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ *aRetVal = acc->StartOffset();
+ *aOk = true;
+ } else {
+ *aRetVal = 0;
+ *aOk = false;
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvEndOffset(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk) {
+ LocalAccessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ *aRetVal = acc->EndOffset();
+ *aOk = true;
+ } else {
+ *aRetVal = 0;
+ *aOk = false;
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvIsLinkValid(const uint64_t& aID,
+ bool* aRetVal) {
+ LocalAccessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ *aRetVal = acc->IsLinkValid();
+ } else {
+ *aRetVal = false;
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvAnchorCount(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk) {
+ LocalAccessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ *aRetVal = acc->AnchorCount();
+ *aOk = true;
+ } else {
+ *aRetVal = 0;
+ *aOk = false;
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvAnchorURIAt(
+ const uint64_t& aID, const uint32_t& aIndex, nsCString* aURI, bool* aOk) {
+ LocalAccessible* acc = IdToAccessibleLink(aID);
+ *aOk = false;
+ if (acc) {
+ nsCOMPtr<nsIURI> uri = acc->AnchorURIAt(aIndex);
+ if (uri) {
+ uri->GetSpec(*aURI);
+ *aOk = true;
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvAnchorAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aIDOfAnchor,
+ bool* aOk) {
+ *aIDOfAnchor = 0;
+ *aOk = false;
+ LocalAccessible* acc = IdToAccessibleLink(aID);
+ if (acc) {
+ LocalAccessible* anchor = acc->AnchorAt(aIndex);
+ if (anchor) {
+ *aIDOfAnchor = reinterpret_cast<uint64_t>(anchor->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvLinkCount(const uint64_t& aID,
+ uint32_t* aCount) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aCount = acc ? acc->LinkCount() : 0;
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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) {
+ LocalAccessible* link = acc->LinkAt(aIndex);
+ if (link) {
+ *aIDOfLink = reinterpret_cast<uint64_t>(link->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvLinkIndexAtOffset(
+ const uint64_t& aID, const uint32_t& aOffset, int32_t* aIndex) {
+ HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
+ *aIndex = acc ? acc->LinkIndexAtOffset(aOffset) : -1;
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvColIdx(const uint64_t& aID,
+ uint32_t* aIndex) {
+ *aIndex = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aIndex = acc->ColIdx();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvRowIdx(const uint64_t& aID,
+ uint32_t* aIndex) {
+ *aIndex = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aIndex = acc->RowIdx();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvGetPosition(const uint64_t& aID,
+ uint32_t* aRowIdx,
+ uint32_t* aColIdx) {
+ *aColIdx = 0;
+ *aRowIdx = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aColIdx = acc->ColIdx();
+ *aRowIdx = acc->RowIdx();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvColExtent(const uint64_t& aID,
+ uint32_t* aExtent) {
+ *aExtent = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aExtent = acc->ColExtent();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvRowExtent(const uint64_t& aID,
+ uint32_t* aExtent) {
+ *aExtent = 0;
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ if (acc) {
+ *aExtent = acc->RowExtent();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 (Accessible* header : headerCells) {
+ aCells->AppendElement(header->ID());
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 (Accessible* header : headerCells) {
+ aCells->AppendElement(header->ID());
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvIsCellSelected(
+ const uint64_t& aID, bool* aSelected) {
+ TableCellAccessible* acc = IdToTableCellAccessible(aID);
+ *aSelected = acc && acc->Selected();
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableCaption(
+ const uint64_t& aID, uint64_t* aCaptionID, bool* aOk) {
+ *aCaptionID = 0;
+ *aOk = false;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ LocalAccessible* caption = acc->Caption();
+ if (caption) {
+ *aCaptionID = reinterpret_cast<uint64_t>(caption->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableSummary(
+ const uint64_t& aID, nsString* aSummary) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->Summary(*aSummary);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableColumnCount(
+ const uint64_t& aID, uint32_t* aColCount) {
+ *aColCount = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aColCount = acc->ColCount();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableRowCount(
+ const uint64_t& aID, uint32_t* aRowCount) {
+ *aRowCount = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aRowCount = acc->RowCount();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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) {
+ LocalAccessible* cell = acc->CellAt(aRow, aCol);
+ if (cell) {
+ *aCellID = reinterpret_cast<uint64_t>(cell->UniqueID());
+ *aOk = true;
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableColumnDescription(
+ const uint64_t& aID, const uint32_t& aCol, nsString* aDescription) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->ColDescription(aCol, *aDescription);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableRowDescription(
+ const uint64_t& aID, const uint32_t& aRow, nsString* aDescription) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->RowDescription(aRow, *aDescription);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableSelectedCellCount(
+ const uint64_t& aID, uint32_t* aSelectedCells) {
+ *aSelectedCells = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aSelectedCells = acc->SelectedCellCount();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableSelectedColumnCount(
+ const uint64_t& aID, uint32_t* aSelectedColumns) {
+ *aSelectedColumns = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aSelectedColumns = acc->SelectedColCount();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableSelectedRowCount(
+ const uint64_t& aID, uint32_t* aSelectedRows) {
+ *aSelectedRows = 0;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aSelectedRows = acc->SelectedRowCount();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 (Accessible* cell : cells) {
+ aCellIDs->AppendElement(cell->ID());
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableSelectedCellIndices(
+ const uint64_t& aID, nsTArray<uint32_t>* aCellIndices) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectedCellIndices(aCellIndices);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableSelectedColumnIndices(
+ const uint64_t& aID, nsTArray<uint32_t>* aColumnIndices) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectedColIndices(aColumnIndices);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableSelectedRowIndices(
+ const uint64_t& aID, nsTArray<uint32_t>* aRowIndices) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectedRowIndices(aRowIndices);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableSelectColumn(
+ const uint64_t& aID, const uint32_t& aCol) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectCol(aCol);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableSelectRow(
+ const uint64_t& aID, const uint32_t& aRow) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->SelectRow(aRow);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableUnselectColumn(
+ const uint64_t& aID, const uint32_t& aCol) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->UnselectCol(aCol);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableUnselectRow(
+ const uint64_t& aID, const uint32_t& aRow) {
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ acc->UnselectRow(aRow);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTableIsProbablyForLayout(
+ const uint64_t& aID, bool* aForLayout) {
+ *aForLayout = false;
+ TableAccessible* acc = IdToTableAccessible(aID);
+ if (acc) {
+ *aForLayout = acc->IsProbablyLayoutTable();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 = header->ID();
+ *aOk = true;
+ }
+ }
+#endif
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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 = header->ID();
+ *aOk = true;
+ }
+ }
+#endif
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvSelectedItems(
+ const uint64_t& aID, nsTArray<uint64_t>* aSelectedItemIDs) {
+ LocalAccessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ AutoTArray<Accessible*, 10> selectedItems;
+ acc->SelectedItems(&selectedItems);
+ aSelectedItemIDs->SetCapacity(selectedItems.Length());
+ for (Accessible* item : selectedItems) {
+ aSelectedItemIDs->AppendElement(
+ reinterpret_cast<uint64_t>(item->AsLocal()->UniqueID()));
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvSelectedItemCount(
+ const uint64_t& aID, uint32_t* aCount) {
+ *aCount = 0;
+ LocalAccessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aCount = acc->SelectedItemCount();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvGetSelectedItem(
+ const uint64_t& aID, const uint32_t& aIndex, uint64_t* aSelected,
+ bool* aOk) {
+ LocalAccessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ Accessible* selected = acc->GetSelectedItem(aIndex);
+ *aSelected = reinterpret_cast<uint64_t>(selected->AsLocal()->UniqueID());
+ }
+
+ *aOk = !!acc;
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvIsItemSelected(
+ const uint64_t& aID, const uint32_t& aIndex, bool* aSelected) {
+ *aSelected = false;
+ LocalAccessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSelected = acc->IsItemSelected(aIndex);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvAddItemToSelection(
+ const uint64_t& aID, const uint32_t& aIndex, bool* aSuccess) {
+ *aSuccess = false;
+ LocalAccessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSuccess = acc->AddItemToSelection(aIndex);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvRemoveItemFromSelection(
+ const uint64_t& aID, const uint32_t& aIndex, bool* aSuccess) {
+ *aSuccess = false;
+ LocalAccessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSuccess = acc->RemoveItemFromSelection(aIndex);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvSelectAll(const uint64_t& aID,
+ bool* aSuccess) {
+ *aSuccess = false;
+ LocalAccessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSuccess = acc->SelectAll();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvUnselectAll(const uint64_t& aID,
+ bool* aSuccess) {
+ *aSuccess = false;
+ LocalAccessible* acc = IdToAccessibleSelect(aID);
+ if (acc) {
+ *aSuccess = acc->UnselectAll();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvDoAction(const uint64_t& aID,
+ const uint8_t& aIndex,
+ bool* aSuccess) {
+ *aSuccess = false;
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aSuccess = acc->DoAction(aIndex);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvActionCount(const uint64_t& aID,
+ uint8_t* aCount) {
+ *aCount = 0;
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aCount = acc->ActionCount();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvActionNameAt(
+ const uint64_t& aID, const uint8_t& aIndex, nsString* aName) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->ActionNameAt(aIndex, *aName);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvAccessKey(
+ const uint64_t& aID, uint32_t* aKey, uint32_t* aModifierMask) {
+ *aKey = 0;
+ *aModifierMask = 0;
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ KeyBinding kb = acc->AccessKey();
+ *aKey = kb.Key();
+ *aModifierMask = kb.ModifierMask();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvAtkKeyBinding(
+ const uint64_t& aID, nsString* aResult) {
+#ifdef MOZ_ACCESSIBILITY_ATK
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ AccessibleWrap::GetKeyBinding(acc, *aResult);
+ }
+#endif
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvCurValue(const uint64_t& aID,
+ double* aValue) {
+ *aValue = UnspecifiedNaN<double>();
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aValue = acc->CurValue();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvSetCurValue(
+ const uint64_t& aID, const double& aValue, bool* aRetVal) {
+ *aRetVal = false;
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aRetVal = acc->SetCurValue(aValue);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvMinValue(const uint64_t& aID,
+ double* aValue) {
+ *aValue = UnspecifiedNaN<double>();
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aValue = acc->MinValue();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvMaxValue(const uint64_t& aID,
+ double* aValue) {
+ *aValue = UnspecifiedNaN<double>();
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aValue = acc->MaxValue();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvStep(const uint64_t& aID,
+ double* aStep) {
+ *aStep = UnspecifiedNaN<double>();
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ *aStep = acc->Step();
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvLanguage(const uint64_t& aID,
+ nsString* aLocale) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ acc->Language(*aLocale);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvDocType(const uint64_t& aID,
+ nsString* aType) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc && acc->IsDoc()) {
+ acc->AsDoc()->DocType(*aType);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvTitle(const uint64_t& aID,
+ nsString* aTitle) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc) {
+ mozilla::ErrorResult rv;
+ acc->GetContent()->GetTextContent(*aTitle, rv);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvMimeType(const uint64_t& aID,
+ nsString* aMime) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc && acc->IsDoc()) {
+ acc->AsDoc()->MimeType(*aMime);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvURLDocTypeMimeType(
+ const uint64_t& aID, nsString* aURL, nsString* aDocType,
+ nsString* aMimeType) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc && acc->IsDoc()) {
+ DocAccessible* doc = acc->AsDoc();
+ doc->URL(*aURL);
+ doc->DocType(*aDocType);
+ doc->MimeType(*aMimeType);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvChildAtPoint(
+ const uint64_t& aID, const int32_t& aX, const int32_t& aY,
+ const uint32_t& aWhich, PDocAccessibleChild** aResultDoc,
+ uint64_t* aResultID) {
+ *aResultDoc = nullptr;
+ *aResultID = 0;
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc && !acc->IsDefunct()) {
+ int32_t x = aX;
+ int32_t y = aY;
+ LocalAccessible* result = acc->LocalChildAtPoint(
+ x, y, static_cast<LocalAccessible::EWhichChildAtPoint>(aWhich));
+ if (result) {
+ // LocalAccessible::ChildAtPoint can return a LocalAccessible from a
+ // descendant document.
+ DocAccessibleChild* resultDoc = result->Document()->IPCDoc();
+ // We've sent the constructor for this document to the parent process.
+ // However, because the constructor is async, the parent process might
+ // get the result of this (sync) method before it runs the constructor.
+ // If we send this document in this case, the parent process will crash.
+ // Therefore, we only do this if the parent process has explicitly told
+ // us that the document has been constructed there.
+ if (resultDoc && resultDoc->IsConstructedInParentProcess()) {
+ *aResultDoc = resultDoc;
+ *aResultID = result->IsDoc()
+ ? 0
+ : reinterpret_cast<uint64_t>(result->UniqueID());
+ }
+ }
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult 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;
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc && !acc->IsDefunct()) {
+ LayoutDeviceIntRect screenRect = acc->Bounds();
+ if (!screenRect.IsEmpty()) {
+ if (aNeedsScreenCoords) {
+ LayoutDeviceIntPoint winCoords =
+ nsAccUtils::GetScreenCoordsForWindow(acc);
+ screenRect.x -= winCoords.x;
+ screenRect.y -= winCoords.y;
+ }
+
+ *aWidth = screenRect.width;
+ *aHeight = screenRect.height;
+ }
+ // We should always report the position of our acc, even if
+ // the returned screenRect is empty.
+ *aX = screenRect.x;
+ *aY = screenRect.y;
+ }
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvExtentsInCSSPixels(
+ const uint64_t& aID, int32_t* aX, int32_t* aY, int32_t* aWidth,
+ int32_t* aHeight) {
+ *aX = 0;
+ *aY = 0;
+ *aWidth = 0;
+ *aHeight = 0;
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (acc && !acc->IsDefunct()) {
+ nsIntRect screenRect = acc->BoundsInCSSPixels();
+ if (!screenRect.IsEmpty()) {
+ *aWidth = screenRect.width;
+ *aHeight = screenRect.height;
+ }
+ // We should always report the position of our acc, even if
+ // the returned screenRect is empty.
+ *aX = screenRect.x;
+ *aY = screenRect.y;
+ }
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvDOMNodeID(
+ const uint64_t& aID, nsString* aDOMNodeID) {
+ LocalAccessible* acc = IdToAccessible(aID);
+ if (!acc) {
+ return IPC_OK();
+ }
+
+ nsIContent* content = acc->GetContent();
+ if (!content) {
+ return IPC_OK();
+ }
+
+ nsAtom* id = content->GetID();
+ if (id) {
+ id->ToString(*aDOMNodeID);
+ }
+
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvConstructedInParentProcess() {
+ SetConstructedInParentProcess();
+ return IPC_OK();
+}
+
+mozilla::ipc::IPCResult DocAccessibleChild::RecvRestoreFocus() {
+ FocusMgr()->ForceFocusEvent();
+ return IPC_OK();
+}
+
+bool DocAccessibleChild::DeallocPDocAccessiblePlatformExtChild(
+ PDocAccessiblePlatformExtChild* aActor) {
+ delete aActor;
+ return true;
+}
+
+PDocAccessiblePlatformExtChild*
+DocAccessibleChild::AllocPDocAccessiblePlatformExtChild() {
+ return new DocAccessiblePlatformExtChild();
+}
+
+DocAccessiblePlatformExtChild* DocAccessibleChild::GetPlatformExtension() {
+ return static_cast<DocAccessiblePlatformExtChild*>(
+ SingleManagedOrNull(ManagedPDocAccessiblePlatformExtChild()));
+}
+
+} // namespace a11y
+} // namespace mozilla
diff --git a/accessible/ipc/other/DocAccessibleChild.h b/accessible/ipc/other/DocAccessibleChild.h
new file mode 100644
index 0000000000..8973cb6eba
--- /dev/null
+++ b/accessible/ipc/other/DocAccessibleChild.h
@@ -0,0 +1,465 @@
+/* -*- 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 LocalAccessible;
+class DocAccessiblePlatformExtChild;
+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 {
+ friend DocAccessiblePlatformExtChild;
+
+ public:
+ DocAccessibleChild(DocAccessible* aDoc, IProtocol* aManager)
+ : DocAccessibleChildBase(aDoc) {
+ MOZ_COUNT_CTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
+ SetManager(aManager);
+ }
+
+ ~DocAccessibleChild() {
+ MOZ_COUNT_DTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
+ }
+
+ virtual mozilla::ipc::IPCResult RecvConstructedInParentProcess() override;
+ virtual mozilla::ipc::IPCResult RecvRestoreFocus() override;
+
+ /*
+ * Return the state for the accessible with given ID.
+ */
+ virtual mozilla::ipc::IPCResult RecvState(const uint64_t& aID,
+ uint64_t* aState) override;
+
+ /*
+ * Return the native state for the accessible with given ID.
+ */
+ virtual mozilla::ipc::IPCResult RecvNativeState(const uint64_t& aID,
+ uint64_t* aState) override;
+
+ /*
+ * Get the name for the accessible with given id.
+ */
+ virtual mozilla::ipc::IPCResult RecvName(const uint64_t& aID, nsString* aName,
+ uint32_t* aFlag) override;
+
+ virtual mozilla::ipc::IPCResult RecvValue(const uint64_t& aID,
+ nsString* aValue) override;
+
+ virtual mozilla::ipc::IPCResult RecvHelp(const uint64_t& aID,
+ nsString* aHelp) override;
+
+ /*
+ * Get the description for the accessible with given id.
+ */
+ virtual mozilla::ipc::IPCResult RecvDescription(const uint64_t& aID,
+ nsString* aDesc) override;
+ virtual mozilla::ipc::IPCResult RecvRelationByType(
+ const uint64_t& aID, const uint32_t& aType,
+ nsTArray<uint64_t>* aTargets) override;
+ virtual mozilla::ipc::IPCResult RecvRelations(
+ const uint64_t& aID, nsTArray<RelationTargets>* aRelations) override;
+
+ virtual mozilla::ipc::IPCResult RecvIsSearchbox(const uint64_t& aID,
+ bool* aRetVal) override;
+
+ virtual mozilla::ipc::IPCResult RecvLandmarkRole(
+ const uint64_t& aID, nsString* aLandmark) override;
+
+ virtual mozilla::ipc::IPCResult RecvGroupPosition(
+ const uint64_t& aID, int32_t* aLevel, int32_t* aSimilarItemsInGroup,
+ int32_t* aPositionInGroup) override;
+
+ virtual mozilla::ipc::IPCResult RecvAttributes(
+ const uint64_t& aID, RefPtr<AccAttributes>* aAttributes) override;
+ virtual mozilla::ipc::IPCResult RecvScrollToPoint(const uint64_t& aID,
+ const uint32_t& aScrollType,
+ const int32_t& aX,
+ const int32_t& aY) override;
+
+ virtual mozilla::ipc::IPCResult RecvAnnounce(
+ const uint64_t& aID, const nsAString& aAnnouncement,
+ const uint16_t& aPriority) override;
+
+ virtual mozilla::ipc::IPCResult RecvCaretLineNumber(
+ const uint64_t& aID, int32_t* aLineNumber) override;
+ virtual mozilla::ipc::IPCResult RecvCaretOffset(const uint64_t& aID,
+ int32_t* aOffset) override;
+
+ virtual mozilla::ipc::IPCResult RecvCharacterCount(const uint64_t& aID,
+ int32_t* aCount) override;
+ virtual mozilla::ipc::IPCResult RecvSelectionCount(const uint64_t& aID,
+ int32_t* aCount) override;
+
+ virtual mozilla::ipc::IPCResult RecvTextSubstring(const uint64_t& aID,
+ const int32_t& aStartOffset,
+ const int32_t& aEndOffset,
+ nsString* aText,
+ bool* aValid) override;
+
+ virtual mozilla::ipc::IPCResult RecvGetTextAfterOffset(
+ const uint64_t& aID, const int32_t& aOffset, const int32_t& aBoundaryType,
+ nsString* aText, int32_t* aStartOffset, int32_t* aEndOffset) override;
+ virtual mozilla::ipc::IPCResult RecvGetTextAtOffset(
+ const uint64_t& aID, const int32_t& aOffset, const int32_t& aBoundaryType,
+ nsString* aText, int32_t* aStartOffset, int32_t* aEndOffset) override;
+ virtual mozilla::ipc::IPCResult RecvGetTextBeforeOffset(
+ const uint64_t& aID, const int32_t& aOffset, const int32_t& aBoundaryType,
+ nsString* aText, int32_t* aStartOffset, int32_t* aEndOffset) override;
+
+ virtual mozilla::ipc::IPCResult RecvCharAt(const uint64_t& aID,
+ const int32_t& aOffset,
+ uint16_t* aChar) override;
+
+ virtual mozilla::ipc::IPCResult RecvTextAttributes(
+ const uint64_t& aID, const bool& aIncludeDefAttrs, const int32_t& aOffset,
+ RefPtr<AccAttributes>* aAttributes, int32_t* aStartOffset,
+ int32_t* aEndOffset) override;
+
+ virtual mozilla::ipc::IPCResult RecvDefaultTextAttributes(
+ const uint64_t& aID, RefPtr<AccAttributes>* aAttributes) override;
+
+ virtual mozilla::ipc::IPCResult RecvTextBounds(
+ const uint64_t& aID, const int32_t& aStartOffset,
+ const int32_t& aEndOffset, const uint32_t& aCoordType,
+ LayoutDeviceIntRect* aRetVal) override;
+
+ virtual mozilla::ipc::IPCResult RecvCharBounds(
+ const uint64_t& aID, const int32_t& aOffset, const uint32_t& aCoordType,
+ LayoutDeviceIntRect* aRetVal) override;
+
+ virtual mozilla::ipc::IPCResult RecvOffsetAtPoint(const uint64_t& aID,
+ const int32_t& aX,
+ const int32_t& aY,
+ const uint32_t& aCoordType,
+ int32_t* aRetVal) override;
+
+ virtual mozilla::ipc::IPCResult RecvSelectionBoundsAt(
+ const uint64_t& aID, const int32_t& aSelectionNum, bool* aSucceeded,
+ nsString* aData, int32_t* aStartOffset, int32_t* aEndOffset) override;
+
+ virtual mozilla::ipc::IPCResult RecvSetSelectionBoundsAt(
+ const uint64_t& aID, const int32_t& aSelectionNum,
+ const int32_t& aStartOffset, const int32_t& aEndOffset,
+ bool* aSucceeded) override;
+
+ virtual mozilla::ipc::IPCResult RecvAddToSelection(
+ const uint64_t& aID, const int32_t& aStartOffset,
+ const int32_t& aEndOffset, bool* aSucceeded) override;
+
+ virtual mozilla::ipc::IPCResult RecvRemoveFromSelection(
+ const uint64_t& aID, const int32_t& aSelectionNum,
+ bool* aSucceeded) override;
+
+ virtual mozilla::ipc::IPCResult RecvScrollSubstringTo(
+ const uint64_t& aID, const int32_t& aStartOffset,
+ const int32_t& aEndOffset, const uint32_t& aScrollType) override;
+
+ virtual mozilla::ipc::IPCResult 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 mozilla::ipc::IPCResult RecvText(const uint64_t& aID,
+ nsString* aText) override;
+
+ virtual mozilla::ipc::IPCResult RecvReplaceText(
+ const uint64_t& aID, const nsAString& aText) override;
+
+ virtual mozilla::ipc::IPCResult RecvInsertText(const uint64_t& aID,
+ const nsAString& aText,
+ const int32_t& aPosition,
+ bool* aValid) override;
+
+ virtual mozilla::ipc::IPCResult RecvCopyText(const uint64_t& aID,
+ const int32_t& aStartPos,
+ const int32_t& aEndPos,
+ bool* aValid) override;
+
+ virtual mozilla::ipc::IPCResult RecvCutText(const uint64_t& aID,
+ const int32_t& aStartPos,
+ const int32_t& aEndPos,
+ bool* aValid) override;
+
+ virtual mozilla::ipc::IPCResult RecvDeleteText(const uint64_t& aID,
+ const int32_t& aStartPos,
+ const int32_t& aEndPos,
+ bool* aValid) override;
+
+ MOZ_CAN_RUN_SCRIPT_BOUNDARY
+ virtual mozilla::ipc::IPCResult RecvPasteText(const uint64_t& aID,
+ const int32_t& aPosition,
+ bool* aValid) override;
+
+ virtual mozilla::ipc::IPCResult RecvImagePosition(
+ const uint64_t& aID, const uint32_t& aCoordType,
+ LayoutDeviceIntPoint* aRetVal) override;
+
+ virtual mozilla::ipc::IPCResult RecvImageSize(
+ const uint64_t& aID, LayoutDeviceIntSize* aRetVal) override;
+
+ virtual mozilla::ipc::IPCResult RecvStartOffset(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk) override;
+ virtual mozilla::ipc::IPCResult RecvEndOffset(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk) override;
+ virtual mozilla::ipc::IPCResult RecvIsLinkValid(const uint64_t& aID,
+ bool* aRetVal) override;
+ virtual mozilla::ipc::IPCResult RecvAnchorCount(const uint64_t& aID,
+ uint32_t* aRetVal,
+ bool* aOk) override;
+ virtual mozilla::ipc::IPCResult RecvAnchorURIAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ nsCString* aURI,
+ bool* aOk) override;
+ virtual mozilla::ipc::IPCResult RecvAnchorAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aIDOfAnchor,
+ bool* aOk) override;
+
+ virtual mozilla::ipc::IPCResult RecvLinkCount(const uint64_t& aID,
+ uint32_t* aCount) override;
+
+ virtual mozilla::ipc::IPCResult RecvLinkAt(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aIDOfLink,
+ bool* aOk) override;
+
+ virtual mozilla::ipc::IPCResult RecvLinkIndexAtOffset(
+ const uint64_t& aID, const uint32_t& aOffset, int32_t* aIndex) override;
+
+ virtual mozilla::ipc::IPCResult RecvTableOfACell(const uint64_t& aID,
+ uint64_t* aTableID,
+ bool* aOk) override;
+
+ virtual mozilla::ipc::IPCResult RecvColIdx(const uint64_t& aID,
+ uint32_t* aIndex) override;
+
+ virtual mozilla::ipc::IPCResult RecvRowIdx(const uint64_t& aID,
+ uint32_t* aIndex) override;
+
+ virtual mozilla::ipc::IPCResult RecvColExtent(const uint64_t& aID,
+ uint32_t* aExtent) override;
+
+ virtual mozilla::ipc::IPCResult RecvGetPosition(const uint64_t& aID,
+ uint32_t* aRowIdx,
+ uint32_t* aColIdx) override;
+
+ virtual mozilla::ipc::IPCResult RecvGetColRowExtents(
+ const uint64_t& aID, uint32_t* aColIdx, uint32_t* aRowIdx,
+ uint32_t* aColExtent, uint32_t* aRowExtent) override;
+
+ virtual mozilla::ipc::IPCResult RecvRowExtent(const uint64_t& aID,
+ uint32_t* aExtent) override;
+
+ virtual mozilla::ipc::IPCResult RecvColHeaderCells(
+ const uint64_t& aID, nsTArray<uint64_t>* aCells) override;
+
+ virtual mozilla::ipc::IPCResult RecvRowHeaderCells(
+ const uint64_t& aID, nsTArray<uint64_t>* aCells) override;
+
+ virtual mozilla::ipc::IPCResult RecvIsCellSelected(const uint64_t& aID,
+ bool* aSelected) override;
+
+ virtual mozilla::ipc::IPCResult RecvTableCaption(const uint64_t& aID,
+ uint64_t* aCaptionID,
+ bool* aOk) override;
+ virtual mozilla::ipc::IPCResult RecvTableSummary(const uint64_t& aID,
+ nsString* aSummary) override;
+ virtual mozilla::ipc::IPCResult RecvTableColumnCount(
+ const uint64_t& aID, uint32_t* aColCount) override;
+ virtual mozilla::ipc::IPCResult RecvTableRowCount(
+ const uint64_t& aID, uint32_t* aRowCount) override;
+ virtual mozilla::ipc::IPCResult RecvTableCellAt(const uint64_t& aID,
+ const uint32_t& aRow,
+ const uint32_t& aCol,
+ uint64_t* aCellID,
+ bool* aOk) override;
+ virtual mozilla::ipc::IPCResult RecvTableCellIndexAt(
+ const uint64_t& aID, const uint32_t& aRow, const uint32_t& aCol,
+ int32_t* aIndex) override;
+ virtual mozilla::ipc::IPCResult RecvTableColumnIndexAt(
+ const uint64_t& aID, const uint32_t& aCellIndex, int32_t* aCol) override;
+ virtual mozilla::ipc::IPCResult RecvTableRowIndexAt(
+ const uint64_t& aID, const uint32_t& aCellIndex, int32_t* aRow) override;
+ virtual mozilla::ipc::IPCResult RecvTableRowAndColumnIndicesAt(
+ const uint64_t& aID, const uint32_t& aCellIndex, int32_t* aRow,
+ int32_t* aCol) override;
+ virtual mozilla::ipc::IPCResult RecvTableColumnExtentAt(
+ const uint64_t& aID, const uint32_t& aRow, const uint32_t& aCol,
+ uint32_t* aExtent) override;
+ virtual mozilla::ipc::IPCResult RecvTableRowExtentAt(
+ const uint64_t& aID, const uint32_t& aRow, const uint32_t& aCol,
+ uint32_t* aExtent) override;
+ virtual mozilla::ipc::IPCResult RecvTableColumnDescription(
+ const uint64_t& aID, const uint32_t& aCol,
+ nsString* aDescription) override;
+ virtual mozilla::ipc::IPCResult RecvTableRowDescription(
+ const uint64_t& aID, const uint32_t& aRow,
+ nsString* aDescription) override;
+ virtual mozilla::ipc::IPCResult RecvTableColumnSelected(
+ const uint64_t& aID, const uint32_t& aCol, bool* aSelected) override;
+ virtual mozilla::ipc::IPCResult RecvTableRowSelected(
+ const uint64_t& aID, const uint32_t& aRow, bool* aSelected) override;
+ virtual mozilla::ipc::IPCResult RecvTableCellSelected(
+ const uint64_t& aID, const uint32_t& aRow, const uint32_t& aCol,
+ bool* aSelected) override;
+ virtual mozilla::ipc::IPCResult RecvTableSelectedCellCount(
+ const uint64_t& aID, uint32_t* aSelectedCells) override;
+ virtual mozilla::ipc::IPCResult RecvTableSelectedColumnCount(
+ const uint64_t& aID, uint32_t* aSelectedColumns) override;
+ virtual mozilla::ipc::IPCResult RecvTableSelectedRowCount(
+ const uint64_t& aID, uint32_t* aSelectedRows) override;
+ virtual mozilla::ipc::IPCResult RecvTableSelectedCells(
+ const uint64_t& aID, nsTArray<uint64_t>* aCellIDs) override;
+ virtual mozilla::ipc::IPCResult RecvTableSelectedCellIndices(
+ const uint64_t& aID, nsTArray<uint32_t>* aCellIndices) override;
+ virtual mozilla::ipc::IPCResult RecvTableSelectedColumnIndices(
+ const uint64_t& aID, nsTArray<uint32_t>* aColumnIndices) override;
+ virtual mozilla::ipc::IPCResult RecvTableSelectedRowIndices(
+ const uint64_t& aID, nsTArray<uint32_t>* aRowIndices) override;
+ virtual mozilla::ipc::IPCResult RecvTableSelectColumn(
+ const uint64_t& aID, const uint32_t& aCol) override;
+ virtual mozilla::ipc::IPCResult RecvTableSelectRow(
+ const uint64_t& aID, const uint32_t& aRow) override;
+ virtual mozilla::ipc::IPCResult RecvTableUnselectColumn(
+ const uint64_t& aID, const uint32_t& aCol) override;
+ virtual mozilla::ipc::IPCResult RecvTableUnselectRow(
+ const uint64_t& aID, const uint32_t& aRow) override;
+ virtual mozilla::ipc::IPCResult RecvTableIsProbablyForLayout(
+ const uint64_t& aID, bool* aForLayout) override;
+ virtual mozilla::ipc::IPCResult RecvAtkTableColumnHeader(const uint64_t& aID,
+ const int32_t& aCol,
+ uint64_t* aHeader,
+ bool* aOk) override;
+ virtual mozilla::ipc::IPCResult RecvAtkTableRowHeader(const uint64_t& aID,
+ const int32_t& aRow,
+ uint64_t* aHeader,
+ bool* aOk) override;
+
+ virtual mozilla::ipc::IPCResult RecvSelectedItems(
+ const uint64_t& aID, nsTArray<uint64_t>* aSelectedItemIDs) override;
+
+ virtual mozilla::ipc::IPCResult RecvSelectedItemCount(
+ const uint64_t& aID, uint32_t* aCount) override;
+
+ virtual mozilla::ipc::IPCResult RecvGetSelectedItem(const uint64_t& aID,
+ const uint32_t& aIndex,
+ uint64_t* aSelected,
+ bool* aOk) override;
+
+ virtual mozilla::ipc::IPCResult RecvIsItemSelected(const uint64_t& aID,
+ const uint32_t& aIndex,
+ bool* aSelected) override;
+
+ virtual mozilla::ipc::IPCResult RecvAddItemToSelection(
+ const uint64_t& aID, const uint32_t& aIndex, bool* aSuccess) override;
+
+ virtual mozilla::ipc::IPCResult RecvRemoveItemFromSelection(
+ const uint64_t& aID, const uint32_t& aIndex, bool* aSuccess) override;
+
+ virtual mozilla::ipc::IPCResult RecvSelectAll(const uint64_t& aID,
+ bool* aSuccess) override;
+
+ virtual mozilla::ipc::IPCResult RecvUnselectAll(const uint64_t& aID,
+ bool* aSuccess) override;
+
+ virtual mozilla::ipc::IPCResult RecvDoAction(const uint64_t& aID,
+ const uint8_t& aIndex,
+ bool* aSuccess) override;
+
+ virtual mozilla::ipc::IPCResult RecvActionCount(const uint64_t& aID,
+ uint8_t* aCount) override;
+
+ virtual mozilla::ipc::IPCResult RecvActionNameAt(const uint64_t& aID,
+ const uint8_t& aIndex,
+ nsString* aName) override;
+
+ virtual mozilla::ipc::IPCResult RecvAccessKey(
+ const uint64_t& aID, uint32_t* aKey, uint32_t* aModifierMask) override;
+
+ virtual mozilla::ipc::IPCResult RecvAtkKeyBinding(const uint64_t& aID,
+ nsString* aResult) override;
+
+ virtual mozilla::ipc::IPCResult RecvCurValue(const uint64_t& aID,
+ double* aValue) override;
+
+ virtual mozilla::ipc::IPCResult RecvSetCurValue(const uint64_t& aID,
+ const double& aValue,
+ bool* aRetVal) override;
+
+ virtual mozilla::ipc::IPCResult RecvMinValue(const uint64_t& aID,
+ double* aValue) override;
+
+ virtual mozilla::ipc::IPCResult RecvMaxValue(const uint64_t& aID,
+ double* aValue) override;
+
+ virtual mozilla::ipc::IPCResult RecvStep(const uint64_t& aID,
+ double* aStep) override;
+
+ virtual mozilla::ipc::IPCResult RecvLanguage(const uint64_t& aID,
+ nsString* aLocale) override;
+ virtual mozilla::ipc::IPCResult RecvDocType(const uint64_t& aID,
+ nsString* aType) override;
+ virtual mozilla::ipc::IPCResult RecvTitle(const uint64_t& aID,
+ nsString* aTitle) override;
+ virtual mozilla::ipc::IPCResult RecvMimeType(const uint64_t& aID,
+ nsString* aMime) override;
+ virtual mozilla::ipc::IPCResult RecvURLDocTypeMimeType(
+ const uint64_t& aID, nsString* aURL, nsString* aDocType,
+ nsString* aMimeType) override;
+
+ virtual mozilla::ipc::IPCResult RecvChildAtPoint(
+ const uint64_t& aID, const int32_t& aX, const int32_t& aY,
+ const uint32_t& aWhich, PDocAccessibleChild** aResultDoc,
+ uint64_t* aResultID) override;
+
+ virtual mozilla::ipc::IPCResult RecvExtents(const uint64_t& aID,
+ const bool& aNeedsScreenCoords,
+ int32_t* aX, int32_t* aY,
+ int32_t* aWidth,
+ int32_t* aHeight) override;
+ virtual mozilla::ipc::IPCResult RecvExtentsInCSSPixels(
+ const uint64_t& aID, int32_t* aX, int32_t* aY, int32_t* aWidth,
+ int32_t* aHeight) override;
+ virtual mozilla::ipc::IPCResult RecvDOMNodeID(const uint64_t& aID,
+ nsString* aDOMNodeID) override;
+
+ virtual bool DeallocPDocAccessiblePlatformExtChild(
+ PDocAccessiblePlatformExtChild* aActor) override;
+
+ virtual PDocAccessiblePlatformExtChild* AllocPDocAccessiblePlatformExtChild()
+ override;
+
+ DocAccessiblePlatformExtChild* GetPlatformExtension();
+
+ private:
+ LocalAccessible* IdToAccessibleLink(const uint64_t& aID) const;
+ LocalAccessible* IdToAccessibleSelect(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;
+};
+
+} // namespace a11y
+} // namespace mozilla
+
+#endif
diff --git a/accessible/ipc/other/PDocAccessible.ipdl b/accessible/ipc/other/PDocAccessible.ipdl
new file mode 100644
index 0000000000..13a9056cac
--- /dev/null
+++ b/accessible/ipc/other/PDocAccessible.ipdl
@@ -0,0 +1,357 @@
+/* -*- 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 PBrowser;
+include protocol PDocAccessiblePlatformExt;
+
+include DocAccessibleTypes;
+
+include "mozilla/GfxMessageUtils.h";
+
+using LayoutDeviceIntRect from "Units.h";
+using LayoutDeviceIntPoint from "Units.h";
+using LayoutDeviceIntSize from "Units.h";
+using mozilla::a11y::role from "mozilla/a11y/IPCTypes.h";
+using mozilla::a11y::AccType from "mozilla/a11y/IPCTypes.h";
+using mozilla::a11y::AccGenericType from "mozilla/a11y/IPCTypes.h";
+[RefCounted] using mozilla::a11y::AccAttributes from "mozilla/a11y/IPCTypes.h";
+using mozilla::a11y::CacheUpdateType from "mozilla/a11y/IPCTypes.h";
+using mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
+
+namespace mozilla {
+namespace a11y {
+
+struct AccessibleData
+{
+ uint64_t ID;
+ role Role;
+ uint32_t ChildrenCount;
+ AccType Type;
+ AccGenericType GenericTypes;
+ uint8_t RoleMapEntryIndex;
+};
+
+union OriginDocument
+{
+ PDocAccessible;
+};
+
+struct BatchData
+{
+ OriginDocument Document;
+ uint64_t ID;
+ uint64_t State;
+ LayoutDeviceIntRect Bounds;
+ uint8_t ActionCount;
+ nsString Name;
+ nsString TextValue;
+ nsString DOMNodeID;
+ nsString Description;
+ double CurValue;
+ double MinValue;
+ double MaxValue;
+ double Step;
+ AccAttributes Attributes;
+};
+
+struct ShowEventData
+{
+ uint64_t ID;
+ uint32_t Idx;
+ AccessibleData[] NewTree;
+ bool EventSuppressed;
+};
+
+struct RelationTargets
+{
+ uint32_t Type;
+ uint64_t[] Targets;
+};
+
+struct TextRangeData
+{
+ uint64_t StartID;
+ uint64_t EndID;
+ int32_t StartOffset;
+ int32_t EndOffset;
+};
+
+[ManualDealloc, NestedUpTo=inside_sync, ChildImpl=virtual, ParentImpl=virtual]
+sync protocol PDocAccessible
+{
+ manager PBrowser;
+ manages PDocAccessiblePlatformExt;
+
+parent:
+ async PDocAccessiblePlatformExt();
+ 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,
+ bool aIsSelectionCollapsed, bool aIsAtEndOfLine,
+ int32_t aGranularity);
+ 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(role aRole, uint8_t aRoleMapEntryIndex);
+ async VirtualCursorChangeEvent(uint64_t aID,
+ uint64_t aOldPosition,
+ int32_t aOldStartOffset, int32_t aOldEndOffset,
+ uint64_t aPosition,
+ int32_t aStartOffset, int32_t aEndOffset,
+ int16_t aReason, int16_t aBoundaryType,
+ bool aFromUservcEvent);
+ async ScrollingEvent(uint64_t aID, uint64_t aType,
+ uint32_t aScrollX, uint32_t aScrollY,
+ uint32_t aMaxScrollX, uint32_t aMaxScrollY);
+ async AnnouncementEvent(uint64_t aID,
+ nsString aAnnouncement,
+ uint16_t aPriority);
+ async TextSelectionChangeEvent(uint64_t aID, TextRangeData[] aSelection);
+
+ /*
+ * Tell the parent document to bind the existing document as a new child
+ * document.
+ */
+ async BindChildDoc(PDocAccessible aChildDoc, uint64_t aID);
+
+ // Android
+ async Batch(uint64_t aBatchType, BatchData[] aData);
+
+ /*
+ * Cache The World
+ * aDispatchShowEvent is true when a show event with the first accessible in
+ * the cache list as the target should be dispatched after the cache is
+ * populated. The show event will have a from-user flag value of false.
+ */
+ async Cache(CacheUpdateType aUpdateType, CacheData[] aData, bool aDispatchShowEvent);
+
+ /*
+ * Lists of accessibles that either gained or lost a selected state.
+ */
+ async SelectedAccessiblesChanged(uint64_t[] aSelectedIDs, uint64_t[] aUnselectedIDs);
+
+ /*
+ * Tell the parent process that the given Accessibles are about to be moved
+ * via subsequent hide and show events.
+ */
+ async AccessiblesWillMove(uint64_t[] aIDs);
+
+child:
+ /*
+ * Notify the content process that the PDocAccessible has finished being
+ * constructed in the parent process.
+ */
+ async ConstructedInParentProcess();
+
+ async __delete__();
+
+ /*
+ * Called as a result of focus shifting from chrome to content
+ * elements through keyboard navigation.
+ */
+ async RestoreFocus();
+
+ // LocalAccessible
+ [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, uint32_t flag);
+ [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(AccAttributes 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 GroupPosition(uint64_t aID)
+ returns(int32_t groupLevel, int32_t similarItemsInGroup, int32_t positionInGroup);
+ async ScrollTo(uint64_t aID, uint32_t aScrollType);
+ async ScrollToPoint(uint64_t aID, uint32_t aScrollType, int32_t aX,
+ int32_t aY);
+ async Announce(uint64_t aID, nsString aAnnouncement, uint16_t aPriority);
+
+ // 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(AccAttributes aAttributes, int32_t aStartOffset, int32_t aEndOffset);
+ [Nested=inside_sync] sync DefaultTextAttributes(uint64_t aID) returns(AccAttributes aAttributes);
+
+ [Nested=inside_sync] sync TextBounds(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset,
+ uint32_t aCoordType)
+ returns(LayoutDeviceIntRect aRetVal);
+ [Nested=inside_sync] sync CharBounds(uint64_t aID, int32_t aOffset, uint32_t aCoordType)
+ returns(LayoutDeviceIntRect 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(LayoutDeviceIntPoint aRetVal);
+ [Nested=inside_sync] sync ImageSize(uint64_t aID) returns(LayoutDeviceIntSize 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 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);
+ async DoActionAsync(uint64_t aID, uint8_t aIndex);
+ [Nested=inside_sync] sync ActionCount(uint64_t aID) returns(uint8_t aCount);
+ [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 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 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 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 ChildAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aWhich)
+ returns(nullable PDocAccessible aResultDoc, uint64_t aResultID);
+
+ [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 ExtentsInCSSPixels(uint64_t aID)
+ returns(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight);
+ [Nested=inside_sync] sync DOMNodeID(uint64_t aID) returns(nsString aDOMNodeID);
+
+ /*
+ * Verify the cache. Used for testing purposes.
+ */
+ async VerifyCache(uint64_t aID, uint64_t aCacheDomain, AccAttributes aFields);
+
+};
+
+}
+}
diff --git a/accessible/ipc/other/RemoteAccessible.cpp b/accessible/ipc/other/RemoteAccessible.cpp
new file mode 100644
index 0000000000..d720ff2530
--- /dev/null
+++ b/accessible/ipc/other/RemoteAccessible.cpp
@@ -0,0 +1,989 @@
+/* -*- 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 "RemoteAccessible.h"
+#include "mozilla/a11y/DocAccessibleParent.h"
+#include "DocAccessible.h"
+#include "AccAttributes.h"
+#include "mozilla/a11y/DocManager.h"
+#include "mozilla/dom/Element.h"
+#include "mozilla/dom/BrowserParent.h"
+#include "mozilla/Unused.h"
+#include "mozilla/a11y/Platform.h"
+#include "Relation.h"
+#include "RelationType.h"
+#include "mozilla/a11y/Role.h"
+#include "mozilla/StaticPrefs_accessibility.h"
+
+namespace mozilla {
+namespace a11y {
+
+uint64_t RemoteAccessible::State() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::State();
+ }
+ uint64_t state = 0;
+ Unused << mDoc->SendState(mID, &state);
+ return state;
+}
+
+uint64_t RemoteAccessible::NativeState() const {
+ uint64_t state = 0;
+ Unused << mDoc->SendNativeState(mID, &state);
+ return state;
+}
+
+ENameValueFlag RemoteAccessible::Name(nsString& aName) const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::Name(aName);
+ }
+
+ uint32_t flag = 0;
+ Unused << mDoc->SendName(mID, &aName, &flag);
+ return static_cast<ENameValueFlag>(flag);
+}
+
+void RemoteAccessible::Value(nsString& aValue) const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ RemoteAccessibleBase<RemoteAccessible>::Value(aValue);
+ return;
+ }
+
+ Unused << mDoc->SendValue(mID, &aValue);
+}
+
+void RemoteAccessible::Help(nsString& aHelp) const {
+ Unused << mDoc->SendHelp(mID, &aHelp);
+}
+
+void RemoteAccessible::Description(nsString& aDesc) const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ RemoteAccessibleBase<RemoteAccessible>::Description(aDesc);
+ return;
+ }
+
+ Unused << mDoc->SendDescription(mID, &aDesc);
+}
+
+already_AddRefed<AccAttributes> RemoteAccessible::Attributes() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::Attributes();
+ }
+ RefPtr<AccAttributes> attrs;
+ Unused << mDoc->SendAttributes(mID, &attrs);
+ return attrs.forget();
+}
+
+Relation RemoteAccessible::RelationByType(RelationType aType) const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::RelationByType(aType);
+ }
+
+ nsTArray<uint64_t> targetIDs;
+ Unused << mDoc->SendRelationByType(mID, static_cast<uint32_t>(aType),
+ &targetIDs);
+ return Relation(new RemoteAccIterator(std::move(targetIDs), Document()));
+}
+
+void RemoteAccessible::Relations(
+ nsTArray<RelationType>* aTypes,
+ nsTArray<nsTArray<RemoteAccessible*>>* 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<RemoteAccessible*> targets(targetCount);
+ for (size_t j = 0; j < targetCount; j++) {
+ if (RemoteAccessible* proxy =
+ mDoc->GetAccessible(ipcRelations[i].Targets()[j])) {
+ targets.AppendElement(proxy);
+ }
+ }
+
+ if (targets.IsEmpty()) continue;
+
+ aTargetSets->AppendElement(std::move(targets));
+ aTypes->AppendElement(static_cast<RelationType>(type));
+ }
+}
+
+bool RemoteAccessible::IsSearchbox() const {
+ bool retVal = false;
+ Unused << mDoc->SendIsSearchbox(mID, &retVal);
+ return retVal;
+}
+
+nsAtom* RemoteAccessible::LandmarkRole() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::LandmarkRole();
+ }
+
+ nsString landmark;
+ Unused << mDoc->SendLandmarkRole(mID, &landmark);
+ return NS_GetStaticAtom(landmark);
+}
+
+GroupPos RemoteAccessible::GroupPosition() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::GroupPosition();
+ }
+
+ GroupPos groupPos;
+ Unused << mDoc->SendGroupPosition(mID, &groupPos.level, &groupPos.setSize,
+ &groupPos.posInSet);
+ return groupPos;
+}
+
+void RemoteAccessible::ScrollToPoint(uint32_t aScrollType, int32_t aX,
+ int32_t aY) {
+ Unused << mDoc->SendScrollToPoint(mID, aScrollType, aX, aY);
+}
+
+void RemoteAccessible::Announce(const nsString& aAnnouncement,
+ uint16_t aPriority) {
+ Unused << mDoc->SendAnnounce(mID, aAnnouncement, aPriority);
+}
+
+int32_t RemoteAccessible::CaretLineNumber() {
+ int32_t line = -1;
+ Unused << mDoc->SendCaretOffset(mID, &line);
+ return line;
+}
+
+int32_t RemoteAccessible::CaretOffset() const {
+ int32_t offset = 0;
+ Unused << mDoc->SendCaretOffset(mID, &offset);
+ return offset;
+}
+
+uint32_t RemoteAccessible::CharacterCount() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::CharacterCount();
+ }
+ int32_t count = 0;
+ Unused << mDoc->SendCharacterCount(mID, &count);
+ return count;
+}
+
+int32_t RemoteAccessible::SelectionCount() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::SelectionCount();
+ }
+ int32_t count = 0;
+ Unused << mDoc->SendSelectionCount(mID, &count);
+ return count;
+}
+
+void RemoteAccessible::TextSubstring(int32_t aStartOffset, int32_t aEndOffset,
+ nsAString& aText) const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::TextSubstring(
+ aStartOffset, aEndOffset, aText);
+ }
+
+ bool valid;
+ nsString text;
+ Unused << mDoc->SendTextSubstring(mID, aStartOffset, aEndOffset, &text,
+ &valid);
+ aText = std::move(text);
+}
+
+void RemoteAccessible::TextAfterOffset(int32_t aOffset,
+ AccessibleTextBoundary aBoundaryType,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset, nsAString& aText) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::TextAfterOffset(
+ aOffset, aBoundaryType, aStartOffset, aEndOffset, aText);
+ }
+ nsString text;
+ Unused << mDoc->SendGetTextAfterOffset(mID, aOffset, aBoundaryType, &text,
+ aStartOffset, aEndOffset);
+ aText = std::move(text);
+}
+
+void RemoteAccessible::TextAtOffset(int32_t aOffset,
+ AccessibleTextBoundary aBoundaryType,
+ int32_t* aStartOffset, int32_t* aEndOffset,
+ nsAString& aText) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::TextAtOffset(
+ aOffset, aBoundaryType, aStartOffset, aEndOffset, aText);
+ }
+ nsString text;
+ Unused << mDoc->SendGetTextAtOffset(mID, aOffset, aBoundaryType, &text,
+ aStartOffset, aEndOffset);
+ aText = std::move(text);
+}
+
+void RemoteAccessible::TextBeforeOffset(int32_t aOffset,
+ AccessibleTextBoundary aBoundaryType,
+ int32_t* aStartOffset,
+ int32_t* aEndOffset, nsAString& aText) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::TextBeforeOffset(
+ aOffset, aBoundaryType, aStartOffset, aEndOffset, aText);
+ }
+ nsString text;
+ Unused << mDoc->SendGetTextBeforeOffset(mID, aOffset, aBoundaryType, &text,
+ aStartOffset, aEndOffset);
+ aText = std::move(text);
+}
+
+char16_t RemoteAccessible::CharAt(int32_t aOffset) {
+ uint16_t retval = 0;
+ Unused << mDoc->SendCharAt(mID, aOffset, &retval);
+ return static_cast<char16_t>(retval);
+}
+
+already_AddRefed<AccAttributes> RemoteAccessible::TextAttributes(
+ bool aIncludeDefAttrs, int32_t aOffset, int32_t* aStartOffset,
+ int32_t* aEndOffset) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::TextAttributes(
+ aIncludeDefAttrs, aOffset, aStartOffset, aEndOffset);
+ }
+ RefPtr<AccAttributes> attrs;
+ Unused << mDoc->SendTextAttributes(mID, aIncludeDefAttrs, aOffset, &attrs,
+ aStartOffset, aEndOffset);
+ return attrs.forget();
+}
+
+already_AddRefed<AccAttributes> RemoteAccessible::DefaultTextAttributes() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::DefaultTextAttributes();
+ }
+ RefPtr<AccAttributes> attrs;
+ Unused << mDoc->SendDefaultTextAttributes(mID, &attrs);
+ return attrs.forget();
+}
+
+LayoutDeviceIntRect RemoteAccessible::TextBounds(int32_t aStartOffset,
+ int32_t aEndOffset,
+ uint32_t aCoordType) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ MOZ_ASSERT(IsHyperText(), "is not hypertext?");
+ return RemoteAccessibleBase<RemoteAccessible>::TextBounds(
+ aStartOffset, aEndOffset, aCoordType);
+ }
+
+ LayoutDeviceIntRect rect;
+ Unused << mDoc->SendTextBounds(mID, aStartOffset, aEndOffset, aCoordType,
+ &rect);
+ return rect;
+}
+
+LayoutDeviceIntRect RemoteAccessible::CharBounds(int32_t aOffset,
+ uint32_t aCoordType) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ MOZ_ASSERT(IsHyperText(), "is not hypertext?");
+ return RemoteAccessibleBase<RemoteAccessible>::CharBounds(aOffset,
+ aCoordType);
+ }
+
+ LayoutDeviceIntRect rect;
+ Unused << mDoc->SendCharBounds(mID, aOffset, aCoordType, &rect);
+ return rect;
+}
+
+int32_t RemoteAccessible::OffsetAtPoint(int32_t aX, int32_t aY,
+ uint32_t aCoordType) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ MOZ_ASSERT(IsHyperText(), "is not hypertext?");
+ return RemoteAccessibleBase<RemoteAccessible>::OffsetAtPoint(aX, aY,
+ aCoordType);
+ }
+
+ int32_t retVal = -1;
+ Unused << mDoc->SendOffsetAtPoint(mID, aX, aY, aCoordType, &retVal);
+ return retVal;
+}
+
+bool RemoteAccessible::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 RemoteAccessible::SetSelectionBoundsAt(int32_t aSelectionNum,
+ int32_t aStartOffset,
+ int32_t aEndOffset) {
+ bool retVal = false;
+ Unused << mDoc->SendSetSelectionBoundsAt(mID, aSelectionNum, aStartOffset,
+ aEndOffset, &retVal);
+ return retVal;
+}
+
+bool RemoteAccessible::AddToSelection(int32_t aStartOffset,
+ int32_t aEndOffset) {
+ bool retVal = false;
+ Unused << mDoc->SendAddToSelection(mID, aStartOffset, aEndOffset, &retVal);
+ return retVal;
+}
+
+bool RemoteAccessible::RemoveFromSelection(int32_t aSelectionNum) {
+ bool retVal = false;
+ Unused << mDoc->SendRemoveFromSelection(mID, aSelectionNum, &retVal);
+ return retVal;
+}
+
+void RemoteAccessible::ScrollSubstringTo(int32_t aStartOffset,
+ int32_t aEndOffset,
+ uint32_t aScrollType) {
+ Unused << mDoc->SendScrollSubstringTo(mID, aStartOffset, aEndOffset,
+ aScrollType);
+}
+
+void RemoteAccessible::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 RemoteAccessible::Text(nsString* aText) {
+ Unused << mDoc->SendText(mID, aText);
+}
+
+void RemoteAccessible::ReplaceText(const nsString& aText) {
+ Unused << mDoc->SendReplaceText(mID, aText);
+}
+
+bool RemoteAccessible::InsertText(const nsString& aText, int32_t aPosition) {
+ bool valid;
+ Unused << mDoc->SendInsertText(mID, aText, aPosition, &valid);
+ return valid;
+}
+
+bool RemoteAccessible::CopyText(int32_t aStartPos, int32_t aEndPos) {
+ bool valid;
+ Unused << mDoc->SendCopyText(mID, aStartPos, aEndPos, &valid);
+ return valid;
+}
+
+bool RemoteAccessible::CutText(int32_t aStartPos, int32_t aEndPos) {
+ bool valid;
+ Unused << mDoc->SendCutText(mID, aStartPos, aEndPos, &valid);
+ return valid;
+}
+
+bool RemoteAccessible::DeleteText(int32_t aStartPos, int32_t aEndPos) {
+ bool valid;
+ Unused << mDoc->SendDeleteText(mID, aStartPos, aEndPos, &valid);
+ return valid;
+}
+
+bool RemoteAccessible::PasteText(int32_t aPosition) {
+ bool valid;
+ Unused << mDoc->SendPasteText(mID, aPosition, &valid);
+ return valid;
+}
+
+uint32_t RemoteAccessible::StartOffset() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::StartOffset();
+ }
+ uint32_t retVal = 0;
+ bool ok;
+ Unused << mDoc->SendStartOffset(mID, &retVal, &ok);
+ return retVal;
+}
+
+uint32_t RemoteAccessible::EndOffset() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::EndOffset();
+ }
+ bool ok;
+ uint32_t retVal = 0;
+ Unused << mDoc->SendEndOffset(mID, &retVal, &ok);
+ return retVal;
+}
+
+bool RemoteAccessible::IsLinkValid() {
+ bool retVal = false;
+ Unused << mDoc->SendIsLinkValid(mID, &retVal);
+ return retVal;
+}
+
+uint32_t RemoteAccessible::AnchorCount(bool* aOk) {
+ uint32_t retVal = 0;
+ Unused << mDoc->SendAnchorCount(mID, &retVal, aOk);
+ return retVal;
+}
+
+void RemoteAccessible::AnchorURIAt(uint32_t aIndex, nsCString& aURI,
+ bool* aOk) {
+ Unused << mDoc->SendAnchorURIAt(mID, aIndex, &aURI, aOk);
+}
+
+RemoteAccessible* RemoteAccessible::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 RemoteAccessible::LinkCount() {
+ uint32_t retVal = 0;
+ Unused << mDoc->SendLinkCount(mID, &retVal);
+ return retVal;
+}
+
+RemoteAccessible* RemoteAccessible::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 RemoteAccessible::LinkIndexAtOffset(uint32_t aOffset) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::LinkIndexAtOffset(aOffset);
+ }
+ int32_t retVal = -1;
+ Unused << mDoc->SendLinkIndexAtOffset(mID, aOffset, &retVal);
+ return retVal;
+}
+
+RemoteAccessible* RemoteAccessible::TableOfACell() {
+ uint64_t tableID = 0;
+ bool ok = false;
+ Unused << mDoc->SendTableOfACell(mID, &tableID, &ok);
+ return ok ? mDoc->GetAccessible(tableID) : nullptr;
+}
+
+uint32_t RemoteAccessible::ColIdx() {
+ uint32_t index = 0;
+ Unused << mDoc->SendColIdx(mID, &index);
+ return index;
+}
+
+uint32_t RemoteAccessible::RowIdx() {
+ uint32_t index = 0;
+ Unused << mDoc->SendRowIdx(mID, &index);
+ return index;
+}
+
+void RemoteAccessible::GetColRowExtents(uint32_t* aColIdx, uint32_t* aRowIdx,
+ uint32_t* aColExtent,
+ uint32_t* aRowExtent) {
+ Unused << mDoc->SendGetColRowExtents(mID, aColIdx, aRowIdx, aColExtent,
+ aRowExtent);
+}
+
+void RemoteAccessible::GetPosition(uint32_t* aRowIdx, uint32_t* aColIdx) {
+ Unused << mDoc->SendGetPosition(mID, aRowIdx, aColIdx);
+}
+
+uint32_t RemoteAccessible::ColExtent() {
+ uint32_t extent = 0;
+ Unused << mDoc->SendColExtent(mID, &extent);
+ return extent;
+}
+
+uint32_t RemoteAccessible::RowExtent() {
+ uint32_t extent = 0;
+ Unused << mDoc->SendRowExtent(mID, &extent);
+ return extent;
+}
+
+void RemoteAccessible::ColHeaderCells(nsTArray<RemoteAccessible*>* 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 RemoteAccessible::RowHeaderCells(nsTArray<RemoteAccessible*>* 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 RemoteAccessible::IsCellSelected() {
+ bool selected = false;
+ Unused << mDoc->SendIsCellSelected(mID, &selected);
+ return selected;
+}
+
+RemoteAccessible* RemoteAccessible::TableCaption() {
+ uint64_t captionID = 0;
+ bool ok = false;
+ Unused << mDoc->SendTableCaption(mID, &captionID, &ok);
+ return ok ? mDoc->GetAccessible(captionID) : nullptr;
+}
+
+void RemoteAccessible::TableSummary(nsString& aSummary) {
+ Unused << mDoc->SendTableSummary(mID, &aSummary);
+}
+
+uint32_t RemoteAccessible::TableColumnCount() {
+ uint32_t count = 0;
+ Unused << mDoc->SendTableColumnCount(mID, &count);
+ return count;
+}
+
+uint32_t RemoteAccessible::TableRowCount() {
+ uint32_t count = 0;
+ Unused << mDoc->SendTableRowCount(mID, &count);
+ return count;
+}
+
+RemoteAccessible* RemoteAccessible::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 RemoteAccessible::TableCellIndexAt(uint32_t aRow, uint32_t aCol) {
+ int32_t index = 0;
+ Unused << mDoc->SendTableCellIndexAt(mID, aRow, aCol, &index);
+ return index;
+}
+
+int32_t RemoteAccessible::TableColumnIndexAt(uint32_t aCellIndex) {
+ int32_t index = 0;
+ Unused << mDoc->SendTableColumnIndexAt(mID, aCellIndex, &index);
+ return index;
+}
+
+int32_t RemoteAccessible::TableRowIndexAt(uint32_t aCellIndex) {
+ int32_t index = 0;
+ Unused << mDoc->SendTableRowIndexAt(mID, aCellIndex, &index);
+ return index;
+}
+
+void RemoteAccessible::TableRowAndColumnIndicesAt(uint32_t aCellIndex,
+ int32_t* aRow,
+ int32_t* aCol) {
+ Unused << mDoc->SendTableRowAndColumnIndicesAt(mID, aCellIndex, aRow, aCol);
+}
+
+uint32_t RemoteAccessible::TableColumnExtentAt(uint32_t aRow, uint32_t aCol) {
+ uint32_t extent = 0;
+ Unused << mDoc->SendTableColumnExtentAt(mID, aRow, aCol, &extent);
+ return extent;
+}
+
+uint32_t RemoteAccessible::TableRowExtentAt(uint32_t aRow, uint32_t aCol) {
+ uint32_t extent = 0;
+ Unused << mDoc->SendTableRowExtentAt(mID, aRow, aCol, &extent);
+ return extent;
+}
+
+void RemoteAccessible::TableColumnDescription(uint32_t aCol,
+ nsString& aDescription) {
+ Unused << mDoc->SendTableColumnDescription(mID, aCol, &aDescription);
+}
+
+void RemoteAccessible::TableRowDescription(uint32_t aRow,
+ nsString& aDescription) {
+ Unused << mDoc->SendTableRowDescription(mID, aRow, &aDescription);
+}
+
+bool RemoteAccessible::TableColumnSelected(uint32_t aCol) {
+ bool selected = false;
+ Unused << mDoc->SendTableColumnSelected(mID, aCol, &selected);
+ return selected;
+}
+
+bool RemoteAccessible::TableRowSelected(uint32_t aRow) {
+ bool selected = false;
+ Unused << mDoc->SendTableRowSelected(mID, aRow, &selected);
+ return selected;
+}
+
+bool RemoteAccessible::TableCellSelected(uint32_t aRow, uint32_t aCol) {
+ bool selected = false;
+ Unused << mDoc->SendTableCellSelected(mID, aRow, aCol, &selected);
+ return selected;
+}
+
+uint32_t RemoteAccessible::TableSelectedCellCount() {
+ uint32_t count = 0;
+ Unused << mDoc->SendTableSelectedCellCount(mID, &count);
+ return count;
+}
+
+uint32_t RemoteAccessible::TableSelectedColumnCount() {
+ uint32_t count = 0;
+ Unused << mDoc->SendTableSelectedColumnCount(mID, &count);
+ return count;
+}
+
+uint32_t RemoteAccessible::TableSelectedRowCount() {
+ uint32_t count = 0;
+ Unused << mDoc->SendTableSelectedRowCount(mID, &count);
+ return count;
+}
+
+void RemoteAccessible::TableSelectedCells(
+ nsTArray<RemoteAccessible*>* 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 RemoteAccessible::TableSelectedCellIndices(
+ nsTArray<uint32_t>* aCellIndices) {
+ Unused << mDoc->SendTableSelectedCellIndices(mID, aCellIndices);
+}
+
+void RemoteAccessible::TableSelectedColumnIndices(
+ nsTArray<uint32_t>* aColumnIndices) {
+ Unused << mDoc->SendTableSelectedColumnIndices(mID, aColumnIndices);
+}
+
+void RemoteAccessible::TableSelectedRowIndices(
+ nsTArray<uint32_t>* aRowIndices) {
+ Unused << mDoc->SendTableSelectedRowIndices(mID, aRowIndices);
+}
+
+void RemoteAccessible::TableSelectColumn(uint32_t aCol) {
+ Unused << mDoc->SendTableSelectColumn(mID, aCol);
+}
+
+void RemoteAccessible::TableSelectRow(uint32_t aRow) {
+ Unused << mDoc->SendTableSelectRow(mID, aRow);
+}
+
+void RemoteAccessible::TableUnselectColumn(uint32_t aCol) {
+ Unused << mDoc->SendTableUnselectColumn(mID, aCol);
+}
+
+void RemoteAccessible::TableUnselectRow(uint32_t aRow) {
+ Unused << mDoc->SendTableUnselectRow(mID, aRow);
+}
+
+bool RemoteAccessible::TableIsProbablyForLayout() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::TableIsProbablyForLayout();
+ }
+
+ bool forLayout = false;
+ Unused << mDoc->SendTableIsProbablyForLayout(mID, &forLayout);
+ return forLayout;
+}
+
+RemoteAccessible* RemoteAccessible::AtkTableColumnHeader(int32_t aCol) {
+ uint64_t headerID = 0;
+ bool ok = false;
+ Unused << mDoc->SendAtkTableColumnHeader(mID, aCol, &headerID, &ok);
+ return ok ? mDoc->GetAccessible(headerID) : nullptr;
+}
+
+RemoteAccessible* RemoteAccessible::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 RemoteAccessible::SelectedItems(nsTArray<Accessible*>* aSelectedItems) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ RemoteAccessibleBase<RemoteAccessible>::SelectedItems(aSelectedItems);
+ return;
+ }
+
+ 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 RemoteAccessible::SelectedItemCount() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::SelectedItemCount();
+ }
+
+ uint32_t count = 0;
+ Unused << mDoc->SendSelectedItemCount(mID, &count);
+ return count;
+}
+
+Accessible* RemoteAccessible::GetSelectedItem(uint32_t aIndex) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::GetSelectedItem(aIndex);
+ }
+
+ uint64_t selectedItemID = 0;
+ bool ok = false;
+ Unused << mDoc->SendGetSelectedItem(mID, aIndex, &selectedItemID, &ok);
+ return ok ? mDoc->GetAccessible(selectedItemID) : nullptr;
+}
+
+bool RemoteAccessible::IsItemSelected(uint32_t aIndex) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::IsItemSelected(aIndex);
+ }
+
+ bool selected = false;
+ Unused << mDoc->SendIsItemSelected(mID, aIndex, &selected);
+ return selected;
+}
+
+bool RemoteAccessible::AddItemToSelection(uint32_t aIndex) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::AddItemToSelection(aIndex);
+ }
+
+ bool success = false;
+ Unused << mDoc->SendAddItemToSelection(mID, aIndex, &success);
+ return success;
+}
+
+bool RemoteAccessible::RemoveItemFromSelection(uint32_t aIndex) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::RemoveItemFromSelection(
+ aIndex);
+ }
+
+ bool success = false;
+ Unused << mDoc->SendRemoveItemFromSelection(mID, aIndex, &success);
+ return success;
+}
+
+bool RemoteAccessible::SelectAll() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::SelectAll();
+ }
+
+ bool success = false;
+ Unused << mDoc->SendSelectAll(mID, &success);
+ return success;
+}
+
+bool RemoteAccessible::UnselectAll() {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::UnselectAll();
+ }
+
+ bool success = false;
+ Unused << mDoc->SendUnselectAll(mID, &success);
+ return success;
+}
+
+bool RemoteAccessible::DoAction(uint8_t aIndex) const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::DoAction(aIndex);
+ }
+
+ bool success = false;
+ Unused << mDoc->SendDoAction(mID, aIndex, &success);
+ return success;
+}
+
+uint8_t RemoteAccessible::ActionCount() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::ActionCount();
+ }
+
+ uint8_t count = 0;
+ Unused << mDoc->SendActionCount(mID, &count);
+ return count;
+}
+
+void RemoteAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ RemoteAccessibleBase<RemoteAccessible>::ActionNameAt(aIndex, aName);
+ return;
+ }
+
+ nsAutoString name;
+ Unused << mDoc->SendActionNameAt(mID, aIndex, &name);
+
+ aName.Assign(name);
+}
+
+KeyBinding RemoteAccessible::AccessKey() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::AccessKey();
+ }
+ uint32_t key = 0;
+ uint32_t modifierMask = 0;
+ Unused << mDoc->SendAccessKey(mID, &key, &modifierMask);
+ return KeyBinding(key, modifierMask);
+}
+
+void RemoteAccessible::AtkKeyBinding(nsString& aBinding) {
+ Unused << mDoc->SendAtkKeyBinding(mID, &aBinding);
+}
+
+double RemoteAccessible::CurValue() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::CurValue();
+ }
+
+ double val = UnspecifiedNaN<double>();
+ Unused << mDoc->SendCurValue(mID, &val);
+ return val;
+}
+
+bool RemoteAccessible::SetCurValue(double aValue) {
+ bool success = false;
+ Unused << mDoc->SendSetCurValue(mID, aValue, &success);
+ return success;
+}
+
+double RemoteAccessible::MinValue() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::MinValue();
+ }
+
+ double val = UnspecifiedNaN<double>();
+ Unused << mDoc->SendMinValue(mID, &val);
+ return val;
+}
+
+double RemoteAccessible::MaxValue() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::MaxValue();
+ }
+
+ double val = UnspecifiedNaN<double>();
+ Unused << mDoc->SendMaxValue(mID, &val);
+ return val;
+}
+
+double RemoteAccessible::Step() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::Step();
+ }
+
+ double step = UnspecifiedNaN<double>();
+ Unused << mDoc->SendStep(mID, &step);
+ return step;
+}
+
+Accessible* RemoteAccessible::ChildAtPoint(
+ int32_t aX, int32_t aY, LocalAccessible::EWhichChildAtPoint aWhichChild) {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::ChildAtPoint(aX, aY,
+ aWhichChild);
+ }
+
+ RemoteAccessible* target = this;
+ do {
+ if (target->IsOuterDoc()) {
+ if (target->ChildCount() == 0) {
+ // Return the OuterDoc if the requested point is within its bounds.
+ LayoutDeviceIntRect rect = target->Bounds();
+ if (rect.Contains(aX, aY)) {
+ return target;
+ }
+ return nullptr;
+ }
+ DocAccessibleParent* childDoc = target->RemoteChildAt(0)->AsDoc();
+ MOZ_ASSERT(childDoc);
+ if (childDoc->IsTopLevelInContentProcess()) {
+ // This is an OOP iframe. Remote calls can only work within their
+ // process, so they stop at OOP iframes.
+ if (aWhichChild == Accessible::EWhichChildAtPoint::DirectChild) {
+ // Return the child document if it's within the bounds of the iframe.
+ LayoutDeviceIntRect docRect = target->Bounds();
+ if (docRect.Contains(aX, aY)) {
+ return childDoc;
+ }
+ return nullptr;
+ }
+ // We must continue the search from the child document.
+ target = childDoc;
+ }
+ }
+ PDocAccessibleParent* resultDoc = nullptr;
+ uint64_t resultID = 0;
+ Unused << target->mDoc->SendChildAtPoint(target->mID, aX, aY,
+ static_cast<uint32_t>(aWhichChild),
+ &resultDoc, &resultID);
+ // If resultDoc is null, this means there is no child at this point.
+ auto useDoc = static_cast<DocAccessibleParent*>(resultDoc);
+ target = resultDoc ? useDoc->GetAccessible(resultID) : nullptr;
+ } while (target && target->IsOuterDoc() &&
+ aWhichChild == Accessible::EWhichChildAtPoint::DeepestChild);
+ return target;
+}
+
+LayoutDeviceIntRect RemoteAccessible::Bounds() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::Bounds();
+ }
+
+ LayoutDeviceIntRect rect;
+ Unused << mDoc->SendExtents(mID, false, &(rect.x), &(rect.y), &(rect.width),
+ &(rect.height));
+ return rect;
+}
+
+nsIntRect RemoteAccessible::BoundsInCSSPixels() const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::BoundsInCSSPixels();
+ }
+
+ nsIntRect rect;
+ Unused << mDoc->SendExtentsInCSSPixels(mID, &rect.x, &rect.y, &rect.width,
+ &rect.height);
+ return rect;
+}
+
+void RemoteAccessible::Language(nsString& aLocale) {
+ Unused << mDoc->SendLanguage(mID, &aLocale);
+}
+
+void RemoteAccessible::DocType(nsString& aType) {
+ Unused << mDoc->SendDocType(mID, &aType);
+}
+
+void RemoteAccessible::Title(nsString& aTitle) {
+ Unused << mDoc->SendTitle(mID, &aTitle);
+}
+
+void RemoteAccessible::MimeType(nsString aMime) {
+ Unused << mDoc->SendMimeType(mID, &aMime);
+}
+
+void RemoteAccessible::URLDocTypeMimeType(nsString& aURL, nsString& aDocType,
+ nsString& aMimeType) {
+ Unused << mDoc->SendURLDocTypeMimeType(mID, &aURL, &aDocType, &aMimeType);
+}
+
+void RemoteAccessible::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 RemoteAccessible::DOMNodeID(nsString& aID) const {
+ if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
+ return RemoteAccessibleBase<RemoteAccessible>::DOMNodeID(aID);
+ }
+ Unused << mDoc->SendDOMNodeID(mID, &aID);
+}
+
+} // namespace a11y
+} // namespace mozilla
diff --git a/accessible/ipc/other/RemoteAccessible.h b/accessible/ipc/other/RemoteAccessible.h
new file mode 100644
index 0000000000..57ba4db328
--- /dev/null
+++ b/accessible/ipc/other/RemoteAccessible.h
@@ -0,0 +1,107 @@
+/* -*- 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_RemoteAccessible_h
+#define mozilla_a11y_RemoteAccessible_h
+
+#include "LocalAccessible.h"
+#include "mozilla/a11y/RemoteAccessibleBase.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 {
+
+/**
+ * Functionality common across Linux and macOS for an accessibility tree node
+ * that originated in the parent process.
+ */
+class RemoteAccessible : public RemoteAccessibleBase<RemoteAccessible> {
+ public:
+ RemoteAccessible(uint64_t aID, RemoteAccessible* aParent,
+ DocAccessibleParent* aDoc, role aRole, AccType aType,
+ AccGenericType aGenericTypes, uint8_t aRoleMapEntryIndex)
+ : RemoteAccessibleBase(aID, aParent, aDoc, aRole, aType, aGenericTypes,
+ aRoleMapEntryIndex) {
+ MOZ_COUNT_CTOR(RemoteAccessible);
+ }
+
+ MOZ_COUNTED_DTOR(RemoteAccessible)
+
+#include "mozilla/a11y/RemoteAccessibleShared.h"
+
+ virtual uint32_t CharacterCount() const override;
+
+ LayoutDeviceIntRect TextBounds(
+ int32_t aStartOffset, int32_t aEndOffset,
+ uint32_t aCoordType =
+ nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE) override;
+
+ LayoutDeviceIntRect CharBounds(int32_t aOffset, uint32_t aCoordType) override;
+
+ virtual already_AddRefed<AccAttributes> TextAttributes(
+ bool aIncludeDefAttrs, int32_t aOffset, int32_t* aStartOffset,
+ int32_t* aEndOffset) override;
+
+ virtual already_AddRefed<AccAttributes> DefaultTextAttributes() override;
+
+ virtual uint32_t StartOffset() override;
+ virtual uint32_t EndOffset() override;
+
+ virtual int32_t LinkIndexAtOffset(uint32_t aOffset) override;
+
+ virtual bool DoAction(uint8_t aIndex) const override;
+ virtual uint8_t ActionCount() const override;
+ virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
+ virtual KeyBinding AccessKey() const override;
+
+ virtual void SelectedItems(nsTArray<Accessible*>* aSelectedItems) override;
+ virtual uint32_t SelectedItemCount() override;
+ virtual Accessible* GetSelectedItem(uint32_t aIndex) override;
+ virtual bool IsItemSelected(uint32_t aIndex) override;
+ virtual bool AddItemToSelection(uint32_t aIndex) override;
+ virtual bool RemoveItemFromSelection(uint32_t aIndex) override;
+ virtual bool SelectAll() override;
+ virtual bool UnselectAll() override;
+
+ virtual nsAtom* LandmarkRole() const override;
+
+ virtual int32_t SelectionCount() override;
+
+ using RemoteAccessibleBase<RemoteAccessible>::SelectionBoundsAt;
+ bool SelectionBoundsAt(int32_t aSelectionNum, nsString& aData,
+ int32_t* aStartOffset, int32_t* aEndOffset);
+
+ virtual bool TableIsProbablyForLayout() override;
+
+ /**
+ * Get all relations for this accessible.
+ */
+ void Relations(nsTArray<RelationType>* aTypes,
+ nsTArray<nsTArray<RemoteAccessible*>>* aTargetSets) const;
+
+ protected:
+ explicit RemoteAccessible(DocAccessibleParent* aThisAsDoc)
+ : RemoteAccessibleBase(aThisAsDoc) {
+ MOZ_COUNT_CTOR(RemoteAccessible);
+ }
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// RemoteAccessible downcasting method
+
+inline RemoteAccessible* Accessible::AsRemote() {
+ return IsRemote() ? static_cast<RemoteAccessible*>(this) : nullptr;
+}
+
+} // namespace a11y
+} // namespace mozilla
+
+#endif
diff --git a/accessible/ipc/other/moz.build b/accessible/ipc/other/moz.build
new file mode 100644
index 0000000000..2ea27c20c8
--- /dev/null
+++ b/accessible/ipc/other/moz.build
@@ -0,0 +1,51 @@
+# -*- 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/.
+
+
+if CONFIG["ACCESSIBILITY"]:
+ IPDL_SOURCES += [
+ "PDocAccessible.ipdl",
+ ]
+
+ EXPORTS.mozilla.a11y += [
+ "DocAccessibleChild.h",
+ "RemoteAccessible.h",
+ ]
+
+ SOURCES += [
+ "DocAccessibleChild.cpp",
+ "RemoteAccessible.cpp",
+ ]
+
+ LOCAL_INCLUDES += [
+ "../../base",
+ "../../generic",
+ "../../xpcom",
+ ]
+
+ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+ LOCAL_INCLUDES += [
+ "/accessible/atk",
+ ]
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
+ LOCAL_INCLUDES += [
+ "/accessible/mac",
+ ]
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
+ LOCAL_INCLUDES += [
+ "/accessible/android",
+ ]
+ else:
+ LOCAL_INCLUDES += [
+ "/accessible/other",
+ ]
+
+include("/ipc/chromium/chromium-config.mozbuild")
+
+# Add libFuzzer configuration directives
+include("/tools/fuzzing/libfuzzer-config.mozbuild")
+
+FINAL_LIBRARY = "xul"