LCOV - code coverage report
Current view: top level - accessible/atk - AtkSocketAccessible.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 49 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 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 <atk/atk.h>
       8             : #include "AtkSocketAccessible.h"
       9             : 
      10             : #include "InterfaceInitFuncs.h"
      11             : #include "nsMai.h"
      12             : #include "mozilla/Likely.h"
      13             : 
      14             : using namespace mozilla::a11y;
      15             : 
      16             : AtkSocketEmbedType AtkSocketAccessible::g_atk_socket_embed = nullptr;
      17             : GType AtkSocketAccessible::g_atk_socket_type = G_TYPE_INVALID;
      18             : const char* AtkSocketAccessible::sATKSocketEmbedSymbol = "atk_socket_embed";
      19             : const char* AtkSocketAccessible::sATKSocketGetTypeSymbol = "atk_socket_get_type";
      20             : 
      21             : bool AtkSocketAccessible::gCanEmbed = FALSE;
      22             : 
      23             : extern "C" void mai_atk_component_iface_init(AtkComponentIface* aIface);
      24             : 
      25           0 : G_DEFINE_TYPE_EXTENDED(MaiAtkSocket, mai_atk_socket,
      26             :                        AtkSocketAccessible::g_atk_socket_type, 0,
      27             :                        G_IMPLEMENT_INTERFACE(ATK_TYPE_COMPONENT,
      28             :                                              mai_atk_component_iface_init))
      29             : 
      30             : void
      31           0 : mai_atk_socket_class_init(MaiAtkSocketClass* aAcc)
      32             : {
      33           0 : }
      34             : 
      35             : void
      36           0 : mai_atk_socket_init(MaiAtkSocket* aAcc)
      37             : {
      38           0 : }
      39             : 
      40             : static AtkObject*
      41           0 : mai_atk_socket_new(AccessibleWrap* aAccWrap)
      42             : {
      43           0 :   NS_ENSURE_TRUE(aAccWrap, nullptr);
      44             : 
      45           0 :   MaiAtkSocket* acc = nullptr;
      46           0 :   acc = static_cast<MaiAtkSocket*>(g_object_new(MAI_TYPE_ATK_SOCKET, nullptr));
      47           0 :   NS_ENSURE_TRUE(acc, nullptr);
      48             : 
      49           0 :   acc->accWrap = aAccWrap;
      50           0 :   return ATK_OBJECT(acc);
      51             : }
      52             : 
      53             : extern "C" {
      54             : static AtkObject*
      55           0 : RefAccessibleAtPoint(AtkComponent* aComponent, gint aX, gint aY,
      56             :                      AtkCoordType aCoordType)
      57             : {
      58           0 :   NS_ENSURE_TRUE(MAI_IS_ATK_SOCKET(aComponent), nullptr);
      59             : 
      60           0 :   return refAccessibleAtPointHelper(ATK_OBJECT(MAI_ATK_SOCKET(aComponent)),
      61           0 :                                     aX, aY, aCoordType);
      62             : }
      63             : 
      64             : static void
      65           0 : GetExtents(AtkComponent* aComponent, gint* aX, gint* aY, gint* aWidth,
      66             :            gint* aHeight, AtkCoordType aCoordType)
      67             : {
      68           0 :   *aX = *aY = *aWidth = *aHeight = 0;
      69             : 
      70           0 :   if (!MAI_IS_ATK_SOCKET(aComponent))
      71           0 :     return;
      72             : 
      73           0 :   getExtentsHelper(ATK_OBJECT(MAI_ATK_SOCKET(aComponent)),
      74           0 :                    aX, aY, aWidth, aHeight, aCoordType);
      75             : }
      76             : }
      77             : 
      78             : void
      79           0 : mai_atk_component_iface_init(AtkComponentIface* aIface)
      80             : {
      81           0 :   NS_ASSERTION(aIface, "Invalid Interface");
      82           0 :   if (MOZ_UNLIKELY(!aIface))
      83           0 :     return;
      84             : 
      85           0 :   aIface->ref_accessible_at_point = RefAccessibleAtPoint;
      86           0 :   aIface->get_extents = GetExtents;
      87             : }
      88             : 
      89           0 : AtkSocketAccessible::AtkSocketAccessible(nsIContent* aContent,
      90             :                                          DocAccessible* aDoc,
      91           0 :                                          const nsCString& aPlugId) :
      92           0 :   AccessibleWrap(aContent, aDoc)
      93             : {
      94           0 :   mAtkObject = mai_atk_socket_new(this);
      95           0 :   if (!mAtkObject)
      96           0 :     return;
      97             : 
      98             :   // Embeds the children of an AtkPlug, specified by plugId, as the children of
      99             :   // this socket.
     100             :   // Using G_TYPE macros instead of ATK_SOCKET macros to avoid undefined
     101             :   // symbols.
     102           0 :   if (gCanEmbed && G_TYPE_CHECK_INSTANCE_TYPE(mAtkObject, g_atk_socket_type) &&
     103           0 :       !aPlugId.IsVoid()) {
     104             :     AtkSocket* accSocket =
     105           0 :       G_TYPE_CHECK_INSTANCE_CAST(mAtkObject, g_atk_socket_type, AtkSocket);
     106           0 :     g_atk_socket_embed(accSocket, (gchar*)aPlugId.get());
     107             :   }
     108             : }
     109             : 
     110             : void
     111           0 : AtkSocketAccessible::GetNativeInterface(void** aOutAccessible)
     112             : {
     113           0 :   *aOutAccessible = mAtkObject;
     114           0 : }
     115             : 
     116             : void
     117           0 : AtkSocketAccessible::Shutdown()
     118             : {
     119           0 :   if (mAtkObject) {
     120           0 :     if (MAI_IS_ATK_SOCKET(mAtkObject))
     121           0 :       MAI_ATK_SOCKET(mAtkObject)->accWrap = nullptr;
     122           0 :     g_object_unref(mAtkObject);
     123           0 :     mAtkObject = nullptr;
     124             :   }
     125           0 :   AccessibleWrap::Shutdown();
     126           0 : }

Generated by: LCOV version 1.13