2009-11-12 Joanmarie Diggs <joanmarie.diggs@gmail.com>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Nov 2009 01:59:51 +0000 (01:59 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Nov 2009 01:59:51 +0000 (01:59 +0000)
        Reviewed by Gustavo Noronha Silva.

        https://bugs.webkit.org/show_bug.cgi?id=30997
        [Gtk] Implemment AtkDocument

        Added testing support for AtkDocument implementation.

        * accessibility/document-attributes.html: Added.
        * accessibility/document-attributes-expected.txt: Added.
        * platform/mac/Skipped:
        * platform/win/Skipped:
2009-11-12  Joanmarie Diggs  <joanmarie.diggs@gmail.com>

        Reviewed by Gustavo Noronha Silva.

        https://bugs.webkit.org/show_bug.cgi?id=30997
        [Gtk] Implemment AtkDocument

        Added testing support.

        * DumpRenderTree/AccessibilityUIElement.cpp:
        * DumpRenderTree/AccessibilityUIElement.h:
        (getDocumentEncodingCallback):
        (getDocumentURICallback):
        (AccessibilityUIElement::getJSClass):
        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
        (AccessibilityUIElement::documentEncoding):
        (AccessibilityUIElement::documentURI):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@50921 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/accessibility/document-attributes-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/document-attributes.html [new file with mode: 0644]
LayoutTests/platform/mac/Skipped
LayoutTests/platform/win/Skipped
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
WebKitTools/DumpRenderTree/AccessibilityUIElement.h
WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp

index bca520c79990a0d41ab6e9454dddb5e2ea01aadd..9adda7da6be4f0614b338dd1631b5893633a469d 100644 (file)
@@ -1,3 +1,17 @@
+2009-11-12  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30997
+        [Gtk] Implemment AtkDocument
+
+        Added testing support for AtkDocument implementation.
+
+        * accessibility/document-attributes.html: Added.
+        * accessibility/document-attributes-expected.txt: Added.
+        * platform/mac/Skipped:
+        * platform/win/Skipped:
+
 2009-11-11  Dirk Schulze  <krit@webkit.org>
 
         Reviewed by Simon Fraser.
diff --git a/LayoutTests/accessibility/document-attributes-expected.txt b/LayoutTests/accessibility/document-attributes-expected.txt
new file mode 100644 (file)
index 0000000..863339f
--- /dev/null
@@ -0,0 +1 @@
+Passed
diff --git a/LayoutTests/accessibility/document-attributes.html b/LayoutTests/accessibility/document-attributes.html
new file mode 100644 (file)
index 0000000..cf46bd8
--- /dev/null
@@ -0,0 +1,30 @@
+<html>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+</script>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+<body id="body">
+    <!-- This tests the exposure of a document's encoding and URI to assistive technologies -->
+    <div id="result"></div>
+    <script>
+        if (window.accessibilityController) {
+            var body = document.getElementById("body");
+            body.focus();
+            var webArea = accessibilityController.focusedElement;
+            var result = document.getElementById("result");
+
+            var documentEncoding = webArea.documentEncoding;
+            var documentURI = webArea.documentURI;
+
+            if (documentEncoding == "UTF-8" && documentURI == location.href) {
+               result.innerText = "Passed";
+            }
+            else {
+               result.innerText = "Failed:\nExpected: UTF-8 and " + location.href + ".\nActual: " + documentEncoding + " and " + documentURI + ".";
+            }
+        }
+    </script>
+</body>
+</html>
index 9c9cee7aa38ef388ec3ce5d920ca5d90075e3066..2d61bf8841939070c07fa68192cee9fa4c163823 100644 (file)
@@ -98,3 +98,6 @@ fast/ruby
 
 # Missing SocketStreamHandle implementation
 websocket/tests
+
+# Accessibility tests without results
+accessibility/document-attributes.html
index 0a460d1d2bf78b8d8c1319cbc2859e1d7bbbf2cf..5bfbf05472cc9aa64382c0c329b64823efd91108 100644 (file)
@@ -371,6 +371,7 @@ accessibility/aria-tables.html
 accessibility/aria-tab-roles.html
 accessibility/button-press-action.html
 accessibility/canvas.html
+accessibility/document-attributes.html
 accessibility/editable-webarea-context-menu-point.html
 accessibility/iframe-bastardization.html
 accessibility/ignore-spacer-elements.html
index 02bd387869c07b28ddccb79ba34246e5569e9b01..4f13791575a3625fea2c4f7876cd4bcf80e1bde6 100644 (file)
@@ -1,3 +1,23 @@
+2009-11-12  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
+
+        Reviewed by Gustavo Noronha Silva.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30997
+        [Gtk] Implemment AtkDocument
+
+        Added testing support.
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        * DumpRenderTree/AccessibilityUIElement.h:
+        (getDocumentEncodingCallback):
+        (getDocumentURICallback):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+        (AccessibilityUIElement::documentEncoding):
+        (AccessibilityUIElement::documentURI):
+
 2009-11-12  Adam Roben  <aroben@apple.com>
 
         Replace worldIDs with world objects
index eafe61e7a3f31ac1d7d31dc3c4308a85dd799fa9..24a5429e0303022cd30cbd65114978c0ec28ad0a 100644 (file)
@@ -429,6 +429,18 @@ static JSValueRef getAccessibilityValueCallback(JSContextRef context, JSObjectRe
     return JSValueMakeString(context, accessibilityValue.get());
 }
 
+static JSValueRef getDocumentEncodingCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    JSRetainPtr<JSStringRef> documentEncoding(Adopt, toAXElement(thisObject)->documentEncoding());
+    return JSValueMakeString(context, documentEncoding.get());
+}
+
+static JSValueRef getDocumentURICallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    JSRetainPtr<JSStringRef> documentURI(Adopt, toAXElement(thisObject)->documentURI());
+    return JSValueMakeString(context, documentURI.get());
+}
+
 // Destruction
 
 static void finalize(JSObjectRef thisObject)
@@ -471,6 +483,8 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "isExpanded", getIsExpandedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "valueDescription", getValueDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "hierarchicalLevel", hierarchicalLevelCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "documentEncoding", getDocumentEncodingCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "documentURI", getDocumentURICallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0, 0 }
     };
 
index 8800cbe5079183a5fdea02fbced10cc708bf5462..289ff1c959cae464d0041fc6844c57cc1f1cc429 100644 (file)
@@ -112,6 +112,8 @@ public:
     int hierarchicalLevel() const;
     double clickPointX();
     double clickPointY();
+    JSStringRef documentEncoding();
+    JSStringRef documentURI();
 
     // Table-specific attributes
     JSStringRef attributesOfColumnHeaders();
index c1bf07d0b06cd800b6f4e8a3f608935fd0c09828..8984630a30f65daf726c1393b138ae3aa9d35fab 100644 (file)
@@ -476,3 +476,21 @@ JSStringRef AccessibilityUIElement::accessibilityValue() const
     // FIXME: implement
     return JSStringCreateWithCharacters(0, 0);
 }
+
+JSStringRef AccessibilityUIElement::documentEncoding()
+{
+    AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
+    if (role != ATK_ROLE_DOCUMENT_FRAME)
+        return JSStringCreateWithCharacters(0, 0);
+
+    return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "Encoding"));
+}
+
+JSStringRef AccessibilityUIElement::documentURI()
+{
+    AtkRole role = atk_object_get_role(ATK_OBJECT(m_element));
+    if (role != ATK_ROLE_DOCUMENT_FRAME)
+        return JSStringCreateWithCharacters(0, 0);
+
+    return JSStringCreateWithUTF8CString(atk_document_get_attribute_value(ATK_DOCUMENT(m_element), "URI"));
+}
index 7762f75891ea5da7fe3ad686e9ba6fa888873180..950b6efbe62b4ab934fb9608463ce12deca54da2 100644 (file)
@@ -639,3 +639,13 @@ JSStringRef AccessibilityUIElement::accessibilityValue() const
     // FIXME: implement
     return JSStringCreateWithCharacters(0, 0);
 }
+
+JSStringRef AccessibilityUIElement::documentEncoding()
+{
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::documentURI()
+{
+    return JSStringCreateWithCharacters(0, 0);
+}
index 8e20078f3279af661b631853a29fb72b5229fc0c..0afa89bbc1bf0158e25265f6acfc96af07b29083 100644 (file)
@@ -431,3 +431,14 @@ JSStringRef AccessibilityUIElement::accessibilityValue() const
 
     return JSStringCreateWithCharacters(value.data(), value.length());
 }
+
+
+JSStringRef AccessibilityUIElement::documentEncoding()
+{
+    return JSStringCreateWithCharacters(0, 0);
+}
+
+JSStringRef AccessibilityUIElement::documentURI()
+{
+    return JSStringCreateWithCharacters(0, 0);
+}