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

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

Issue 914233002: Use effective columns when cells with colspan are present. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Second attempt to land this patch Created 5 years, 10 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/AXTableCell.cpp ('k') | no next file » | 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 LayoutTable* table = toLayoutTable(renderer); 95 LayoutTable* table = toLayoutTable(renderer);
96 LayoutTableSection* tableSection = table->topSection(); 96 LayoutTableSection* tableSection = table->topSection();
97 for (; tableSection; tableSection = table->sectionBelow(tableSection, SkipEm ptySections)) { 97 for (; tableSection; tableSection = table->sectionBelow(tableSection, SkipEm ptySections)) {
98 unsigned numRows = tableSection->numRows(); 98 unsigned numRows = tableSection->numRows();
99 for (unsigned r = 0; r < numRows; r++) { 99 for (unsigned r = 0; r < numRows; r++) {
100 LayoutTableCell* layoutCell = tableSection->primaryCellAt(r, m_colum nIndex); 100 LayoutTableCell* layoutCell = tableSection->primaryCellAt(r, m_colum nIndex);
101 if (!layoutCell) 101 if (!layoutCell)
102 continue; 102 continue;
103 103
104 // Whenever cell's col is less then current column index, we've foun d the cell with colspan. 104 // Whenever cell's effective col is less then current column index, we've found the cell with colspan.
105 // We do not need to add this cell, it's already been added. 105 // We do not need to add this cell, it's already been added.
106 if (layoutCell->col() < m_columnIndex) 106 if (layoutCell->table()->colToEffCol(layoutCell->col()) < m_columnIn dex)
107 continue; 107 continue;
108 108
109 AXObject* cell = axObjectCache()->getOrCreate(layoutCell->node()); 109 AXObject* cell = axObjectCache()->getOrCreate(layoutCell->node());
110 if (!cell || !cell->isTableCell()) 110 if (!cell || !cell->isTableCell())
111 continue; 111 continue;
112 112
113 if (toAXTableCell(cell)->scanToDecideHeaderRole() == ColumnHeaderRol e) 113 if (toAXTableCell(cell)->scanToDecideHeaderRole() == ColumnHeaderRol e)
114 headers.append(cell); 114 headers.append(cell);
115 } 115 }
116 } 116 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 LayoutTableCell* cell = 0; 175 LayoutTableCell* cell = 0;
176 // also account for cells that have a span 176 // also account for cells that have a span
177 for (int testCol = m_columnIndex; testCol >= 0; --testCol) { 177 for (int testCol = m_columnIndex; testCol >= 0; --testCol) {
178 LayoutTableCell* testCell = section->primaryCellAt(0, testCol); 178 LayoutTableCell* testCell = section->primaryCellAt(0, testCol);
179 if (!testCell) 179 if (!testCell)
180 continue; 180 continue;
181 181
182 // we've reached a cell that doesn't even overlap our column 182 // we've reached a cell that doesn't even overlap our column
183 // it can't be our header 183 // it can't be our header
184 if ((testCell->col() + (testCell->colSpan()-1)) < m_columnIndex) 184 if (testCell->table()->colToEffCol(testCell->col() + (testCell->colSpan( )-1)) < m_columnIndex)
185 break; 185 break;
186 186
187 Node* node = testCell->node(); 187 Node* node = testCell->node();
188 if (!node) 188 if (!node)
189 continue; 189 continue;
190 190
191 if (thTagRequired && !node->hasTagName(thTag)) 191 if (thTagRequired && !node->hasTagName(thTag))
192 continue; 192 continue;
193 193
194 cell = testCell; 194 cell = testCell;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // make sure the last one isn't the same as this one (rowspan cells) 227 // make sure the last one isn't the same as this one (rowspan cells)
228 if (m_children.size() > 0 && m_children.last() == cell) 228 if (m_children.size() > 0 && m_children.last() == cell)
229 continue; 229 continue;
230 230
231 m_children.append(cell); 231 m_children.append(cell);
232 m_columnRect.unite(cell->elementRect()); 232 m_columnRect.unite(cell->elementRect());
233 } 233 }
234 } 234 }
235 235
236 } // namespace blink 236 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXTableCell.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698