1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/src/xul/XULAlertAccessible.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "XULAlertAccessible.h" 1.10 + 1.11 +#include "Accessible-inl.h" 1.12 +#include "Role.h" 1.13 +#include "States.h" 1.14 + 1.15 +using namespace mozilla::a11y; 1.16 + 1.17 +//////////////////////////////////////////////////////////////////////////////// 1.18 +// XULAlertAccessible 1.19 +//////////////////////////////////////////////////////////////////////////////// 1.20 + 1.21 +XULAlertAccessible:: 1.22 + XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) : 1.23 + AccessibleWrap(aContent, aDoc) 1.24 +{ 1.25 +} 1.26 + 1.27 +NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible) 1.28 + 1.29 +role 1.30 +XULAlertAccessible::NativeRole() 1.31 +{ 1.32 + return roles::ALERT; 1.33 +} 1.34 + 1.35 +uint64_t 1.36 +XULAlertAccessible::NativeState() 1.37 +{ 1.38 + return Accessible::NativeState() | states::ALERT; 1.39 +} 1.40 + 1.41 +ENameValueFlag 1.42 +XULAlertAccessible::Name(nsString& aName) 1.43 +{ 1.44 + // Screen readers need to read contents of alert, not the accessible name. 1.45 + // If we have both some screen readers will read the alert twice. 1.46 + aName.Truncate(); 1.47 + return eNameOK; 1.48 +} 1.49 + 1.50 +//////////////////////////////////////////////////////////////////////////////// 1.51 +// Widgets 1.52 + 1.53 +bool 1.54 +XULAlertAccessible::IsWidget() const 1.55 +{ 1.56 + return true; 1.57 +} 1.58 + 1.59 +Accessible* 1.60 +XULAlertAccessible::ContainerWidget() const 1.61 +{ 1.62 + // If a part of colorpicker widget. 1.63 + if (mParent && mParent->IsMenuButton()) 1.64 + return mParent; 1.65 + return nullptr; 1.66 +}