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

Side by Side Diff: webkit/glue/webaccessibility.cc

Issue 3380017: Support additional webkit accessibility notifications and states. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Adding missig file. Created 10 years, 2 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
« no previous file with comments | « webkit/glue/webaccessibility.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/glue/webaccessibility.h" 5 #include "webkit/glue/webaccessibility.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h" 8 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityCache.h"
9 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" 9 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h"
10 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h" 10 #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityRole.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 default: 220 default:
221 return WebAccessibility::ROLE_UNKNOWN; 221 return WebAccessibility::ROLE_UNKNOWN;
222 } 222 }
223 } 223 }
224 224
225 uint32 ConvertState(const WebAccessibilityObject& o) { 225 uint32 ConvertState(const WebAccessibilityObject& o) {
226 uint32 state = 0; 226 uint32 state = 0;
227 if (o.isChecked()) 227 if (o.isChecked())
228 state |= (1 << WebAccessibility::STATE_CHECKED); 228 state |= (1 << WebAccessibility::STATE_CHECKED);
229 229
230 if (o.isCollapsed())
231 state |= (1 << WebAccessibility::STATE_COLLAPSED);
232
230 if (o.canSetFocusAttribute()) 233 if (o.canSetFocusAttribute())
231 state |= (1 << WebAccessibility::STATE_FOCUSABLE); 234 state |= (1 << WebAccessibility::STATE_FOCUSABLE);
232 235
233 if (o.isFocused()) 236 if (o.isFocused())
234 state |= (1 << WebAccessibility::STATE_FOCUSED); 237 state |= (1 << WebAccessibility::STATE_FOCUSED);
235 238
239 if (o.roleValue() == WebKit::WebAccessibilityRolePopUpButton) {
240 state |= (1 << WebAccessibility::STATE_HASPOPUP);
241
242 if (!o.isCollapsed())
243 state |= (1 << WebAccessibility::STATE_EXPANDED);
244 }
245
236 if (o.isHovered()) 246 if (o.isHovered())
237 state |= (1 << WebAccessibility::STATE_HOTTRACKED); 247 state |= (1 << WebAccessibility::STATE_HOTTRACKED);
238 248
239 if (o.isIndeterminate()) 249 if (o.isIndeterminate())
240 state |= (1 << WebAccessibility::STATE_INDETERMINATE); 250 state |= (1 << WebAccessibility::STATE_INDETERMINATE);
241 251
242 if (o.isAnchor()) 252 if (!o.isVisible())
253 state |= (1 << WebAccessibility::STATE_INVISIBLE);
254
255 if (o.isLinked())
243 state |= (1 << WebAccessibility::STATE_LINKED); 256 state |= (1 << WebAccessibility::STATE_LINKED);
244 257
245 if (o.isMultiSelectable()) 258 if (o.isMultiSelectable())
246 state |= (1 << WebAccessibility::STATE_MULTISELECTABLE); 259 state |= (1 << WebAccessibility::STATE_MULTISELECTABLE);
247 260
248 if (o.isOffScreen()) 261 if (o.isOffScreen())
249 state |= (1 << WebAccessibility::STATE_OFFSCREEN); 262 state |= (1 << WebAccessibility::STATE_OFFSCREEN);
250 263
251 if (o.isPressed()) 264 if (o.isPressed())
252 state |= (1 << WebAccessibility::STATE_PRESSED); 265 state |= (1 << WebAccessibility::STATE_PRESSED);
253 266
254 if (o.isPasswordField()) 267 if (o.isPasswordField())
255 state |= (1 << WebAccessibility::STATE_PROTECTED); 268 state |= (1 << WebAccessibility::STATE_PROTECTED);
256 269
257 if (o.isReadOnly()) 270 if (o.isReadOnly())
258 state |= (1 << WebAccessibility::STATE_READONLY); 271 state |= (1 << WebAccessibility::STATE_READONLY);
259 272
273 if (o.canSetSelectedAttribute())
274 state |= (1 << WebAccessibility::STATE_SELECTABLE);
275
276 if (o.isSelected())
277 state |= (1 << WebAccessibility::STATE_SELECTED);
278
260 if (o.isVisited()) 279 if (o.isVisited())
261 state |= (1 << WebAccessibility::STATE_TRAVERSED); 280 state |= (1 << WebAccessibility::STATE_TRAVERSED);
262 281
263 if (!o.isEnabled()) 282 if (!o.isEnabled())
264 state |= (1 << WebAccessibility::STATE_UNAVAILABLE); 283 state |= (1 << WebAccessibility::STATE_UNAVAILABLE);
265 284
266 return state; 285 return state;
267 } 286 }
268 287
269 WebAccessibility::WebAccessibility() 288 WebAccessibility::WebAccessibility()
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // The child may be invalid due to issues in webkit accessibility code. 362 // The child may be invalid due to issues in webkit accessibility code.
344 // Don't add children are invalid thus preventing a crash. 363 // Don't add children are invalid thus preventing a crash.
345 // https://bugs.webkit.org/show_bug.cgi?id=44149 364 // https://bugs.webkit.org/show_bug.cgi?id=44149
346 // TODO(ctguil): We may want to remove this check as webkit stabilizes. 365 // TODO(ctguil): We may want to remove this check as webkit stabilizes.
347 if (child.isValid()) 366 if (child.isValid())
348 children.push_back(WebAccessibility(child, cache)); 367 children.push_back(WebAccessibility(child, cache));
349 } 368 }
350 } 369 }
351 370
352 } // namespace webkit_glue 371 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webaccessibility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698