Coverage Report

Created: 2018-09-25 14:53

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