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 // Generally, the presentation role is handled in computeAccessibilityIsIgno red(). | |
63 // In case of ListBoxOption, if it just marked as ignored in computeAccessib ilityIsIgnored(), | |
64 // we can't see listboxoption on tree without any text. | |
65 // http://www.w3.org/TR/wai-aria/complete#presentation | |
66 // ARIA spec says that the presentation role causes a given element to be tr eated | |
67 // as having no role or to be removed from the accessibility tree, but does not cause the | |
68 // content contained within the element to be removed from the accessibility tree. | |
69 if (isParentPresentationRole()) | |
70 return StaticTextRole; | |
71 | |
61 return ListBoxOptionRole; | 72 return ListBoxOptionRole; |
62 } | 73 } |
63 | 74 |
75 bool AXListBoxOption::isParentPresentationRole() const | |
76 { | |
77 AXObject* parent = parentObject(); | |
78 if (!parent) | |
79 return false; | |
80 | |
81 // The parent should be a listbox in order to be Required Owned Elements and | |
82 // have a presentation role. | |
83 Node* parentNode = parent->node(); | |
84 if (isHTMLSelectElement(parentNode)) { | |
85 HTMLSelectElement& selectElement = toHTMLSelectElement(*parentNode); | |
86 if (selectElement.multiple() && isPresentationRole(parent)) | |
dmazzoni
2015/03/31 16:35:23
selectElement.multiple() isn't the same as a selec
je_julie(Not used)
2015/04/01 12:51:28
I updated it with layoutObject->isListBox().
| |
87 return true; | |
88 } | |
89 return false; | |
90 } | |
91 | |
64 bool AXListBoxOption::isEnabled() const | 92 bool AXListBoxOption::isEnabled() const |
65 { | 93 { |
66 if (!node()) | 94 if (!node()) |
67 return false; | 95 return false; |
68 | 96 |
69 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true")) | 97 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true")) |
70 return false; | 98 return false; |
71 | 99 |
72 if (toElement(node())->hasAttribute(disabledAttr)) | 100 if (toElement(node())->hasAttribute(disabledAttr)) |
73 return false; | 101 return false; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 unsigned length = listItems.size(); | 197 unsigned length = listItems.size(); |
170 for (unsigned i = 0; i < length; i++) { | 198 for (unsigned i = 0; i < length; i++) { |
171 if (listItems[i] == node()) | 199 if (listItems[i] == node()) |
172 return i; | 200 return i; |
173 } | 201 } |
174 | 202 |
175 return -1; | 203 return -1; |
176 } | 204 } |
177 | 205 |
178 } // namespace blink | 206 } // namespace blink |
OLD | NEW |