2005-03-15 15:44:02 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2005-03-15 15:44:02 +00:00
|
|
|
|
2012-06-10 23:37:47 +00:00
|
|
|
#include "nsXULAlertAccessible.h"
|
2005-03-15 15:44:02 +00:00
|
|
|
|
2012-01-12 03:07:35 +00:00
|
|
|
#include "Role.h"
|
2011-04-09 23:38:06 +00:00
|
|
|
#include "States.h"
|
2005-03-15 15:44:02 +00:00
|
|
|
|
2011-07-27 12:43:01 +00:00
|
|
|
using namespace mozilla::a11y;
|
|
|
|
|
2010-06-11 08:23:18 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-10 23:37:47 +00:00
|
|
|
// nsXULAlertAccessible
|
2010-06-11 08:23:18 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2005-03-15 15:44:02 +00:00
|
|
|
|
2012-06-10 23:37:47 +00:00
|
|
|
nsXULAlertAccessible::
|
|
|
|
nsXULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
2012-05-29 01:18:45 +00:00
|
|
|
AccessibleWrap(aContent, aDoc)
|
2005-03-15 15:44:02 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-06-10 23:37:47 +00:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED0(nsXULAlertAccessible, Accessible)
|
2010-06-11 08:23:18 +00:00
|
|
|
|
2012-01-12 03:07:35 +00:00
|
|
|
role
|
2012-06-10 23:37:47 +00:00
|
|
|
nsXULAlertAccessible::NativeRole()
|
2005-03-15 15:44:02 +00:00
|
|
|
{
|
2012-01-12 03:07:35 +00:00
|
|
|
return roles::ALERT;
|
2005-03-15 15:44:02 +00:00
|
|
|
}
|
|
|
|
|
2011-04-09 23:38:06 +00:00
|
|
|
PRUint64
|
2012-06-10 23:37:47 +00:00
|
|
|
nsXULAlertAccessible::NativeState()
|
2005-03-15 15:44:02 +00:00
|
|
|
{
|
2012-05-29 01:18:45 +00:00
|
|
|
return Accessible::NativeState() | states::ALERT;
|
2005-03-15 15:44:02 +00:00
|
|
|
}
|
|
|
|
|
2012-05-01 03:08:31 +00:00
|
|
|
ENameValueFlag
|
2012-06-10 23:37:47 +00:00
|
|
|
nsXULAlertAccessible::Name(nsString& aName)
|
2008-01-23 23:49:10 +00: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-05-01 03:08:31 +00:00
|
|
|
return eNameOK;
|
2008-01-23 23:49:10 +00:00
|
|
|
}
|
2011-09-28 01:46:11 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Widgets
|
|
|
|
|
|
|
|
bool
|
2012-06-10 23:37:47 +00:00
|
|
|
nsXULAlertAccessible::IsWidget() const
|
2011-09-28 01:46:11 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-29 01:18:45 +00:00
|
|
|
Accessible*
|
2012-06-10 23:37:47 +00:00
|
|
|
nsXULAlertAccessible::ContainerWidget() const
|
2011-09-28 01:46:11 +00:00
|
|
|
{
|
|
|
|
// If a part of colorpicker widget.
|
|
|
|
if (mParent && mParent->IsMenuButton())
|
|
|
|
return mParent;
|
|
|
|
return nsnull;
|
|
|
|
}
|