1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* vim: set ts=2 et sw=2 tw=80: */
3/* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7include protocol PFileDescriptorSet;
8include protocol PBrowser;
9
10include "mozilla/GfxMessageUtils.h";
11
12using mozilla::a11y::role from "mozilla/a11y/IPCTypes.h";
13using mozilla::a11y::IAccessibleHolder from "mozilla/a11y/IPCTypes.h";
14using mozilla::a11y::IDispatchHolder from "mozilla/a11y/IPCTypes.h";
15using mozilla::a11y::AccType from "mozilla/a11y/IPCTypes.h";
16using mozilla::a11y::AccGenericType from "mozilla/a11y/IPCTypes.h";
17using mozilla::WindowsHandle from "mozilla/ipc/IPCTypes.h";
18using mozilla::LayoutDeviceIntRect from "Units.h";
19
20namespace mozilla {
21namespace a11y {
22
23struct AccessibleData
24{
25  uint64_t ID;
26  int32_t MsaaID;
27  role Role;
28  uint32_t ChildrenCount;
29  AccType Type;
30  AccGenericType GenericTypes;
31  uint8_t RoleMapEntryIndex;
32};
33
34struct ShowEventData
35{
36  uint64_t ID;
37  uint32_t Idx;
38  AccessibleData[] NewTree;
39  bool EventSuppressed;
40};
41
42sync protocol PDocAccessible
43{
44  manager PBrowser;
45
46parent:
47  async Shutdown();
48
49  /*
50   * Notify the parent process the document in the child process is firing an
51   * event.
52   */
53  async Event(uint64_t aID, uint32_t type);
54  async ShowEvent(ShowEventData data, bool aFromUser);
55  async HideEvent(uint64_t aRootID, bool aFromUser);
56  async StateChangeEvent(uint64_t aID, uint64_t aState, bool aEnabled);
57  async CaretMoveEvent(uint64_t aID, LayoutDeviceIntRect aCaretRect,
58                       int32_t aOffset, bool aIsSelectionCollapsed);
59  async TextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart, uint32_t aLen,
60                        bool aIsInsert, bool aFromUser);
61  sync SyncTextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart,
62                           uint32_t aLen, bool aIsInsert, bool aFromUser);
63  async SelectionEvent(uint64_t aID, uint64_t aWidgetID, uint32_t aType);
64  async RoleChangedEvent(role aRole);
65  async FocusEvent(uint64_t aID, LayoutDeviceIntRect aCaretRect);
66  async VirtualCursorChangeEvent(uint64_t aID,
67                                 uint64_t aOldPosition,
68                                 int32_t aOldStartOffset, int32_t aOldEndOffset,
69                                 uint64_t aPosition,
70                                 int32_t aStartOffset, int32_t aEndOffset,
71                                 int16_t aReason, int16_t aBoundaryType,
72                                 bool aFromUservcEvent);
73  async ScrollingEvent(uint64_t aID, uint64_t aType,
74                       uint32_t aScrollX, uint32_t aScrollY,
75                       uint32_t aMaxScrollX, uint32_t aMaxScrollY);
76
77  /*
78   * Tell the parent document to bind the existing document as a new child
79   * document.
80   */
81  async BindChildDoc(PDocAccessible aChildDoc, uint64_t aID);
82
83child:
84  /**
85   * We use IDispatchHolder instead of IAccessibleHolder for the following two
86   * methods because of sandboxing. IAccessible::get_accParent returns the parent
87   * as an IDispatch. COM is not smart enough to understand that IAccessible is
88   * derived from IDispatch, so during marshaling it attempts to QueryInterface
89   * on the parent's proxy for IDispatch. This will fail with E_ACCESSDENIED
90   * thanks to the sandbox. We can avoid this entirely by just giving content
91   * the correct interface to begin with: IDispatch.
92   */
93  async ParentCOMProxy(IDispatchHolder aParentCOMProxy);
94  async EmulatedWindow(WindowsHandle aEmulatedWindowHandle,
95                       IDispatchHolder aEmulatedWindowCOMProxy);
96  async TopLevelDocCOMProxy(IAccessibleHolder aCOMProxy);
97  /*
98   * Called as a result of focus shifting from chrome to content
99   * elements through keyboard navigation.
100   */
101  async RestoreFocus();
102
103  async __delete__();
104};
105
106}
107}
108