Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXTable.cpp

Issue 2539503003: ARIA 1.1: implementation for aria-col-* and aria-row-*. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 unsigned AXTable::columnCount() { 494 int AXTable::ariaColumnCount()
495 {
496 const AtomicString& colCountValue = getAttribute(aria_colcountAttr);
497 int colCountInt = colCountValue.toInt();
498
499 if (colCountInt > (int)columnCount())
500 return colCountInt;
501
502 // Spec says that if all of the columns are present in the DOM, it
503 // is not necessary to set this attribute as the user agent can
504 // automatically calculate the total number of columns.
505 // It returns 0 in order not to set this attribute.
506 if (colCountInt == (int)columnCount() || colCountInt != -1)
507 return 0;
508
509 return -1;
510 }
511
512 int AXTable::ariaRowCount()
513 {
514 const AtomicString& rowCountValue = getAttribute(aria_rowcountAttr);
aboxhall 2016/11/29 17:36:54 Any point checking hasAttribute here and early out
dmazzoni 2016/11/30 22:48:17 Done.
515 int rowCountInt = rowCountValue.toInt();
516
517 if (rowCountInt > (int)rowCount())
518 return rowCountInt;
519
520 // Spec says that If all of the rows are present in the DOM, it is
521 // not necessary to set this attribute as the user agent can
522 // automatically calculate the total number of rows. .
523 // It returns 0 in order not to set this attribute.
524 if (rowCountInt == (int)rowCount() || rowCountInt != -1)
525 return 0;
526
527 return -1;
528 }
529
530 unsigned AXTable::columnCount()
531 {
495 updateChildrenIfNecessary(); 532 updateChildrenIfNecessary();
496 533
497 return m_columns.size(); 534 return m_columns.size();
498 } 535 }
499 536
500 unsigned AXTable::rowCount() { 537 unsigned AXTable::rowCount() {
501 updateChildrenIfNecessary(); 538 updateChildrenIfNecessary();
502 539
503 return m_rows.size(); 540 return m_rows.size();
504 } 541 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 600 }
564 601
565 DEFINE_TRACE(AXTable) { 602 DEFINE_TRACE(AXTable) {
566 visitor->trace(m_rows); 603 visitor->trace(m_rows);
567 visitor->trace(m_columns); 604 visitor->trace(m_columns);
568 visitor->trace(m_headerContainer); 605 visitor->trace(m_headerContainer);
569 AXLayoutObject::trace(visitor); 606 AXLayoutObject::trace(visitor);
570 } 607 }
571 608
572 } // namespace blink 609 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698