summaryrefslogtreecommitdiffstats
path: root/accessible/ipc/extension/android/DocAccessiblePlatformExtParent.cpp
blob: dbc16b7401f91a8d8a5ae5b5958e7682b9863bf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* -*- 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 "DocAccessiblePlatformExtParent.h"

#include "AccessibleWrap.h"
#include "SessionAccessibility.h"

#include "mozilla/a11y/DocAccessibleParent.h"

namespace mozilla {
namespace a11y {

mozilla::ipc::IPCResult DocAccessiblePlatformExtParent::RecvSetPivotBoundaries(
    PDocAccessibleParent* aFirstDoc, uint64_t aFirst,
    PDocAccessibleParent* aLastDoc, uint64_t aLast) {
  MOZ_ASSERT(aFirstDoc);
  MOZ_ASSERT(aLastDoc);

  RefPtr<SessionAccessibility> sessionAcc =
      SessionAccessibility::GetInstanceFor(
          static_cast<DocAccessibleParent*>(Manager()));
  if (!sessionAcc) {
    return IPC_OK();
  }

  RemoteAccessible* first =
      static_cast<DocAccessibleParent*>(aFirstDoc)->GetAccessible(aFirst);
  RemoteAccessible* last =
      static_cast<DocAccessibleParent*>(aLastDoc)->GetAccessible(aLast);

  // We may not have proxy accessibles available yet for those accessibles
  // in the parent process.
  if (first && last) {
    sessionAcc->UpdateAccessibleFocusBoundaries(first, last);
  }

  return IPC_OK();
}

}  // namespace a11y
}  // namespace mozilla