accessible/src/xul/XULAlertAccessible.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "XULAlertAccessible.h"
     8 #include "Accessible-inl.h"
     9 #include "Role.h"
    10 #include "States.h"
    12 using namespace mozilla::a11y;
    14 ////////////////////////////////////////////////////////////////////////////////
    15 // XULAlertAccessible
    16 ////////////////////////////////////////////////////////////////////////////////
    18 XULAlertAccessible::
    19   XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
    20   AccessibleWrap(aContent, aDoc)
    21 {
    22 }
    24 NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible)
    26 role
    27 XULAlertAccessible::NativeRole()
    28 {
    29   return roles::ALERT;
    30 }
    32 uint64_t
    33 XULAlertAccessible::NativeState()
    34 {
    35   return Accessible::NativeState() | states::ALERT;
    36 }
    38 ENameValueFlag
    39 XULAlertAccessible::Name(nsString& aName)
    40 {
    41   // Screen readers need to read contents of alert, not the accessible name.
    42   // If we have both some screen readers will read the alert twice.
    43   aName.Truncate();
    44   return eNameOK;
    45 }
    47 ////////////////////////////////////////////////////////////////////////////////
    48 // Widgets
    50 bool
    51 XULAlertAccessible::IsWidget() const
    52 {
    53   return true;
    54 }
    56 Accessible*
    57 XULAlertAccessible::ContainerWidget() const
    58 {
    59   // If a part of colorpicker widget.
    60   if (mParent && mParent->IsMenuButton())
    61     return mParent;
    62   return nullptr;
    63 }

mercurial