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

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

Issue 2858493002: Rename AXObject to AXObjectImpl in modules/ and web/ (Closed)
Patch Set: Fixed rebase Created 3 years, 7 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 LayoutTable* table = ToLayoutTable(layout_object_); 380 LayoutTable* table = ToLayoutTable(layout_object_);
381 AXObjectCacheImpl& ax_cache = AxObjectCache(); 381 AXObjectCacheImpl& ax_cache = AxObjectCache();
382 382
383 Node* table_node = table->GetNode(); 383 Node* table_node = table->GetNode();
384 if (!isHTMLTableElement(table_node)) 384 if (!isHTMLTableElement(table_node))
385 return; 385 return;
386 386
387 // Add caption 387 // Add caption
388 if (HTMLTableCaptionElement* caption = 388 if (HTMLTableCaptionElement* caption =
389 toHTMLTableElement(table_node)->caption()) { 389 toHTMLTableElement(table_node)->caption()) {
390 AXObject* caption_object = ax_cache.GetOrCreate(caption); 390 AXObjectImpl* caption_object = ax_cache.GetOrCreate(caption);
391 if (caption_object && !caption_object->AccessibilityIsIgnored()) 391 if (caption_object && !caption_object->AccessibilityIsIgnored())
392 children_.push_back(caption_object); 392 children_.push_back(caption_object);
393 } 393 }
394 394
395 // Go through all the available sections to pull out the rows and add them as 395 // Go through all the available sections to pull out the rows and add them as
396 // children. 396 // children.
397 table->RecalcSectionsIfNeeded(); 397 table->RecalcSectionsIfNeeded();
398 LayoutTableSection* table_section = table->TopSection(); 398 LayoutTableSection* table_section = table->TopSection();
399 if (!table_section) 399 if (!table_section)
400 return; 400 return;
401 401
402 LayoutTableSection* initial_table_section = table_section; 402 LayoutTableSection* initial_table_section = table_section;
403 while (table_section) { 403 while (table_section) {
404 HeapHashSet<Member<AXObject>> appended_rows; 404 HeapHashSet<Member<AXObjectImpl>> appended_rows;
405 unsigned num_rows = table_section->NumRows(); 405 unsigned num_rows = table_section->NumRows();
406 for (unsigned row_index = 0; row_index < num_rows; ++row_index) { 406 for (unsigned row_index = 0; row_index < num_rows; ++row_index) {
407 LayoutTableRow* layout_row = table_section->RowLayoutObjectAt(row_index); 407 LayoutTableRow* layout_row = table_section->RowLayoutObjectAt(row_index);
408 if (!layout_row) 408 if (!layout_row)
409 continue; 409 continue;
410 410
411 AXObject* row_object = ax_cache.GetOrCreate(layout_row); 411 AXObjectImpl* row_object = ax_cache.GetOrCreate(layout_row);
412 if (!row_object || !row_object->IsTableRow()) 412 if (!row_object || !row_object->IsTableRow())
413 continue; 413 continue;
414 414
415 AXTableRow* row = ToAXTableRow(row_object); 415 AXTableRow* row = ToAXTableRow(row_object);
416 // We need to check every cell for a new row, because cell spans 416 // We need to check every cell for a new row, because cell spans
417 // can cause us to miss rows if we just check the first column. 417 // can cause us to miss rows if we just check the first column.
418 if (appended_rows.Contains(row)) 418 if (appended_rows.Contains(row))
419 continue; 419 continue;
420 420
421 row->SetRowIndex(static_cast<int>(rows_.size())); 421 row->SetRowIndex(static_cast<int>(rows_.size()));
(...skipping 10 matching lines...) Expand all
432 unsigned length = initial_table_section->NumEffectiveColumns(); 432 unsigned length = initial_table_section->NumEffectiveColumns();
433 for (unsigned i = 0; i < length; ++i) { 433 for (unsigned i = 0; i < length; ++i) {
434 AXTableColumn* column = ToAXTableColumn(ax_cache.GetOrCreate(kColumnRole)); 434 AXTableColumn* column = ToAXTableColumn(ax_cache.GetOrCreate(kColumnRole));
435 column->SetColumnIndex((int)i); 435 column->SetColumnIndex((int)i);
436 column->SetParent(this); 436 column->SetParent(this);
437 columns_.push_back(column); 437 columns_.push_back(column);
438 if (!column->AccessibilityIsIgnored()) 438 if (!column->AccessibilityIsIgnored())
439 children_.push_back(column); 439 children_.push_back(column);
440 } 440 }
441 441
442 AXObject* header_container_object = HeaderContainer(); 442 AXObjectImpl* header_container_object = HeaderContainer();
443 if (header_container_object && 443 if (header_container_object &&
444 !header_container_object->AccessibilityIsIgnored()) 444 !header_container_object->AccessibilityIsIgnored())
445 children_.push_back(header_container_object); 445 children_.push_back(header_container_object);
446 } 446 }
447 447
448 AXObject* AXTable::HeaderContainer() { 448 AXObjectImpl* AXTable::HeaderContainer() {
449 if (header_container_) 449 if (header_container_)
450 return header_container_.Get(); 450 return header_container_.Get();
451 451
452 AXMockObject* table_header = 452 AXMockObject* table_header =
453 ToAXMockObject(AxObjectCache().GetOrCreate(kTableHeaderContainerRole)); 453 ToAXMockObject(AxObjectCache().GetOrCreate(kTableHeaderContainerRole));
454 table_header->SetParent(this); 454 table_header->SetParent(this);
455 455
456 header_container_ = table_header; 456 header_container_ = table_header;
457 return header_container_.Get(); 457 return header_container_.Get();
458 } 458 }
459 459
460 const AXObject::AXObjectVector& AXTable::Columns() { 460 const AXObjectImpl::AXObjectVector& AXTable::Columns() {
461 UpdateChildrenIfNecessary(); 461 UpdateChildrenIfNecessary();
462 462
463 return columns_; 463 return columns_;
464 } 464 }
465 465
466 const AXObject::AXObjectVector& AXTable::Rows() { 466 const AXObjectImpl::AXObjectVector& AXTable::Rows() {
467 UpdateChildrenIfNecessary(); 467 UpdateChildrenIfNecessary();
468 468
469 return rows_; 469 return rows_;
470 } 470 }
471 471
472 void AXTable::ColumnHeaders(AXObjectVector& headers) { 472 void AXTable::ColumnHeaders(AXObjectVector& headers) {
473 if (!layout_object_) 473 if (!layout_object_)
474 return; 474 return;
475 475
476 UpdateChildrenIfNecessary(); 476 UpdateChildrenIfNecessary();
477 unsigned column_count = columns_.size(); 477 unsigned column_count = columns_.size();
478 for (unsigned c = 0; c < column_count; c++) { 478 for (unsigned c = 0; c < column_count; c++) {
479 AXObject* column = columns_[c].Get(); 479 AXObjectImpl* column = columns_[c].Get();
480 if (column->IsTableCol()) 480 if (column->IsTableCol())
481 ToAXTableColumn(column)->HeaderObjectsForColumn(headers); 481 ToAXTableColumn(column)->HeaderObjectsForColumn(headers);
482 } 482 }
483 } 483 }
484 484
485 void AXTable::RowHeaders(AXObjectVector& headers) { 485 void AXTable::RowHeaders(AXObjectVector& headers) {
486 if (!layout_object_) 486 if (!layout_object_)
487 return; 487 return;
488 488
489 UpdateChildrenIfNecessary(); 489 UpdateChildrenIfNecessary();
490 unsigned row_count = rows_.size(); 490 unsigned row_count = rows_.size();
491 for (unsigned r = 0; r < row_count; r++) { 491 for (unsigned r = 0; r < row_count; r++) {
492 AXObject* row = rows_[r].Get(); 492 AXObjectImpl* row = rows_[r].Get();
493 if (row->IsTableRow()) 493 if (row->IsTableRow())
494 ToAXTableRow(rows_[r].Get())->HeaderObjectsForRow(headers); 494 ToAXTableRow(rows_[r].Get())->HeaderObjectsForRow(headers);
495 } 495 }
496 } 496 }
497 497
498 int AXTable::AriaColumnCount() { 498 int AXTable::AriaColumnCount() {
499 if (!HasAttribute(aria_colcountAttr)) 499 if (!HasAttribute(aria_colcountAttr))
500 return 0; 500 return 0;
501 501
502 const AtomicString& col_count_value = GetAttribute(aria_colcountAttr); 502 const AtomicString& col_count_value = GetAttribute(aria_colcountAttr);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 for (unsigned row_index_counter = row + 1; row_index_counter > 0; 558 for (unsigned row_index_counter = row + 1; row_index_counter > 0;
559 --row_index_counter) { 559 --row_index_counter) {
560 unsigned row_index = row_index_counter - 1; 560 unsigned row_index = row_index_counter - 1;
561 const auto& children = rows_[row_index]->Children(); 561 const auto& children = rows_[row_index]->Children();
562 // Since some cells may have colspans, we have to check the actual range of 562 // Since some cells may have colspans, we have to check the actual range of
563 // each cell to determine which is the right one. 563 // each cell to determine which is the right one.
564 for (unsigned col_index_counter = 564 for (unsigned col_index_counter =
565 std::min(static_cast<unsigned>(children.size()), column + 1); 565 std::min(static_cast<unsigned>(children.size()), column + 1);
566 col_index_counter > 0; --col_index_counter) { 566 col_index_counter > 0; --col_index_counter) {
567 unsigned col_index = col_index_counter - 1; 567 unsigned col_index = col_index_counter - 1;
568 AXObject* child = children[col_index].Get(); 568 AXObjectImpl* child = children[col_index].Get();
569 569
570 if (!child->IsTableCell()) 570 if (!child->IsTableCell())
571 continue; 571 continue;
572 572
573 std::pair<unsigned, unsigned> column_range; 573 std::pair<unsigned, unsigned> column_range;
574 std::pair<unsigned, unsigned> row_range; 574 std::pair<unsigned, unsigned> row_range;
575 AXTableCell* table_cell_child = ToAXTableCell(child); 575 AXTableCell* table_cell_child = ToAXTableCell(child);
576 table_cell_child->ColumnIndexRange(column_range); 576 table_cell_child->ColumnIndexRange(column_range);
577 table_cell_child->RowIndexRange(row_range); 577 table_cell_child->RowIndexRange(row_range);
578 578
(...skipping 30 matching lines...) Expand all
609 } 609 }
610 610
611 DEFINE_TRACE(AXTable) { 611 DEFINE_TRACE(AXTable) {
612 visitor->Trace(rows_); 612 visitor->Trace(rows_);
613 visitor->Trace(columns_); 613 visitor->Trace(columns_);
614 visitor->Trace(header_container_); 614 visitor->Trace(header_container_);
615 AXLayoutObject::Trace(visitor); 615 AXLayoutObject::Trace(visitor);
616 } 616 }
617 617
618 } // namespace blink 618 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698