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

Side by Side Diff: Source/modules/accessibility/AXListBoxOption.cpp

Issue 1039873002: AX presentation role should be inherited to its required owned elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update Created 5 years, 8 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // http://www.w3.org/TR/wai-aria/complete#presentation
63 // ARIA spec says that the presentation role causes a given element to be tr eated
64 // as having no role or to be removed from the accessibility tree, but does not cause the
65 // content contained within the element to be removed from the accessibility tree.
66 if (isParentPresentationalRole())
67 return StaticTextRole;
68
61 return ListBoxOptionRole; 69 return ListBoxOptionRole;
62 } 70 }
63 71
72 bool AXListBoxOption::isParentPresentationalRole() const
73 {
74 AXObject* parent = parentObject();
75 if (!parent)
76 return false;
77
78 LayoutObject* layoutObject = parent->layoutObject();
79 if (!layoutObject)
80 return false;
81
82 if (layoutObject->isListBox() && parent->hasInheritedPresentationalRole())
83 return true;
84
85 return false;
86 }
87
64 bool AXListBoxOption::isEnabled() const 88 bool AXListBoxOption::isEnabled() const
65 { 89 {
66 if (!node()) 90 if (!node())
67 return false; 91 return false;
68 92
69 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true")) 93 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true"))
70 return false; 94 return false;
71 95
72 if (toElement(node())->hasAttribute(disabledAttr)) 96 if (toElement(node())->hasAttribute(disabledAttr))
73 return false; 97 return false;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 unsigned length = listItems.size(); 193 unsigned length = listItems.size();
170 for (unsigned i = 0; i < length; i++) { 194 for (unsigned i = 0; i < length; i++) {
171 if (listItems[i] == node()) 195 if (listItems[i] == node())
172 return i; 196 return i;
173 } 197 }
174 198
175 return -1; 199 return -1;
176 } 200 }
177 201
178 } // namespace blink 202 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXListBoxOption.h ('k') | Source/modules/accessibility/AXNodeObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698