diff options
Diffstat (limited to 'accessible/ipc/other')
-rw-r--r-- | accessible/ipc/other/DocAccessibleChild.cpp | 1734 | ||||
-rw-r--r-- | accessible/ipc/other/DocAccessibleChild.h | 501 | ||||
-rw-r--r-- | accessible/ipc/other/PDocAccessible.ipdl | 333 | ||||
-rw-r--r-- | accessible/ipc/other/ProxyAccessible.cpp | 856 | ||||
-rw-r--r-- | accessible/ipc/other/ProxyAccessible.h | 46 | ||||
-rw-r--r-- | accessible/ipc/other/moz.build | 52 |
6 files changed, 3522 insertions, 0 deletions
diff --git a/accessible/ipc/other/DocAccessibleChild.cpp b/accessible/ipc/other/DocAccessibleChild.cpp new file mode 100644 index 0000000000..523b8e127e --- /dev/null +++ b/accessible/ipc/other/DocAccessibleChild.cpp @@ -0,0 +1,1734 @@ +/* -*- 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 "nsAccessibilityService.h" +#include "Accessible-inl.h" +#include "ProxyAccessible.h" +#include "Relation.h" +#include "HyperTextAccessible-inl.h" +#include "TextLeafAccessible.h" +#include "ImageAccessible.h" +#include "TableAccessible.h" +#include "TableCellAccessible.h" +#include "nsIPersistentProperties2.h" +#include "nsAccUtils.h" +#ifdef MOZ_ACCESSIBILITY_ATK +# include "AccessibleWrap.h" +#endif +#include "mozilla/PresShell.h" +#include "mozilla/a11y/DocAccessiblePlatformExtChild.h" + +namespace mozilla { +namespace a11y { + +Accessible* DocAccessibleChild::IdToAccessible(const uint64_t& aID) const { + if (!aID) return mDoc; + + if (!mDoc) return nullptr; + + return mDoc->GetAccessibleByUniqueID(reinterpret_cast<void*>(aID)); +} + +Accessible* DocAccessibleChild::IdToAccessibleLink(const uint64_t& aID) const { + Accessible* acc = IdToAccessible(aID); + return acc && acc->IsLink() ? acc : nullptr; +} + +Accessible* DocAccessibleChild::IdToAccessibleSelect( + const uint64_t& aID) const { + Accessible* acc = IdToAccessible(aID); + return acc && acc->IsSelect() ? acc : nullptr; +} + +HyperTextAccessible* DocAccessibleChild::IdToHyperTextAccessible( + const uint64_t& aID) const { + Accessible* acc = IdToAccessible(aID); + return acc && acc->IsHyperText() ? acc->AsHyperText() : nullptr; +} + +TextLeafAccessible* DocAccessibleChild::IdToTextLeafAccessible( + const uint64_t& aID) const { + Accessible* acc = IdToAccessible(aID); + return acc && acc->IsTextLeaf() ? acc->AsTextLeaf() : nullptr; +} + +ImageAccessible* DocAccessibleChild::IdToImageAccessible( + const uint64_t& aID) const { + Accessible* acc = IdToAccessible(aID); + return (acc && acc->IsImage()) ? acc->AsImage() : nullptr; +} + +TableCellAccessible* DocAccessibleChild::IdToTableCellAccessible( + const uint64_t& aID) const { + Accessible* acc = IdToAccessible(aID); + return (acc && acc->IsTableCell()) ? acc->AsTableCell() : nullptr; +} + +TableAccessible* DocAccessibleChild::IdToTableAccessible( + const uint64_t& aID) const { + Accessible* acc = IdToAccessible(aID); + return (acc && acc->IsTable()) ? acc->AsTable() : nullptr; +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvState(const uint64_t& aID, + uint64_t* aState) { + Accessible* 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) { + Accessible* 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) { + Accessible* 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) { + Accessible* 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) { + Accessible* 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) { + Accessible* acc = IdToAccessible(aID); + if (!acc) return IPC_OK(); + + acc->Description(*aDesc); + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvAttributes( + const uint64_t& aID, nsTArray<Attribute>* aAttributes) { + Accessible* acc = IdToAccessible(aID); + if (!acc) return IPC_OK(); + + nsCOMPtr<nsIPersistentProperties> props = acc->Attributes(); + if (!nsAccUtils::PersistentPropertiesToArray(props, aAttributes)) { + return IPC_FAIL_NO_REASON(this); + } + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvRelationByType( + const uint64_t& aID, const uint32_t& aType, nsTArray<uint64_t>* aTargets) { + Accessible* acc = IdToAccessible(aID); + if (!acc) return IPC_OK(); + + auto type = static_cast<RelationType>(aType); + Relation rel = acc->RelationByType(type); + while (Accessible* target = rel.Next()) + aTargets->AppendElement(reinterpret_cast<uint64_t>(target->UniqueID())); + + return IPC_OK(); +} + +static void AddRelation(Accessible* aAcc, RelationType aType, + nsTArray<RelationTargets>* aTargets) { + Relation rel = aAcc->RelationByType(aType); + nsTArray<uint64_t> targets; + while (Accessible* target = rel.Next()) + targets.AppendElement(reinterpret_cast<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) { + Accessible* 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) { + Accessible* 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) { + Accessible* acc = IdToAccessible(aID); + if (!acc) { + return IPC_OK(); + } + + if (nsAtom* roleAtom = acc->LandmarkRole()) { + roleAtom->ToString(*aLandmark); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvARIARoleAtom( + const uint64_t& aID, nsString* aRole) { + Accessible* acc = IdToAccessible(aID); + if (!acc) { + return IPC_OK(); + } + + if (const nsRoleMapEntry* roleMap = acc->ARIARoleMap()) { + if (nsStaticAtom* roleAtom = roleMap->roleAtom) { + roleAtom->ToString(*aRole); + } + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvGroupPosition( + const uint64_t& aID, int32_t* aLevel, int32_t* aSimilarItemsInGroup, + int32_t* aPositionInGroup) { + Accessible* 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::RecvScrollTo( + const uint64_t& aID, const uint32_t& aScrollType) { + Accessible* acc = IdToAccessible(aID); + if (acc) { + RefPtr<PresShell> presShell = acc->Document()->PresShellPtr(); + nsCOMPtr<nsIContent> content = acc->GetContent(); + nsCoreUtils::ScrollTo(presShell, content, aScrollType); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvScrollToPoint( + const uint64_t& aID, const uint32_t& aScrollType, const int32_t& aX, + const int32_t& aY) { + Accessible* acc = IdToAccessible(aID); + if (acc) { + acc->ScrollToPoint(aScrollType, aX, aY); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvAnnounce( + const uint64_t& aID, const nsString& aAnnouncement, + const uint16_t& aPriority) { + Accessible* 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::RecvSetCaretOffset( + const uint64_t& aID, const int32_t& aOffset) { + HyperTextAccessible* acc = IdToHyperTextAccessible(aID); + if (acc && acc->IsTextRole() && acc->IsValidOffset(aOffset)) { + acc->SetCaretOffset(aOffset); + } + 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) { + Accessible* 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, + nsTArray<Attribute>* aAttributes, int32_t* aStartOffset, + int32_t* aEndOffset) { + HyperTextAccessible* acc = IdToHyperTextAccessible(aID); + if (!acc || !acc->IsTextRole()) { + return IPC_OK(); + } + + nsCOMPtr<nsIPersistentProperties> props = + acc->TextAttributes(aIncludeDefAttrs, aOffset, aStartOffset, aEndOffset); + if (!nsAccUtils::PersistentPropertiesToArray(props, aAttributes)) { + return IPC_FAIL_NO_REASON(this); + } + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvDefaultTextAttributes( + const uint64_t& aID, nsTArray<Attribute>* aAttributes) { + HyperTextAccessible* acc = IdToHyperTextAccessible(aID); + if (!acc || !acc->IsTextRole()) { + return IPC_OK(); + } + + nsCOMPtr<nsIPersistentProperties> props = acc->DefaultTextAttributes(); + if (!nsAccUtils::PersistentPropertiesToArray(props, aAttributes)) { + return IPC_FAIL_NO_REASON(this); + } + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvTextBounds( + const uint64_t& aID, const int32_t& aStartOffset, const int32_t& aEndOffset, + const uint32_t& aCoordType, nsIntRect* aRetVal) { + HyperTextAccessible* acc = IdToHyperTextAccessible(aID); + if (acc && acc->IsTextRole()) { + *aRetVal = acc->TextBounds(aStartOffset, aEndOffset, aCoordType); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvCharBounds( + const uint64_t& aID, const int32_t& aOffset, const uint32_t& aCoordType, + nsIntRect* aRetVal) { + HyperTextAccessible* acc = IdToHyperTextAccessible(aID); + if (acc && acc->IsTextRole()) { + *aRetVal = acc->CharBounds(aOffset, aCoordType); + } + + return 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 nsString& 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 nsString& aText, const int32_t& aPosition, + bool* aValid) { + HyperTextAccessible* acc = IdToHyperTextAccessible(aID); + if (acc && acc->IsTextRole()) { + *aValid = acc->IsValidOffset(aPosition); + acc->InsertText(aText, aPosition); + } + + return 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, nsIntPoint* aRetVal) { + ImageAccessible* acc = IdToImageAccessible(aID); + if (acc) { + *aRetVal = acc->Position(aCoordType); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvImageSize(const uint64_t& aID, + nsIntSize* 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) { + Accessible* 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) { + Accessible* 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) { + Accessible* 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) { + Accessible* 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) { + Accessible* 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; + Accessible* acc = IdToAccessibleLink(aID); + if (acc) { + Accessible* 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) { + Accessible* link = acc->LinkAt(aIndex); + if (link) { + *aIDOfLink = reinterpret_cast<uint64_t>(link->UniqueID()); + *aOk = true; + } + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvLinkIndexOf( + const uint64_t& aID, const uint64_t& aLinkID, int32_t* aIndex) { + HyperTextAccessible* acc = IdToHyperTextAccessible(aID); + Accessible* link = IdToAccessible(aLinkID); + *aIndex = -1; + if (acc && link) { + *aIndex = acc->LinkIndexOf(link); + } + + return 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* aColIdx, + uint32_t* aRowIdx) { + *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 (uint32_t i = 0; i < headerCells.Length(); ++i) { + aCells->AppendElement( + reinterpret_cast<uint64_t>(headerCells[i]->UniqueID())); + } + } + + 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 (uint32_t i = 0; i < headerCells.Length(); ++i) { + aCells->AppendElement( + reinterpret_cast<uint64_t>(headerCells[i]->UniqueID())); + } + } + + 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) { + Accessible* 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) { + Accessible* 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 (uint32_t i = 0; i < cells.Length(); ++i) { + aCellIDs->AppendElement(reinterpret_cast<uint64_t>(cells[i]->UniqueID())); + } + } + + 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 = reinterpret_cast<uint64_t>(header->UniqueID()); + *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 = reinterpret_cast<uint64_t>(header->UniqueID()); + *aOk = true; + } + } +#endif + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvSelectedItems( + const uint64_t& aID, nsTArray<uint64_t>* aSelectedItemIDs) { + Accessible* acc = IdToAccessibleSelect(aID); + if (acc) { + AutoTArray<Accessible*, 10> selectedItems; + acc->SelectedItems(&selectedItems); + aSelectedItemIDs->SetCapacity(selectedItems.Length()); + for (size_t i = 0; i < selectedItems.Length(); ++i) { + aSelectedItemIDs->AppendElement( + reinterpret_cast<uint64_t>(selectedItems[i]->UniqueID())); + } + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvSelectedItemCount( + const uint64_t& aID, uint32_t* aCount) { + *aCount = 0; + Accessible* 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) { + *aSelected = 0; + *aOk = false; + Accessible* acc = IdToAccessibleSelect(aID); + if (acc) { + Accessible* item = acc->GetSelectedItem(aIndex); + if (item) { + *aSelected = reinterpret_cast<uint64_t>(item->UniqueID()); + *aOk = true; + } + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvIsItemSelected( + const uint64_t& aID, const uint32_t& aIndex, bool* aSelected) { + *aSelected = false; + Accessible* acc = IdToAccessibleSelect(aID); + if (acc) { + *aSelected = acc->IsItemSelected(aIndex); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvAddItemToSelection( + const uint64_t& aID, const uint32_t& aIndex, bool* aSuccess) { + *aSuccess = false; + Accessible* acc = IdToAccessibleSelect(aID); + if (acc) { + *aSuccess = acc->AddItemToSelection(aIndex); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvRemoveItemFromSelection( + const uint64_t& aID, const uint32_t& aIndex, bool* aSuccess) { + *aSuccess = false; + Accessible* acc = IdToAccessibleSelect(aID); + if (acc) { + *aSuccess = acc->RemoveItemFromSelection(aIndex); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvSelectAll(const uint64_t& aID, + bool* aSuccess) { + *aSuccess = false; + Accessible* acc = IdToAccessibleSelect(aID); + if (acc) { + *aSuccess = acc->SelectAll(); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvUnselectAll(const uint64_t& aID, + bool* aSuccess) { + *aSuccess = false; + Accessible* acc = IdToAccessibleSelect(aID); + if (acc) { + *aSuccess = acc->UnselectAll(); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvTakeSelection( + const uint64_t& aID) { + Accessible* acc = IdToAccessible(aID); + if (acc) { + acc->TakeSelection(); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvSetSelected( + const uint64_t& aID, const bool& aSelect) { + Accessible* acc = IdToAccessible(aID); + if (acc) { + acc->SetSelected(aSelect); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvDoAction(const uint64_t& aID, + const uint8_t& aIndex, + bool* aSuccess) { + *aSuccess = false; + Accessible* acc = IdToAccessible(aID); + if (acc) { + *aSuccess = acc->DoAction(aIndex); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvActionCount(const uint64_t& aID, + uint8_t* aCount) { + *aCount = 0; + Accessible* acc = IdToAccessible(aID); + if (acc) { + *aCount = acc->ActionCount(); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvActionDescriptionAt( + const uint64_t& aID, const uint8_t& aIndex, nsString* aDescription) { + Accessible* acc = IdToAccessible(aID); + if (acc) { + acc->ActionDescriptionAt(aIndex, *aDescription); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvActionNameAt( + const uint64_t& aID, const uint8_t& aIndex, nsString* aName) { + Accessible* 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; + Accessible* acc = IdToAccessible(aID); + if (acc) { + KeyBinding kb = acc->AccessKey(); + *aKey = kb.Key(); + *aModifierMask = kb.ModifierMask(); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvKeyboardShortcut( + const uint64_t& aID, uint32_t* aKey, uint32_t* aModifierMask) { + *aKey = 0; + *aModifierMask = 0; + Accessible* acc = IdToAccessible(aID); + if (acc) { + KeyBinding kb = acc->KeyboardShortcut(); + *aKey = kb.Key(); + *aModifierMask = kb.ModifierMask(); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvAtkKeyBinding( + const uint64_t& aID, nsString* aResult) { +#ifdef MOZ_ACCESSIBILITY_ATK + Accessible* 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>(); + Accessible* 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; + Accessible* 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>(); + Accessible* 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>(); + Accessible* 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>(); + Accessible* acc = IdToAccessible(aID); + if (acc) { + *aStep = acc->Step(); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvTakeFocus(const uint64_t& aID) { + Accessible* acc = IdToAccessible(aID); + if (acc) { + acc->TakeFocus(); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvFocusedChild( + const uint64_t& aID, uint64_t* aChild, bool* aOk) { + *aChild = 0; + *aOk = false; + Accessible* acc = IdToAccessible(aID); + if (acc) { + Accessible* child = acc->FocusedChild(); + if (child) { + *aChild = reinterpret_cast<uint64_t>(child->UniqueID()); + *aOk = true; + } + } + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvLanguage(const uint64_t& aID, + nsString* aLocale) { + Accessible* acc = IdToAccessible(aID); + if (acc) { + acc->Language(*aLocale); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvDocType(const uint64_t& aID, + nsString* aType) { + Accessible* 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) { + Accessible* acc = IdToAccessible(aID); + if (acc) { + mozilla::ErrorResult rv; + acc->GetContent()->GetTextContent(*aTitle, rv); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvURL(const uint64_t& aID, + nsString* aURL) { + Accessible* acc = IdToAccessible(aID); + if (acc && acc->IsDoc()) { + acc->AsDoc()->URL(*aURL); + } + + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvMimeType(const uint64_t& aID, + nsString* aMime) { + Accessible* 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) { + Accessible* 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; + Accessible* acc = IdToAccessible(aID); + if (acc && !acc->IsDefunct()) { + int32_t x = aX; + int32_t y = aY; + Accessible* result = acc->ChildAtPoint( + x, y, static_cast<Accessible::EWhichChildAtPoint>(aWhich)); + if (result) { + // Accessible::ChildAtPoint can return an Accessible 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; + Accessible* acc = IdToAccessible(aID); + if (acc && !acc->IsDefunct()) { + nsIntRect screenRect = acc->Bounds(); + if (!screenRect.IsEmpty()) { + if (aNeedsScreenCoords) { + nsIntPoint winCoords = + nsCoreUtils::GetScreenCoordsForWindow(acc->GetNode()); + screenRect.x -= winCoords.x; + screenRect.y -= winCoords.y; + } + + *aX = screenRect.x; + *aY = screenRect.y; + *aWidth = screenRect.width; + *aHeight = screenRect.height; + } + } + return 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; + Accessible* acc = IdToAccessible(aID); + if (acc && !acc->IsDefunct()) { + nsIntRect screenRect = acc->BoundsInCSSPixels(); + if (!screenRect.IsEmpty()) { + *aX = screenRect.x; + *aY = screenRect.y; + *aWidth = screenRect.width; + *aHeight = screenRect.height; + } + } + return IPC_OK(); +} + +mozilla::ipc::IPCResult DocAccessibleChild::RecvDOMNodeID( + const uint64_t& aID, nsString* aDOMNodeID) { + Accessible* 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..f568ce6ad6 --- /dev/null +++ b/accessible/ipc/other/DocAccessibleChild.h @@ -0,0 +1,501 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_a11y_DocAccessibleChild_h +#define mozilla_a11y_DocAccessibleChild_h + +#include "mozilla/a11y/DocAccessibleChildBase.h" + +namespace mozilla { +namespace a11y { + +class Accessible; +class 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 RecvARIARoleAtom(const uint64_t& aID, + nsString* aRole) 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, nsTArray<Attribute>* aAttributes) override; + MOZ_CAN_RUN_SCRIPT_BOUNDARY + virtual mozilla::ipc::IPCResult RecvScrollTo( + const uint64_t& aID, const uint32_t& aScrollType) 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 nsString& 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 RecvSetCaretOffset( + const uint64_t& aID, const 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, + nsTArray<Attribute>* aAttributes, int32_t* aStartOffset, + int32_t* aEndOffset) override; + + virtual mozilla::ipc::IPCResult RecvDefaultTextAttributes( + const uint64_t& aID, nsTArray<Attribute>* aAttributes) override; + + virtual mozilla::ipc::IPCResult RecvTextBounds(const uint64_t& aID, + const int32_t& aStartOffset, + const int32_t& aEndOffset, + const uint32_t& aCoordType, + nsIntRect* aRetVal) override; + + virtual mozilla::ipc::IPCResult RecvCharBounds(const uint64_t& aID, + const int32_t& aOffset, + const uint32_t& aCoordType, + nsIntRect* 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 nsString& aText) override; + + virtual mozilla::ipc::IPCResult RecvInsertText(const uint64_t& aID, + const nsString& 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, + nsIntPoint* aRetVal) override; + + virtual mozilla::ipc::IPCResult RecvImageSize(const uint64_t& aID, + nsIntSize* 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 RecvLinkIndexOf(const uint64_t& aID, + const uint64_t& aLinkID, + int32_t* aIndex) 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* aColIdx, + uint32_t* aRowIdx) 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 RecvTakeSelection( + const uint64_t& aID) override; + virtual mozilla::ipc::IPCResult RecvSetSelected(const uint64_t& aID, + const bool& aSelect) 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 RecvActionDescriptionAt( + const uint64_t& aID, const uint8_t& aIndex, + nsString* aDescription) 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 RecvKeyboardShortcut( + 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 RecvTakeFocus(const uint64_t& aID) override; + + virtual mozilla::ipc::IPCResult RecvFocusedChild(const uint64_t& aID, + uint64_t* aChild, + bool* aOk) 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 RecvURL(const uint64_t& aID, + nsString* aURL) 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: + Accessible* IdToAccessible(const uint64_t& aID) const; + Accessible* IdToAccessibleLink(const uint64_t& aID) const; + Accessible* IdToAccessibleSelect(const uint64_t& aID) const; + HyperTextAccessible* IdToHyperTextAccessible(const uint64_t& aID) const; + TextLeafAccessible* IdToTextLeafAccessible(const uint64_t& aID) const; + ImageAccessible* IdToImageAccessible(const uint64_t& aID) const; + TableCellAccessible* IdToTableCellAccessible(const uint64_t& aID) const; + TableAccessible* IdToTableAccessible(const uint64_t& aID) const; +}; + +} // 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..d47a704a62 --- /dev/null +++ b/accessible/ipc/other/PDocAccessible.ipdl @@ -0,0 +1,333 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +include protocol PFileDescriptorSet; +include protocol PBrowser; +include protocol PDocAccessiblePlatformExt; + +include "mozilla/GfxMessageUtils.h"; + +using nsIntRect from "nsRect.h"; +using mozilla::a11y::role from "mozilla/a11y/IPCTypes.h"; +using mozilla::gfx::IntSize from "mozilla/gfx/Point.h"; +using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h"; + +namespace mozilla { +namespace a11y { + +struct AccessibleData +{ + uint64_t ID; + role Role; + uint32_t ChildrenCount; + uint32_t Interfaces; +}; + +union OriginDocument +{ + PDocAccessible; +}; + +struct BatchData +{ + OriginDocument Document; + uint64_t ID; + uint64_t State; + nsIntRect Bounds; + uint8_t ActionCount; + nsString Name; + nsString TextValue; + nsString DOMNodeID; + nsString Description; + double CurValue; + double MinValue; + double MaxValue; + double Step; + Attribute[] Attributes; +}; + +struct ShowEventData +{ + uint64_t ID; + uint32_t Idx; + AccessibleData[] NewTree; + bool EventSuppressed; +}; + +struct Attribute +{ + nsCString Name; + nsString Value; +}; + +struct RelationTargets +{ + uint32_t Type; + uint64_t[] Targets; +}; + +struct TextRangeData +{ + uint64_t StartID; + uint64_t EndID; + int32_t StartOffset; + int32_t EndOffset; +}; + +nested(upto inside_sync) 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); + 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); + 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); + +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(); + + // Accessible + nested(inside_sync) sync State(uint64_t aID) returns(uint64_t states); + nested(inside_sync) sync NativeState(uint64_t aID) returns(uint64_t states); + nested(inside_sync) sync Name(uint64_t aID) returns(nsString name, 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(Attribute[] attributes); + nested(inside_sync) sync RelationByType(uint64_t aID, uint32_t aRelationType) + returns(uint64_t[] targets); + nested(inside_sync) sync Relations(uint64_t aID) returns(RelationTargets[] relations); + nested(inside_sync) sync IsSearchbox(uint64_t aID) returns(bool retval); + nested(inside_sync) sync LandmarkRole(uint64_t aID) returns(nsString landmark); + nested(inside_sync) sync ARIARoleAtom(uint64_t aID) returns(nsString ariaRole); + 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(Attribute[] aAttributes, int32_t aStartOffset, int32_t aEndOffset); + nested(inside_sync) sync DefaultTextAttributes(uint64_t aID) returns(Attribute[] aAttributes); + + nested(inside_sync) sync TextBounds(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset, + uint32_t aCoordType) + returns(nsIntRect aRetVal); + nested(inside_sync) sync CharBounds(uint64_t aID, int32_t aOffset, uint32_t aCoordType) + returns(nsIntRect aRetVal); + + nested(inside_sync) sync OffsetAtPoint(uint64_t aID, int32_t aX, int32_t aY, uint32_t aCoordType) + returns(int32_t aRetVal); + + nested(inside_sync) sync SelectionBoundsAt(uint64_t aID, int32_t aSelectionNum) + returns(bool aSucceeded, nsString aData, int32_t aStartOffset, int32_t aEndOffset); + nested(inside_sync) sync SetSelectionBoundsAt(uint64_t aID, int32_t aSelectionNum, + int32_t aStartOffset, int32_t aEndOffset) + returns(bool aSucceeded); + nested(inside_sync) sync AddToSelection(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset) + returns(bool aSucceeded); + nested(inside_sync) sync RemoveFromSelection(uint64_t aID, int32_t aSelectionNum) + returns(bool aSucceeded); + + async ScrollSubstringTo(uint64_t aID, int32_t aStartOffset, int32_t aEndOffset, + uint32_t aScrollType); + async ScrollSubstringToPoint(uint64_t aID, + int32_t aStartOffset, + int32_t aEndOffset, + uint32_t aCoordinateType, + int32_t aX, int32_t aY); + + nested(inside_sync) sync Text(uint64_t aID) returns(nsString aText); + nested(inside_sync) sync ReplaceText(uint64_t aID, nsString aText); + nested(inside_sync) sync InsertText(uint64_t aID, nsString aText, int32_t aPosition) + returns(bool aValid); + nested(inside_sync) sync CopyText(uint64_t aID, int32_t aStartPos, int32_t aEndPos) + returns(bool aValid); + nested(inside_sync) sync CutText(uint64_t aID, int32_t aStartPos, int32_t aEndPos) + returns(bool aValid); + nested(inside_sync) sync DeleteText(uint64_t aID, int32_t aStartPos, int32_t aEndPos) + returns(bool aValid); + nested(inside_sync) sync PasteText(uint64_t aID, int32_t aPosition) + returns(bool aValid); + + nested(inside_sync) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal); + nested(inside_sync) sync ImageSize(uint64_t aID) returns(IntSize aRetVal); + + nested(inside_sync) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk); + nested(inside_sync) sync EndOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk); + nested(inside_sync) sync IsLinkValid(uint64_t aID) returns(bool aRetVal); + nested(inside_sync) sync AnchorCount(uint64_t aID) returns(uint32_t aRetVal, bool aOk); + nested(inside_sync) sync AnchorURIAt(uint64_t aID, uint32_t aIndex) returns(nsCString aURI, bool aOk); + nested(inside_sync) sync AnchorAt(uint64_t aID, uint32_t aIndex) returns(uint64_t aIDOfAnchor, bool aOk); + + nested(inside_sync) sync LinkCount(uint64_t aID) returns(uint32_t aCount); + nested(inside_sync) sync LinkAt(uint64_t aID, uint32_t aIndex) returns(uint64_t aIDOfLink, bool aOk); + nested(inside_sync) sync LinkIndexOf(uint64_t aID, uint64_t aLinkID) returns(int32_t aIndex); + nested(inside_sync) sync LinkIndexAtOffset(uint64_t aID, uint32_t aOffset) returns(int32_t aIndex); + + nested(inside_sync) sync TableOfACell(uint64_t aID) returns(uint64_t aTableID, bool aOk); + nested(inside_sync) sync ColIdx(uint64_t aID) returns(uint32_t aIndex); + nested(inside_sync) sync RowIdx(uint64_t aID) returns(uint32_t aIndex); + nested(inside_sync) sync GetPosition(uint64_t aID) returns(uint32_t aRow, uint32_t aCol); + nested(inside_sync) sync ColExtent(uint64_t aID) returns(uint32_t aExtent); + nested(inside_sync) sync RowExtent(uint64_t aID) returns(uint32_t aExtent); + nested(inside_sync) sync GetColRowExtents(uint64_t aID) + returns(uint32_t aCol, uint32_t aRow, uint32_t aColExtent, uint32_t aRowExtent); + nested(inside_sync) sync ColHeaderCells(uint64_t aID) returns(uint64_t[] aCells); + nested(inside_sync) sync RowHeaderCells(uint64_t aID) returns(uint64_t[] aCells); + nested(inside_sync) sync IsCellSelected(uint64_t aID) returns(bool aSelected); + + nested(inside_sync) sync TableCaption(uint64_t aID) returns(uint64_t aCaptionID, bool aOk); + nested(inside_sync) sync TableSummary(uint64_t aID) returns(nsString aSummary); + nested(inside_sync) sync TableColumnCount(uint64_t aID) returns(uint32_t aColCount); + nested(inside_sync) sync TableRowCount(uint64_t aID) returns(uint32_t aRowCount); + nested(inside_sync) sync TableCellAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint64_t aCellID, bool aOk); + nested(inside_sync) sync TableCellIndexAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(int32_t aIndex); + nested(inside_sync) sync TableColumnIndexAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aCol); + nested(inside_sync) sync TableRowIndexAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aRow); + nested(inside_sync) sync TableRowAndColumnIndicesAt(uint64_t aID, uint32_t aCellIndex) returns(int32_t aRow, int32_t aCol); + nested(inside_sync) sync TableColumnExtentAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint32_t aExtent); + nested(inside_sync) sync TableRowExtentAt(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(uint32_t aExtent); + nested(inside_sync) sync TableColumnDescription(uint64_t aID, uint32_t aCol) returns(nsString aDescription); + nested(inside_sync) sync TableRowDescription(uint64_t aID, uint32_t aRow) returns(nsString aDescription); + nested(inside_sync) sync TableColumnSelected(uint64_t aID, uint32_t aCol) returns(bool aSelected); + nested(inside_sync) sync TableRowSelected(uint64_t aID, uint32_t aRow) returns(bool aSelected); + nested(inside_sync) sync TableCellSelected(uint64_t aID, uint32_t aRow, uint32_t aCol) returns(bool aSelected); + nested(inside_sync) sync TableSelectedCellCount(uint64_t aID) returns(uint32_t aSelectedCells); + nested(inside_sync) sync TableSelectedColumnCount(uint64_t aID) returns(uint32_t aSelectedColumns); + nested(inside_sync) sync TableSelectedRowCount(uint64_t aID) returns(uint32_t aSelectedRows); + nested(inside_sync) sync TableSelectedCells(uint64_t aID) returns(uint64_t[] aCellIDs); + nested(inside_sync) sync TableSelectedCellIndices(uint64_t aID) returns(uint32_t[] aCellIndeces); + nested(inside_sync) sync TableSelectedColumnIndices(uint64_t aID) returns(uint32_t[] aColumnIndeces); + nested(inside_sync) sync TableSelectedRowIndices(uint64_t aID) returns(uint32_t[] aRowIndeces); + nested(inside_sync) sync TableSelectColumn(uint64_t aID, uint32_t aCol); + nested(inside_sync) sync TableSelectRow(uint64_t aID, uint32_t aRow); + nested(inside_sync) sync TableUnselectColumn(uint64_t aID, uint32_t aCol); + nested(inside_sync) sync TableUnselectRow(uint64_t aID, uint32_t aRow); + nested(inside_sync) sync TableIsProbablyForLayout(uint64_t aID) returns(bool aForLayout); + nested(inside_sync) sync AtkTableColumnHeader(uint64_t aID, int32_t aCol) + returns(uint64_t aHeaderID, bool aOk); + nested(inside_sync) sync AtkTableRowHeader(uint64_t aID, int32_t aRow) + returns(uint64_t aHeaderID, bool aOk); + + nested(inside_sync) sync SelectedItems(uint64_t aID) returns(uint64_t[] aSelectedItemIDs); + nested(inside_sync) sync SelectedItemCount(uint64_t aID) returns(uint32_t aCount); + nested(inside_sync) sync GetSelectedItem(uint64_t aID, uint32_t aIndex) returns(uint64_t aSelected, bool aOk); + nested(inside_sync) sync IsItemSelected(uint64_t aID, uint32_t aIndex) returns(bool aSelected); + nested(inside_sync) sync AddItemToSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess); + nested(inside_sync) sync RemoveItemFromSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess); + nested(inside_sync) sync SelectAll(uint64_t aID) returns(bool aSuccess); + nested(inside_sync) sync UnselectAll(uint64_t aID) returns(bool aSuccess); + + async TakeSelection(uint64_t aID); + async SetSelected(uint64_t aID, bool aSelected); + + nested(inside_sync) sync DoAction(uint64_t aID, uint8_t aIndex) returns(bool aSuccess); + nested(inside_sync) sync ActionCount(uint64_t aID) returns(uint8_t aCount); + nested(inside_sync) sync ActionDescriptionAt(uint64_t aID, uint8_t aIndex) returns(nsString aDescription); + nested(inside_sync) sync ActionNameAt(uint64_t aID, uint8_t aIndex) returns(nsString aName); + nested(inside_sync) sync AccessKey(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask); + nested(inside_sync) sync KeyboardShortcut(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask); + nested(inside_sync) sync AtkKeyBinding(uint64_t aID) returns(nsString aResult); + + nested(inside_sync) sync CurValue(uint64_t aID) returns(double aValue); + nested(inside_sync) sync SetCurValue(uint64_t aID, double aValue) returns(bool aRetVal); + nested(inside_sync) sync MinValue(uint64_t aID) returns(double aValue); + nested(inside_sync) sync MaxValue(uint64_t aID) returns(double aValue); + nested(inside_sync) sync Step(uint64_t aID) returns(double aStep); + + async TakeFocus(uint64_t aID); + nested(inside_sync) sync FocusedChild(uint64_t aID) + returns(uint64_t aChild, bool aOk); + + nested(inside_sync) sync Language(uint64_t aID) returns(nsString aLocale); + nested(inside_sync) sync DocType(uint64_t aID) returns(nsString aType); + nested(inside_sync) sync Title(uint64_t aID) returns(nsString aTitle); + nested(inside_sync) sync URL(uint64_t aID) returns(nsString aURL); + nested(inside_sync) sync MimeType(uint64_t aID) returns(nsString aMime); + nested(inside_sync) sync URLDocTypeMimeType(uint64_t aID) returns(nsString aURL, nsString aDocType, nsString aMimeType); + + nested(inside_sync) sync 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); +}; + +} +} diff --git a/accessible/ipc/other/ProxyAccessible.cpp b/accessible/ipc/other/ProxyAccessible.cpp new file mode 100644 index 0000000000..31c2fe8b3b --- /dev/null +++ b/accessible/ipc/other/ProxyAccessible.cpp @@ -0,0 +1,856 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "ProxyAccessible.h" +#include "mozilla/a11y/DocAccessibleParent.h" +#include "DocAccessible.h" +#include "mozilla/a11y/DocManager.h" +#include "mozilla/dom/Element.h" +#include "mozilla/dom/BrowserParent.h" +#include "mozilla/Unused.h" +#include "mozilla/a11y/Platform.h" +#include "RelationType.h" +#include "mozilla/a11y/Role.h" + +namespace mozilla { +namespace a11y { + +uint64_t ProxyAccessible::State() const { + uint64_t state = 0; + Unused << mDoc->SendState(mID, &state); + return state; +} + +uint64_t ProxyAccessible::NativeState() const { + uint64_t state = 0; + Unused << mDoc->SendNativeState(mID, &state); + return state; +} + +uint32_t ProxyAccessible::Name(nsString& aName) const { + uint32_t flag; + Unused << mDoc->SendName(mID, &aName, &flag); + return flag; +} + +void ProxyAccessible::Value(nsString& aValue) const { + Unused << mDoc->SendValue(mID, &aValue); +} + +void ProxyAccessible::Help(nsString& aHelp) const { + Unused << mDoc->SendHelp(mID, &aHelp); +} + +void ProxyAccessible::Description(nsString& aDesc) const { + Unused << mDoc->SendDescription(mID, &aDesc); +} + +void ProxyAccessible::Attributes(nsTArray<Attribute>* aAttrs) const { + Unused << mDoc->SendAttributes(mID, aAttrs); +} + +nsTArray<ProxyAccessible*> ProxyAccessible::RelationByType( + RelationType aType) const { + nsTArray<uint64_t> targetIDs; + Unused << mDoc->SendRelationByType(mID, static_cast<uint32_t>(aType), + &targetIDs); + + size_t targetCount = targetIDs.Length(); + nsTArray<ProxyAccessible*> targets(targetCount); + for (size_t i = 0; i < targetCount; i++) + if (ProxyAccessible* proxy = mDoc->GetAccessible(targetIDs[i])) + targets.AppendElement(proxy); + + return targets; +} + +void ProxyAccessible::Relations( + nsTArray<RelationType>* aTypes, + nsTArray<nsTArray<ProxyAccessible*>>* aTargetSets) const { + nsTArray<RelationTargets> ipcRelations; + Unused << mDoc->SendRelations(mID, &ipcRelations); + + size_t relationCount = ipcRelations.Length(); + aTypes->SetCapacity(relationCount); + aTargetSets->SetCapacity(relationCount); + for (size_t i = 0; i < relationCount; i++) { + uint32_t type = ipcRelations[i].Type(); + if (type > static_cast<uint32_t>(RelationType::LAST)) continue; + + size_t targetCount = ipcRelations[i].Targets().Length(); + nsTArray<ProxyAccessible*> targets(targetCount); + for (size_t j = 0; j < targetCount; j++) + if (ProxyAccessible* proxy = + mDoc->GetAccessible(ipcRelations[i].Targets()[j])) + targets.AppendElement(proxy); + + if (targets.IsEmpty()) continue; + + aTargetSets->AppendElement(std::move(targets)); + aTypes->AppendElement(static_cast<RelationType>(type)); + } +} + +bool ProxyAccessible::IsSearchbox() const { + bool retVal = false; + Unused << mDoc->SendIsSearchbox(mID, &retVal); + return retVal; +} + +nsAtom* ProxyAccessible::LandmarkRole() const { + nsString landmark; + Unused << mDoc->SendLandmarkRole(mID, &landmark); + return NS_GetStaticAtom(landmark); +} + +nsStaticAtom* ProxyAccessible::ARIARoleAtom() const { + nsString role; + Unused << mDoc->SendARIARoleAtom(mID, &role); + return NS_GetStaticAtom(role); +} + +GroupPos ProxyAccessible::GroupPosition() { + GroupPos groupPos; + Unused << mDoc->SendGroupPosition(mID, &groupPos.level, &groupPos.setSize, + &groupPos.posInSet); + return groupPos; +} + +void ProxyAccessible::ScrollTo(uint32_t aScrollType) { + Unused << mDoc->SendScrollTo(mID, aScrollType); +} + +void ProxyAccessible::ScrollToPoint(uint32_t aScrollType, int32_t aX, + int32_t aY) { + Unused << mDoc->SendScrollToPoint(mID, aScrollType, aX, aY); +} + +void ProxyAccessible::Announce(const nsString& aAnnouncement, + uint16_t aPriority) { + Unused << mDoc->SendAnnounce(mID, aAnnouncement, aPriority); +} + +int32_t ProxyAccessible::CaretLineNumber() { + int32_t line = -1; + Unused << mDoc->SendCaretOffset(mID, &line); + return line; +} + +int32_t ProxyAccessible::CaretOffset() { + int32_t offset = 0; + Unused << mDoc->SendCaretOffset(mID, &offset); + return offset; +} + +void ProxyAccessible::SetCaretOffset(int32_t aOffset) { + Unused << mDoc->SendSetCaretOffset(mID, aOffset); +} + +int32_t ProxyAccessible::CharacterCount() { + int32_t count = 0; + Unused << mDoc->SendCharacterCount(mID, &count); + return count; +} + +int32_t ProxyAccessible::SelectionCount() { + int32_t count = 0; + Unused << mDoc->SendSelectionCount(mID, &count); + return count; +} + +bool ProxyAccessible::TextSubstring(int32_t aStartOffset, int32_t aEndOfset, + nsString& aText) const { + bool valid; + Unused << mDoc->SendTextSubstring(mID, aStartOffset, aEndOfset, &aText, + &valid); + return valid; +} + +void ProxyAccessible::GetTextAfterOffset(int32_t aOffset, + AccessibleTextBoundary aBoundaryType, + nsString& aText, int32_t* aStartOffset, + int32_t* aEndOffset) { + Unused << mDoc->SendGetTextAfterOffset(mID, aOffset, aBoundaryType, &aText, + aStartOffset, aEndOffset); +} + +void ProxyAccessible::GetTextAtOffset(int32_t aOffset, + AccessibleTextBoundary aBoundaryType, + nsString& aText, int32_t* aStartOffset, + int32_t* aEndOffset) { + Unused << mDoc->SendGetTextAtOffset(mID, aOffset, aBoundaryType, &aText, + aStartOffset, aEndOffset); +} + +void ProxyAccessible::GetTextBeforeOffset(int32_t aOffset, + AccessibleTextBoundary aBoundaryType, + nsString& aText, + int32_t* aStartOffset, + int32_t* aEndOffset) { + Unused << mDoc->SendGetTextBeforeOffset(mID, aOffset, aBoundaryType, &aText, + aStartOffset, aEndOffset); +} + +char16_t ProxyAccessible::CharAt(int32_t aOffset) { + uint16_t retval = 0; + Unused << mDoc->SendCharAt(mID, aOffset, &retval); + return static_cast<char16_t>(retval); +} + +void ProxyAccessible::TextAttributes(bool aIncludeDefAttrs, int32_t aOffset, + nsTArray<Attribute>* aAttributes, + int32_t* aStartOffset, + int32_t* aEndOffset) { + Unused << mDoc->SendTextAttributes(mID, aIncludeDefAttrs, aOffset, + aAttributes, aStartOffset, aEndOffset); +} + +void ProxyAccessible::DefaultTextAttributes(nsTArray<Attribute>* aAttrs) { + Unused << mDoc->SendDefaultTextAttributes(mID, aAttrs); +} + +nsIntRect ProxyAccessible::TextBounds(int32_t aStartOffset, int32_t aEndOffset, + uint32_t aCoordType) { + nsIntRect rect; + Unused << mDoc->SendTextBounds(mID, aStartOffset, aEndOffset, aCoordType, + &rect); + return rect; +} + +nsIntRect ProxyAccessible::CharBounds(int32_t aOffset, uint32_t aCoordType) { + nsIntRect rect; + Unused << mDoc->SendCharBounds(mID, aOffset, aCoordType, &rect); + return rect; +} + +int32_t ProxyAccessible::OffsetAtPoint(int32_t aX, int32_t aY, + uint32_t aCoordType) { + int32_t retVal = -1; + Unused << mDoc->SendOffsetAtPoint(mID, aX, aY, aCoordType, &retVal); + return retVal; +} + +bool ProxyAccessible::SelectionBoundsAt(int32_t aSelectionNum, nsString& aData, + int32_t* aStartOffset, + int32_t* aEndOffset) { + bool retVal = false; + Unused << mDoc->SendSelectionBoundsAt(mID, aSelectionNum, &retVal, &aData, + aStartOffset, aEndOffset); + return retVal; +} + +bool ProxyAccessible::SetSelectionBoundsAt(int32_t aSelectionNum, + int32_t aStartOffset, + int32_t aEndOffset) { + bool retVal = false; + Unused << mDoc->SendSetSelectionBoundsAt(mID, aSelectionNum, aStartOffset, + aEndOffset, &retVal); + return retVal; +} + +bool ProxyAccessible::AddToSelection(int32_t aStartOffset, int32_t aEndOffset) { + bool retVal = false; + Unused << mDoc->SendAddToSelection(mID, aStartOffset, aEndOffset, &retVal); + return retVal; +} + +bool ProxyAccessible::RemoveFromSelection(int32_t aSelectionNum) { + bool retVal = false; + Unused << mDoc->SendRemoveFromSelection(mID, aSelectionNum, &retVal); + return retVal; +} + +void ProxyAccessible::ScrollSubstringTo(int32_t aStartOffset, + int32_t aEndOffset, + uint32_t aScrollType) { + Unused << mDoc->SendScrollSubstringTo(mID, aStartOffset, aEndOffset, + aScrollType); +} + +void ProxyAccessible::ScrollSubstringToPoint(int32_t aStartOffset, + int32_t aEndOffset, + uint32_t aCoordinateType, + int32_t aX, int32_t aY) { + Unused << mDoc->SendScrollSubstringToPoint(mID, aStartOffset, aEndOffset, + aCoordinateType, aX, aY); +} + +void ProxyAccessible::Text(nsString* aText) { + Unused << mDoc->SendText(mID, aText); +} + +void ProxyAccessible::ReplaceText(const nsString& aText) { + Unused << mDoc->SendReplaceText(mID, aText); +} + +bool ProxyAccessible::InsertText(const nsString& aText, int32_t aPosition) { + bool valid; + Unused << mDoc->SendInsertText(mID, aText, aPosition, &valid); + return valid; +} + +bool ProxyAccessible::CopyText(int32_t aStartPos, int32_t aEndPos) { + bool valid; + Unused << mDoc->SendCopyText(mID, aStartPos, aEndPos, &valid); + return valid; +} + +bool ProxyAccessible::CutText(int32_t aStartPos, int32_t aEndPos) { + bool valid; + Unused << mDoc->SendCutText(mID, aStartPos, aEndPos, &valid); + return valid; +} + +bool ProxyAccessible::DeleteText(int32_t aStartPos, int32_t aEndPos) { + bool valid; + Unused << mDoc->SendDeleteText(mID, aStartPos, aEndPos, &valid); + return valid; +} + +bool ProxyAccessible::PasteText(int32_t aPosition) { + bool valid; + Unused << mDoc->SendPasteText(mID, aPosition, &valid); + return valid; +} + +nsIntPoint ProxyAccessible::ImagePosition(uint32_t aCoordType) { + nsIntPoint retVal; + Unused << mDoc->SendImagePosition(mID, aCoordType, &retVal); + return retVal; +} + +nsIntSize ProxyAccessible::ImageSize() { + nsIntSize retVal; + Unused << mDoc->SendImageSize(mID, &retVal); + return retVal; +} + +uint32_t ProxyAccessible::StartOffset(bool* aOk) { + uint32_t retVal = 0; + Unused << mDoc->SendStartOffset(mID, &retVal, aOk); + return retVal; +} + +uint32_t ProxyAccessible::EndOffset(bool* aOk) { + uint32_t retVal = 0; + Unused << mDoc->SendEndOffset(mID, &retVal, aOk); + return retVal; +} + +bool ProxyAccessible::IsLinkValid() { + bool retVal = false; + Unused << mDoc->SendIsLinkValid(mID, &retVal); + return retVal; +} + +uint32_t ProxyAccessible::AnchorCount(bool* aOk) { + uint32_t retVal = 0; + Unused << mDoc->SendAnchorCount(mID, &retVal, aOk); + return retVal; +} + +void ProxyAccessible::AnchorURIAt(uint32_t aIndex, nsCString& aURI, bool* aOk) { + Unused << mDoc->SendAnchorURIAt(mID, aIndex, &aURI, aOk); +} + +ProxyAccessible* ProxyAccessible::AnchorAt(uint32_t aIndex) { + uint64_t id = 0; + bool ok = false; + Unused << mDoc->SendAnchorAt(mID, aIndex, &id, &ok); + return ok ? mDoc->GetAccessible(id) : nullptr; +} + +uint32_t ProxyAccessible::LinkCount() { + uint32_t retVal = 0; + Unused << mDoc->SendLinkCount(mID, &retVal); + return retVal; +} + +ProxyAccessible* ProxyAccessible::LinkAt(const uint32_t& aIndex) { + uint64_t linkID = 0; + bool ok = false; + Unused << mDoc->SendLinkAt(mID, aIndex, &linkID, &ok); + return ok ? mDoc->GetAccessible(linkID) : nullptr; +} + +int32_t ProxyAccessible::LinkIndexOf(ProxyAccessible* aLink) { + int32_t retVal = -1; + if (aLink) { + Unused << mDoc->SendLinkIndexOf(mID, aLink->ID(), &retVal); + } + + return retVal; +} + +int32_t ProxyAccessible::LinkIndexAtOffset(uint32_t aOffset) { + int32_t retVal = -1; + Unused << mDoc->SendLinkIndexAtOffset(mID, aOffset, &retVal); + return retVal; +} + +ProxyAccessible* ProxyAccessible::TableOfACell() { + uint64_t tableID = 0; + bool ok = false; + Unused << mDoc->SendTableOfACell(mID, &tableID, &ok); + return ok ? mDoc->GetAccessible(tableID) : nullptr; +} + +uint32_t ProxyAccessible::ColIdx() { + uint32_t index = 0; + Unused << mDoc->SendColIdx(mID, &index); + return index; +} + +uint32_t ProxyAccessible::RowIdx() { + uint32_t index = 0; + Unused << mDoc->SendRowIdx(mID, &index); + return index; +} + +void ProxyAccessible::GetColRowExtents(uint32_t* aColIdx, uint32_t* aRowIdx, + uint32_t* aColExtent, + uint32_t* aRowExtent) { + Unused << mDoc->SendGetColRowExtents(mID, aColIdx, aRowIdx, aColExtent, + aRowExtent); +} + +void ProxyAccessible::GetPosition(uint32_t* aColIdx, uint32_t* aRowIdx) { + Unused << mDoc->SendGetPosition(mID, aColIdx, aRowIdx); +} + +uint32_t ProxyAccessible::ColExtent() { + uint32_t extent = 0; + Unused << mDoc->SendColExtent(mID, &extent); + return extent; +} + +uint32_t ProxyAccessible::RowExtent() { + uint32_t extent = 0; + Unused << mDoc->SendRowExtent(mID, &extent); + return extent; +} + +void ProxyAccessible::ColHeaderCells(nsTArray<ProxyAccessible*>* aCells) { + nsTArray<uint64_t> targetIDs; + Unused << mDoc->SendColHeaderCells(mID, &targetIDs); + + size_t targetCount = targetIDs.Length(); + for (size_t i = 0; i < targetCount; i++) { + aCells->AppendElement(mDoc->GetAccessible(targetIDs[i])); + } +} + +void ProxyAccessible::RowHeaderCells(nsTArray<ProxyAccessible*>* aCells) { + nsTArray<uint64_t> targetIDs; + Unused << mDoc->SendRowHeaderCells(mID, &targetIDs); + + size_t targetCount = targetIDs.Length(); + for (size_t i = 0; i < targetCount; i++) { + aCells->AppendElement(mDoc->GetAccessible(targetIDs[i])); + } +} + +bool ProxyAccessible::IsCellSelected() { + bool selected = false; + Unused << mDoc->SendIsCellSelected(mID, &selected); + return selected; +} + +ProxyAccessible* ProxyAccessible::TableCaption() { + uint64_t captionID = 0; + bool ok = false; + Unused << mDoc->SendTableCaption(mID, &captionID, &ok); + return ok ? mDoc->GetAccessible(captionID) : nullptr; +} + +void ProxyAccessible::TableSummary(nsString& aSummary) { + Unused << mDoc->SendTableSummary(mID, &aSummary); +} + +uint32_t ProxyAccessible::TableColumnCount() { + uint32_t count = 0; + Unused << mDoc->SendTableColumnCount(mID, &count); + return count; +} + +uint32_t ProxyAccessible::TableRowCount() { + uint32_t count = 0; + Unused << mDoc->SendTableRowCount(mID, &count); + return count; +} + +ProxyAccessible* ProxyAccessible::TableCellAt(uint32_t aRow, uint32_t aCol) { + uint64_t cellID = 0; + bool ok = false; + Unused << mDoc->SendTableCellAt(mID, aRow, aCol, &cellID, &ok); + return ok ? mDoc->GetAccessible(cellID) : nullptr; +} + +int32_t ProxyAccessible::TableCellIndexAt(uint32_t aRow, uint32_t aCol) { + int32_t index = 0; + Unused << mDoc->SendTableCellIndexAt(mID, aRow, aCol, &index); + return index; +} + +int32_t ProxyAccessible::TableColumnIndexAt(uint32_t aCellIndex) { + int32_t index = 0; + Unused << mDoc->SendTableColumnIndexAt(mID, aCellIndex, &index); + return index; +} + +int32_t ProxyAccessible::TableRowIndexAt(uint32_t aCellIndex) { + int32_t index = 0; + Unused << mDoc->SendTableRowIndexAt(mID, aCellIndex, &index); + return index; +} + +void ProxyAccessible::TableRowAndColumnIndicesAt(uint32_t aCellIndex, + int32_t* aRow, int32_t* aCol) { + Unused << mDoc->SendTableRowAndColumnIndicesAt(mID, aCellIndex, aRow, aCol); +} + +uint32_t ProxyAccessible::TableColumnExtentAt(uint32_t aRow, uint32_t aCol) { + uint32_t extent = 0; + Unused << mDoc->SendTableColumnExtentAt(mID, aRow, aCol, &extent); + return extent; +} + +uint32_t ProxyAccessible::TableRowExtentAt(uint32_t aRow, uint32_t aCol) { + uint32_t extent = 0; + Unused << mDoc->SendTableRowExtentAt(mID, aRow, aCol, &extent); + return extent; +} + +void ProxyAccessible::TableColumnDescription(uint32_t aCol, + nsString& aDescription) { + Unused << mDoc->SendTableColumnDescription(mID, aCol, &aDescription); +} + +void ProxyAccessible::TableRowDescription(uint32_t aRow, + nsString& aDescription) { + Unused << mDoc->SendTableRowDescription(mID, aRow, &aDescription); +} + +bool ProxyAccessible::TableColumnSelected(uint32_t aCol) { + bool selected = false; + Unused << mDoc->SendTableColumnSelected(mID, aCol, &selected); + return selected; +} + +bool ProxyAccessible::TableRowSelected(uint32_t aRow) { + bool selected = false; + Unused << mDoc->SendTableRowSelected(mID, aRow, &selected); + return selected; +} + +bool ProxyAccessible::TableCellSelected(uint32_t aRow, uint32_t aCol) { + bool selected = false; + Unused << mDoc->SendTableCellSelected(mID, aRow, aCol, &selected); + return selected; +} + +uint32_t ProxyAccessible::TableSelectedCellCount() { + uint32_t count = 0; + Unused << mDoc->SendTableSelectedCellCount(mID, &count); + return count; +} + +uint32_t ProxyAccessible::TableSelectedColumnCount() { + uint32_t count = 0; + Unused << mDoc->SendTableSelectedColumnCount(mID, &count); + return count; +} + +uint32_t ProxyAccessible::TableSelectedRowCount() { + uint32_t count = 0; + Unused << mDoc->SendTableSelectedRowCount(mID, &count); + return count; +} + +void ProxyAccessible::TableSelectedCells(nsTArray<ProxyAccessible*>* aCellIDs) { + AutoTArray<uint64_t, 30> cellIDs; + Unused << mDoc->SendTableSelectedCells(mID, &cellIDs); + aCellIDs->SetCapacity(cellIDs.Length()); + for (uint32_t i = 0; i < cellIDs.Length(); ++i) { + aCellIDs->AppendElement(mDoc->GetAccessible(cellIDs[i])); + } +} + +void ProxyAccessible::TableSelectedCellIndices( + nsTArray<uint32_t>* aCellIndices) { + Unused << mDoc->SendTableSelectedCellIndices(mID, aCellIndices); +} + +void ProxyAccessible::TableSelectedColumnIndices( + nsTArray<uint32_t>* aColumnIndices) { + Unused << mDoc->SendTableSelectedColumnIndices(mID, aColumnIndices); +} + +void ProxyAccessible::TableSelectedRowIndices(nsTArray<uint32_t>* aRowIndices) { + Unused << mDoc->SendTableSelectedRowIndices(mID, aRowIndices); +} + +void ProxyAccessible::TableSelectColumn(uint32_t aCol) { + Unused << mDoc->SendTableSelectColumn(mID, aCol); +} + +void ProxyAccessible::TableSelectRow(uint32_t aRow) { + Unused << mDoc->SendTableSelectRow(mID, aRow); +} + +void ProxyAccessible::TableUnselectColumn(uint32_t aCol) { + Unused << mDoc->SendTableUnselectColumn(mID, aCol); +} + +void ProxyAccessible::TableUnselectRow(uint32_t aRow) { + Unused << mDoc->SendTableUnselectRow(mID, aRow); +} + +bool ProxyAccessible::TableIsProbablyForLayout() { + bool forLayout = false; + Unused << mDoc->SendTableIsProbablyForLayout(mID, &forLayout); + return forLayout; +} + +ProxyAccessible* ProxyAccessible::AtkTableColumnHeader(int32_t aCol) { + uint64_t headerID = 0; + bool ok = false; + Unused << mDoc->SendAtkTableColumnHeader(mID, aCol, &headerID, &ok); + return ok ? mDoc->GetAccessible(headerID) : nullptr; +} + +ProxyAccessible* ProxyAccessible::AtkTableRowHeader(int32_t aRow) { + uint64_t headerID = 0; + bool ok = false; + Unused << mDoc->SendAtkTableRowHeader(mID, aRow, &headerID, &ok); + return ok ? mDoc->GetAccessible(headerID) : nullptr; +} + +void ProxyAccessible::SelectedItems( + nsTArray<ProxyAccessible*>* aSelectedItems) { + AutoTArray<uint64_t, 10> itemIDs; + Unused << mDoc->SendSelectedItems(mID, &itemIDs); + aSelectedItems->SetCapacity(itemIDs.Length()); + for (size_t i = 0; i < itemIDs.Length(); ++i) { + aSelectedItems->AppendElement(mDoc->GetAccessible(itemIDs[i])); + } +} + +uint32_t ProxyAccessible::SelectedItemCount() { + uint32_t count = 0; + Unused << mDoc->SendSelectedItemCount(mID, &count); + return count; +} + +ProxyAccessible* ProxyAccessible::GetSelectedItem(uint32_t aIndex) { + uint64_t selectedItemID = 0; + bool ok = false; + Unused << mDoc->SendGetSelectedItem(mID, aIndex, &selectedItemID, &ok); + return ok ? mDoc->GetAccessible(selectedItemID) : nullptr; +} + +bool ProxyAccessible::IsItemSelected(uint32_t aIndex) { + bool selected = false; + Unused << mDoc->SendIsItemSelected(mID, aIndex, &selected); + return selected; +} + +bool ProxyAccessible::AddItemToSelection(uint32_t aIndex) { + bool success = false; + Unused << mDoc->SendAddItemToSelection(mID, aIndex, &success); + return success; +} + +bool ProxyAccessible::RemoveItemFromSelection(uint32_t aIndex) { + bool success = false; + Unused << mDoc->SendRemoveItemFromSelection(mID, aIndex, &success); + return success; +} + +bool ProxyAccessible::SelectAll() { + bool success = false; + Unused << mDoc->SendSelectAll(mID, &success); + return success; +} + +bool ProxyAccessible::UnselectAll() { + bool success = false; + Unused << mDoc->SendUnselectAll(mID, &success); + return success; +} + +void ProxyAccessible::TakeSelection() { + Unused << mDoc->SendTakeSelection(mID); +} + +void ProxyAccessible::SetSelected(bool aSelect) { + Unused << mDoc->SendSetSelected(mID, aSelect); +} + +bool ProxyAccessible::DoAction(uint8_t aIndex) { + bool success = false; + Unused << mDoc->SendDoAction(mID, aIndex, &success); + return success; +} + +uint8_t ProxyAccessible::ActionCount() { + uint8_t count = 0; + Unused << mDoc->SendActionCount(mID, &count); + return count; +} + +void ProxyAccessible::ActionDescriptionAt(uint8_t aIndex, + nsString& aDescription) { + Unused << mDoc->SendActionDescriptionAt(mID, aIndex, &aDescription); +} + +void ProxyAccessible::ActionNameAt(uint8_t aIndex, nsString& aName) { + Unused << mDoc->SendActionNameAt(mID, aIndex, &aName); +} + +KeyBinding ProxyAccessible::AccessKey() { + uint32_t key = 0; + uint32_t modifierMask = 0; + Unused << mDoc->SendAccessKey(mID, &key, &modifierMask); + return KeyBinding(key, modifierMask); +} + +KeyBinding ProxyAccessible::KeyboardShortcut() { + uint32_t key = 0; + uint32_t modifierMask = 0; + Unused << mDoc->SendKeyboardShortcut(mID, &key, &modifierMask); + return KeyBinding(key, modifierMask); +} + +void ProxyAccessible::AtkKeyBinding(nsString& aBinding) { + Unused << mDoc->SendAtkKeyBinding(mID, &aBinding); +} + +double ProxyAccessible::CurValue() { + double val = UnspecifiedNaN<double>(); + Unused << mDoc->SendCurValue(mID, &val); + return val; +} + +bool ProxyAccessible::SetCurValue(double aValue) { + bool success = false; + Unused << mDoc->SendSetCurValue(mID, aValue, &success); + return success; +} + +double ProxyAccessible::MinValue() { + double val = UnspecifiedNaN<double>(); + Unused << mDoc->SendMinValue(mID, &val); + return val; +} + +double ProxyAccessible::MaxValue() { + double val = UnspecifiedNaN<double>(); + Unused << mDoc->SendMaxValue(mID, &val); + return val; +} + +double ProxyAccessible::Step() { + double step = UnspecifiedNaN<double>(); + Unused << mDoc->SendStep(mID, &step); + return step; +} + +void ProxyAccessible::TakeFocus() { Unused << mDoc->SendTakeFocus(mID); } + +ProxyAccessible* ProxyAccessible::FocusedChild() { + uint64_t childID = 0; + bool ok = false; + Unused << mDoc->SendFocusedChild(mID, &childID, &ok); + return ok ? mDoc->GetAccessible(childID) : nullptr; +} + +ProxyAccessible* ProxyAccessible::ChildAtPoint( + int32_t aX, int32_t aY, Accessible::EWhichChildAtPoint aWhichChild) { + ProxyAccessible* target = this; + do { + if (target->mOuterDoc) { + MOZ_ASSERT(target->ChildrenCount() == 1); + DocAccessibleParent* childDoc = target->ChildAt(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::eDirectChild) { + // Return the child document if it's within the bounds of the iframe. + nsIntRect 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->mOuterDoc && + aWhichChild == Accessible::eDeepestChild); + return target; +} + +nsIntRect ProxyAccessible::Bounds() { + nsIntRect rect; + Unused << mDoc->SendExtents(mID, false, &(rect.x), &(rect.y), &(rect.width), + &(rect.height)); + return rect; +} + +nsIntRect ProxyAccessible::BoundsInCSSPixels() { + nsIntRect rect; + Unused << mDoc->SendExtentsInCSSPixels(mID, &rect.x, &rect.y, &rect.width, + &rect.height); + return rect; +} + +void ProxyAccessible::Language(nsString& aLocale) { + Unused << mDoc->SendLanguage(mID, &aLocale); +} + +void ProxyAccessible::DocType(nsString& aType) { + Unused << mDoc->SendDocType(mID, &aType); +} + +void ProxyAccessible::Title(nsString& aTitle) { + Unused << mDoc->SendTitle(mID, &aTitle); +} + +void ProxyAccessible::URL(nsString& aURL) { + Unused << mDoc->SendURL(mID, &aURL); +} + +void ProxyAccessible::MimeType(nsString aMime) { + Unused << mDoc->SendMimeType(mID, &aMime); +} + +void ProxyAccessible::URLDocTypeMimeType(nsString& aURL, nsString& aDocType, + nsString& aMimeType) { + Unused << mDoc->SendURLDocTypeMimeType(mID, &aURL, &aDocType, &aMimeType); +} + +void ProxyAccessible::Extents(bool aNeedsScreenCoords, int32_t* aX, int32_t* aY, + int32_t* aWidth, int32_t* aHeight) { + Unused << mDoc->SendExtents(mID, aNeedsScreenCoords, aX, aY, aWidth, aHeight); +} + +void ProxyAccessible::DOMNodeID(nsString& aID) { + Unused << mDoc->SendDOMNodeID(mID, &aID); +} + +} // namespace a11y +} // namespace mozilla diff --git a/accessible/ipc/other/ProxyAccessible.h b/accessible/ipc/other/ProxyAccessible.h new file mode 100644 index 0000000000..ae104004a5 --- /dev/null +++ b/accessible/ipc/other/ProxyAccessible.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_a11y_ProxyAccessible_h +#define mozilla_a11y_ProxyAccessible_h + +#include "Accessible.h" +#include "mozilla/a11y/ProxyAccessibleBase.h" +#include "mozilla/a11y/Role.h" +#include "nsIAccessibleText.h" +#include "nsIAccessibleTypes.h" +#include "nsString.h" +#include "nsTArray.h" +#include "nsRect.h" + +namespace mozilla { +namespace a11y { + +class ProxyAccessible : public ProxyAccessibleBase<ProxyAccessible> { + public: + ProxyAccessible(uint64_t aID, ProxyAccessible* aParent, + DocAccessibleParent* aDoc, role aRole, uint32_t aInterfaces) + : ProxyAccessibleBase(aID, aParent, aDoc, aRole, aInterfaces) + + { + MOZ_COUNT_CTOR(ProxyAccessible); + } + + MOZ_COUNTED_DTOR(ProxyAccessible) + +#include "mozilla/a11y/ProxyAccessibleShared.h" + + protected: + explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc) + : ProxyAccessibleBase(aThisAsDoc) { + MOZ_COUNT_CTOR(ProxyAccessible); + } +}; + +} // 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..db386c6eb3 --- /dev/null +++ b/accessible/ipc/other/moz.build @@ -0,0 +1,52 @@ +# -*- 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", + "ProxyAccessible.h", + ] + + SOURCES += [ + "DocAccessibleChild.cpp", + "ProxyAccessible.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") + +if CONFIG["CC_TYPE"] in ("clang", "gcc"): + CXXFLAGS += ["-Wno-error=shadow"] + +FINAL_LIBRARY = "xul" |