Bug 1504988 [wpt PR 13947] - Run py36-flake8 also for tools/wpt/, a=testonly
[gecko.git] / accessible / xul / XULAlertAccessible.cpp
blob1e94762e9b66920b39a22a83d4622ff9933dc781
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/. */
6 #include "XULAlertAccessible.h"
8 #include "Accessible-inl.h"
9 #include "Role.h"
10 #include "States.h"
12 using namespace mozilla::a11y;
14 ////////////////////////////////////////////////////////////////////////////////
15 // XULAlertAccessible
16 ////////////////////////////////////////////////////////////////////////////////
18 XULAlertAccessible::
19 XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
20 AccessibleWrap(aContent, aDoc)
22 mGenericTypes |= eAlert;
25 XULAlertAccessible::~XULAlertAccessible()
29 role
30 XULAlertAccessible::NativeRole() const
32 return roles::ALERT;
35 uint64_t
36 XULAlertAccessible::NativeState() const
38 return Accessible::NativeState() | states::ALERT;
41 ENameValueFlag
42 XULAlertAccessible::Name(nsString& aName) const
44 // Screen readers need to read contents of alert, not the accessible name.
45 // If we have both some screen readers will read the alert twice.
46 aName.Truncate();
47 return eNameOK;
50 ////////////////////////////////////////////////////////////////////////////////
51 // Widgets
53 bool
54 XULAlertAccessible::IsWidget() const
56 return true;
59 Accessible*
60 XULAlertAccessible::ContainerWidget() const
62 return nullptr;