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

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: Fix frameset tests 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) 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 668
669 if (isHTMLHRElement(*GetNode())) 669 if (isHTMLHRElement(*GetNode()))
670 return kSplitterRole; 670 return kSplitterRole;
671 671
672 if (IsFieldset()) 672 if (IsFieldset())
673 return kGroupRole; 673 return kGroupRole;
674 674
675 return kUnknownRole; 675 return kUnknownRole;
676 } 676 }
677 677
678 // Determine an accessibility role.
dmazzoni 2017/05/24 21:57:02 This comment doesn't really add much value. :) Ei
aleventhal 2017/05/25 17:28:34 Yeah I'm not sure how that happened, duh.
678 AccessibilityRole AXNodeObject::DetermineAccessibilityRole() { 679 AccessibilityRole AXNodeObject::DetermineAccessibilityRole() {
679 if (!GetNode()) 680 if (!GetNode())
680 return kUnknownRole; 681 return kUnknownRole;
681 682
682 if ((aria_role_ = DetermineAriaRoleAttribute()) != kUnknownRole) 683 if ((aria_role_ = DetermineAriaRoleAttribute()) != kUnknownRole)
683 return aria_role_; 684 return aria_role_;
684 if (GetNode()->IsTextNode()) 685 if (GetNode()->IsTextNode())
685 return kStaticTextRole; 686 return kStaticTextRole;
686 687
687 AccessibilityRole role = NativeAccessibilityRoleIgnoringAria(); 688 AccessibilityRole role = NativeAccessibilityRoleIgnoringAria();
688 if (role != kUnknownRole) 689 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 } 690 }
700 691
701 AccessibilityRole AXNodeObject::DetermineAriaRoleAttribute() const { 692 AccessibilityRole AXNodeObject::DetermineAriaRoleAttribute() const {
702 const AtomicString& aria_role = 693 const AtomicString& aria_role =
703 GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRole); 694 GetAOMPropertyOrARIAAttribute(AOMStringProperty::kRole);
704 if (aria_role.IsNull() || aria_role.IsEmpty()) 695 if (aria_role.IsNull() || aria_role.IsEmpty())
705 return kUnknownRole; 696 return kUnknownRole;
706 697
707 AccessibilityRole role = AriaRoleToWebCoreRole(aria_role); 698 AccessibilityRole role = AriaRoleToWebCoreRole(aria_role);
708 699
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 return String(); 3220 return String();
3230 return ToTextControlElement(node)->StrippedPlaceholder(); 3221 return ToTextControlElement(node)->StrippedPlaceholder();
3231 } 3222 }
3232 3223
3233 DEFINE_TRACE(AXNodeObject) { 3224 DEFINE_TRACE(AXNodeObject) {
3234 visitor->Trace(node_); 3225 visitor->Trace(node_);
3235 AXObjectImpl::Trace(visitor); 3226 AXObjectImpl::Trace(visitor);
3236 } 3227 }
3237 3228
3238 } // namespace blink 3229 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698