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