~ubuntu-branches/ubuntu/lucid/webkit/lucid-updates

« back to all changes in this revision

Viewing changes to WebCore/accessibility/AccessibilityARIAGridRow.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2010-01-06 21:25:06 UTC
  • mfrom: (1.2.6 upstream) (4.3.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100106212506-gd0czn4zrwf1j19l
* New upstream release
- adds basic Content-Encoding support, thanks to soup
  (Closes: #529271)
- fixes over-advertising content types as supported by
  the media player (Closes: #559420)
* debian/control:
- updated libsoup build requirement (>= 2.28.2)
* debian/libwebkit-1.0-2.symbols:
- updated with new symbols
* debian/copyright:
- updated information since 1.1.17
* Imported patch from https://bugs.webkit.org/show_bug.cgi?id=30623
- I am shipping this patch because I believe it is correct, it is the
  way to go, it fixes a race, and it needs testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "AccessibilityARIAGridRow.h"
31
31
 
32
32
#include "AccessibilityObject.h"
 
33
#include "AccessibilityTable.h"
33
34
#include "RenderObject.h"
34
35
 
35
36
using namespace std;
50
51
    return adoptRef(new AccessibilityARIAGridRow(renderer));
51
52
}
52
53
 
 
54
bool AccessibilityARIAGridRow::isARIATreeGridRow() const
 
55
{
 
56
    AccessibilityObject* parent = parentTable();
 
57
    if (!parent)
 
58
        return false;
 
59
    
 
60
    return parent->ariaRoleAttribute() == TreeGridRole;
 
61
}
 
62
    
 
63
void AccessibilityARIAGridRow::disclosedRows(AccessibilityChildrenVector& disclosedRows)
 
64
{
 
65
    // The contiguous disclosed rows will be the rows in the table that 
 
66
    // have an aria-level of plus 1 from this row.
 
67
    AccessibilityObject* parent = parentObjectUnignored();
 
68
    if (!parent || !parent->isDataTable())
 
69
        return;
 
70
    
 
71
    // Search for rows that match the correct level. 
 
72
    // Only take the subsequent rows from this one that are +1 from this row's level.
 
73
    int index = rowIndex();
 
74
    if (index < 0)
 
75
        return;
 
76
    
 
77
    unsigned level = hierarchicalLevel();
 
78
    AccessibilityChildrenVector& allRows = static_cast<AccessibilityTable*>(parent)->rows();
 
79
    int rowCount = allRows.size();
 
80
    for (int k = index + 1; k < rowCount; ++k) {
 
81
        AccessibilityObject* row = allRows[k].get();
 
82
        // Stop at the first row that doesn't match the correct level.
 
83
        if (row->hierarchicalLevel() != level + 1)
 
84
            break;
 
85
 
 
86
        disclosedRows.append(row);
 
87
    }
 
88
}
 
89
    
 
90
AccessibilityObject* AccessibilityARIAGridRow::disclosedByRow() const
 
91
{
 
92
    // The row that discloses this one is the row in the table
 
93
    // that is aria-level subtract 1 from this row.
 
94
    AccessibilityObject* parent = parentObjectUnignored();
 
95
    if (!parent || !parent->isDataTable())
 
96
        return 0;
 
97
    
 
98
    // If the level is 1 or less, than nothing discloses this row.
 
99
    unsigned level = hierarchicalLevel();
 
100
    if (level <= 1)
 
101
        return 0;
 
102
    
 
103
    // Search for the previous row that matches the correct level.
 
104
    int index = rowIndex();
 
105
    AccessibilityChildrenVector& allRows = static_cast<AccessibilityTable*>(parent)->rows();
 
106
    int rowCount = allRows.size();
 
107
    if (index >= rowCount)
 
108
        return 0;
 
109
    
 
110
    for (int k = index - 1; k >= 0; --k) {
 
111
        AccessibilityObject* row = allRows[k].get();
 
112
        if (row->hierarchicalLevel() == level - 1)
 
113
            return row;
 
114
    }
 
115
    
 
116
    return 0;
 
117
}
 
118
    
53
119
AccessibilityObject* AccessibilityARIAGridRow::parentTable() const
54
120
{
55
121
    AccessibilityObject* parent = parentObjectUnignored();