[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

jhoneycutt at apple.com jhoneycutt at apple.com
Thu Oct 29 20:51:01 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 39e86ed235854bfcc6505cac29c1bf367a996447
Author: jhoneycutt at apple.com <jhoneycutt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 23 22:16:33 2009 +0000

    MSAA: Name for image elements should use alt attribute text
    
    https://bugs.webkit.org/show_bug.cgi?id=30727
    <rdar://problem/7328291>
    
    Reviewed by Alice Liu.
    
    WebKit/win:
    
    * AccessibleBase.cpp:
    (AccessibleBase::createInstance):
    If the AccessibilityObject is an image, return an AccessibleImage.
    
    * AccessibleImage.cpp: Added.
    (AccessibleImage::AccessibleImage):
    Call the base constructor.
    (AccessibleImage::name):
    If the object is not an AccessibilityRenderObject, return the base's
    name(). Look first for an ARIA "labeled-by" attribute, then look for an
    alternate text attribute. Fall back to the base's name().
    
    * AccessibleImage.h: Added.
    (AccessibleImage::~AccessibleImage):
    
    * WebKit.vcproj/WebKit.vcproj:
    Add AccessibleImage to the project.
    
    LayoutTests:
    
    * platform/win/accessibility/img-alt-attribute-expected.txt: Added.
    * platform/win/accessibility/img-alt-attribute.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50004 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a1b1370..bb97606 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-23  Jon Honeycutt  <jhoneycutt at apple.com>
+
+        MSAA: Name for image elements should use alt attribute text
+
+        https://bugs.webkit.org/show_bug.cgi?id=30727
+        <rdar://problem/7328291>
+
+        Reviewed by Alice Liu.
+
+        * platform/win/accessibility/img-alt-attribute-expected.txt: Added.
+        * platform/win/accessibility/img-alt-attribute.html: Added.
+
 2009-10-23  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Anders Carlsson.
diff --git a/LayoutTests/platform/win/accessibility/img-alt-attribute-expected.txt b/LayoutTests/platform/win/accessibility/img-alt-attribute-expected.txt
new file mode 100644
index 0000000..bfb5a79
--- /dev/null
+++ b/LayoutTests/platform/win/accessibility/img-alt-attribute-expected.txt
@@ -0,0 +1,7 @@
+  
+
+This test verifies that, on Windows, an img tag's alt text is returned for the element's 'title' property when the element has no ARIA name.
+
+PASS e.title is "ARIA labeled-by name"
+PASS e.title is "alternate text"
+
diff --git a/LayoutTests/platform/win/accessibility/img-alt-attribute.html b/LayoutTests/platform/win/accessibility/img-alt-attribute.html
new file mode 100644
index 0000000..910164d
--- /dev/null
+++ b/LayoutTests/platform/win/accessibility/img-alt-attribute.html
@@ -0,0 +1,37 @@
+<html>
+    <head>
+        <link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+        <script src="../../../fast/js/resources/js-test-pre.js"></script>
+
+        <script>
+            if (window.layoutTestController)
+                layoutTestController.dumpAsText();
+        </script>
+    </head>
+    <body id="body">
+        <img aria-labeledby="desc" alt="alternate text" title="title">
+        <img alt="alternate text" title="title">
+
+        <p id="desc" style="visibility: hidden">ARIA labeled-by name</p>
+
+        <p>
+            This test verifies that, on Windows, an img tag's alt text is
+            returned for the element's 'title' property when the element has no
+            ARIA name.
+        </p>
+
+        <p id="console"></p>
+
+        <script>
+            if (window.accessibilityController) {
+                document.getElementById("body").focus();
+
+                var e = accessibilityController.focusedElement.childAtIndex(0);
+                shouldBe('e.title', '"ARIA labeled-by name"');
+
+                e = accessibilityController.focusedElement.childAtIndex(1);
+                shouldBe('e.title', '"alternate text"');
+            }
+        </script>
+    </body>
+</html>
diff --git a/WebKit/win/AccessibleBase.cpp b/WebKit/win/AccessibleBase.cpp
index d02ec7e..55cbab3 100644
--- a/WebKit/win/AccessibleBase.cpp
+++ b/WebKit/win/AccessibleBase.cpp
@@ -27,7 +27,8 @@
 #include "WebKitDLL.h"
 #include "AccessibleBase.h"
 
-#include <oleacc.h>
+#include "AccessibleImage.h"
+#include "WebView.h"
 #include <WebCore/AccessibilityObject.h>
 #include <WebCore/AXObjectCache.h>
 #include <WebCore/BString.h>
@@ -43,7 +44,7 @@
 #include <WebCore/RenderFrame.h>
 #include <WebCore/RenderObject.h>
 #include <WebCore/RenderView.h>
-#include "WebView.h"
+#include <oleacc.h>
 #include <wtf/RefPtr.h>
 
 using namespace WebCore;
@@ -68,6 +69,9 @@ AccessibleBase* AccessibleBase::createInstance(AccessibilityObject* obj)
 {
     ASSERT_ARG(obj, obj);
 
+    if (obj->isImage())
+        return new AccessibleImage(obj);
+
     return new AccessibleBase(obj);
 }
 
diff --git a/WebKit/win/AccessibleImage.cpp b/WebKit/win/AccessibleImage.cpp
new file mode 100644
index 0000000..4b080b2
--- /dev/null
+++ b/WebKit/win/AccessibleImage.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "AccessibleImage.h"
+
+#include <WebCore/AccessibilityRenderObject.h>
+#include <WebCore/HTMLNames.h>
+
+using namespace WebCore;
+using namespace WebCore::HTMLNames;
+
+AccessibleImage::AccessibleImage(AccessibilityObject* obj)
+    : AccessibleBase(obj)
+{
+    ASSERT_ARG(obj, obj->isImage());
+    ASSERT_ARG(obj, obj->isAccessibilityRenderObject());
+}
+
+String AccessibleImage::name() const
+{
+    if (!m_object->isAccessibilityRenderObject())
+        return AccessibleBase::name();
+
+    AccessibilityRenderObject* obj = static_cast<AccessibilityRenderObject*>(m_object);
+
+    String ariaLabel = obj->ariaLabeledByAttribute();
+    if (!ariaLabel.isEmpty())
+        return ariaLabel;
+
+    const AtomicString& altText = obj->getAttribute(HTMLNames::altAttr);
+    if (!altText.isEmpty())
+        return altText;
+
+    return AccessibleBase::name();
+}
diff --git a/WebKit/win/AccessibleImage.h b/WebKit/win/AccessibleImage.h
new file mode 100644
index 0000000..0c111e2
--- /dev/null
+++ b/WebKit/win/AccessibleImage.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef AccessibleImage_h
+#define AccessibleImage_h
+
+#include "AccessibleBase.h"
+
+class AccessibleImage : public AccessibleBase
+{
+public:
+    AccessibleImage(WebCore::AccessibilityObject*);
+    virtual ~AccessibleImage() { }
+
+private:
+    virtual WebCore::String name() const;
+};
+
+#endif // AccessibleImage_h
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 5e27a3f..657b70d 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,30 @@
+2009-10-23  Jon Honeycutt  <jhoneycutt at apple.com>
+
+        MSAA: Name for image elements should use alt attribute text
+
+        https://bugs.webkit.org/show_bug.cgi?id=30727
+        <rdar://problem/7328291>
+
+        Reviewed by Alice Liu.
+
+        * AccessibleBase.cpp:
+        (AccessibleBase::createInstance):
+        If the AccessibilityObject is an image, return an AccessibleImage.
+
+        * AccessibleImage.cpp: Added.
+        (AccessibleImage::AccessibleImage):
+        Call the base constructor.
+        (AccessibleImage::name):
+        If the object is not an AccessibilityRenderObject, return the base's
+        name(). Look first for an ARIA "labeled-by" attribute, then look for an
+        alternate text attribute. Fall back to the base's name().
+
+        * AccessibleImage.h: Added.
+        (AccessibleImage::~AccessibleImage):
+
+        * WebKit.vcproj/WebKit.vcproj:
+        Add AccessibleImage to the project.
+
 2009-10-23  Sam Weinig  <sam at webkit.org>
 
         Try and fix the windows build.
diff --git a/WebKit/win/WebKit.vcproj/WebKit.vcproj b/WebKit/win/WebKit.vcproj/WebKit.vcproj
index 0497111..b292c8a 100644
--- a/WebKit/win/WebKit.vcproj/WebKit.vcproj
+++ b/WebKit/win/WebKit.vcproj/WebKit.vcproj
@@ -526,6 +526,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\AccessibleImage.h"
+				>
+			</File>
+			<File
 				RelativePath=".\autoversion.h"
 				>
 			</File>
@@ -842,6 +846,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\AccessibleImage.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\CFDictionaryPropertyBag.cpp"
 				>
 			</File>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list