Diff
Modified: trunk/LayoutTests/ChangeLog (112988 => 112989)
--- trunk/LayoutTests/ChangeLog 2012-04-03 07:14:51 UTC (rev 112988)
+++ trunk/LayoutTests/ChangeLog 2012-04-03 07:15:37 UTC (rev 112989)
@@ -1,3 +1,13 @@
+2012-04-03 Chris Fleizach <[email protected]>
+
+ AX: search field on Google.com does not have the AXSearchField subrole
+ https://bugs.webkit.org/show_bug.cgi?id=82819
+
+ Reviewed by Darin Adler.
+
+ * platform/mac/accessibility/search-subrole-expected.txt: Added.
+ * platform/mac/accessibility/search-subrole.html: Added.
+
2012-04-02 Adam Barth <[email protected]>
Implement <iframe srcdoc>
Added: trunk/LayoutTests/platform/mac/accessibility/search-subrole-expected.txt (0 => 112989)
--- trunk/LayoutTests/platform/mac/accessibility/search-subrole-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-subrole-expected.txt 2012-04-03 07:15:37 UTC (rev 112989)
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+This tests that we can detect a search field based on a few heuristics.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS search.subrole is 'AXSubrole: AXSearchField'
+PASS search.subrole is 'AXSubrole: AXSearchField'
+PASS search.subrole is 'AXSubrole: AXSearchField'
+PASS search.subrole is 'AXSubrole: AXSearchField'
+PASS search.subrole is 'AXSubrole: AXSearchField'
+PASS search.subrole is 'AXSubrole: AXSearchField'
+PASS search.subrole is 'AXSubrole: AXSearchField'
+PASS nosearch.subrole is 'AXSubrole: '
+PASS nosearch.subrole is 'AXSubrole: '
+PASS nosearch.subrole is 'AXSubrole: '
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/search-subrole.html (0 => 112989)
--- trunk/LayoutTests/platform/mac/accessibility/search-subrole.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-subrole.html 2012-04-03 07:15:37 UTC (rev 112989)
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<input type="search" id="search1"><br>
+
+<input type="text" name="search" id="search2"><br>
+
+<form action=""
+<input type="text" id="search3">
+</form>
+
+<form name="searchme" action=""
+<input type="text" id="search4">
+</form>
+
+<form name="Searchme" action=""
+<input type="text" id="search5">
+</form>
+
+<form action=""
+<input type="text" id="search6">
+</form>
+
+<input type="text" id="search7" name="SEarch">
+
+<form name="/" action=""
+<input type="text" id="nosearch1">
+</form>
+
+<input type="text" id="nosearch2">
+
+<input type="text" id="nosearch3" name="textonly">
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that we can detect a search field based on a few heuristics.");
+
+ if (window.accessibilityController) {
+
+ for (var k = 1; k <= 7; k++) {
+ document.getElementById("search" + k).focus();
+ var search = accessibilityController.focusedElement;
+ shouldBe("search.subrole", "'AXSubrole: AXSearchField'");
+ }
+
+ for (var k = 1; k <= 3; k++) {
+ document.getElementById("nosearch" + k).focus();
+ var nosearch = accessibilityController.focusedElement;
+ shouldBe("nosearch.subrole", "'AXSubrole: '");
+ }
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (112988 => 112989)
--- trunk/Source/WebCore/ChangeLog 2012-04-03 07:14:51 UTC (rev 112988)
+++ trunk/Source/WebCore/ChangeLog 2012-04-03 07:15:37 UTC (rev 112989)
@@ -1,3 +1,24 @@
+2012-04-02 Chris Fleizach <[email protected]>
+
+ AX: search field on Google.com does not have the AXSearchField subrole
+ https://bugs.webkit.org/show_bug.cgi?id=82819
+
+ Reviewed by Darin Adler.
+
+ Detect search fields when possible for accessibility.
+
+ Test: platform/mac/accessibility/search-subrole.html
+
+ * accessibility/AccessibilityObject.h:
+ (WebCore::AccessibilityObject::isSearchField):
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::isSearchField):
+ (WebCore):
+ * accessibility/AccessibilityRenderObject.h:
+ (AccessibilityRenderObject):
+ * accessibility/mac/WebAccessibilityObjectWrapper.mm:
+ (-[WebAccessibilityObjectWrapper subrole]):
+
2012-04-02 Kent Tamura <[email protected]>
Introduce another file-to-array script
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (112988 => 112989)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2012-04-03 07:14:51 UTC (rev 112988)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2012-04-03 07:15:37 UTC (rev 112989)
@@ -331,6 +331,7 @@
virtual bool isImageButton() const { return false; }
virtual bool isPasswordField() const { return false; }
virtual bool isNativeTextControl() const { return false; }
+ virtual bool isSearchField() const { return false; }
virtual bool isWebArea() const { return false; }
virtual bool isCheckbox() const { return roleValue() == CheckBoxRole; }
virtual bool isRadioButton() const { return roleValue() == RadioButtonRole; }
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (112988 => 112989)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-04-03 07:14:51 UTC (rev 112988)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2012-04-03 07:15:37 UTC (rev 112989)
@@ -491,6 +491,35 @@
return m_renderer->isTextControl();
}
+bool AccessibilityRenderObject::isSearchField() const
+{
+ if (!node())
+ return false;
+
+ HTMLInputElement* inputElement = node()->toInputElement();
+ if (!inputElement)
+ return false;
+
+ if (inputElement->isSearchField())
+ return true;
+
+ // Some websites don't label their search fields as such. However, they will
+ // use the word "search" in either the form or input type. This won't catch every case,
+ // but it will catch google.com for example.
+
+ // Check the node name of the input type, sometimes it's "search".
+ const AtomicString& nameAttribute = getAttribute(nameAttr);
+ if (nameAttribute.contains("search", false))
+ return true;
+
+ // Check the form action and the name, which will sometimes be "search".
+ HTMLFormElement* form = inputElement->form();
+ if (form && (form->name().contains("search", false) || form->action().contains("search", false)))
+ return true;
+
+ return false;
+}
+
bool AccessibilityRenderObject::isNativeImage() const
{
return m_renderer->isBoxModelObject() && toRenderBoxModelObject(m_renderer)->isImage();
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h (112988 => 112989)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2012-04-03 07:14:51 UTC (rev 112988)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h 2012-04-03 07:15:37 UTC (rev 112989)
@@ -73,6 +73,7 @@
virtual bool isNativeImage() const;
virtual bool isPasswordField() const;
virtual bool isNativeTextControl() const;
+ virtual bool isSearchField() const;
virtual bool isWebArea() const;
virtual bool isFileUploadButton() const;
virtual bool isInputImage() const;
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm (112988 => 112989)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm 2012-04-03 07:14:51 UTC (rev 112988)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm 2012-04-03 07:15:37 UTC (rev 112989)
@@ -1584,6 +1584,8 @@
{
if (m_object->isPasswordField())
return NSAccessibilitySecureTextFieldSubrole;
+ if (m_object->isSearchField())
+ return NSAccessibilitySearchFieldSubrole;
if (m_object->isAttachment()) {
NSView* attachView = [self attachmentView];