OLD | NEW |
---|---|
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 if (toHTMLOptionElement(node())->isDisabledFormControl()) | 131 if (toHTMLOptionElement(node())->isDisabledFormControl()) |
132 return false; | 132 return false; |
133 | 133 |
134 HTMLSelectElement* selectElement = listBoxOptionParentNode(); | 134 HTMLSelectElement* selectElement = listBoxOptionParentNode(); |
135 if (selectElement && selectElement->isDisabledFormControl()) | 135 if (selectElement && selectElement->isDisabledFormControl()) |
136 return false; | 136 return false; |
137 | 137 |
138 return true; | 138 return true; |
139 } | 139 } |
140 | 140 |
141 String AXListBoxOption::stringValue() const | 141 String AXListBoxOption::textAlternative(bool recursive, bool inAriaLabelledByTra versal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relat edObjects, NameSources* nameSources) const |
142 { | 142 { |
143 if (!node()) | 143 if (!node()) |
144 return String(); | 144 return String(); |
145 | 145 |
146 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); | 146 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); |
147 if (!ariaLabel.isNull()) | 147 if (!ariaLabel.isEmpty()) { |
148 nameFrom = AXNameFromAttribute; | |
149 if (nameSources) { | |
150 nameSources->append(NameSource(true, aria_labelAttr)); | |
aboxhall
2015/11/13 23:13:49
Why true?
dmazzoni
2015/11/16 18:52:04
Oh, good catch! I misinterpreted what that first a
| |
151 nameSources->last().type = nameFrom; | |
152 nameSources->last().text = ariaLabel; | |
153 } | |
148 return ariaLabel; | 154 return ariaLabel; |
155 } | |
149 | 156 |
150 if (isHTMLOptionElement(node())) | 157 if (!isHTMLOptionElement(node())) |
151 return toHTMLOptionElement(node())->displayLabel(); | 158 return String(); |
152 | 159 |
153 return String(); | 160 nameFrom = AXNameFromContents; |
161 if (nameSources) { | |
162 nameSources->append(NameSource(true)); | |
163 nameSources->last().type = nameFrom; | |
164 nameSources->last().text = toHTMLOptionElement(node())->displayLabel(); | |
165 } | |
166 | |
167 return toHTMLOptionElement(node())->displayLabel(); | |
154 } | 168 } |
155 | 169 |
156 void AXListBoxOption::setSelected(bool selected) | 170 void AXListBoxOption::setSelected(bool selected) |
157 { | 171 { |
158 HTMLSelectElement* selectElement = listBoxOptionParentNode(); | 172 HTMLSelectElement* selectElement = listBoxOptionParentNode(); |
159 if (!selectElement) | 173 if (!selectElement) |
160 return; | 174 return; |
161 | 175 |
162 if (!canSetSelectedAttribute()) | 176 if (!canSetSelectedAttribute()) |
163 return; | 177 return; |
(...skipping 28 matching lines...) Expand all Loading... | |
192 unsigned length = listItems.size(); | 206 unsigned length = listItems.size(); |
193 for (unsigned i = 0; i < length; i++) { | 207 for (unsigned i = 0; i < length; i++) { |
194 if (listItems[i] == node()) | 208 if (listItems[i] == node()) |
195 return i; | 209 return i; |
196 } | 210 } |
197 | 211 |
198 return -1; | 212 return -1; |
199 } | 213 } |
200 | 214 |
201 } // namespace blink | 215 } // namespace blink |
OLD | NEW |