tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

XULAlertAccessible.cpp (1529B)


      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/. */
      5 
      6 #include "XULAlertAccessible.h"
      7 
      8 #include "LocalAccessible-inl.h"
      9 #include "mozilla/a11y/Role.h"
     10 #include "States.h"
     11 
     12 using namespace mozilla::a11y;
     13 
     14 ////////////////////////////////////////////////////////////////////////////////
     15 // XULAlertAccessible
     16 ////////////////////////////////////////////////////////////////////////////////
     17 
     18 XULAlertAccessible::XULAlertAccessible(nsIContent* aContent,
     19                                       DocAccessible* aDoc)
     20    : AccessibleWrap(aContent, aDoc) {
     21  mGenericTypes |= eAlert;
     22 }
     23 
     24 XULAlertAccessible::~XULAlertAccessible() {}
     25 
     26 role XULAlertAccessible::NativeRole() const { return roles::ALERT; }
     27 
     28 uint64_t XULAlertAccessible::NativeState() const {
     29  return LocalAccessible::NativeState() | states::ALERT;
     30 }
     31 
     32 ENameValueFlag XULAlertAccessible::DirectName(nsString& aName) const {
     33  // Screen readers need to read contents of alert, not the accessible name.
     34  // If we have both some screen readers will read the alert twice.
     35  aName.Truncate();
     36  return eNameOK;
     37 }
     38 
     39 ////////////////////////////////////////////////////////////////////////////////
     40 // Widgets
     41 
     42 bool XULAlertAccessible::IsWidget() const { return true; }
     43 
     44 LocalAccessible* XULAlertAccessible::ContainerWidget() const { return nullptr; }