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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 379 |
380 Node* tableNode = table->node(); | 380 Node* tableNode = table->node(); |
381 if (!isHTMLTableElement(tableNode)) | 381 if (!isHTMLTableElement(tableNode)) |
382 return; | 382 return; |
383 | 383 |
384 // Add caption | 384 // Add caption |
385 if (HTMLTableCaptionElement* caption = | 385 if (HTMLTableCaptionElement* caption = |
386 toHTMLTableElement(tableNode)->caption()) { | 386 toHTMLTableElement(tableNode)->caption()) { |
387 AXObject* captionObject = axCache.getOrCreate(caption); | 387 AXObject* captionObject = axCache.getOrCreate(caption); |
388 if (captionObject && !captionObject->accessibilityIsIgnored()) | 388 if (captionObject && !captionObject->accessibilityIsIgnored()) |
389 m_children.append(captionObject); | 389 m_children.push_back(captionObject); |
390 } | 390 } |
391 | 391 |
392 // Go through all the available sections to pull out the rows and add them as | 392 // Go through all the available sections to pull out the rows and add them as |
393 // children. | 393 // children. |
394 table->recalcSectionsIfNeeded(); | 394 table->recalcSectionsIfNeeded(); |
395 LayoutTableSection* tableSection = table->topSection(); | 395 LayoutTableSection* tableSection = table->topSection(); |
396 if (!tableSection) | 396 if (!tableSection) |
397 return; | 397 return; |
398 | 398 |
399 LayoutTableSection* initialTableSection = tableSection; | 399 LayoutTableSection* initialTableSection = tableSection; |
400 while (tableSection) { | 400 while (tableSection) { |
401 HeapHashSet<Member<AXObject>> appendedRows; | 401 HeapHashSet<Member<AXObject>> appendedRows; |
402 unsigned numRows = tableSection->numRows(); | 402 unsigned numRows = tableSection->numRows(); |
403 for (unsigned rowIndex = 0; rowIndex < numRows; ++rowIndex) { | 403 for (unsigned rowIndex = 0; rowIndex < numRows; ++rowIndex) { |
404 LayoutTableRow* layoutRow = tableSection->rowLayoutObjectAt(rowIndex); | 404 LayoutTableRow* layoutRow = tableSection->rowLayoutObjectAt(rowIndex); |
405 if (!layoutRow) | 405 if (!layoutRow) |
406 continue; | 406 continue; |
407 | 407 |
408 AXObject* rowObject = axCache.getOrCreate(layoutRow); | 408 AXObject* rowObject = axCache.getOrCreate(layoutRow); |
409 if (!rowObject || !rowObject->isTableRow()) | 409 if (!rowObject || !rowObject->isTableRow()) |
410 continue; | 410 continue; |
411 | 411 |
412 AXTableRow* row = toAXTableRow(rowObject); | 412 AXTableRow* row = toAXTableRow(rowObject); |
413 // We need to check every cell for a new row, because cell spans | 413 // We need to check every cell for a new row, because cell spans |
414 // can cause us to miss rows if we just check the first column. | 414 // can cause us to miss rows if we just check the first column. |
415 if (appendedRows.contains(row)) | 415 if (appendedRows.contains(row)) |
416 continue; | 416 continue; |
417 | 417 |
418 row->setRowIndex(static_cast<int>(m_rows.size())); | 418 row->setRowIndex(static_cast<int>(m_rows.size())); |
419 m_rows.append(row); | 419 m_rows.push_back(row); |
420 if (!row->accessibilityIsIgnored()) | 420 if (!row->accessibilityIsIgnored()) |
421 m_children.append(row); | 421 m_children.push_back(row); |
422 appendedRows.add(row); | 422 appendedRows.add(row); |
423 } | 423 } |
424 | 424 |
425 tableSection = table->sectionBelow(tableSection, SkipEmptySections); | 425 tableSection = table->sectionBelow(tableSection, SkipEmptySections); |
426 } | 426 } |
427 | 427 |
428 // make the columns based on the number of columns in the first body | 428 // make the columns based on the number of columns in the first body |
429 unsigned length = initialTableSection->numEffectiveColumns(); | 429 unsigned length = initialTableSection->numEffectiveColumns(); |
430 for (unsigned i = 0; i < length; ++i) { | 430 for (unsigned i = 0; i < length; ++i) { |
431 AXTableColumn* column = toAXTableColumn(axCache.getOrCreate(ColumnRole)); | 431 AXTableColumn* column = toAXTableColumn(axCache.getOrCreate(ColumnRole)); |
432 column->setColumnIndex((int)i); | 432 column->setColumnIndex((int)i); |
433 column->setParent(this); | 433 column->setParent(this); |
434 m_columns.append(column); | 434 m_columns.push_back(column); |
435 if (!column->accessibilityIsIgnored()) | 435 if (!column->accessibilityIsIgnored()) |
436 m_children.append(column); | 436 m_children.push_back(column); |
437 } | 437 } |
438 | 438 |
439 AXObject* headerContainerObject = headerContainer(); | 439 AXObject* headerContainerObject = headerContainer(); |
440 if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored()) | 440 if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored()) |
441 m_children.append(headerContainerObject); | 441 m_children.push_back(headerContainerObject); |
442 } | 442 } |
443 | 443 |
444 AXObject* AXTable::headerContainer() { | 444 AXObject* AXTable::headerContainer() { |
445 if (m_headerContainer) | 445 if (m_headerContainer) |
446 return m_headerContainer.get(); | 446 return m_headerContainer.get(); |
447 | 447 |
448 AXMockObject* tableHeader = | 448 AXMockObject* tableHeader = |
449 toAXMockObject(axObjectCache().getOrCreate(TableHeaderContainerRole)); | 449 toAXMockObject(axObjectCache().getOrCreate(TableHeaderContainerRole)); |
450 tableHeader->setParent(this); | 450 tableHeader->setParent(this); |
451 | 451 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 604 } |
605 | 605 |
606 DEFINE_TRACE(AXTable) { | 606 DEFINE_TRACE(AXTable) { |
607 visitor->trace(m_rows); | 607 visitor->trace(m_rows); |
608 visitor->trace(m_columns); | 608 visitor->trace(m_columns); |
609 visitor->trace(m_headerContainer); | 609 visitor->trace(m_headerContainer); |
610 AXLayoutObject::trace(visitor); | 610 AXLayoutObject::trace(visitor); |
611 } | 611 } |
612 | 612 |
613 } // namespace blink | 613 } // namespace blink |
OLD | NEW |