LCOV - code coverage report
Current view: top level - accessible/atk - nsMaiInterfaceAction.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 48 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "InterfaceInitFuncs.h"
       8             : 
       9             : #include "Accessible-inl.h"
      10             : #include "nsMai.h"
      11             : #include "Role.h"
      12             : #include "mozilla/Likely.h"
      13             : #include "ProxyAccessible.h"
      14             : #include "nsString.h"
      15             : 
      16             : using namespace mozilla::a11y;
      17             : 
      18             : extern "C" {
      19             : 
      20             : static gboolean
      21           0 : doActionCB(AtkAction *aAction, gint aActionIndex)
      22             : {
      23           0 :   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
      24           0 :   if (accWrap) {
      25           0 :     return accWrap->DoAction(aActionIndex);
      26             :   }
      27             : 
      28           0 :   ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aAction));
      29           0 :   return proxy && proxy->DoAction(aActionIndex);
      30             : }
      31             : 
      32             : static gint
      33           0 : getActionCountCB(AtkAction *aAction)
      34             : {
      35           0 :   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
      36           0 :   if (accWrap) {
      37           0 :     return accWrap->ActionCount();
      38             :   }
      39             : 
      40           0 :   ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aAction));
      41           0 :   return proxy ? proxy->ActionCount() : 0;
      42             : }
      43             : 
      44             : static const gchar*
      45           0 : getActionDescriptionCB(AtkAction *aAction, gint aActionIndex)
      46             : {
      47           0 :   nsAutoString description;
      48           0 :   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
      49           0 :   if (accWrap) {
      50           0 :     accWrap->ActionDescriptionAt(aActionIndex, description);
      51           0 :   } else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aAction))) {
      52           0 :     proxy->ActionDescriptionAt(aActionIndex, description);
      53             :   } else {
      54           0 :     return nullptr;
      55             :   }
      56             : 
      57           0 :   return AccessibleWrap::ReturnString(description);
      58             : }
      59             : 
      60             : static const gchar*
      61           0 : getActionNameCB(AtkAction *aAction, gint aActionIndex)
      62             : {
      63           0 :   nsAutoString autoStr;
      64           0 :   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
      65           0 :   if (accWrap) {
      66           0 :     accWrap->ActionNameAt(aActionIndex, autoStr);
      67           0 :   } else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aAction))) {
      68           0 :     proxy->ActionNameAt(aActionIndex, autoStr);
      69             :   } else {
      70           0 :     return nullptr;
      71             :   }
      72             : 
      73           0 :   return AccessibleWrap::ReturnString(autoStr);
      74             : }
      75             : 
      76             : static const gchar*
      77           0 : getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
      78             : {
      79           0 :   nsAutoString keyBindingsStr;
      80           0 :   AccessibleWrap* acc = GetAccessibleWrap(ATK_OBJECT(aAction));
      81           0 :   if (acc) {
      82           0 :     AccessibleWrap::GetKeyBinding(acc, keyBindingsStr);
      83           0 :   } else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aAction))) {
      84           0 :     proxy->AtkKeyBinding(keyBindingsStr);
      85             :   } else {
      86           0 :     return nullptr;
      87             :   }
      88             : 
      89           0 :   return AccessibleWrap::ReturnString(keyBindingsStr);
      90             : }
      91             : }
      92             : 
      93             : void
      94           0 : actionInterfaceInitCB(AtkActionIface* aIface)
      95             : {
      96           0 :   NS_ASSERTION(aIface, "Invalid aIface");
      97           0 :   if (MOZ_UNLIKELY(!aIface))
      98           0 :     return;
      99             : 
     100           0 :   aIface->do_action = doActionCB;
     101           0 :   aIface->get_n_actions = getActionCountCB;
     102           0 :   aIface->get_description = getActionDescriptionCB;
     103           0 :   aIface->get_keybinding = getKeyBindingCB;
     104           0 :   aIface->get_name = getActionNameCB;
     105             : }

Generated by: LCOV version 1.13