diff options
author | Ben Murdoch <benm@google.com> | 2010-07-22 15:37:06 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-07-27 10:20:25 +0100 |
commit | 967717af5423377c967781471ee106e2bb4e11c8 (patch) | |
tree | 1e701dc0a12f7f07cce1df4a7681717de77a211b /WebCore/accessibility/AccessibilityTable.cpp | |
parent | dcc30a9fca45f634b1d3a12b276d3a0ccce99fc3 (diff) | |
download | external_webkit-967717af5423377c967781471ee106e2bb4e11c8.zip external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.gz external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.bz2 |
Merge WebKit at r63859 : Initial merge by git.
Change-Id: Ie8096c63ec7c991c9a9cba8bdd9c3b74a3b8ed62
Diffstat (limited to 'WebCore/accessibility/AccessibilityTable.cpp')
-rw-r--r-- | WebCore/accessibility/AccessibilityTable.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/WebCore/accessibility/AccessibilityTable.cpp b/WebCore/accessibility/AccessibilityTable.cpp index 437ac38..a0bb655 100644 --- a/WebCore/accessibility/AccessibilityTable.cpp +++ b/WebCore/accessibility/AccessibilityTable.cpp @@ -137,6 +137,9 @@ bool AccessibilityTable::isTableExposableThroughAccessibility() unsigned borderedCellCount = 0; unsigned backgroundDifferenceCellCount = 0; + Color alternatingRowColors[5]; + int alternatingRowColorCount = 0; + int headersInFirstColumnCount = 0; for (int row = 0; row < numRows; ++row) { @@ -189,6 +192,19 @@ bool AccessibilityTable::isTableExposableThroughAccessibility() // if we've found 10 "good" cells, we don't need to keep searching if (borderedCellCount >= 10 || backgroundDifferenceCellCount >= 10) return true; + + // For the first 5 rows, cache the background color so we can check if this table has zebra-striped rows. + if (row < 5 && row == alternatingRowColorCount) { + RenderObject* renderRow = cell->parent(); + if (!renderRow || !renderRow->isTableRow()) + continue; + RenderStyle* rowRenderStyle = renderRow->style(); + if (!rowRenderStyle) + continue; + Color rowColor = rowRenderStyle->visitedDependentColor(CSSPropertyBackgroundColor); + alternatingRowColors[alternatingRowColorCount] = rowColor; + alternatingRowColorCount++; + } } if (!row && headersInFirstRowCount == numCols && numCols > 1) @@ -211,6 +227,20 @@ bool AccessibilityTable::isTableExposableThroughAccessibility() if (backgroundDifferenceCellCount >= neededCellCount) return true; + // Check if there is an alternating row background color indicating a zebra striped style pattern. + if (alternatingRowColorCount > 2) { + Color firstColor = alternatingRowColors[0]; + for (int k = 1; k < alternatingRowColorCount; k++) { + // If an odd row was the same color as the first row, its not alternating. + if (k % 2 == 1 && alternatingRowColors[k] == firstColor) + return false; + // If an even row is not the same as the first row, its not alternating. + if (!(k % 2) && alternatingRowColors[k] != firstColor) + return false; + } + return true; + } + return false; } |