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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 484 |
485 updateChildrenIfNecessary(); | 485 updateChildrenIfNecessary(); |
486 unsigned rowCount = m_rows.size(); | 486 unsigned rowCount = m_rows.size(); |
487 for (unsigned r = 0; r < rowCount; r++) { | 487 for (unsigned r = 0; r < rowCount; r++) { |
488 AXObject* row = m_rows[r].get(); | 488 AXObject* row = m_rows[r].get(); |
489 if (row->isTableRow()) | 489 if (row->isTableRow()) |
490 toAXTableRow(m_rows[r].get())->headerObjectsForRow(headers); | 490 toAXTableRow(m_rows[r].get())->headerObjectsForRow(headers); |
491 } | 491 } |
492 } | 492 } |
493 | 493 |
| 494 int AXTable::ariaColumnCount() { |
| 495 if (!hasAttribute(aria_colcountAttr)) |
| 496 return 0; |
| 497 |
| 498 const AtomicString& colCountValue = getAttribute(aria_colcountAttr); |
| 499 int colCountInt = colCountValue.toInt(); |
| 500 |
| 501 if (colCountInt > (int)columnCount()) |
| 502 return colCountInt; |
| 503 |
| 504 // Spec says that if all of the columns are present in the DOM, it |
| 505 // is not necessary to set this attribute as the user agent can |
| 506 // automatically calculate the total number of columns. |
| 507 // It returns 0 in order not to set this attribute. |
| 508 if (colCountInt == (int)columnCount() || colCountInt != -1) |
| 509 return 0; |
| 510 |
| 511 return -1; |
| 512 } |
| 513 |
| 514 int AXTable::ariaRowCount() { |
| 515 if (!hasAttribute(aria_rowcountAttr)) |
| 516 return 0; |
| 517 |
| 518 const AtomicString& rowCountValue = getAttribute(aria_rowcountAttr); |
| 519 int rowCountInt = rowCountValue.toInt(); |
| 520 |
| 521 if (rowCountInt > (int)rowCount()) |
| 522 return rowCountInt; |
| 523 |
| 524 // Spec says that if all of the rows are present in the DOM, it is |
| 525 // not necessary to set this attribute as the user agent can |
| 526 // automatically calculate the total number of rows. |
| 527 // It returns 0 in order not to set this attribute. |
| 528 if (rowCountInt == (int)rowCount() || rowCountInt != -1) |
| 529 return 0; |
| 530 |
| 531 // In the spec, -1 explicitly means an unknown number of rows. |
| 532 return -1; |
| 533 } |
| 534 |
494 unsigned AXTable::columnCount() { | 535 unsigned AXTable::columnCount() { |
495 updateChildrenIfNecessary(); | 536 updateChildrenIfNecessary(); |
496 | 537 |
497 return m_columns.size(); | 538 return m_columns.size(); |
498 } | 539 } |
499 | 540 |
500 unsigned AXTable::rowCount() { | 541 unsigned AXTable::rowCount() { |
501 updateChildrenIfNecessary(); | 542 updateChildrenIfNecessary(); |
502 | 543 |
503 return m_rows.size(); | 544 return m_rows.size(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } | 604 } |
564 | 605 |
565 DEFINE_TRACE(AXTable) { | 606 DEFINE_TRACE(AXTable) { |
566 visitor->trace(m_rows); | 607 visitor->trace(m_rows); |
567 visitor->trace(m_columns); | 608 visitor->trace(m_columns); |
568 visitor->trace(m_headerContainer); | 609 visitor->trace(m_headerContainer); |
569 AXLayoutObject::trace(visitor); | 610 AXLayoutObject::trace(visitor); |
570 } | 611 } |
571 | 612 |
572 } // namespace blink | 613 } // namespace blink |
OLD | NEW |