|
Lines 159-187
static const gchar* nameFromChildren(AccessibilityObject* object)
a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp_sec1
|
| 159 |
static const gchar* webkit_accessible_get_name(AtkObject* object) |
159 |
static const gchar* webkit_accessible_get_name(AtkObject* object) |
| 160 |
{ |
160 |
{ |
| 161 |
AccessibilityObject* coreObject = core(object); |
161 |
AccessibilityObject* coreObject = core(object); |
|
|
162 |
if (!coreObject->isAccessibilityRenderObject()) |
| 163 |
return returnString(coreObject->stringValue()); |
| 164 |
|
| 165 |
AccessibilityRenderObject* renderObject = static_cast<AccessibilityRenderObject*>(coreObject); |
| 162 |
if (coreObject->isControl()) { |
166 |
if (coreObject->isControl()) { |
| 163 |
AccessibilityRenderObject* renderObject = static_cast<AccessibilityRenderObject*>(coreObject); |
|
|
| 164 |
AccessibilityObject* label = renderObject->correspondingLabelForControlElement(); |
167 |
AccessibilityObject* label = renderObject->correspondingLabelForControlElement(); |
| 165 |
if (label) |
168 |
if (label) |
| 166 |
return returnString(nameFromChildren(label)); |
169 |
return returnString(nameFromChildren(label)); |
| 167 |
} |
170 |
} |
|
|
171 |
|
| 172 |
if (renderObject->isImage() || renderObject->isInputImage()) { |
| 173 |
Node* node = renderObject->renderer()->node(); |
| 174 |
if (node && node->isHTMLElement()) { |
| 175 |
// Get the attribute rather than altText String so as not to fall back on title. |
| 176 |
String alt = static_cast<HTMLElement*>(node)->getAttribute(HTMLNames::altAttr); |
| 177 |
if (!alt.isEmpty()) |
| 178 |
return returnString(alt); |
| 179 |
} |
| 180 |
} |
| 181 |
|
| 168 |
return returnString(coreObject->stringValue()); |
182 |
return returnString(coreObject->stringValue()); |
| 169 |
} |
183 |
} |
| 170 |
|
184 |
|
| 171 |
static const gchar* webkit_accessible_get_description(AtkObject* object) |
185 |
static const gchar* webkit_accessible_get_description(AtkObject* object) |
| 172 |
{ |
186 |
{ |
| 173 |
AccessibilityObject* coreObject = core(object); |
187 |
AccessibilityObject* coreObject = core(object); |
|
|
188 |
Node* node = 0; |
| 189 |
if (coreObject->isAccessibilityRenderObject()) |
| 190 |
node = static_cast<AccessibilityRenderObject*>(coreObject)->renderer()->node(); |
| 191 |
if (!node || !node->isHTMLElement() || coreObject->ariaRoleAttribute() != UnknownRole) |
| 192 |
return returnString(coreObject->accessibilityDescription()); |
| 174 |
|
193 |
|
| 175 |
// atk_table_get_summary returns an AtkObject. We have no summary object, so expose summary here. |
194 |
// atk_table_get_summary returns an AtkObject. We have no summary object, so expose summary here. |
| 176 |
if (coreObject->roleValue() == TableRole && coreObject->ariaRoleAttribute() == UnknownRole) { |
195 |
if (coreObject->roleValue() == TableRole) { |
| 177 |
Node* node = static_cast<AccessibilityRenderObject*>(coreObject)->renderer()->node(); |
196 |
String summary = static_cast<HTMLTableElement*>(node)->summary(); |
| 178 |
if (node && node->isHTMLElement()) { |
197 |
if (!summary.isEmpty()) |
| 179 |
String summary = static_cast<HTMLTableElement*>(node)->summary(); |
198 |
return returnString(summary); |
| 180 |
if (!summary.isEmpty()) |
|
|
| 181 |
return returnString(summary); |
| 182 |
} |
| 183 |
} |
199 |
} |
| 184 |
|
200 |
|
|
|
201 |
// The title attribute should be reliably available as the object's descripton. |
| 202 |
// We do not want to fall back on other attributes in its absence. See bug 25524. |
| 203 |
String title = static_cast<HTMLElement*>(node)->title(); |
| 204 |
if (!title.isEmpty()) |
| 205 |
return returnString(title); |
| 206 |
|
| 185 |
return returnString(coreObject->accessibilityDescription()); |
207 |
return returnString(coreObject->accessibilityDescription()); |
| 186 |
} |
208 |
} |
| 187 |
|
209 |
|
| 188 |
- |
|
|