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

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

Issue 2894103002: Int and Float properties for Accessibility Object Model phase 1 (Closed)
Patch Set: Update webexposed/ 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 10 matching lines...) Expand all
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
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/AXTableRow.h" 29 #include "modules/accessibility/AXTableRow.h"
30 30
31 #include "core/dom/AccessibleNode.h"
31 #include "core/layout/LayoutObject.h" 32 #include "core/layout/LayoutObject.h"
32 #include "modules/accessibility/AXObjectCacheImpl.h" 33 #include "modules/accessibility/AXObjectCacheImpl.h"
33 #include "modules/accessibility/AXTableCell.h" 34 #include "modules/accessibility/AXTableCell.h"
34 35
35 namespace blink { 36 namespace blink {
36 37
37 using namespace HTMLNames; 38 using namespace HTMLNames;
38 39
39 AXTableRow::AXTableRow(LayoutObject* layout_object, 40 AXTableRow::AXTableRow(LayoutObject* layout_object,
40 AXObjectCacheImpl& ax_object_cache) 41 AXObjectCacheImpl& ax_object_cache)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 AXObjectImpl* AXTableRow::HeaderObject() { 108 AXObjectImpl* AXTableRow::HeaderObject() {
108 AXObjectVector headers; 109 AXObjectVector headers;
109 HeaderObjectsForRow(headers); 110 HeaderObjectsForRow(headers);
110 if (!headers.size()) 111 if (!headers.size())
111 return 0; 112 return 0;
112 113
113 return headers[0].Get(); 114 return headers[0].Get();
114 } 115 }
115 116
116 unsigned AXTableRow::AriaColumnIndex() const { 117 unsigned AXTableRow::AriaColumnIndex() const {
117 const AtomicString& col_index_value = GetAttribute(aria_colindexAttr); 118 uint32_t col_index;
118 if (col_index_value.ToInt() >= 1) 119 if (HasAOMPropertyOrARIAAttribute(AOMUIntProperty::kColIndex, col_index) &&
119 return col_index_value.ToInt(); 120 col_index >= 1) {
121 return col_index;
122 }
120 123
121 return 0; 124 return 0;
122 } 125 }
123 126
124 unsigned AXTableRow::AriaRowIndex() const { 127 unsigned AXTableRow::AriaRowIndex() const {
125 const AtomicString& row_index_value = GetAttribute(aria_rowindexAttr); 128 uint32_t row_index;
126 if (row_index_value.ToInt() >= 1) 129 if (HasAOMPropertyOrARIAAttribute(AOMUIntProperty::kRowIndex, row_index) &&
127 return row_index_value.ToInt(); 130 row_index >= 1) {
131 return row_index;
132 }
128 133
129 return 0; 134 return 0;
130 } 135 }
131 136
132 void AXTableRow::HeaderObjectsForRow(AXObjectVector& headers) { 137 void AXTableRow::HeaderObjectsForRow(AXObjectVector& headers) {
133 if (!layout_object_ || !layout_object_->IsTableRow()) 138 if (!layout_object_ || !layout_object_->IsTableRow())
134 return; 139 return;
135 140
136 for (const auto& cell : Children()) { 141 for (const auto& cell : Children()) {
137 if (!cell->IsTableCell()) 142 if (!cell->IsTableCell())
138 continue; 143 continue;
139 144
140 if (ToAXTableCell(cell.Get())->ScanToDecideHeaderRole() == kRowHeaderRole) 145 if (ToAXTableCell(cell.Get())->ScanToDecideHeaderRole() == kRowHeaderRole)
141 headers.push_back(cell); 146 headers.push_back(cell);
142 } 147 }
143 } 148 }
144 149
145 } // namespace blink 150 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698