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

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

Issue 1488893002: Stops using SYSTEM_STATE_INDETERMINATE as it makes radio buttons appear to have a mixed state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a few test expectations. Created 5 years 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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 987
988 const AtomicString& expanded = getAttribute(aria_expandedAttr); 988 const AtomicString& expanded = getAttribute(aria_expandedAttr);
989 if (equalIgnoringCase(expanded, "true")) 989 if (equalIgnoringCase(expanded, "true"))
990 return ExpandedExpanded; 990 return ExpandedExpanded;
991 if (equalIgnoringCase(expanded, "false")) 991 if (equalIgnoringCase(expanded, "false"))
992 return ExpandedCollapsed; 992 return ExpandedCollapsed;
993 993
994 return ExpandedUndefined; 994 return ExpandedUndefined;
995 } 995 }
996 996
997 bool AXNodeObject::isIndeterminate() const
998 {
999 Node* node = this->node();
1000 if (!isHTMLInputElement(node))
1001 return false;
1002
1003 return toHTMLInputElement(node)->shouldAppearIndeterminate();
1004 }
1005
1006 bool AXNodeObject::isPressed() const 997 bool AXNodeObject::isPressed() const
1007 { 998 {
1008 if (!isButton()) 999 if (!isButton())
1009 return false; 1000 return false;
1010 1001
1011 Node* node = this->node(); 1002 Node* node = this->node();
1012 if (!node) 1003 if (!node)
1013 return false; 1004 return false;
1014 1005
1015 // ARIA button with aria-pressed not undefined, then check for aria-pressed attribute rather than node()->active() 1006 // ARIA button with aria-pressed not undefined, then check for aria-pressed attribute rather than node()->active()
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 return toHTMLTextFormControlElement(*node).value(); 1228 return toHTMLTextFormControlElement(*node).value();
1238 1229
1239 if (!node->isElementNode()) 1230 if (!node->isElementNode())
1240 return String(); 1231 return String();
1241 1232
1242 return toElement(node)->innerText(); 1233 return toElement(node)->innerText();
1243 } 1234 }
1244 1235
1245 AccessibilityButtonState AXNodeObject::checkboxOrRadioValue() const 1236 AccessibilityButtonState AXNodeObject::checkboxOrRadioValue() const
1246 { 1237 {
1238 if (isNativeCheckboxInMixedState())
1239 return ButtonStateMixed;
1240
1247 if (isNativeCheckboxOrRadio()) 1241 if (isNativeCheckboxOrRadio())
1248 return isChecked() ? ButtonStateOn : ButtonStateOff; 1242 return isChecked() ? ButtonStateOn : ButtonStateOff;
1249 1243
1250 return AXObject::checkboxOrRadioValue(); 1244 return AXObject::checkboxOrRadioValue();
1251 } 1245 }
1252 1246
1253 RGBA32 AXNodeObject::colorValue() const 1247 RGBA32 AXNodeObject::colorValue() const
1254 { 1248 {
1255 if (!isHTMLInputElement(node()) || !isColorWell()) 1249 if (!isHTMLInputElement(node()) || !isColorWell())
1256 return AXObject::colorValue(); 1250 return AXObject::colorValue();
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 AXObject* AXNodeObject::findChildWithTagName(const HTMLQualifiedName& tagName) c onst 1474 AXObject* AXNodeObject::findChildWithTagName(const HTMLQualifiedName& tagName) c onst
1481 { 1475 {
1482 for (AXObject* child = firstChild(); child; child = child->nextSibling()) { 1476 for (AXObject* child = firstChild(); child; child = child->nextSibling()) {
1483 Node* childNode = child->node(); 1477 Node* childNode = child->node();
1484 if (childNode && childNode->hasTagName(tagName)) 1478 if (childNode && childNode->hasTagName(tagName))
1485 return child; 1479 return child;
1486 } 1480 }
1487 return 0; 1481 return 0;
1488 } 1482 }
1489 1483
1484 bool AXNodeObject::isNativeCheckboxInMixedState() const
1485 {
1486 if (!isHTMLInputElement(m_node))
1487 return false;
1488
1489 HTMLInputElement* input = toHTMLInputElement(m_node);
1490 return input->type() == InputTypeNames::checkbox
1491 && input->shouldAppearIndeterminate();
1492 }
1493
1490 // 1494 //
1491 // New AX name calculation. 1495 // New AX name calculation.
1492 // 1496 //
1493 1497
1494 String AXNodeObject::textAlternative(bool recursive, bool inAriaLabelledByTraver sal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relatedO bjects, NameSources* nameSources) const 1498 String AXNodeObject::textAlternative(bool recursive, bool inAriaLabelledByTraver sal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relatedO bjects, NameSources* nameSources) const
1495 { 1499 {
1496 // If nameSources is non-null, relatedObjects is used in filling it in, so i t must be non-null as well. 1500 // If nameSources is non-null, relatedObjects is used in filling it in, so i t must be non-null as well.
1497 if (nameSources) 1501 if (nameSources)
1498 ASSERT(relatedObjects); 1502 ASSERT(relatedObjects);
1499 1503
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 return placeholder; 2688 return placeholder;
2685 } 2689 }
2686 2690
2687 DEFINE_TRACE(AXNodeObject) 2691 DEFINE_TRACE(AXNodeObject)
2688 { 2692 {
2689 visitor->trace(m_node); 2693 visitor->trace(m_node);
2690 AXObject::trace(visitor); 2694 AXObject::trace(visitor);
2691 } 2695 }
2692 2696
2693 } // namespace blin 2697 } // namespace blin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698