accessible/src/xul/XULAlertAccessible.cpp

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:df0e43c63051
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "XULAlertAccessible.h"
7
8 #include "Accessible-inl.h"
9 #include "Role.h"
10 #include "States.h"
11
12 using namespace mozilla::a11y;
13
14 ////////////////////////////////////////////////////////////////////////////////
15 // XULAlertAccessible
16 ////////////////////////////////////////////////////////////////////////////////
17
18 XULAlertAccessible::
19 XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
20 AccessibleWrap(aContent, aDoc)
21 {
22 }
23
24 NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible)
25
26 role
27 XULAlertAccessible::NativeRole()
28 {
29 return roles::ALERT;
30 }
31
32 uint64_t
33 XULAlertAccessible::NativeState()
34 {
35 return Accessible::NativeState() | states::ALERT;
36 }
37
38 ENameValueFlag
39 XULAlertAccessible::Name(nsString& aName)
40 {
41 // Screen readers need to read contents of alert, not the accessible name.
42 // If we have both some screen readers will read the alert twice.
43 aName.Truncate();
44 return eNameOK;
45 }
46
47 ////////////////////////////////////////////////////////////////////////////////
48 // Widgets
49
50 bool
51 XULAlertAccessible::IsWidget() const
52 {
53 return true;
54 }
55
56 Accessible*
57 XULAlertAccessible::ContainerWidget() const
58 {
59 // If a part of colorpicker widget.
60 if (mParent && mParent->IsMenuButton())
61 return mParent;
62 return nullptr;
63 }

mercurial