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

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

Issue 347773002: Implement select listbox using shadow DOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed Created 6 years, 5 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 bool AXListBoxOption::isSelectedOptionActive() const 82 bool AXListBoxOption::isSelectedOptionActive() const
83 { 83 {
84 HTMLSelectElement* listBoxParentNode = listBoxOptionParentNode(); 84 HTMLSelectElement* listBoxParentNode = listBoxOptionParentNode();
85 if (!listBoxParentNode) 85 if (!listBoxParentNode)
86 return false; 86 return false;
87 87
88 return listBoxParentNode->activeSelectionEndListIndex() == listBoxOptionInde x(); 88 return listBoxParentNode->activeSelectionEndListIndex() == listBoxOptionInde x();
89 } 89 }
90 90
91 LayoutRect AXListBoxOption::elementRect() const
92 {
93 LayoutRect rect;
94 if (!m_optionElement)
95 return rect;
96
97 HTMLSelectElement* listBoxParentNode = listBoxOptionParentNode();
98 if (!listBoxParentNode)
99 return rect;
100
101 RenderObject* listBoxRenderer = listBoxParentNode->renderer();
102 if (!listBoxRenderer)
103 return rect;
104
105 LayoutRect parentRect = listBoxRenderer->document().axObjectCache()->getOrCr eate(listBoxRenderer)->elementRect();
106 int index = listBoxOptionIndex();
107 if (index != -1)
108 rect = toRenderListBox(listBoxRenderer)->itemBoundingBoxRect(parentRect. location(), index);
109
110 return rect;
111 }
112
113 bool AXListBoxOption::computeAccessibilityIsIgnored() const 91 bool AXListBoxOption::computeAccessibilityIsIgnored() const
114 { 92 {
115 if (!m_optionElement) 93 if (!m_optionElement)
116 return true; 94 return true;
117 95
118 if (accessibilityIsIgnoredByDefault()) 96 if (accessibilityIsIgnoredByDefault())
119 return true; 97 return true;
120 98
121 return parentObject()->accessibilityIsIgnored(); 99 return parentObject()->accessibilityIsIgnored();
122 } 100 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 unsigned length = listItems.size(); 191 unsigned length = listItems.size();
214 for (unsigned i = 0; i < length; i++) { 192 for (unsigned i = 0; i < length; i++) {
215 if (listItems[i] == m_optionElement) 193 if (listItems[i] == m_optionElement)
216 return i; 194 return i;
217 } 195 }
218 196
219 return -1; 197 return -1;
220 } 198 }
221 199
222 } // namespace WebCore 200 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698