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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (!canSetSelectedChildrenAttribute()) | 87 if (!canSetSelectedChildrenAttribute()) |
88 return; | 88 return; |
89 | 89 |
90 Node* selectNode = m_renderer->node(); | 90 Node* selectNode = m_renderer->node(); |
91 if (!selectNode) | 91 if (!selectNode) |
92 return; | 92 return; |
93 | 93 |
94 // disable any selected options | 94 // disable any selected options |
95 unsigned length = m_children.size(); | 95 unsigned length = m_children.size(); |
96 for (unsigned i = 0; i < length; i++) { | 96 for (unsigned i = 0; i < length; i++) { |
97 AccessibilityListBoxOption* listBoxOption = static_cast<AccessibilityLis
tBoxOption*>(m_children[i].get()); | 97 AccessibilityListBoxOption* listBoxOption = toAccessibilityListBoxOption
(m_children[i].get()); |
98 if (listBoxOption->isSelected()) | 98 if (listBoxOption->isSelected()) |
99 listBoxOption->setSelected(false); | 99 listBoxOption->setSelected(false); |
100 } | 100 } |
101 | 101 |
102 length = children.size(); | 102 length = children.size(); |
103 for (unsigned i = 0; i < length; i++) { | 103 for (unsigned i = 0; i < length; i++) { |
104 AccessibilityObject* obj = children[i].get(); | 104 AccessibilityObject* obj = children[i].get(); |
105 if (obj->roleValue() != ListBoxOptionRole) | 105 if (obj->roleValue() != ListBoxOptionRole) |
106 continue; | 106 continue; |
107 | 107 |
108 static_cast<AccessibilityListBoxOption*>(obj)->setSelected(true); | 108 toAccessibilityListBoxOption(obj)->setSelected(true); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 void AccessibilityListBox::selectedChildren(AccessibilityChildrenVector& result) | 112 void AccessibilityListBox::selectedChildren(AccessibilityChildrenVector& result) |
113 { | 113 { |
114 ASSERT(result.isEmpty()); | 114 ASSERT(result.isEmpty()); |
115 | 115 |
116 if (!hasChildren()) | 116 if (!hasChildren()) |
117 addChildren(); | 117 addChildren(); |
118 | 118 |
119 unsigned length = m_children.size(); | 119 unsigned length = m_children.size(); |
120 for (unsigned i = 0; i < length; i++) { | 120 for (unsigned i = 0; i < length; i++) { |
121 if (static_cast<AccessibilityListBoxOption*>(m_children[i].get())->isSel
ected()) | 121 if (toAccessibilityListBoxOption(m_children[i].get())->isSelected()) |
122 result.append(m_children[i]); | 122 result.append(m_children[i]); |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 AccessibilityObject* AccessibilityListBox::listBoxOptionAccessibilityObject(HTML
Element* element) const | 126 AccessibilityObject* AccessibilityListBox::listBoxOptionAccessibilityObject(HTML
Element* element) const |
127 { | 127 { |
128 // skip hr elements | 128 // skip hr elements |
129 if (!element || element->hasTagName(hrTag)) | 129 if (!element || element->hasTagName(hrTag)) |
130 return 0; | 130 return 0; |
131 | 131 |
132 AccessibilityObject* listBoxObject = m_renderer->document().axObjectCache()-
>getOrCreate(ListBoxOptionRole); | 132 AccessibilityObject* listBoxObject = m_renderer->document().axObjectCache()-
>getOrCreate(ListBoxOptionRole); |
133 static_cast<AccessibilityListBoxOption*>(listBoxObject)->setHTMLElement(elem
ent); | 133 toAccessibilityListBoxOption(listBoxObject)->setHTMLElement(element); |
134 | 134 |
135 return listBoxObject; | 135 return listBoxObject; |
136 } | 136 } |
137 | 137 |
138 AccessibilityObject* AccessibilityListBox::elementAccessibilityHitTest(const Int
Point& point) const | 138 AccessibilityObject* AccessibilityListBox::elementAccessibilityHitTest(const Int
Point& point) const |
139 { | 139 { |
140 // the internal HTMLSelectElement methods for returning a listbox option at
a point | 140 // the internal HTMLSelectElement methods for returning a listbox option at
a point |
141 // ignore optgroup elements. | 141 // ignore optgroup elements. |
142 if (!m_renderer) | 142 if (!m_renderer) |
143 return 0; | 143 return 0; |
(...skipping 16 matching lines...) Expand all Loading... |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 if (listBoxOption && !listBoxOption->accessibilityIsIgnored()) | 163 if (listBoxOption && !listBoxOption->accessibilityIsIgnored()) |
164 return listBoxOption; | 164 return listBoxOption; |
165 | 165 |
166 return axObjectCache()->getOrCreate(m_renderer); | 166 return axObjectCache()->getOrCreate(m_renderer); |
167 } | 167 } |
168 | 168 |
169 } // namespace WebCore | 169 } // namespace WebCore |
OLD | NEW |