Line data Source code
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 0 : XULAlertAccessible::
19 0 : XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
20 0 : AccessibleWrap(aContent, aDoc)
21 : {
22 0 : mGenericTypes |= eAlert;
23 0 : }
24 :
25 0 : XULAlertAccessible::~XULAlertAccessible()
26 : {
27 0 : }
28 :
29 0 : NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible)
30 :
31 : role
32 0 : XULAlertAccessible::NativeRole()
33 : {
34 0 : return roles::ALERT;
35 : }
36 :
37 : uint64_t
38 0 : XULAlertAccessible::NativeState()
39 : {
40 0 : return Accessible::NativeState() | states::ALERT;
41 : }
42 :
43 : ENameValueFlag
44 0 : XULAlertAccessible::Name(nsString& aName)
45 : {
46 : // Screen readers need to read contents of alert, not the accessible name.
47 : // If we have both some screen readers will read the alert twice.
48 0 : aName.Truncate();
49 0 : return eNameOK;
50 : }
51 :
52 : ////////////////////////////////////////////////////////////////////////////////
53 : // Widgets
54 :
55 : bool
56 0 : XULAlertAccessible::IsWidget() const
57 : {
58 0 : return true;
59 : }
60 :
61 : Accessible*
62 0 : XULAlertAccessible::ContainerWidget() const
63 : {
64 : // If a part of colorpicker widget.
65 0 : if (mParent && mParent->IsMenuButton())
66 0 : return mParent;
67 0 : return nullptr;
68 : }
|