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

Side by Side Diff: Source/core/accessibility/AccessibilityListBox.cpp

Issue 14740025: Simplify and add caching for accessible bounding box calculation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Re-landing with null check fix Created 7 years, 7 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 | Annotate | Revision Log
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebAccessibilityObject.cpp ('k') | Source/core/accessibility/AccessibilityListBoxOption.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698