| 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 10 matching lines...) Expand all Loading... |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "modules/accessibility/AXTable.h" | 29 #include "modules/accessibility/AXTable.h" |
| 30 | 30 |
| 31 #include "core/dom/AccessibleNode.h" |
| 31 #include "core/dom/ElementTraversal.h" | 32 #include "core/dom/ElementTraversal.h" |
| 32 #include "core/editing/EditingUtilities.h" | 33 #include "core/editing/EditingUtilities.h" |
| 33 #include "core/html/HTMLCollection.h" | 34 #include "core/html/HTMLCollection.h" |
| 34 #include "core/html/HTMLTableCaptionElement.h" | 35 #include "core/html/HTMLTableCaptionElement.h" |
| 35 #include "core/html/HTMLTableCellElement.h" | 36 #include "core/html/HTMLTableCellElement.h" |
| 36 #include "core/html/HTMLTableColElement.h" | 37 #include "core/html/HTMLTableColElement.h" |
| 37 #include "core/html/HTMLTableElement.h" | 38 #include "core/html/HTMLTableElement.h" |
| 38 #include "core/html/HTMLTableRowElement.h" | 39 #include "core/html/HTMLTableRowElement.h" |
| 39 #include "core/html/HTMLTableRowsCollection.h" | 40 #include "core/html/HTMLTableRowsCollection.h" |
| 40 #include "core/html/HTMLTableSectionElement.h" | 41 #include "core/html/HTMLTableSectionElement.h" |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 UpdateChildrenIfNecessary(); | 490 UpdateChildrenIfNecessary(); |
| 490 unsigned row_count = rows_.size(); | 491 unsigned row_count = rows_.size(); |
| 491 for (unsigned r = 0; r < row_count; r++) { | 492 for (unsigned r = 0; r < row_count; r++) { |
| 492 AXObjectImpl* row = rows_[r].Get(); | 493 AXObjectImpl* row = rows_[r].Get(); |
| 493 if (row->IsTableRow()) | 494 if (row->IsTableRow()) |
| 494 ToAXTableRow(rows_[r].Get())->HeaderObjectsForRow(headers); | 495 ToAXTableRow(rows_[r].Get())->HeaderObjectsForRow(headers); |
| 495 } | 496 } |
| 496 } | 497 } |
| 497 | 498 |
| 498 int AXTable::AriaColumnCount() { | 499 int AXTable::AriaColumnCount() { |
| 499 if (!HasAttribute(aria_colcountAttr)) | 500 int32_t col_count; |
| 501 if (!HasAOMPropertyOrARIAAttribute(AOMIntProperty::kColCount, col_count)) |
| 500 return 0; | 502 return 0; |
| 501 | 503 |
| 502 const AtomicString& col_count_value = GetAttribute(aria_colcountAttr); | 504 if (col_count > static_cast<int>(ColumnCount())) |
| 503 int col_count_int = col_count_value.ToInt(); | 505 return col_count; |
| 504 | |
| 505 if (col_count_int > (int)ColumnCount()) | |
| 506 return col_count_int; | |
| 507 | 506 |
| 508 // Spec says that if all of the columns are present in the DOM, it | 507 // Spec says that if all of the columns are present in the DOM, it |
| 509 // is not necessary to set this attribute as the user agent can | 508 // is not necessary to set this attribute as the user agent can |
| 510 // automatically calculate the total number of columns. | 509 // automatically calculate the total number of columns. |
| 511 // It returns 0 in order not to set this attribute. | 510 // It returns 0 in order not to set this attribute. |
| 512 if (col_count_int == (int)ColumnCount() || col_count_int != -1) | 511 if (col_count == static_cast<int>(ColumnCount()) || col_count != -1) |
| 513 return 0; | 512 return 0; |
| 514 | 513 |
| 515 return -1; | 514 return -1; |
| 516 } | 515 } |
| 517 | 516 |
| 518 int AXTable::AriaRowCount() { | 517 int AXTable::AriaRowCount() { |
| 519 if (!HasAttribute(aria_rowcountAttr)) | 518 int32_t row_count; |
| 519 if (!HasAOMPropertyOrARIAAttribute(AOMIntProperty::kRowCount, row_count)) |
| 520 return 0; | 520 return 0; |
| 521 | 521 |
| 522 const AtomicString& row_count_value = GetAttribute(aria_rowcountAttr); | 522 if (row_count > static_cast<int>(RowCount())) |
| 523 int row_count_int = row_count_value.ToInt(); | 523 return row_count; |
| 524 | |
| 525 if (row_count_int > (int)RowCount()) | |
| 526 return row_count_int; | |
| 527 | 524 |
| 528 // Spec says that if all of the rows are present in the DOM, it is | 525 // Spec says that if all of the rows are present in the DOM, it is |
| 529 // not necessary to set this attribute as the user agent can | 526 // not necessary to set this attribute as the user agent can |
| 530 // automatically calculate the total number of rows. | 527 // automatically calculate the total number of rows. |
| 531 // It returns 0 in order not to set this attribute. | 528 // It returns 0 in order not to set this attribute. |
| 532 if (row_count_int == (int)RowCount() || row_count_int != -1) | 529 if (row_count == (int)RowCount() || row_count != -1) |
| 533 return 0; | 530 return 0; |
| 534 | 531 |
| 535 // In the spec, -1 explicitly means an unknown number of rows. | 532 // In the spec, -1 explicitly means an unknown number of rows. |
| 536 return -1; | 533 return -1; |
| 537 } | 534 } |
| 538 | 535 |
| 539 unsigned AXTable::ColumnCount() { | 536 unsigned AXTable::ColumnCount() { |
| 540 UpdateChildrenIfNecessary(); | 537 UpdateChildrenIfNecessary(); |
| 541 | 538 |
| 542 return columns_.size(); | 539 return columns_.size(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 606 } |
| 610 | 607 |
| 611 DEFINE_TRACE(AXTable) { | 608 DEFINE_TRACE(AXTable) { |
| 612 visitor->Trace(rows_); | 609 visitor->Trace(rows_); |
| 613 visitor->Trace(columns_); | 610 visitor->Trace(columns_); |
| 614 visitor->Trace(header_container_); | 611 visitor->Trace(header_container_); |
| 615 AXLayoutObject::Trace(visitor); | 612 AXLayoutObject::Trace(visitor); |
| 616 } | 613 } |
| 617 | 614 |
| 618 } // namespace blink | 615 } // namespace blink |
| OLD | NEW |