LCOV - code coverage report
Current view: top level - accessible/xpcom - xpcAccessibleTableCell.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 75 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 file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "xpcAccessibleTableCell.h"
       8             : 
       9             : #include "Accessible.h"
      10             : #include "nsIAccessibleTable.h"
      11             : #include "TableAccessible.h"
      12             : #include "TableCellAccessible.h"
      13             : #include "xpcAccessibleDocument.h"
      14             : 
      15             : #include "nsComponentManagerUtils.h"
      16             : #include "nsIMutableArray.h"
      17             : 
      18             : using namespace mozilla;
      19             : using namespace mozilla::a11y;
      20             : 
      21             : ////////////////////////////////////////////////////////////////////////////////
      22             : // nsISupports
      23             : 
      24           0 : NS_IMPL_ISUPPORTS_INHERITED(xpcAccessibleTableCell,
      25             :                             xpcAccessibleHyperText,
      26             :                             nsIAccessibleTableCell)
      27             : 
      28             : ////////////////////////////////////////////////////////////////////////////////
      29             : // nsIAccessibleTableCell
      30             : 
      31             : NS_IMETHODIMP
      32           0 : xpcAccessibleTableCell::GetTable(nsIAccessibleTable** aTable)
      33             : {
      34           0 :   NS_ENSURE_ARG_POINTER(aTable);
      35           0 :   *aTable = nullptr;
      36             : 
      37           0 :   if (!Intl())
      38           0 :     return NS_ERROR_FAILURE;
      39             : 
      40           0 :   TableAccessible* table = Intl()->Table();
      41           0 :   if (!table)
      42           0 :     return NS_ERROR_FAILURE;
      43             : 
      44             :   nsCOMPtr<nsIAccessibleTable> xpcTable =
      45           0 :     do_QueryInterface(static_cast<nsIAccessible*>(ToXPC(table->AsAccessible())));
      46           0 :   xpcTable.forget(aTable);
      47           0 :   return NS_OK;
      48             : }
      49             : 
      50             : NS_IMETHODIMP
      51           0 : xpcAccessibleTableCell::GetColumnIndex(int32_t* aColIdx)
      52             : {
      53           0 :   NS_ENSURE_ARG_POINTER(aColIdx);
      54           0 :   *aColIdx = -1;
      55             : 
      56           0 :   if (!Intl())
      57           0 :     return NS_ERROR_FAILURE;
      58             : 
      59           0 :   *aColIdx = Intl()->ColIdx();
      60           0 :   return NS_OK;
      61             : }
      62             : 
      63             : NS_IMETHODIMP
      64           0 : xpcAccessibleTableCell::GetRowIndex(int32_t* aRowIdx)
      65             : {
      66           0 :   NS_ENSURE_ARG_POINTER(aRowIdx);
      67           0 :   *aRowIdx = -1;
      68             : 
      69           0 :   if (!Intl())
      70           0 :     return NS_ERROR_FAILURE;
      71             : 
      72           0 :   *aRowIdx = Intl()->RowIdx();
      73           0 :   return NS_OK;
      74             : }
      75             : 
      76             : NS_IMETHODIMP
      77           0 : xpcAccessibleTableCell::GetColumnExtent(int32_t* aExtent)
      78             : {
      79           0 :   NS_ENSURE_ARG_POINTER(aExtent);
      80           0 :   *aExtent = -1;
      81             : 
      82           0 :   if (!Intl())
      83           0 :     return NS_ERROR_FAILURE;
      84             : 
      85           0 :   *aExtent = Intl()->ColExtent();
      86           0 :   return NS_OK;
      87             : }
      88             : 
      89             : NS_IMETHODIMP
      90           0 : xpcAccessibleTableCell::GetRowExtent(int32_t* aExtent)
      91             : {
      92           0 :   NS_ENSURE_ARG_POINTER(aExtent);
      93           0 :   *aExtent = -1;
      94             : 
      95           0 :   if (!Intl())
      96           0 :     return NS_ERROR_FAILURE;
      97             : 
      98           0 :   *aExtent = Intl()->RowExtent();
      99           0 :   return NS_OK;
     100             : }
     101             : 
     102             : NS_IMETHODIMP
     103           0 : xpcAccessibleTableCell::GetColumnHeaderCells(nsIArray** aHeaderCells)
     104             : {
     105           0 :   NS_ENSURE_ARG_POINTER(aHeaderCells);
     106           0 :   *aHeaderCells = nullptr;
     107             : 
     108           0 :   if (!Intl())
     109           0 :     return NS_ERROR_FAILURE;
     110             : 
     111           0 :   AutoTArray<Accessible*, 10> headerCells;
     112           0 :   Intl()->ColHeaderCells(&headerCells);
     113             : 
     114           0 :   nsCOMPtr<nsIMutableArray> cells = do_CreateInstance(NS_ARRAY_CONTRACTID);
     115           0 :   NS_ENSURE_TRUE(cells, NS_ERROR_FAILURE);
     116             : 
     117           0 :   for (uint32_t idx = 0; idx < headerCells.Length(); idx++) {
     118           0 :     cells->AppendElement(static_cast<nsIAccessible*>(ToXPC(headerCells[idx])),
     119           0 :                          false);
     120             :   }
     121             : 
     122           0 :   NS_ADDREF(*aHeaderCells = cells);
     123           0 :   return NS_OK;
     124             : }
     125             : 
     126             : NS_IMETHODIMP
     127           0 : xpcAccessibleTableCell::GetRowHeaderCells(nsIArray** aHeaderCells)
     128             : {
     129           0 :   NS_ENSURE_ARG_POINTER(aHeaderCells);
     130           0 :   *aHeaderCells = nullptr;
     131             : 
     132           0 :   if (!Intl())
     133           0 :     return NS_ERROR_FAILURE;
     134             : 
     135           0 :   AutoTArray<Accessible*, 10> headerCells;
     136           0 :   Intl()->RowHeaderCells(&headerCells);
     137             : 
     138           0 :   nsCOMPtr<nsIMutableArray> cells = do_CreateInstance(NS_ARRAY_CONTRACTID);
     139           0 :   NS_ENSURE_TRUE(cells, NS_ERROR_FAILURE);
     140             : 
     141           0 :   for (uint32_t idx = 0; idx < headerCells.Length(); idx++) {
     142           0 :     cells->AppendElement(static_cast<nsIAccessible*>(ToXPC(headerCells[idx])),
     143           0 :                          false);
     144             :   }
     145             : 
     146           0 :   NS_ADDREF(*aHeaderCells = cells);
     147           0 :   return NS_OK;
     148             : }
     149             : 
     150             : NS_IMETHODIMP
     151           0 : xpcAccessibleTableCell::IsSelected(bool* aSelected)
     152             : {
     153           0 :   NS_ENSURE_ARG_POINTER(aSelected);
     154           0 :   *aSelected = false;
     155             : 
     156           0 :   if (!Intl())
     157           0 :     return NS_ERROR_FAILURE;
     158             : 
     159           0 :   *aSelected = Intl()->Selected();
     160           0 :   return NS_OK;
     161             : }

Generated by: LCOV version 1.13