Commit 47955bfa authored by cfleizach@apple.com's avatar cfleizach@apple.com

AX: isNativeCheckbox does not work as advertised

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

Re-adding this patch after it was erroneously rolled out.

WebCore: 

Test: platform/mac/accessibility/native-vs-nonnative-checkboxes.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isInputImage):
(WebCore::AccessibilityRenderObject::isNativeCheckboxOrRadio):
* dom/InputElement.h:
* html/HTMLInputElement.h:
(WebCore::HTMLInputElement::isCheckbox):

LayoutTests: 

* platform/mac/accessibility/native-vs-nonnative-checkboxes-expected.txt: Added.
* platform/mac/accessibility/native-vs-nonnative-checkboxes.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1e5db771
2010-08-13 Chris Fleizach <cfleizach@apple.com>
AX: isNativeCheckbox does not work as advertised
https://bugs.webkit.org/show_bug.cgi?id=43872
Re-adding this patch after it was erroneously rolled out.
* platform/mac/accessibility/native-vs-nonnative-checkboxes-expected.txt: Added.
* platform/mac/accessibility/native-vs-nonnative-checkboxes.html: Added.
2010-08-11 Zhenyao Mo <zmo@google.com>
Reviewed by Dimitri Glazkov.
check1
check2
check2
This tests that input types masquerading as checkboxes will use the aria-checked values for its value.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS accessibilityController.focusedElement.intValue is 1
PASS accessibilityController.focusedElement.intValue is 0
PASS accessibilityController.focusedElement.intValue is 2
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
<script>
var successfullyParsed = false;
</script>
<script src="../../../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body">
<input type="image" role="checkbox" aria-checked="true" id="check1">check1<BR>
<input type="image" role="checkbox" aria-checked="mixed" id="check2">check2<BR>
<input type="image" role="checkbox" id="check3">check2<BR>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that input types masquerading as checkboxes will use the aria-checked values for its value.");
if (window.accessibilityController) {
// aria-state=true
document.getElementById("check1").focus();
shouldBe("accessibilityController.focusedElement.intValue", "1");
// aria-state=false
document.getElementById("check3").focus();
shouldBe("accessibilityController.focusedElement.intValue", "0");
// aria-state=mixed
document.getElementById("check2").focus();
shouldBe("accessibilityController.focusedElement.intValue", "2");
}
successfullyParsed = true;
</script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
2010-08-13 Chris Fleizach <cfleizach@apple.com>
AX: isNativeCheckbox does not work as advertised
https://bugs.webkit.org/show_bug.cgi?id=43872
Re-adding this patch after it was erroneously rolled out.
Test: platform/mac/accessibility/native-vs-nonnative-checkboxes.html
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isInputImage):
(WebCore::AccessibilityRenderObject::isNativeCheckboxOrRadio):
* dom/InputElement.h:
* html/HTMLInputElement.h:
(WebCore::HTMLInputElement::isCheckbox):
2010-08-13 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r65331.
......@@ -508,8 +508,9 @@ bool AccessibilityRenderObject::isFileUploadButton() const
bool AccessibilityRenderObject::isInputImage() const
{
if (m_renderer && m_renderer->node() && m_renderer->node()->hasTagName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(m_renderer->node());
Node* elementNode = node();
if (roleValue() == ButtonRole && elementNode && elementNode->hasTagName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(elementNode);
return input->inputType() == HTMLInputElement::IMAGE;
}
......@@ -591,8 +592,11 @@ bool AccessibilityRenderObject::isIndeterminate() const
bool AccessibilityRenderObject::isNativeCheckboxOrRadio() const
{
Node* elementNode = node();
if (elementNode && elementNode->isElementNode())
return toInputElement(static_cast<Element*>(elementNode));
if (elementNode && elementNode->isElementNode()) {
InputElement* input = toInputElement(static_cast<Element*>(elementNode));
if (input)
return input->isCheckbox() || input->isRadioButton();
}
return false;
}
......
......@@ -43,6 +43,9 @@ public:
virtual bool isPasswordField() const = 0;
virtual bool isSearchField() const = 0;
virtual bool isTextField() const = 0;
virtual bool isRadioButton() const = 0;
virtual bool isCheckbox() const = 0;
virtual bool supportsMaxLength() const = 0;
virtual bool hasSpinButton() const { return false; }
#if ENABLE(INPUT_SPEECH)
......
......@@ -101,6 +101,7 @@ public:
virtual bool isSearchField() const { return m_type == SEARCH; }
virtual bool isInputTypeHidden() const { return m_type == HIDDEN; }
virtual bool isPasswordField() const { return m_type == PASSWORD; }
virtual bool isCheckbox() const { return m_type == CHECKBOX; }
bool isTelephoneField() const { return m_type == TELEPHONE; }
bool isNumberField() const { return m_type == NUMBER; }
bool isEmailField() const { return m_type == EMAIL; }
......
......@@ -47,6 +47,7 @@ public:
virtual bool isIndeterminate() const { return false; }
virtual bool isTextFormControl() const { return true; }
virtual bool isRadioButton() const { return false; }
virtual bool isCheckbox() const { return false; }
virtual bool isTextField() const { return true; }
virtual bool isSearchField() const { return false; }
virtual bool isInputTypeHidden() const { return false; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment