OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 487 |
488 void AXTable::cells(AXObject::AccessibilityChildrenVector& cells) | 488 void AXTable::cells(AXObject::AccessibilityChildrenVector& cells) |
489 { | 489 { |
490 if (!m_renderer) | 490 if (!m_renderer) |
491 return; | 491 return; |
492 | 492 |
493 updateChildrenIfNecessary(); | 493 updateChildrenIfNecessary(); |
494 | 494 |
495 int numRows = m_rows.size(); | 495 int numRows = m_rows.size(); |
496 for (int row = 0; row < numRows; ++row) { | 496 for (int row = 0; row < numRows; ++row) { |
497 AccessibilityChildrenVector rowChildren = m_rows[row]->children(); | 497 cells.appendVector(m_rows[row]->children()); |
498 cells.appendVector(rowChildren); | |
499 } | 498 } |
500 } | 499 } |
501 | 500 |
502 unsigned AXTable::columnCount() | 501 unsigned AXTable::columnCount() |
503 { | 502 { |
504 updateChildrenIfNecessary(); | 503 updateChildrenIfNecessary(); |
505 | 504 |
506 return m_columns.size(); | 505 return m_columns.size(); |
507 } | 506 } |
508 | 507 |
509 unsigned AXTable::rowCount() | 508 unsigned AXTable::rowCount() |
510 { | 509 { |
511 updateChildrenIfNecessary(); | 510 updateChildrenIfNecessary(); |
512 | 511 |
513 return m_rows.size(); | 512 return m_rows.size(); |
514 } | 513 } |
515 | 514 |
516 AXTableCell* AXTable::cellForColumnAndRow(unsigned column, unsigned row) | 515 AXTableCell* AXTable::cellForColumnAndRow(unsigned column, unsigned row) |
517 { | 516 { |
518 updateChildrenIfNecessary(); | 517 updateChildrenIfNecessary(); |
519 if (column >= columnCount() || row >= rowCount()) | 518 if (column >= columnCount() || row >= rowCount()) |
520 return 0; | 519 return 0; |
521 | 520 |
522 // Iterate backwards through the rows in case the desired cell has a rowspan
and exists in a previous row. | 521 // Iterate backwards through the rows in case the desired cell has a rowspan
and exists in a previous row. |
523 for (unsigned rowIndexCounter = row + 1; rowIndexCounter > 0; --rowIndexCoun
ter) { | 522 for (unsigned rowIndexCounter = row + 1; rowIndexCounter > 0; --rowIndexCoun
ter) { |
524 unsigned rowIndex = rowIndexCounter - 1; | 523 unsigned rowIndex = rowIndexCounter - 1; |
525 AccessibilityChildrenVector children = m_rows[rowIndex]->children(); | 524 const AccessibilityChildrenVector& children = m_rows[rowIndex]->children
(); |
526 // Since some cells may have colspans, we have to check the actual range
of each | 525 // Since some cells may have colspans, we have to check the actual range
of each |
527 // cell to determine which is the right one. | 526 // cell to determine which is the right one. |
528 for (unsigned colIndexCounter = std::min(static_cast<unsigned>(children.
size()), column + 1); colIndexCounter > 0; --colIndexCounter) { | 527 for (unsigned colIndexCounter = std::min(static_cast<unsigned>(children.
size()), column + 1); colIndexCounter > 0; --colIndexCounter) { |
529 unsigned colIndex = colIndexCounter - 1; | 528 unsigned colIndex = colIndexCounter - 1; |
530 AXObject* child = children[colIndex].get(); | 529 AXObject* child = children[colIndex].get(); |
531 | 530 |
532 if (!child->isTableCell()) | 531 if (!child->isTableCell()) |
533 continue; | 532 continue; |
534 | 533 |
535 pair<unsigned, unsigned> columnRange; | 534 pair<unsigned, unsigned> columnRange; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 } | 586 } |
588 | 587 |
589 // try the standard | 588 // try the standard |
590 if (title.isEmpty()) | 589 if (title.isEmpty()) |
591 title = AXLayoutObject::title(mode); | 590 title = AXLayoutObject::title(mode); |
592 | 591 |
593 return title; | 592 return title; |
594 } | 593 } |
595 | 594 |
596 } // namespace blink | 595 } // namespace blink |
OLD | NEW |