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 (!m_element) |
| 125 return String(); |
| 126 |
| 127 const AtomicString& ariaLabel = getAttribute(aria_labelAttr); |
| 128 if (!ariaLabel.isEmpty()) { |
| 129 nameFrom = AXNameFromAttribute; |
| 130 if (nameSources) { |
| 131 nameSources->append(NameSource(true, aria_labelAttr)); |
| 132 nameSources->last().type = nameFrom; |
| 133 nameSources->last().text = ariaLabel; |
| 134 } |
| 135 return ariaLabel; |
| 136 } |
| 137 |
| 138 nameFrom = AXNameFromContents; |
| 139 if (nameSources) { |
| 140 nameSources->append(NameSource(true)); |
| 141 nameSources->last().type = nameFrom; |
| 142 nameSources->last().text = m_element->displayLabel(); |
| 143 } |
| 144 |
| 145 return m_element->displayLabel(); |
125 } | 146 } |
126 | 147 |
127 DEFINE_TRACE(AXMenuListOption) | 148 DEFINE_TRACE(AXMenuListOption) |
128 { | 149 { |
129 visitor->trace(m_element); | 150 visitor->trace(m_element); |
130 AXMockObject::trace(visitor); | 151 AXMockObject::trace(visitor); |
131 } | 152 } |
132 | 153 |
133 } // namespace blink | 154 } // namespace blink |
OLD | NEW |