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

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

Issue 1547643002: ARIA 1.1: implementation for aria-col-* and aria-row-*. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds MODULES_EXPORT Created 5 years 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 12 matching lines...) Expand all
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "modules/accessibility/AXTableCell.h" 29 #include "modules/accessibility/AXTableCell.h"
30 30
31 #include "core/layout/LayoutTableCell.h" 31 #include "core/layout/LayoutTableCell.h"
32 #include "modules/accessibility/AXObjectCacheImpl.h" 32 #include "modules/accessibility/AXObjectCacheImpl.h"
33 #include "modules/accessibility/AXTableRow.h"
33 34
34 35
35 namespace blink { 36 namespace blink {
36 37
37 using namespace HTMLNames; 38 using namespace HTMLNames;
38 39
39 AXTableCell::AXTableCell(LayoutObject* layoutObject, AXObjectCacheImpl& axObject Cache) 40 AXTableCell::AXTableCell(LayoutObject* layoutObject, AXObjectCacheImpl& axObject Cache)
40 : AXLayoutObject(layoutObject, axObjectCache) 41 : AXLayoutObject(layoutObject, axObjectCache)
42 , m_ariaColIndexFromRow(0)
41 { 43 {
42 } 44 }
43 45
44 AXTableCell::~AXTableCell() 46 AXTableCell::~AXTableCell()
45 { 47 {
46 } 48 }
47 49
48 AXTableCell* AXTableCell::create(LayoutObject* layoutObject, AXObjectCacheImpl& axObjectCache) 50 AXTableCell* AXTableCell::create(LayoutObject* layoutObject, AXObjectCacheImpl& axObjectCache)
49 { 51 {
50 return new AXTableCell(layoutObject, axObjectCache); 52 return new AXTableCell(layoutObject, axObjectCache);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 102
101 bool AXTableCell::isTableCell() const 103 bool AXTableCell::isTableCell() const
102 { 104 {
103 AXObject* parent = parentObjectUnignored(); 105 AXObject* parent = parentObjectUnignored();
104 if (!parent || !parent->isTableRow()) 106 if (!parent || !parent->isTableRow())
105 return false; 107 return false;
106 108
107 return true; 109 return true;
108 } 110 }
109 111
112 unsigned AXTableCell::ariaColumnIndex() const
113 {
114 const AtomicString& colIndex = getAttribute(aria_colindexAttr);
115 if (colIndex.toInt() >= 1)
116 return colIndex.toInt();
117
118 AXObject* parent = parentObjectUnignored();
119 if (!parent || !parent->isTableRow())
120 return 0;
121
122 return m_ariaColIndexFromRow;
123 }
124
125 unsigned AXTableCell::ariaRowIndex() const
126 {
127 const AtomicString& rowIndex = getAttribute(aria_rowindexAttr);
128 if (rowIndex.toInt() >= 1)
129 return rowIndex.toInt();
130
131 AXObject* parent = parentObjectUnignored();
132 if (!parent || !parent->isTableRow())
133 return 0;
134
135 return toAXTableRow(parent)->ariaRowIndex();
136 }
137
110 static AccessibilityRole decideRoleFromSibling(LayoutTableCell* siblingCell) 138 static AccessibilityRole decideRoleFromSibling(LayoutTableCell* siblingCell)
111 { 139 {
112 if (!siblingCell) 140 if (!siblingCell)
113 return CellRole; 141 return CellRole;
114 142
115 if (Node* siblingNode = siblingCell->node()) { 143 if (Node* siblingNode = siblingCell->node()) {
116 if (siblingNode->hasTagName(thTag)) 144 if (siblingNode->hasTagName(thTag))
117 return ColumnHeaderRole; 145 return ColumnHeaderRole;
118 if (siblingNode->hasTagName(tdTag)) 146 if (siblingNode->hasTagName(tdTag))
119 return RowHeaderRole; 147 return RowHeaderRole;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (equalIgnoringCase(ariaSort, "ascending")) 239 if (equalIgnoringCase(ariaSort, "ascending"))
212 return SortDirectionAscending; 240 return SortDirectionAscending;
213 if (equalIgnoringCase(ariaSort, "descending")) 241 if (equalIgnoringCase(ariaSort, "descending"))
214 return SortDirectionDescending; 242 return SortDirectionDescending;
215 if (equalIgnoringCase(ariaSort, "other")) 243 if (equalIgnoringCase(ariaSort, "other"))
216 return SortDirectionOther; 244 return SortDirectionOther;
217 return SortDirectionUndefined; 245 return SortDirectionUndefined;
218 } 246 }
219 247
220 } // namespace blink 248 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698