[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:50:15 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 64031e0f6cb13383ec18e9f32c72f517ceb52711
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 22 23:07:56 2009 +0000

    2009-10-22  Joanmarie Diggs  <joanmarie.diggs at gmail.com>
    
            Reviewed by Xan Lopez.
    
            https://bugs.webkit.org/show_bug.cgi?id=25530
            [Gtk] Implement LABEL_FOR/LABELLED_BY relationship pair for labels
    
            Implements atk_object_ref_relation_set and LABEL_FOR/LABELLED_BY.
            Also causes the accessible name for labeled controls to be based on
            the label as expected, rather than based on the contents.
    
            * accessibility/AccessibilityRenderObject.h:
            * accessibility/AccessibilityRenderObject.cpp:
            (correspondingLabelForControlElement):
            * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
            (setAtkRelationSetFromCoreObject):
            (webkit_accessible_ref_relation_set):
            (webkit_accessible_class_init):
            (webkit_accessible_get_name):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49958 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2aea895..6544d04 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-10-22  Joanmarie Diggs  <joanmarie.diggs at gmail.com>
+ 
+        Reviewed by Xan Lopez.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25530
+        [Gtk] Implement LABEL_FOR/LABELLED_BY relationship pair for labels
+
+        Implements atk_object_ref_relation_set and LABEL_FOR/LABELLED_BY.
+        Also causes the accessible name for labeled controls to be based on
+        the label as expected, rather than based on the contents.
+
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (correspondingLabelForControlElement):
+        * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp:
+        (setAtkRelationSetFromCoreObject):
+        (webkit_accessible_ref_relation_set):
+        (webkit_accessible_class_init):
+        (webkit_accessible_get_name):
+
 2009-10-22  Joseph Pecoraro  <joepeck at webkit.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index 834e931..ef06a82 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -2212,6 +2212,21 @@ AccessibilityObject* AccessibilityRenderObject::correspondingControlForLabelElem
     return axObjectCache()->getOrCreate(correspondingControl->renderer());     
 }
 
+AccessibilityObject* AccessibilityRenderObject::correspondingLabelForControlElement() const
+{
+    if (!m_renderer)
+        return 0;
+
+    Node* node = m_renderer->node();
+    if (node && node->isHTMLElement()) {
+        HTMLLabelElement* label = labelForElement(static_cast<Element*>(node));
+        if (label)
+            return axObjectCache()->getOrCreate(label->renderer());
+    }
+
+    return 0;
+}
+
 AccessibilityObject* AccessibilityRenderObject::observableObject() const
 {
     for (RenderObject* renderer = m_renderer; renderer && renderer->node(); renderer = renderer->parent()) {
diff --git a/WebCore/accessibility/AccessibilityRenderObject.h b/WebCore/accessibility/AccessibilityRenderObject.h
index d82ca71..c6fd748 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.h
+++ b/WebCore/accessibility/AccessibilityRenderObject.h
@@ -134,6 +134,7 @@ public:
     virtual bool exposesTitleUIElement() const;
     virtual AccessibilityObject* titleUIElement() const;
     virtual AccessibilityObject* correspondingControlForLabelElement() const;
+    virtual AccessibilityObject* correspondingLabelForControlElement() const;
 
     virtual AccessibilityRole ariaRoleAttribute() const;
     virtual bool isPresentationalChildOfAriaRole() const;
diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
index 4dfb1c5..f0d9bfe 100644
--- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
+++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp
@@ -122,7 +122,21 @@ static AccessibilityObject* core(AtkImage* image)
 
 static const gchar* webkit_accessible_get_name(AtkObject* object)
 {
-    return returnString(core(object)->stringValue());
+    AccessibilityObject* coreObject = core(object);
+    if (coreObject->isControl()) {
+        AccessibilityRenderObject* renderObject = static_cast<AccessibilityRenderObject*>(coreObject);
+        AccessibilityObject* label = renderObject->correspondingLabelForControlElement();
+        if (label) {
+            AccessibilityRenderObject::AccessibilityChildrenVector children = label->children();
+            // Currently, label->stringValue() should be an empty String. This
+            // might not be the case down the road.
+            String name = label->stringValue();
+            for (unsigned i = 0; i < children.size(); ++i)
+                name += children.at(i).get()->stringValue();
+            return returnString(name);
+        }
+    }
+    return returnString(coreObject->stringValue());
 }
 
 static const gchar* webkit_accessible_get_description(AtkObject* object)
@@ -132,6 +146,20 @@ static const gchar* webkit_accessible_get_description(AtkObject* object)
     return returnString(core(object)->accessibilityDescription());
 }
 
+static void setAtkRelationSetFromCoreObject(AccessibilityObject* coreObject, AtkRelationSet* relationSet)
+{
+    AccessibilityRenderObject* accObject = static_cast<AccessibilityRenderObject*>(coreObject);
+    if (accObject->isControl()) {
+        AccessibilityObject* label = accObject->correspondingLabelForControlElement();
+        if (label)
+            atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, label->wrapper());
+    } else {
+        AccessibilityObject* control = accObject->correspondingControlForLabelElement();
+        if (control)
+            atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABEL_FOR, control->wrapper());
+    }
+}
+
 static gpointer webkit_accessible_parent_class = NULL;
 
 static AtkObject* webkit_accessible_get_parent(AtkObject* object)
@@ -421,6 +449,16 @@ static AtkStateSet* webkit_accessible_ref_state_set(AtkObject* object)
     return stateSet;
 }
 
+static AtkRelationSet* webkit_accessible_ref_relation_set(AtkObject* object)
+{
+    AtkRelationSet* relationSet = ATK_OBJECT_CLASS(webkit_accessible_parent_class)->ref_relation_set(object);
+    AccessibilityObject* coreObject = core(object);
+
+    setAtkRelationSetFromCoreObject(coreObject, relationSet);
+
+    return relationSet;
+}
+
 static void webkit_accessible_init(AtkObject* object, gpointer data)
 {
     if (ATK_OBJECT_CLASS(webkit_accessible_parent_class)->initialize)
@@ -455,6 +493,7 @@ static void webkit_accessible_class_init(AtkObjectClass* klass)
     klass->ref_state_set = webkit_accessible_ref_state_set;
     klass->get_index_in_parent = webkit_accessible_get_index_in_parent;
     klass->get_attributes = webkit_accessible_get_attributes;
+    klass->ref_relation_set = webkit_accessible_ref_relation_set;
 }
 
 GType

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list