diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp')
-rw-r--r-- | Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp b/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp index c8157f5..55d09ad 100644 --- a/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp +++ b/Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp @@ -30,6 +30,7 @@ #include "AccessibilityARIAGridCell.h" #include "AccessibilityObject.h" +#include "AccessibilityTable.h" #include "AccessibilityTableRow.h" using namespace std; @@ -53,9 +54,15 @@ PassRefPtr<AccessibilityARIAGridCell> AccessibilityARIAGridCell::create(RenderOb AccessibilityObject* AccessibilityARIAGridCell::parentTable() const { AccessibilityObject* parent = parentObjectUnignored(); - if (!parent || !parent->isTableRow()) + if (!parent) return 0; + if (parent->isAccessibilityTable()) + return parent; + + // It could happen that we hadn't reached the parent table yet (in + // case objects for rows were not ignoring accessibility) so for + // that reason we need to run parentObjectUnignored once again. parent = parent->parentObjectUnignored(); if (!parent || !parent->isAccessibilityTable()) return 0; @@ -66,20 +73,42 @@ AccessibilityObject* AccessibilityARIAGridCell::parentTable() const void AccessibilityARIAGridCell::rowIndexRange(pair<int, int>& rowRange) { AccessibilityObject* parent = parentObjectUnignored(); - if (!parent || !parent->isTableRow()) + if (!parent) return; + if (parent->isTableRow()) { + // We already got a table row, use its API. + rowRange.first = static_cast<AccessibilityTableRow*>(parent)->rowIndex(); + } else if (parent->isAccessibilityTable()) { + // We reached the parent table, so we need to inspect its + // children to determine the row index for the cell in it. + unsigned columnCount = static_cast<AccessibilityTable*>(parent)->columnCount(); + if (!columnCount) + return; + + AccessibilityChildrenVector siblings = parent->children(); + unsigned childrenSize = siblings.size(); + for (unsigned k = 0; k < childrenSize; ++k) { + if (siblings[k].get() == this) { + rowRange.first = k / columnCount; + break; + } + } + } + // as far as I can tell, grid cells cannot span rows - rowRange.first = static_cast<AccessibilityTableRow*>(parent)->rowIndex(); - rowRange.second = 1; + rowRange.second = 1; } void AccessibilityARIAGridCell::columnIndexRange(pair<int, int>& columnRange) { AccessibilityObject* parent = parentObjectUnignored(); - if (!parent || !parent->isTableRow()) + if (!parent) return; - + + if (!parent->isTableRow() && !parent->isAccessibilityTable()) + return; + AccessibilityChildrenVector siblings = parent->children(); unsigned childrenSize = siblings.size(); for (unsigned k = 0; k < childrenSize; ++k) { |