| 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 nameSources is non-null, relatedObjects is used in filling it in, so i
t must be non-null as well. |
| 144 if (nameSources) |
| 145 ASSERT(relatedObjects); |
| 146 |
| 143 if (!node()) | 147 if (!node()) |
| 144 return String(); | 148 return String(); |
| 145 | 149 |
| 146 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); | 150 bool foundTextAlternative = false; |
| 147 if (!ariaLabel.isNull()) | 151 String textAlternative = ariaTextAlternative(recursive, inAriaLabelledByTrav
ersal, visited, nameFrom, relatedObjects, nameSources, &foundTextAlternative); |
| 148 return ariaLabel; | 152 if (foundTextAlternative && !nameSources) |
| 153 return textAlternative; |
| 149 | 154 |
| 150 if (isHTMLOptionElement(node())) | 155 nameFrom = AXNameFromContents; |
| 151 return toHTMLOptionElement(node())->displayLabel(); | 156 textAlternative = toHTMLOptionElement(node())->displayLabel(); |
| 157 if (nameSources) { |
| 158 nameSources->append(NameSource(foundTextAlternative)); |
| 159 nameSources->last().type = nameFrom; |
| 160 nameSources->last().text = textAlternative; |
| 161 foundTextAlternative = true; |
| 162 } |
| 152 | 163 |
| 153 return String(); | 164 return textAlternative; |
| 154 } | 165 } |
| 155 | 166 |
| 156 void AXListBoxOption::setSelected(bool selected) | 167 void AXListBoxOption::setSelected(bool selected) |
| 157 { | 168 { |
| 158 HTMLSelectElement* selectElement = listBoxOptionParentNode(); | 169 HTMLSelectElement* selectElement = listBoxOptionParentNode(); |
| 159 if (!selectElement) | 170 if (!selectElement) |
| 160 return; | 171 return; |
| 161 | 172 |
| 162 if (!canSetSelectedAttribute()) | 173 if (!canSetSelectedAttribute()) |
| 163 return; | 174 return; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 192 unsigned length = listItems.size(); | 203 unsigned length = listItems.size(); |
| 193 for (unsigned i = 0; i < length; i++) { | 204 for (unsigned i = 0; i < length; i++) { |
| 194 if (listItems[i] == node()) | 205 if (listItems[i] == node()) |
| 195 return i; | 206 return i; |
| 196 } | 207 } |
| 197 | 208 |
| 198 return -1; | 209 return -1; |
| 199 } | 210 } |
| 200 | 211 |
| 201 } // namespace blink | 212 } // namespace blink |
| OLD | NEW |