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

Side by Side Diff: third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp

Issue 2894983002: An unknown role is considered a bug, should never occur (Closed)
Patch Set: Remove useless comment Created 3 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
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 286
287 AccessibilityRole AXLayoutObject::DetermineAccessibilityRole() { 287 AccessibilityRole AXLayoutObject::DetermineAccessibilityRole() {
288 if (!layout_object_) 288 if (!layout_object_)
289 return kUnknownRole; 289 return kUnknownRole;
290 290
291 if ((aria_role_ = DetermineAriaRoleAttribute()) != kUnknownRole) 291 if ((aria_role_ = DetermineAriaRoleAttribute()) != kUnknownRole)
292 return aria_role_; 292 return aria_role_;
293 293
294 AccessibilityRole role = NativeAccessibilityRoleIgnoringAria(); 294 AccessibilityRole role = NativeAccessibilityRoleIgnoringAria();
295 if (role != kUnknownRole) 295 // Anything that needs to still be exposed but doesn't have a more specific
296 return role; 296 // role should be considered a generic container. Examples are
297 297 // layout blocks with no node, in-page link targets, and plain elements
298 // These are layout containers added by blink 298 // such as a <span> with ARIA markup.
299 if (layout_object_->IsLayoutBlockFlow()) 299 return role == kUnknownRole ? kGenericContainerRole : role;
300 return kGenericContainerRole;
301
302 // If the element does not have role, but it has ARIA attributes or is an
303 // in-page link target, accessibility should fallback to exposing it as a
304 // generic container.
305 if (IsInPageLinkTarget() || SupportsARIAAttributes())
306 return kGenericContainerRole;
307
308 return kUnknownRole;
309 } 300 }
310 301
311 void AXLayoutObject::Init() { 302 void AXLayoutObject::Init() {
312 AXNodeObject::Init(); 303 AXNodeObject::Init();
313 } 304 }
314 305
315 void AXLayoutObject::Detach() { 306 void AXLayoutObject::Detach() {
316 AXNodeObject::Detach(); 307 AXNodeObject::Detach();
317 308
318 DetachRemoteSVGRoot(); 309 DetachRemoteSVGRoot();
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 2515
2525 bool AXLayoutObject::ElementAttributeValue( 2516 bool AXLayoutObject::ElementAttributeValue(
2526 const QualifiedName& attribute_name) const { 2517 const QualifiedName& attribute_name) const {
2527 if (!layout_object_) 2518 if (!layout_object_)
2528 return false; 2519 return false;
2529 2520
2530 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true"); 2521 return EqualIgnoringASCIICase(GetAttribute(attribute_name), "true");
2531 } 2522 }
2532 2523
2533 } // namespace blink 2524 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698