| 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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 return toHTMLFormControlElement(n)->isRequired(); | 1058 return toHTMLFormControlElement(n)->isRequired(); |
| 1059 | 1059 |
| 1060 if (equalIgnoringCase(getAttribute(aria_requiredAttr), "true")) | 1060 if (equalIgnoringCase(getAttribute(aria_requiredAttr), "true")) |
| 1061 return true; | 1061 return true; |
| 1062 | 1062 |
| 1063 return false; | 1063 return false; |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 bool AXNodeObject::canSetFocusAttribute() const | 1066 bool AXNodeObject::canSetFocusAttribute() const |
| 1067 { | 1067 { |
| 1068 Node* node = this->getNode(); | 1068 Node* node = getNode(); |
| 1069 if (!node) | 1069 if (!node) |
| 1070 return false; | 1070 return false; |
| 1071 | 1071 |
| 1072 if (isWebArea()) | 1072 if (isWebArea()) |
| 1073 return true; | 1073 return true; |
| 1074 | 1074 |
| 1075 // Children of elements with an aria-activedescendant attribute should be |
| 1076 // focusable if they have an ARIA role. |
| 1077 if (ariaRoleAttribute() != UnknownRole && ancestorExposesActiveDescendant()) |
| 1078 return true; |
| 1079 |
| 1075 // NOTE: It would be more accurate to ask the document whether setFocusedNod
e() would | 1080 // NOTE: It would be more accurate to ask the document whether setFocusedNod
e() would |
| 1076 // do anything. For example, setFocusedNode() will do nothing if the current
focused | 1081 // do anything. For example, setFocusedNode() will do nothing if the current
focused |
| 1077 // node will not relinquish the focus. | 1082 // node will not relinquish the focus. |
| 1078 if (!node) | |
| 1079 return false; | |
| 1080 | |
| 1081 if (isDisabledFormControl(node)) | 1083 if (isDisabledFormControl(node)) |
| 1082 return false; | 1084 return false; |
| 1083 | 1085 |
| 1084 return node->isElementNode() && toElement(node)->supportsFocus(); | 1086 return node->isElementNode() && toElement(node)->supportsFocus(); |
| 1085 } | 1087 } |
| 1086 | 1088 |
| 1087 bool AXNodeObject::canSetValueAttribute() const | 1089 bool AXNodeObject::canSetValueAttribute() const |
| 1088 { | 1090 { |
| 1089 if (equalIgnoringCase(getAttribute(aria_readonlyAttr), "true")) | 1091 if (equalIgnoringCase(getAttribute(aria_readonlyAttr), "true")) |
| 1090 return false; | 1092 return false; |
| 1091 | 1093 |
| 1092 if (isProgressIndicator() || isSlider()) | 1094 if (isProgressIndicator() || isSlider()) |
| 1093 return true; | 1095 return true; |
| 1094 | 1096 |
| 1095 if (isTextControl() && !isNativeTextControl()) | 1097 if (isTextControl() && !isNativeTextControl()) |
| 1096 return true; | 1098 return true; |
| 1097 | 1099 |
| 1098 // Any node could be contenteditable, so isReadOnly should be relied upon | 1100 // Any node could be contenteditable, so isReadOnly should be relied upon |
| 1099 // for this information for all elements. | 1101 // for this information for all elements. |
| 1100 return !isReadOnly(); | 1102 return !isReadOnly(); |
| 1101 } | 1103 } |
| 1102 | 1104 |
| 1105 bool AXNodeObject::canSetSelectedAttribute() const |
| 1106 { |
| 1107 // ARIA list box options can be selected if they are children of an element |
| 1108 // with an aria-activedescendant attribute. |
| 1109 if (ariaRoleAttribute() == ListBoxOptionRole && ancestorExposesActiveDescend
ant()) |
| 1110 return true; |
| 1111 return AXObject::canSetSelectedAttribute(); |
| 1112 } |
| 1113 |
| 1103 bool AXNodeObject::canvasHasFallbackContent() const | 1114 bool AXNodeObject::canvasHasFallbackContent() const |
| 1104 { | 1115 { |
| 1105 Node* node = this->getNode(); | 1116 Node* node = this->getNode(); |
| 1106 if (!isHTMLCanvasElement(node)) | 1117 if (!isHTMLCanvasElement(node)) |
| 1107 return false; | 1118 return false; |
| 1108 | 1119 |
| 1109 // If it has any children that are elements, we'll assume it might be fallba
ck | 1120 // If it has any children that are elements, we'll assume it might be fallba
ck |
| 1110 // content. If it has no children or its only children are not elements | 1121 // content. If it has no children or its only children are not elements |
| 1111 // (e.g. just text nodes), it doesn't have fallback content. | 1122 // (e.g. just text nodes), it doesn't have fallback content. |
| 1112 return ElementTraversal::firstChild(*node); | 1123 return ElementTraversal::firstChild(*node); |
| (...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2759 return placeholder; | 2770 return placeholder; |
| 2760 } | 2771 } |
| 2761 | 2772 |
| 2762 DEFINE_TRACE(AXNodeObject) | 2773 DEFINE_TRACE(AXNodeObject) |
| 2763 { | 2774 { |
| 2764 visitor->trace(m_node); | 2775 visitor->trace(m_node); |
| 2765 AXObject::trace(visitor); | 2776 AXObject::trace(visitor); |
| 2766 } | 2777 } |
| 2767 | 2778 |
| 2768 } // namespace blink | 2779 } // namespace blink |
| OLD | NEW |