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

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

Issue 1511603002: Merge to m48: Stops using SYSTEM_STATE_INDETERMINATE as it makes radio buttons appear to have a mix… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: 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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 1024
1025 const AtomicString& expanded = getAttribute(aria_expandedAttr); 1025 const AtomicString& expanded = getAttribute(aria_expandedAttr);
1026 if (equalIgnoringCase(expanded, "true")) 1026 if (equalIgnoringCase(expanded, "true"))
1027 return ExpandedExpanded; 1027 return ExpandedExpanded;
1028 if (equalIgnoringCase(expanded, "false")) 1028 if (equalIgnoringCase(expanded, "false"))
1029 return ExpandedCollapsed; 1029 return ExpandedCollapsed;
1030 1030
1031 return ExpandedUndefined; 1031 return ExpandedUndefined;
1032 } 1032 }
1033 1033
1034 bool AXNodeObject::isIndeterminate() const
1035 {
1036 Node* node = this->node();
1037 if (!isHTMLInputElement(node))
1038 return false;
1039
1040 return toHTMLInputElement(node)->shouldAppearIndeterminate();
1041 }
1042
1043 bool AXNodeObject::isPressed() const 1034 bool AXNodeObject::isPressed() const
1044 { 1035 {
1045 if (!isButton()) 1036 if (!isButton())
1046 return false; 1037 return false;
1047 1038
1048 Node* node = this->node(); 1039 Node* node = this->node();
1049 if (!node) 1040 if (!node)
1050 return false; 1041 return false;
1051 1042
1052 // ARIA button with aria-pressed not undefined, then check for aria-pressed attribute rather than node()->active() 1043 // ARIA button with aria-pressed not undefined, then check for aria-pressed attribute rather than node()->active()
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 1322
1332 HTMLLabelElement* label = labelForElement(toElement(node())); 1323 HTMLLabelElement* label = labelForElement(toElement(node()));
1333 if (label) 1324 if (label)
1334 return axObjectCache().getOrCreate(label); 1325 return axObjectCache().getOrCreate(label);
1335 1326
1336 return 0; 1327 return 0;
1337 } 1328 }
1338 1329
1339 AccessibilityButtonState AXNodeObject::checkboxOrRadioValue() const 1330 AccessibilityButtonState AXNodeObject::checkboxOrRadioValue() const
1340 { 1331 {
1332 if (isNativeCheckboxInMixedState())
1333 return ButtonStateMixed;
1334
1341 if (isNativeCheckboxOrRadio()) 1335 if (isNativeCheckboxOrRadio())
1342 return isChecked() ? ButtonStateOn : ButtonStateOff; 1336 return isChecked() ? ButtonStateOn : ButtonStateOff;
1343 1337
1344 return AXObject::checkboxOrRadioValue(); 1338 return AXObject::checkboxOrRadioValue();
1345 } 1339 }
1346 1340
1347 RGBA32 AXNodeObject::colorValue() const 1341 RGBA32 AXNodeObject::colorValue() const
1348 { 1342 {
1349 if (!isHTMLInputElement(node()) || !isColorWell()) 1343 if (!isHTMLInputElement(node()) || !isColorWell())
1350 return AXObject::colorValue(); 1344 return AXObject::colorValue();
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 if (isHTMLInputElement(node())) { 1842 if (isHTMLInputElement(node())) {
1849 HTMLInputElement* element = toHTMLInputElement(node()); 1843 HTMLInputElement* element = toHTMLInputElement(node());
1850 placeholder = element->strippedPlaceholder(); 1844 placeholder = element->strippedPlaceholder();
1851 if (!placeholder.isEmpty()) 1845 if (!placeholder.isEmpty())
1852 return placeholder; 1846 return placeholder;
1853 } 1847 }
1854 1848
1855 return String(); 1849 return String();
1856 } 1850 }
1857 1851
1852 bool AXNodeObject::isNativeCheckboxInMixedState() const
1853 {
1854 if (!isHTMLInputElement(m_node))
1855 return false;
1856
1857 HTMLInputElement* input = toHTMLInputElement(m_node);
1858 return input->type() == InputTypeNames::checkbox
1859 && input->shouldAppearIndeterminate();
1860 }
1861
1858 // 1862 //
1859 // New AX name calculation. 1863 // New AX name calculation.
1860 // 1864 //
1861 1865
1862 String AXNodeObject::textAlternative(bool recursive, bool inAriaLabelledByTraver sal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relatedO bjects, NameSources* nameSources) const 1866 String AXNodeObject::textAlternative(bool recursive, bool inAriaLabelledByTraver sal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* relatedO bjects, NameSources* nameSources) const
1863 { 1867 {
1864 // If nameSources is non-null, relatedObjects is used in filling it in, so i t must be non-null as well. 1868 // If nameSources is non-null, relatedObjects is used in filling it in, so i t must be non-null as well.
1865 if (nameSources) 1869 if (nameSources)
1866 ASSERT(relatedObjects); 1870 ASSERT(relatedObjects);
1867 1871
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3111 return String(); 3115 return String();
3112 } 3116 }
3113 3117
3114 DEFINE_TRACE(AXNodeObject) 3118 DEFINE_TRACE(AXNodeObject)
3115 { 3119 {
3116 visitor->trace(m_node); 3120 visitor->trace(m_node);
3117 AXObject::trace(visitor); 3121 AXObject::trace(visitor);
3118 } 3122 }
3119 3123
3120 } // namespace blin 3124 } // namespace blin
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698