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

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

Issue 679623002: Check whether aria-expanded attribute is defined (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Introduce new enum for aria-expanded Created 6 years, 1 month 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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true")) 702 if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true"))
703 return false; 703 return false;
704 704
705 Node* node = this->node(); 705 Node* node = this->node();
706 if (!node || !node->isElementNode()) 706 if (!node || !node->isElementNode())
707 return true; 707 return true;
708 708
709 return !toElement(node)->isDisabledFormControl(); 709 return !toElement(node)->isDisabledFormControl();
710 } 710 }
711 711
712 bool AXNodeObject::isExpanded() const
713 {
714 if (equalIgnoringCase(getAttribute(aria_expandedAttr), "true"))
715 return true;
716
717 return false;
718 }
719
720 bool AXNodeObject::isIndeterminate() const 712 bool AXNodeObject::isIndeterminate() const
721 { 713 {
722 Node* node = this->node(); 714 Node* node = this->node();
723 if (!isHTMLInputElement(node)) 715 if (!isHTMLInputElement(node))
724 return false; 716 return false;
725 717
726 return toHTMLInputElement(node)->shouldAppearIndeterminate(); 718 return toHTMLInputElement(node)->shouldAppearIndeterminate();
727 } 719 }
728 720
729 bool AXNodeObject::isPressed() const 721 bool AXNodeObject::isPressed() const
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 } 1086 }
1095 1087
1096 String AXNodeObject::ariaDescribedByAttribute() const 1088 String AXNodeObject::ariaDescribedByAttribute() const
1097 { 1089 {
1098 WillBeHeapVector<RawPtrWillBeMember<Element> > elements; 1090 WillBeHeapVector<RawPtrWillBeMember<Element> > elements;
1099 elementsFromAttribute(elements, aria_describedbyAttr); 1091 elementsFromAttribute(elements, aria_describedbyAttr);
1100 1092
1101 return accessibilityDescriptionForElements(elements); 1093 return accessibilityDescriptionForElements(elements);
1102 } 1094 }
1103 1095
1096 AccessibilityExpanded AXNodeObject::getExpandedAttr() const
1097 {
1098 const AtomicString& expanded = getAttribute(aria_expandedAttr);
1099 if (equalIgnoringCase(expanded, "true"))
1100 return ExpandedExpanded;
1101 if (equalIgnoringCase(expanded, "false"))
1102 return ExpandedCollapsed;
1103
1104 return ExpandedUndefined;
1105 }
1106
1107 AccessibilityExpanded AXNodeObject::ariaExpanded() const
1108 {
1109 return getExpandedAttr();
1110 }
1104 1111
1105 String AXNodeObject::ariaLabeledByAttribute() const 1112 String AXNodeObject::ariaLabeledByAttribute() const
1106 { 1113 {
1107 WillBeHeapVector<RawPtrWillBeMember<Element> > elements; 1114 WillBeHeapVector<RawPtrWillBeMember<Element> > elements;
1108 ariaLabeledByElements(elements); 1115 ariaLabeledByElements(elements);
1109 1116
1110 return accessibilityDescriptionForElements(elements); 1117 return accessibilityDescriptionForElements(elements);
1111 } 1118 }
1112 1119
1113 AccessibilityRole AXNodeObject::ariaRoleAttribute() const 1120 AccessibilityRole AXNodeObject::ariaRoleAttribute() const
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 float range = maxValueForRange() - minValueForRange(); 1767 float range = maxValueForRange() - minValueForRange();
1761 float value = valueForRange(); 1768 float value = valueForRange();
1762 1769
1763 value += range * (percentChange / 100); 1770 value += range * (percentChange / 100);
1764 setValue(String::number(value)); 1771 setValue(String::number(value));
1765 1772
1766 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true); 1773 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged, true);
1767 } 1774 }
1768 1775
1769 } // namespace blink 1776 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698