Changeset 49958 in webkit
- Timestamp:
- Oct 22, 2009 4:07:56 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49956 r49958 1 2009-10-22 Joanmarie Diggs <joanmarie.diggs@gmail.com> 2 3 Reviewed by Xan Lopez. 4 5 https://bugs.webkit.org/show_bug.cgi?id=25530 6 [Gtk] Implement LABEL_FOR/LABELLED_BY relationship pair for labels 7 8 Implements atk_object_ref_relation_set and LABEL_FOR/LABELLED_BY. 9 Also causes the accessible name for labeled controls to be based on 10 the label as expected, rather than based on the contents. 11 12 * accessibility/AccessibilityRenderObject.h: 13 * accessibility/AccessibilityRenderObject.cpp: 14 (correspondingLabelForControlElement): 15 * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: 16 (setAtkRelationSetFromCoreObject): 17 (webkit_accessible_ref_relation_set): 18 (webkit_accessible_class_init): 19 (webkit_accessible_get_name): 20 1 21 2009-10-22 Joseph Pecoraro <joepeck@webkit.org> 2 22 -
trunk/WebCore/accessibility/AccessibilityRenderObject.cpp
r48521 r49958 2211 2211 2212 2212 return axObjectCache()->getOrCreate(correspondingControl->renderer()); 2213 } 2214 2215 AccessibilityObject* AccessibilityRenderObject::correspondingLabelForControlElement() const 2216 { 2217 if (!m_renderer) 2218 return 0; 2219 2220 Node* node = m_renderer->node(); 2221 if (node && node->isHTMLElement()) { 2222 HTMLLabelElement* label = labelForElement(static_cast<Element*>(node)); 2223 if (label) 2224 return axObjectCache()->getOrCreate(label->renderer()); 2225 } 2226 2227 return 0; 2213 2228 } 2214 2229 -
trunk/WebCore/accessibility/AccessibilityRenderObject.h
r48482 r49958 135 135 virtual AccessibilityObject* titleUIElement() const; 136 136 virtual AccessibilityObject* correspondingControlForLabelElement() const; 137 virtual AccessibilityObject* correspondingLabelForControlElement() const; 137 138 138 139 virtual AccessibilityRole ariaRoleAttribute() const; -
trunk/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
r49885 r49958 123 123 static const gchar* webkit_accessible_get_name(AtkObject* object) 124 124 { 125 return returnString(core(object)->stringValue()); 125 AccessibilityObject* coreObject = core(object); 126 if (coreObject->isControl()) { 127 AccessibilityRenderObject* renderObject = static_cast<AccessibilityRenderObject*>(coreObject); 128 AccessibilityObject* label = renderObject->correspondingLabelForControlElement(); 129 if (label) { 130 AccessibilityRenderObject::AccessibilityChildrenVector children = label->children(); 131 // Currently, label->stringValue() should be an empty String. This 132 // might not be the case down the road. 133 String name = label->stringValue(); 134 for (unsigned i = 0; i < children.size(); ++i) 135 name += children.at(i).get()->stringValue(); 136 return returnString(name); 137 } 138 } 139 return returnString(coreObject->stringValue()); 126 140 } 127 141 … … 131 145 // Should we do this too? 132 146 return returnString(core(object)->accessibilityDescription()); 147 } 148 149 static void setAtkRelationSetFromCoreObject(AccessibilityObject* coreObject, AtkRelationSet* relationSet) 150 { 151 AccessibilityRenderObject* accObject = static_cast<AccessibilityRenderObject*>(coreObject); 152 if (accObject->isControl()) { 153 AccessibilityObject* label = accObject->correspondingLabelForControlElement(); 154 if (label) 155 atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, label->wrapper()); 156 } else { 157 AccessibilityObject* control = accObject->correspondingControlForLabelElement(); 158 if (control) 159 atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, control->wrapper()); 160 } 133 161 } 134 162 … … 422 450 } 423 451 452 static AtkRelationSet* webkit_accessible_ref_relation_set(AtkObject* object) 453 { 454 AtkRelationSet* relationSet = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->ref_relation_set(object); 455 AccessibilityObject* coreObject = core(object); 456 457 setAtkRelationSetFromCoreObject(coreObject, relationSet); 458 459 return relationSet; 460 } 461 424 462 static void webkit_accessible_init(AtkObject* object, gpointer data) 425 463 { … … 456 494 klass->get_index_in_parent = webkit_accessible_get_index_in_parent; 457 495 klass->get_attributes = webkit_accessible_get_attributes; 496 klass->ref_relation_set = webkit_accessible_ref_relation_set; 458 497 } 459 498
Note: See TracChangeset
for help on using the changeset viewer.