[Webkit-unassigned] [Bug 25530] [Gtk] Implement LABEL_FOR/LABELLED_BY relationship pair for labels

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 21 14:02:39 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=25530


Xan Lopez <xan.lopez at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #41596|review?                     |review-
               Flag|                            |




--- Comment #11 from Xan Lopez <xan.lopez at gmail.com>  2009-10-21 14:02:39 PDT ---
(From update of attachment 41596)
> diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
> index 834e931..9c1122b 100644
> --- a/WebCore/accessibility/AccessibilityRenderObject.cpp
> +++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
> @@ -930,6 +930,35 @@ static HTMLLabelElement* labelForElement(Element* element)
>      
>      return 0;
>  }
> +
> +AccessibilityObject* AccessibilityRenderObject::labelForControl() 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 firstAccessibleObjectFromNode(static_cast<Node*>(label));
> +    }
> +
> +    return 0;
> +}
> +
> +AccessibilityObject* AccessibilityRenderObject::controlForLabel() const
> +{
> +    if (!m_renderer)
> +        return 0;
> +
> +    Node* node = m_renderer->node();
> +    if (node && node->hasTagName(labelTag)) {
> +        HTMLLabelElement* label = static_cast<HTMLLabelElement*>(node);
> +        return firstAccessibleObjectFromNode(static_cast<Node*>(label->correspondingControl()));
> +    }
> +
> +    return 0;
> +}

I think I prefer to have this as private functions in our code, since they seem
somewhat tied to ATK functionality. We can later ask the other ports using a11y
if they think this would be useful for them, and we can put it in the
crossplatform code.


> +static void setAtkRelationSetFromCoreObject(AccessibilityObject* coreObject, AtkRelationSet* relationSet)
> +{
> +    AccessibilityRenderObject* accObject = static_cast<AccessibilityRenderObject*>(coreObject);
> +    if (accObject->isControl()) {
> +        AccessibilityObject* label = accObject->labelForControl();
> +        if (label) {
> +            AtkObject* atkLabel = label->wrapper();
> +            atk_relation_set_add_relation_by_type(relationSet, ATK_RELATION_LABELLED_BY, atkLabel);
> +        }
> +    }
> +    else {

The 'else {' goes in the same line than the '}'.

Looks good to me otherwise, marking r- while we change those two details.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list