2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-10 16:44:50 -07:00
|
|
|
#include "XULAlertAccessible.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-12-20 19:16:44 -08:00
|
|
|
#include "Accessible-inl.h"
|
2012-01-11 19:07:35 -08:00
|
|
|
#include "Role.h"
|
2011-04-09 16:38:06 -07:00
|
|
|
#include "States.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-07-27 05:43:01 -07:00
|
|
|
using namespace mozilla::a11y;
|
|
|
|
|
2010-06-11 01:23:18 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-10 16:44:50 -07:00
|
|
|
// XULAlertAccessible
|
2010-06-11 01:23:18 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-10 16:44:50 -07:00
|
|
|
XULAlertAccessible::
|
|
|
|
XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
2012-05-28 18:18:45 -07:00
|
|
|
AccessibleWrap(aContent, aDoc)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-08 14:23:18 -07:00
|
|
|
XULAlertAccessible::~XULAlertAccessible()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-06-10 16:44:50 -07:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible)
|
2010-06-11 01:23:18 -07:00
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
role
|
2012-06-10 16:44:50 -07:00
|
|
|
XULAlertAccessible::NativeRole()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-01-11 19:07:35 -08:00
|
|
|
return roles::ALERT;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint64_t
|
2012-06-10 16:44:50 -07:00
|
|
|
XULAlertAccessible::NativeState()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-05-28 18:18:45 -07:00
|
|
|
return Accessible::NativeState() | states::ALERT;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-04-30 20:08:31 -07:00
|
|
|
ENameValueFlag
|
2012-06-10 16:44:50 -07:00
|
|
|
XULAlertAccessible::Name(nsString& aName)
|
2008-01-23 15:49:10 -08:00
|
|
|
{
|
|
|
|
// Screen readers need to read contents of alert, not the accessible name.
|
|
|
|
// If we have both some screen readers will read the alert twice.
|
|
|
|
aName.Truncate();
|
2012-04-30 20:08:31 -07:00
|
|
|
return eNameOK;
|
2008-01-23 15:49:10 -08:00
|
|
|
}
|
2011-09-27 18:46:11 -07:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Widgets
|
|
|
|
|
|
|
|
bool
|
2012-06-10 16:44:50 -07:00
|
|
|
XULAlertAccessible::IsWidget() const
|
2011-09-27 18:46:11 -07:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible*
|
2012-06-10 16:44:50 -07:00
|
|
|
XULAlertAccessible::ContainerWidget() const
|
2011-09-27 18:46:11 -07:00
|
|
|
{
|
|
|
|
// If a part of colorpicker widget.
|
|
|
|
if (mParent && mParent->IsMenuButton())
|
|
|
|
return mParent;
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2011-09-27 18:46:11 -07:00
|
|
|
}
|