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

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

Issue 14096013: Implement select element list box with shadow DOM. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@shadowselect
Patch Set: Created 7 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 } 124 }
125 125
126 void AccessibilityListBox::visibleChildren(AccessibilityChildrenVector& result) 126 void AccessibilityListBox::visibleChildren(AccessibilityChildrenVector& result)
127 { 127 {
128 ASSERT(result.isEmpty()); 128 ASSERT(result.isEmpty());
129 129
130 if (!hasChildren()) 130 if (!hasChildren())
131 addChildren(); 131 addChildren();
132 132
133 unsigned length = m_children.size(); 133 // unsigned length = m_children.size();
yosin_UTC9 2013/04/23 03:43:25 You may forget to remove this fragment.
134 for (unsigned i = 0; i < length; i++) { 134 // for (unsigned i = 0; i < length; i++) {
135 if (toRenderListBox(m_renderer)->listIndexIsVisible(i)) 135 // if (toRenderListBox(m_renderer)->listIndexIsVisible(i))
136 result.append(m_children[i]); 136 // result.append(m_children[i]);
137 } 137 // }
138 } 138 }
139 139
140 AccessibilityObject* AccessibilityListBox::listBoxOptionAccessibilityObject(HTML Element* element) const 140 AccessibilityObject* AccessibilityListBox::listBoxOptionAccessibilityObject(HTML Element* element) const
141 { 141 {
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) const
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 = boundingBoxRect();
yosin_UTC9 2013/04/23 03:43:25 You may forget to remove this fragment.
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(par entRect.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 possib le 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 featu res 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

Powered by Google App Engine
This is Rietveld 408576698