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

Side by Side Diff: Source/core/accessibility/AccessibilityTable.cpp

Issue 24752002: Cleanup <static_cast>: Switch to toFoo for Accessibility Objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 for (unsigned rowIndex = 0; rowIndex < numRows; ++rowIndex) { 347 for (unsigned rowIndex = 0; rowIndex < numRows; ++rowIndex) {
348 348
349 RenderTableRow* renderRow = tableSection->rowRendererAt(rowIndex); 349 RenderTableRow* renderRow = tableSection->rowRendererAt(rowIndex);
350 if (!renderRow) 350 if (!renderRow)
351 continue; 351 continue;
352 352
353 AccessibilityObject* rowObject = axCache->getOrCreate(renderRow); 353 AccessibilityObject* rowObject = axCache->getOrCreate(renderRow);
354 if (!rowObject->isTableRow()) 354 if (!rowObject->isTableRow())
355 continue; 355 continue;
356 356
357 AccessibilityTableRow* row = static_cast<AccessibilityTableRow*>(row Object); 357 AccessibilityTableRow* row = toAccessibilityTableRow(rowObject);
358 // We need to check every cell for a new row, because cell spans 358 // We need to check every cell for a new row, because cell spans
359 // can cause us to miss rows if we just check the first column. 359 // can cause us to miss rows if we just check the first column.
360 if (appendedRows.contains(row)) 360 if (appendedRows.contains(row))
361 continue; 361 continue;
362 362
363 row->setRowIndex(static_cast<int>(m_rows.size())); 363 row->setRowIndex(static_cast<int>(m_rows.size()));
364 m_rows.append(row); 364 m_rows.append(row);
365 if (!row->accessibilityIsIgnored()) 365 if (!row->accessibilityIsIgnored())
366 m_children.append(row); 366 m_children.append(row);
367 appendedRows.add(row); 367 appendedRows.add(row);
368 } 368 }
369 369
370 tableSection = table->sectionBelow(tableSection, SkipEmptySections); 370 tableSection = table->sectionBelow(tableSection, SkipEmptySections);
371 } 371 }
372 372
373 // make the columns based on the number of columns in the first body 373 // make the columns based on the number of columns in the first body
374 unsigned length = initialTableSection->numColumns(); 374 unsigned length = initialTableSection->numColumns();
375 for (unsigned i = 0; i < length; ++i) { 375 for (unsigned i = 0; i < length; ++i) {
376 AccessibilityTableColumn* column = static_cast<AccessibilityTableColumn* >(axCache->getOrCreate(ColumnRole)); 376 AccessibilityTableColumn* column = toAccessibilityTableColumn(axCache->g etOrCreate(ColumnRole));
377 column->setColumnIndex((int)i); 377 column->setColumnIndex((int)i);
378 column->setParent(this); 378 column->setParent(this);
379 m_columns.append(column); 379 m_columns.append(column);
380 if (!column->accessibilityIsIgnored()) 380 if (!column->accessibilityIsIgnored())
381 m_children.append(column); 381 m_children.append(column);
382 } 382 }
383 383
384 AccessibilityObject* headerContainerObject = headerContainer(); 384 AccessibilityObject* headerContainerObject = headerContainer();
385 if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored( )) 385 if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored( ))
386 m_children.append(headerContainerObject); 386 m_children.append(headerContainerObject);
(...skipping 27 matching lines...) Expand all
414 414
415 void AccessibilityTable::columnHeaders(AccessibilityChildrenVector& headers) 415 void AccessibilityTable::columnHeaders(AccessibilityChildrenVector& headers)
416 { 416 {
417 if (!m_renderer) 417 if (!m_renderer)
418 return; 418 return;
419 419
420 updateChildrenIfNecessary(); 420 updateChildrenIfNecessary();
421 421
422 unsigned colCount = m_columns.size(); 422 unsigned colCount = m_columns.size();
423 for (unsigned k = 0; k < colCount; ++k) { 423 for (unsigned k = 0; k < colCount; ++k) {
424 AccessibilityObject* header = static_cast<AccessibilityTableColumn*>(m_c olumns[k].get())->headerObject(); 424 AccessibilityObject* header = toAccessibilityTableColumn(m_columns[k].ge t())->headerObject();
425 if (!header) 425 if (!header)
426 continue; 426 continue;
427 headers.append(header); 427 headers.append(header);
428 } 428 }
429 } 429 }
430 430
431 void AccessibilityTable::cells(AccessibilityObject::AccessibilityChildrenVector& cells) 431 void AccessibilityTable::cells(AccessibilityObject::AccessibilityChildrenVector& cells)
432 { 432 {
433 if (!m_renderer) 433 if (!m_renderer)
434 return; 434 return;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // cell to determine which is the right one. 481 // cell to determine which is the right one.
482 for (unsigned colIndexCounter = std::min(static_cast<unsigned>(children. size()), column + 1); colIndexCounter > 0; --colIndexCounter) { 482 for (unsigned colIndexCounter = std::min(static_cast<unsigned>(children. size()), column + 1); colIndexCounter > 0; --colIndexCounter) {
483 unsigned colIndex = colIndexCounter - 1; 483 unsigned colIndex = colIndexCounter - 1;
484 AccessibilityObject* child = children[colIndex].get(); 484 AccessibilityObject* child = children[colIndex].get();
485 ASSERT(child->isTableCell()); 485 ASSERT(child->isTableCell());
486 if (!child->isTableCell()) 486 if (!child->isTableCell())
487 continue; 487 continue;
488 488
489 pair<unsigned, unsigned> columnRange; 489 pair<unsigned, unsigned> columnRange;
490 pair<unsigned, unsigned> rowRange; 490 pair<unsigned, unsigned> rowRange;
491 AccessibilityTableCell* tableCellChild = static_cast<AccessibilityTa bleCell*>(child); 491 AccessibilityTableCell* tableCellChild = toAccessibilityTableCell(ch ild);
492 tableCellChild->columnIndexRange(columnRange); 492 tableCellChild->columnIndexRange(columnRange);
493 tableCellChild->rowIndexRange(rowRange); 493 tableCellChild->rowIndexRange(rowRange);
494 494
495 if ((column >= columnRange.first && column < (columnRange.first + co lumnRange.second)) 495 if ((column >= columnRange.first && column < (columnRange.first + co lumnRange.second))
496 && (row >= rowRange.first && row < (rowRange.first + rowRange.se cond))) 496 && (row >= rowRange.first && row < (rowRange.first + rowRange.se cond)))
497 return tableCellChild; 497 return tableCellChild;
498 } 498 }
499 } 499 }
500 500
501 return 0; 501 return 0;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 } 541 }
542 542
543 // try the standard 543 // try the standard
544 if (title.isEmpty()) 544 if (title.isEmpty())
545 title = AccessibilityRenderObject::title(); 545 title = AccessibilityRenderObject::title();
546 546
547 return title; 547 return title;
548 } 548 }
549 549
550 } // namespace WebCore 550 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AccessibilityScrollbar.h ('k') | Source/core/accessibility/AccessibilityTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698