OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 ASSERT(parent->isMenuListPopup()); | 112 ASSERT(parent->isMenuListPopup()); |
113 | 113 |
114 AXObject* grandparent = parent->parentObject(); | 114 AXObject* grandparent = parent->parentObject(); |
115 if (!grandparent) | 115 if (!grandparent) |
116 return LayoutRect(); | 116 return LayoutRect(); |
117 ASSERT(grandparent->isMenuList()); | 117 ASSERT(grandparent->isMenuList()); |
118 | 118 |
119 return grandparent->elementRect(); | 119 return grandparent->elementRect(); |
120 } | 120 } |
121 | 121 |
122 String AXMenuListOption::stringValue() const | 122 String AXMenuListOption::textAlternative(bool recursive, bool inAriaLabelledByTr
aversal, AXObjectSet& visited, AXNameFrom& nameFrom, AXRelatedObjectVector* rela
tedObjects, NameSources* nameSources) const |
123 { | 123 { |
124 return m_element ? m_element->displayLabel() : String(); | 124 // If nameSources is non-null, relatedObjects is used in filling it in, so i
t must be non-null as well. |
| 125 if (nameSources) |
| 126 ASSERT(relatedObjects); |
| 127 |
| 128 if (!node()) |
| 129 return String(); |
| 130 |
| 131 bool foundTextAlternative = false; |
| 132 String textAlternative = ariaTextAlternative(recursive, inAriaLabelledByTrav
ersal, visited, nameFrom, relatedObjects, nameSources, &foundTextAlternative); |
| 133 if (foundTextAlternative && !nameSources) |
| 134 return textAlternative; |
| 135 |
| 136 nameFrom = AXNameFromContents; |
| 137 textAlternative = m_element->displayLabel(); |
| 138 if (nameSources) { |
| 139 nameSources->append(NameSource(foundTextAlternative)); |
| 140 nameSources->last().type = nameFrom; |
| 141 nameSources->last().text = textAlternative; |
| 142 foundTextAlternative = true; |
| 143 } |
| 144 |
| 145 return textAlternative; |
| 146 |
125 } | 147 } |
126 | 148 |
127 DEFINE_TRACE(AXMenuListOption) | 149 DEFINE_TRACE(AXMenuListOption) |
128 { | 150 { |
129 visitor->trace(m_element); | 151 visitor->trace(m_element); |
130 AXMockObject::trace(visitor); | 152 AXMockObject::trace(visitor); |
131 } | 153 } |
132 | 154 |
133 } // namespace blink | 155 } // namespace blink |
OLD | NEW |