michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "XULAlertAccessible.h" michael@0: michael@0: #include "Accessible-inl.h" michael@0: #include "Role.h" michael@0: #include "States.h" michael@0: michael@0: using namespace mozilla::a11y; michael@0: michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: // XULAlertAccessible michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: XULAlertAccessible:: michael@0: XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) : michael@0: AccessibleWrap(aContent, aDoc) michael@0: { michael@0: } michael@0: michael@0: NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible) michael@0: michael@0: role michael@0: XULAlertAccessible::NativeRole() michael@0: { michael@0: return roles::ALERT; michael@0: } michael@0: michael@0: uint64_t michael@0: XULAlertAccessible::NativeState() michael@0: { michael@0: return Accessible::NativeState() | states::ALERT; michael@0: } michael@0: michael@0: ENameValueFlag michael@0: XULAlertAccessible::Name(nsString& aName) michael@0: { michael@0: // Screen readers need to read contents of alert, not the accessible name. michael@0: // If we have both some screen readers will read the alert twice. michael@0: aName.Truncate(); michael@0: return eNameOK; michael@0: } michael@0: michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: // Widgets michael@0: michael@0: bool michael@0: XULAlertAccessible::IsWidget() const michael@0: { michael@0: return true; michael@0: } michael@0: michael@0: Accessible* michael@0: XULAlertAccessible::ContainerWidget() const michael@0: { michael@0: // If a part of colorpicker widget. michael@0: if (mParent && mParent->IsMenuButton()) michael@0: return mParent; michael@0: return nullptr; michael@0: }