accessible/src/xul/XULAlertAccessible.cpp
author Aryeh Gregor <ayg@aryeh.name>
Mon, 30 Jul 2012 17:20:58 +0300
changeset 101232 b5c4b792f3f2a047e3517472d72842a76afb77cd
parent 96704 75b67011b798fb0ab754da5ced223dd0d0eb996a
child 103381 a16372ce30b5f6b747246b01fcd215a4bf3b6342
child 107012 08187a7ea8974548382f5d7775df8171a4ec6449
permissions -rw-r--r--
Bug 777292 part 2 - Change all nsnull to nullptr

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */

#include "XULAlertAccessible.h"

#include "Role.h"
#include "States.h"

using namespace mozilla::a11y;

////////////////////////////////////////////////////////////////////////////////
// XULAlertAccessible
////////////////////////////////////////////////////////////////////////////////

XULAlertAccessible::
  XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
  AccessibleWrap(aContent, aDoc)
{
}

NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible)

role
XULAlertAccessible::NativeRole()
{
  return roles::ALERT;
}

PRUint64
XULAlertAccessible::NativeState()
{
  return Accessible::NativeState() | states::ALERT;
}

ENameValueFlag
XULAlertAccessible::Name(nsString& aName)
{
  // 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();
  return eNameOK;
}

////////////////////////////////////////////////////////////////////////////////
// Widgets

bool
XULAlertAccessible::IsWidget() const
{
  return true;
}

Accessible*
XULAlertAccessible::ContainerWidget() const
{
  // If a part of colorpicker widget.
  if (mParent && mParent->IsMenuButton())
    return mParent;
  return nullptr;
}