Chromium Code Reviews| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 PassRefPtr<AXListBoxOption> AXListBoxOption::create(LayoutObject* layoutObject, AXObjectCacheImpl* axObjectCache) | 51 PassRefPtr<AXListBoxOption> AXListBoxOption::create(LayoutObject* layoutObject, AXObjectCacheImpl* axObjectCache) |
| 52 { | 52 { |
| 53 return adoptRef(new AXListBoxOption(layoutObject, axObjectCache)); | 53 return adoptRef(new AXListBoxOption(layoutObject, axObjectCache)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 AccessibilityRole AXListBoxOption::roleValue() const | 56 AccessibilityRole AXListBoxOption::roleValue() const |
| 57 { | 57 { |
| 58 AccessibilityRole ariaRole = ariaRoleAttribute(); | 58 AccessibilityRole ariaRole = ariaRoleAttribute(); |
| 59 if (ariaRole != UnknownRole) | 59 if (ariaRole != UnknownRole) |
| 60 return ariaRole; | 60 return ariaRole; |
| 61 | |
| 62 // This is for handling presentation Role. | |
| 63 // Currently IE handles presentation role correctly with OptionElement. | |
|
dmazzoni
2015/03/29 07:46:22
I'd leave out this comment on IE unless the only r
je_julie(Not used)
2015/03/31 16:14:27
I replaced the comment with the spec description.
| |
| 64 // It doesn't ignore tree but handles it with Static Text Role. | |
| 65 // That's why it's handled in roleValue(), not in computeAccessibilityIsIgno red() | |
| 66 if (isParentPresentationRole()) | |
| 67 return StaticTextRole; | |
| 68 | |
| 61 return ListBoxOptionRole; | 69 return ListBoxOptionRole; |
| 62 } | 70 } |
| 63 | 71 |
| 72 bool AXListBoxOption::isParentPresentationRole() const | |
| 73 { | |
| 74 AXObject* parent = parentObject(); | |
| 75 if (!parent) | |
| 76 return false; | |
| 77 | |
| 78 Node* parentNode = parent->node(); | |
| 79 if (isHTMLSelectElement(parentNode)) { | |
| 80 HTMLSelectElement& selectElement = toHTMLSelectElement(*parentNode); | |
| 81 if (selectElement.multiple() && isPresentationRole(parent)) | |
| 82 return true; | |
| 83 } | |
| 84 return false; | |
| 85 } | |
| 86 | |
| 64 bool AXListBoxOption::isEnabled() const | 87 bool AXListBoxOption::isEnabled() const |
| 65 { | 88 { |
| 66 if (!node()) | 89 if (!node()) |
| 67 return false; | 90 return false; |
| 68 | 91 |
| 69 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true")) | 92 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true")) |
| 70 return false; | 93 return false; |
| 71 | 94 |
| 72 if (toElement(node())->hasAttribute(disabledAttr)) | 95 if (toElement(node())->hasAttribute(disabledAttr)) |
| 73 return false; | 96 return false; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 unsigned length = listItems.size(); | 192 unsigned length = listItems.size(); |
| 170 for (unsigned i = 0; i < length; i++) { | 193 for (unsigned i = 0; i < length; i++) { |
| 171 if (listItems[i] == node()) | 194 if (listItems[i] == node()) |
| 172 return i; | 195 return i; |
| 173 } | 196 } |
| 174 | 197 |
| 175 return -1; | 198 return -1; |
| 176 } | 199 } |
| 177 | 200 |
| 178 } // namespace blink | 201 } // namespace blink |
| OLD | NEW |