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

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

Issue 2894983002: An unknown role is considered a bug, should never occur (Closed)
Patch Set: Remove useless comment Created 3 years, 6 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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, Google 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 AccessibilityRole AXNodeObject::DetermineAccessibilityRole() { 678 AccessibilityRole AXNodeObject::DetermineAccessibilityRole() {
679 if (!GetNode()) 679 if (!GetNode())
680 return kUnknownRole; 680 return kUnknownRole;
681 681
682 if ((aria_role_ = DetermineAriaRoleAttribute()) != kUnknownRole) 682 if ((aria_role_ = DetermineAriaRoleAttribute()) != kUnknownRole)
683 return aria_role_; 683 return aria_role_;
684 if (GetNode()->IsTextNode()) 684 if (GetNode()->IsTextNode())
685 return kStaticTextRole; 685 return kStaticTextRole;
686 686
687 AccessibilityRole role = NativeAccessibilityRoleIgnoringAria(); 687 AccessibilityRole role = NativeAccessibilityRoleIgnoringAria();
688 if (role != kUnknownRole) 688 return role == kUnknownRole ? kGenericContainerRole : role;
689 return role;
690 if (GetNode()->IsElementNode()) {
691 Element* element = ToElement(GetNode());
692 // A generic element with tabIndex explicitly set gets GroupRole.
693 // The layout checks for focusability aren't critical here; a false
694 // positive would be harmless.
695 if (element->IsInCanvasSubtree() && element->SupportsFocus())
696 return kGenericContainerRole;
697 }
698 return kUnknownRole;
699 } 689 }
700 690
701 AccessibilityRole AXNodeObject::DetermineAriaRoleAttribute() const { 691 AccessibilityRole AXNodeObject::DetermineAriaRoleAttribute() const {
702 const AtomicString& aria_role = 692 const AtomicString& aria_role =
703 GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRole); 693 GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRole);
704 if (aria_role.IsNull() || aria_role.IsEmpty()) 694 if (aria_role.IsNull() || aria_role.IsEmpty())
705 return kUnknownRole; 695 return kUnknownRole;
706 696
707 AccessibilityRole role = AriaRoleToWebCoreRole(aria_role); 697 AccessibilityRole role = AriaRoleToWebCoreRole(aria_role);
708 698
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 return String(); 3219 return String();
3230 return ToTextControlElement(node)->StrippedPlaceholder(); 3220 return ToTextControlElement(node)->StrippedPlaceholder();
3231 } 3221 }
3232 3222
3233 DEFINE_TRACE(AXNodeObject) { 3223 DEFINE_TRACE(AXNodeObject) {
3234 visitor->Trace(node_); 3224 visitor->Trace(node_);
3235 AXObjectImpl::Trace(visitor); 3225 AXObjectImpl::Trace(visitor);
3236 } 3226 }
3237 3227
3238 } // namespace blink 3228 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698