summaryrefslogtreecommitdiffstats
path: root/accessible/ipc/extension/android/DocAccessiblePlatformExtParent.cpp
blob: 960a68a554bca43fe1b4df1759f646302173d6cc (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
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/. */

#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();
  }

  ProxyAccessible* first =
      static_cast<DocAccessibleParent*>(aFirstDoc)->GetAccessible(aFirst);
  ProxyAccessible* 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(WrapperFor(first),
                                                WrapperFor(last));
  }

  return IPC_OK();
}

}  // namespace a11y
}  // namespace mozilla