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

Side by Side Diff: Source/modules/accessibility/AXTableColumn.cpp

Issue 862543003: Table headers are not retrieved properly by Accessibility API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Minor fixes, correct comment and very small refactoring Created 5 years, 11 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
« no previous file with comments | « Source/modules/accessibility/AXTableColumn.h ('k') | Source/modules/accessibility/AXTableRow.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 AXTableColumn::~AXTableColumn() 46 AXTableColumn::~AXTableColumn()
47 { 47 {
48 } 48 }
49 49
50 PassRefPtr<AXTableColumn> AXTableColumn::create(AXObjectCacheImpl* axObjectCache ) 50 PassRefPtr<AXTableColumn> AXTableColumn::create(AXObjectCacheImpl* axObjectCache )
51 { 51 {
52 return adoptRef(new AXTableColumn(axObjectCache)); 52 return adoptRef(new AXTableColumn(axObjectCache));
53 } 53 }
54 54
55
55 void AXTableColumn::setParent(AXObject* parent) 56 void AXTableColumn::setParent(AXObject* parent)
56 { 57 {
57 AXMockObject::setParent(parent); 58 AXMockObject::setParent(parent);
58 59
59 clearChildren(); 60 clearChildren();
60 } 61 }
61 62
62 LayoutRect AXTableColumn::elementRect() const 63 LayoutRect AXTableColumn::elementRect() const
63 { 64 {
64 // this will be filled in when addChildren is called 65 // this will be filled in when addChildren is called
65 return m_columnRect; 66 return m_columnRect;
66 } 67 }
67 68
69 void AXTableColumn::headerObjectsForColumn(AccessibilityChildrenVector& headers)
70 {
71 if (!m_parent)
72 return;
73
74 RenderObject* renderer = m_parent->renderer();
75 if (!renderer || !renderer->isTable())
76 return;
77
78 RenderTable* table = toRenderTable(renderer);
79 RenderTableSection* tableSection = table->topSection();
80 for (; tableSection; tableSection = table->sectionBelow(tableSection, SkipEm ptySections)) {
81 unsigned numRows = tableSection->numRows();
82 for (unsigned r = 0; r < numRows; r++) {
83 RenderTableCell* renderCell = tableSection->primaryCellAt(r, m_colum nIndex);
84 if (!renderCell)
85 continue;
86
87 // Whenever cell's col is less then current column index, we've foun d the cell with colspan.
88 // We do not need to add this cell, it's already been added.
89 if (renderCell->col() < m_columnIndex)
90 continue;
91
92 AXObject* cell = axObjectCache()->getOrCreate(renderCell->node());
93 if (!cell)
94 continue;
95
96 if (toAXTableCell(cell)->scanToDecideHeaderRole() == ColumnHeaderRol e)
97 headers.append(cell);
98 }
99 }
100 }
101
68 AXObject* AXTableColumn::headerObject() 102 AXObject* AXTableColumn::headerObject()
69 { 103 {
70 if (!m_parent) 104 if (!m_parent)
71 return 0; 105 return 0;
72 106
73 RenderObject* renderer = m_parent->renderer(); 107 RenderObject* renderer = m_parent->renderer();
74 if (!renderer) 108 if (!renderer)
75 return 0; 109 return 0;
76 110
77 if (!m_parent->isAXTable()) 111 if (!m_parent->isAXTable())
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // make sure the last one isn't the same as this one (rowspan cells) 210 // make sure the last one isn't the same as this one (rowspan cells)
177 if (m_children.size() > 0 && m_children.last() == cell) 211 if (m_children.size() > 0 && m_children.last() == cell)
178 continue; 212 continue;
179 213
180 m_children.append(cell); 214 m_children.append(cell);
181 m_columnRect.unite(cell->elementRect()); 215 m_columnRect.unite(cell->elementRect());
182 } 216 }
183 } 217 }
184 218
185 } // namespace blink 219 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXTableColumn.h ('k') | Source/modules/accessibility/AXTableRow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698