Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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)
21 {
22 }
24 NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible)
26 role
27 XULAlertAccessible::NativeRole()
28 {
29 return roles::ALERT;
30 }
32 uint64_t
33 XULAlertAccessible::NativeState()
34 {
35 return Accessible::NativeState() | states::ALERT;
36 }
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 }
47 ////////////////////////////////////////////////////////////////////////////////
48 // Widgets
50 bool
51 XULAlertAccessible::IsWidget() const
52 {
53 return true;
54 }
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 }