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

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

Issue 2884573002: Replace LayoutTableCell::AbsoluteColumnIndex() with EffectiveColumnIndex()
Patch Set: - 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (Traversal<HTMLTableColElement>::FirstChild(*table_element)) 158 if (Traversal<HTMLTableColElement>::FirstChild(*table_element))
159 return true; 159 return true;
160 160
161 // go through the cell's and check for tell-tale signs of "data" table status 161 // go through the cell's and check for tell-tale signs of "data" table status
162 // cells have borders, or use attributes like headers, abbr, scope or axis 162 // cells have borders, or use attributes like headers, abbr, scope or axis
163 table->RecalcSectionsIfNeeded(); 163 table->RecalcSectionsIfNeeded();
164 LayoutTableSection* first_body = table->FirstBody(); 164 LayoutTableSection* first_body = table->FirstBody();
165 if (!first_body) 165 if (!first_body)
166 return false; 166 return false;
167 167
168 int num_cols_in_first_body = first_body->NumEffectiveColumns(); 168 int num_cols_in_first_body = first_body->MaxNumEffectiveColumnsOfRows();
169 int num_rows = first_body->NumRows(); 169 int num_rows = first_body->NumRows();
170 170
171 // If there's only one cell, it's not a good AXTable candidate. 171 // If there's only one cell, it's not a good AXTable candidate.
172 if (num_rows == 1 && num_cols_in_first_body == 1) 172 if (num_rows == 1 && num_cols_in_first_body == 1)
173 return false; 173 return false;
174 174
175 // If there are at least 20 rows, we'll call it a data table. 175 // If there are at least 20 rows, we'll call it a data table.
176 if (num_rows >= 20) 176 if (num_rows >= 20)
177 return true; 177 return true;
178 178
(...skipping 18 matching lines...) Expand all
197 unsigned cells_with_bottom_border = 0; 197 unsigned cells_with_bottom_border = 0;
198 unsigned cells_with_left_border = 0; 198 unsigned cells_with_left_border = 0;
199 unsigned cells_with_right_border = 0; 199 unsigned cells_with_right_border = 0;
200 200
201 Color alternating_row_colors[5]; 201 Color alternating_row_colors[5];
202 int alternating_row_color_count = 0; 202 int alternating_row_color_count = 0;
203 203
204 int headers_in_first_column_count = 0; 204 int headers_in_first_column_count = 0;
205 for (int row = 0; row < num_rows; ++row) { 205 for (int row = 0; row < num_rows; ++row) {
206 int headers_in_first_row_count = 0; 206 int headers_in_first_row_count = 0;
207 int n_cols = first_body->NumCols(row); 207 int n_cols = first_body->NumEffectiveColumns(row);
208 for (int col = 0; col < n_cols; ++col) { 208 for (int col = 0; col < n_cols; ++col) {
209 LayoutTableCell* cell = first_body->PrimaryCellAt(row, col); 209 LayoutTableCell* cell = first_body->PrimaryCellAt(row, col);
210 if (!cell) 210 if (!cell)
211 continue; 211 continue;
212 Node* cell_node = cell->GetNode(); 212 Node* cell_node = cell->GetNode();
213 if (!cell_node) 213 if (!cell_node)
214 continue; 214 continue;
215 215
216 if (cell->Size().Width() < 1 || cell->Size().Height() < 1) 216 if (cell->Size().Width() < 1 || cell->Size().Height() < 1)
217 continue; 217 continue;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 rows_.push_back(row); 422 rows_.push_back(row);
423 if (!row->AccessibilityIsIgnored()) 423 if (!row->AccessibilityIsIgnored())
424 children_.push_back(row); 424 children_.push_back(row);
425 appended_rows.insert(row); 425 appended_rows.insert(row);
426 } 426 }
427 427
428 table_section = table->SectionBelow(table_section, kSkipEmptySections); 428 table_section = table->SectionBelow(table_section, kSkipEmptySections);
429 } 429 }
430 430
431 // make the columns based on the number of columns in the first body 431 // make the columns based on the number of columns in the first body
432 unsigned length = initial_table_section->NumEffectiveColumns(); 432 unsigned length = initial_table_section->MaxNumEffectiveColumnsOfRows();
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 AXObjectImpl* header_container_object = HeaderContainer(); 442 AXObjectImpl* header_container_object = HeaderContainer();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
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