| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // skip hr elements | 142 // skip hr elements |
| 143 if (!element || element->hasTagName(hrTag)) | 143 if (!element || element->hasTagName(hrTag)) |
| 144 return 0; | 144 return 0; |
| 145 | 145 |
| 146 AccessibilityObject* listBoxObject = m_renderer->document()->axObjectCache()
->getOrCreate(ListBoxOptionRole); | 146 AccessibilityObject* listBoxObject = m_renderer->document()->axObjectCache()
->getOrCreate(ListBoxOptionRole); |
| 147 static_cast<AccessibilityListBoxOption*>(listBoxObject)->setHTMLElement(elem
ent); | 147 static_cast<AccessibilityListBoxOption*>(listBoxObject)->setHTMLElement(elem
ent); |
| 148 | 148 |
| 149 return listBoxObject; | 149 return listBoxObject; |
| 150 } | 150 } |
| 151 | 151 |
| 152 AccessibilityObject* AccessibilityListBox::elementAccessibilityHitTest(const Int
Point& point) const | 152 AccessibilityObject* AccessibilityListBox::elementAccessibilityHitTest(const Int
Point& point) |
| 153 { | 153 { |
| 154 // the internal HTMLSelectElement methods for returning a listbox option at
a point | 154 // the internal HTMLSelectElement methods for returning a listbox option at
a point |
| 155 // ignore optgroup elements. | 155 // ignore optgroup elements. |
| 156 if (!m_renderer) | 156 if (!m_renderer) |
| 157 return 0; | 157 return 0; |
| 158 | 158 |
| 159 Node* node = m_renderer->node(); | 159 Node* node = m_renderer->node(); |
| 160 if (!node) | 160 if (!node) |
| 161 return 0; | 161 return 0; |
| 162 | 162 |
| 163 LayoutRect parentRect = boundingBoxRect(); | 163 LayoutRect parentRect = elementRect(); |
| 164 | 164 |
| 165 AccessibilityObject* listBoxOption = 0; | 165 AccessibilityObject* listBoxOption = 0; |
| 166 unsigned length = m_children.size(); | 166 unsigned length = m_children.size(); |
| 167 for (unsigned i = 0; i < length; i++) { | 167 for (unsigned i = 0; i < length; i++) { |
| 168 LayoutRect rect = toRenderListBox(m_renderer)->itemBoundingBoxRect(paren
tRect.location(), i); | 168 LayoutRect rect = toRenderListBox(m_renderer)->itemBoundingBoxRect(paren
tRect.location(), i); |
| 169 // The cast to HTMLElement below is safe because the only other possible
listItem type | 169 // The cast to HTMLElement below is safe because the only other possible
listItem type |
| 170 // would be a WMLElement, but WML builds don't use accessibility feature
s at all. | 170 // would be a WMLElement, but WML builds don't use accessibility feature
s at all. |
| 171 if (rect.contains(point)) { | 171 if (rect.contains(point)) { |
| 172 listBoxOption = m_children[i].get(); | 172 listBoxOption = m_children[i].get(); |
| 173 break; | 173 break; |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 if (listBoxOption && !listBoxOption->accessibilityIsIgnored()) | 177 if (listBoxOption && !listBoxOption->accessibilityIsIgnored()) |
| 178 return listBoxOption; | 178 return listBoxOption; |
| 179 | 179 |
| 180 return axObjectCache()->getOrCreate(m_renderer); | 180 return axObjectCache()->getOrCreate(m_renderer); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace WebCore | 183 } // namespace WebCore |
| OLD | NEW |