LCOV - code coverage report
Current view: top level - accessible/generic - TableCellAccessible.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 30 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 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 "TableCellAccessible.h"
       8             : 
       9             : #include "Accessible-inl.h"
      10             : #include "TableAccessible.h"
      11             : 
      12             : using namespace mozilla;
      13             : using namespace mozilla::a11y;
      14             : 
      15             : void
      16           0 : TableCellAccessible::RowHeaderCells(nsTArray<Accessible*>* aCells)
      17             : {
      18           0 :   uint32_t rowIdx = RowIdx(), colIdx = ColIdx();
      19           0 :   TableAccessible* table = Table();
      20           0 :   if (!table)
      21           0 :     return;
      22             : 
      23             :   // Move to the left to find row header cells
      24           0 :   for (uint32_t curColIdx = colIdx - 1; curColIdx < colIdx; curColIdx--) {
      25           0 :     Accessible* cell = table->CellAt(rowIdx, curColIdx);
      26           0 :     if (!cell)
      27           0 :       continue;
      28             : 
      29             :     // CellAt should always return a TableCellAccessible (XXX Bug 587529)
      30           0 :     TableCellAccessible* tableCell = cell->AsTableCell();
      31           0 :     NS_ASSERTION(tableCell, "cell should be a table cell!");
      32           0 :     if (!tableCell)
      33           0 :       continue;
      34             : 
      35             :     // Avoid addding cells multiple times, if this cell spans more columns
      36             :     // we'll get it later.
      37           0 :     if (tableCell->ColIdx() == curColIdx && cell->Role() == roles::ROWHEADER)
      38           0 :       aCells->AppendElement(cell);
      39             :   }
      40             : }
      41             : 
      42             : void
      43           0 : TableCellAccessible::ColHeaderCells(nsTArray<Accessible*>* aCells)
      44             : {
      45           0 :   uint32_t rowIdx = RowIdx(), colIdx = ColIdx();
      46           0 :   TableAccessible* table = Table();
      47           0 :   if (!table)
      48           0 :     return;
      49             : 
      50             :   // Move up to find column header cells
      51           0 :   for (uint32_t curRowIdx = rowIdx - 1; curRowIdx < rowIdx; curRowIdx--) {
      52           0 :     Accessible* cell = table->CellAt(curRowIdx, colIdx);
      53           0 :     if (!cell)
      54           0 :       continue;
      55             : 
      56             :     // CellAt should always return a TableCellAccessible (XXX Bug 587529)
      57           0 :     TableCellAccessible* tableCell = cell->AsTableCell();
      58           0 :     NS_ASSERTION(tableCell, "cell should be a table cell!");
      59           0 :     if (!tableCell)
      60           0 :       continue;
      61             : 
      62             :     // Avoid addding cells multiple times, if this cell spans more rows
      63             :     // we'll get it later.
      64           0 :     if (tableCell->RowIdx() == curRowIdx && cell->Role() == roles::COLUMNHEADER)
      65           0 :       aCells->AppendElement(cell);
      66             :   }
      67             : }

Generated by: LCOV version 1.13