Skip to content

Commit 01fc7a1

Browse files
author
David Harrison
committed
Reviewed by Geoff.
<rdar://problem/4416432> Radio buttons and Checkboxes in AXWebAreas don't fill in their AXTitle attribute * bridge/mac/WebCoreAXObject.mm: (labelForElement): New. Returns the HTMLLabelElement, if any, for the specified Element. (-[WebCoreAXObject title]): For input elements, return the innerHTML() of the labelForElement(). Canonical link: https://commits.webkit.org/13438@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16042 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 99bf73c commit 01fc7a1

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

WebCore/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2006-08-25 David Harrison <harrison@apple.com>
2+
3+
Reviewed by Geoff.
4+
5+
<rdar://problem/4416432> Radio buttons and Checkboxes in AXWebAreas don't fill in their AXTitle attribute
6+
7+
* bridge/mac/WebCoreAXObject.mm:
8+
(labelForElement):
9+
New. Returns the HTMLLabelElement, if any, for the specified Element.
10+
11+
(-[WebCoreAXObject title]):
12+
For input elements, return the innerHTML() of the labelForElement().
13+
114
2006-08-25 Brady Eidson <beidson@apple.com>
215

316
Reviewed by Tim Hatcher

WebCore/bridge/mac/WebCoreAXObject.mm

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#import "htmlediting.h"
3737
#import "HTMLFrameElement.h"
3838
#import "HTMLInputElement.h"
39+
#import "HTMLLabelElement.h"
3940
#import "HTMLMapElement.h"
4041
#import "HTMLNames.h"
4142
#import "HTMLSelectElement.h"
@@ -563,20 +564,40 @@ -(id)value
563564
return nil;
564565
}
565566

567+
static HTMLLabelElement* labelForElement(Element* element)
568+
{
569+
RefPtr<NodeList> list = element->document()->getElementsByTagName("label");
570+
unsigned len = list->length();
571+
for (unsigned i = 0; i < len; i++) {
572+
HTMLLabelElement* label = static_cast<HTMLLabelElement*>(list->item(i));
573+
if (label->formElement() == element)
574+
return label;
575+
}
576+
577+
return 0;
578+
}
579+
566580
-(NSString*)title
567581
{
568582
if (!m_renderer || m_areaElement || !m_renderer->element())
569583
return nil;
570584

571585
if (m_renderer->element()->hasTagName(buttonTag))
572586
return [self textUnderElement];
587+
573588
if (m_renderer->element()->hasTagName(inputTag)) {
574589
HTMLInputElement* input = static_cast<HTMLInputElement*>(m_renderer->element());
575590
if (input->isTextButton())
576591
return input->value();
592+
593+
HTMLLabelElement* label = labelForElement(input);
594+
if (label)
595+
return label->innerText();
577596
}
597+
578598
if (m_renderer->element()->isLink())
579599
return [self textUnderElement];
600+
580601
if ([self isAttachment])
581602
return [[self attachmentView] accessibilityAttributeValue:NSAccessibilityTitleAttribute];
582603

0 commit comments

Comments
 (0)