OLD | NEW |
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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 bool AXNodeObject::isChecked() const | 687 bool AXNodeObject::isChecked() const |
688 { | 688 { |
689 Node* node = this->node(); | 689 Node* node = this->node(); |
690 if (!node) | 690 if (!node) |
691 return false; | 691 return false; |
692 | 692 |
693 // First test for native checkedness semantics | 693 // First test for native checkedness semantics |
694 if (isHTMLInputElement(*node)) | 694 if (isHTMLInputElement(*node)) |
695 return toHTMLInputElement(*node).shouldAppearChecked(); | 695 return toHTMLInputElement(*node).shouldAppearChecked(); |
696 | 696 |
697 // Else, if this is an ARIA checkbox or radio OR ARIA role menuitemcheckbox | 697 // Else, if this is an ARIA role checkbox or radio or menuitemcheckbox |
698 // or menuitemradio, respect the aria-checked attribute | 698 // or menuitemradio or switch, respect the aria-checked attribute |
699 AccessibilityRole ariaRole = ariaRoleAttribute(); | 699 switch (ariaRoleAttribute()) { |
700 if (ariaRole == RadioButtonRole || ariaRole == CheckBoxRole | 700 case CheckBoxRole: |
701 || ariaRole == MenuItemCheckBoxRole || ariaRole == MenuItemRadioRole) { | 701 case MenuItemCheckBoxRole: |
| 702 case MenuItemRadioRole: |
| 703 case RadioButtonRole: |
| 704 case SwitchRole: |
702 if (equalIgnoringCase(getAttribute(aria_checkedAttr), "true")) | 705 if (equalIgnoringCase(getAttribute(aria_checkedAttr), "true")) |
703 return true; | 706 return true; |
704 return false; | 707 return false; |
| 708 default: |
| 709 break; |
705 } | 710 } |
706 | 711 |
707 // Otherwise it's not checked | 712 // Otherwise it's not checked |
708 return false; | 713 return false; |
709 } | 714 } |
710 | 715 |
711 bool AXNodeObject::isClickable() const | 716 bool AXNodeObject::isClickable() const |
712 { | 717 { |
713 if (node()) { | 718 if (node()) { |
714 if (node()->isElementNode() && toElement(node())->isDisabledFormControl(
)) | 719 if (node()->isElementNode() && toElement(node())->isDisabledFormControl(
)) |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 case ButtonRole: | 1418 case ButtonRole: |
1414 case ToggleButtonRole: | 1419 case ToggleButtonRole: |
1415 case CheckBoxRole: | 1420 case CheckBoxRole: |
1416 case ListBoxOptionRole: | 1421 case ListBoxOptionRole: |
1417 case ListItemRole: | 1422 case ListItemRole: |
1418 case MenuButtonRole: | 1423 case MenuButtonRole: |
1419 case MenuItemRole: | 1424 case MenuItemRole: |
1420 case MenuItemCheckBoxRole: | 1425 case MenuItemCheckBoxRole: |
1421 case MenuItemRadioRole: | 1426 case MenuItemRadioRole: |
1422 case RadioButtonRole: | 1427 case RadioButtonRole: |
| 1428 case SwitchRole: |
1423 case TabRole: | 1429 case TabRole: |
1424 return textUnderElement(mode); | 1430 return textUnderElement(mode); |
1425 // SVGRoots should not use the text under itself as a title. That could incl
ude the text of objects like <text>. | 1431 // SVGRoots should not use the text under itself as a title. That could incl
ude the text of objects like <text>. |
1426 case SVGRootRole: | 1432 case SVGRootRole: |
1427 return String(); | 1433 return String(); |
1428 case FigureRole: { | 1434 case FigureRole: { |
1429 AXObject* figcaption = findChildWithTagName(figcaptionTag); | 1435 AXObject* figcaption = findChildWithTagName(figcaptionTag); |
1430 if (figcaption) | 1436 if (figcaption) |
1431 return figcaption->textUnderElement(); | 1437 return figcaption->textUnderElement(); |
1432 } | 1438 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 if (!node() && !isAXLayoutObject()) | 1674 if (!node() && !isAXLayoutObject()) |
1669 return false; | 1675 return false; |
1670 | 1676 |
1671 // Elements that should not have children | 1677 // Elements that should not have children |
1672 switch (roleValue()) { | 1678 switch (roleValue()) { |
1673 case ImageRole: | 1679 case ImageRole: |
1674 case ButtonRole: | 1680 case ButtonRole: |
1675 case PopUpButtonRole: | 1681 case PopUpButtonRole: |
1676 case CheckBoxRole: | 1682 case CheckBoxRole: |
1677 case RadioButtonRole: | 1683 case RadioButtonRole: |
| 1684 case SwitchRole: |
1678 case TabRole: | 1685 case TabRole: |
1679 case ToggleButtonRole: | 1686 case ToggleButtonRole: |
1680 case ListBoxOptionRole: | 1687 case ListBoxOptionRole: |
1681 case ScrollBarRole: | 1688 case ScrollBarRole: |
1682 return false; | 1689 return false; |
1683 case StaticTextRole: | 1690 case StaticTextRole: |
1684 if (!axObjectCache()->inlineTextBoxAccessibilityEnabled()) | 1691 if (!axObjectCache()->inlineTextBoxAccessibilityEnabled()) |
1685 return false; | 1692 return false; |
1686 default: | 1693 default: |
1687 return true; | 1694 return true; |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 float range = maxValueForRange() - minValueForRange(); | 1995 float range = maxValueForRange() - minValueForRange(); |
1989 float value = valueForRange(); | 1996 float value = valueForRange(); |
1990 | 1997 |
1991 value += range * (percentChange / 100); | 1998 value += range * (percentChange / 100); |
1992 setValue(String::number(value)); | 1999 setValue(String::number(value)); |
1993 | 2000 |
1994 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); | 2001 axObjectCache()->postNotification(node(), AXObjectCacheImpl::AXValueChanged,
true); |
1995 } | 2002 } |
1996 | 2003 |
1997 } // namespace blink | 2004 } // namespace blink |
OLD | NEW |