[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

cfleizach at apple.com cfleizach at apple.com
Thu Apr 8 00:10:41 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b012c5eac8fe5794d2c5097d1a889be02fce78d7
Author: cfleizach at apple.com <cfleizach at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 2 04:40:18 2009 +0000

    WAI-ARIA: implement support for ARIA drag and drop
    https://bugs.webkit.org/show_bug.cgi?id=32007
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    Test: platform/mac/accessibility/aria-drag-drop.html
    
    * accessibility/AccessibilityObject.h:
    (WebCore::AccessibilityObject::supportsARIADropping):
    (WebCore::AccessibilityObject::supportsARIADragging):
    (WebCore::AccessibilityObject::isARIAGrabbed):
    (WebCore::AccessibilityObject::setARIAGrabbed):
    (WebCore::AccessibilityObject::determineARIADropEffects):
    * accessibility/AccessibilityRenderObject.cpp:
    (WebCore::AccessibilityRenderObject::supportsARIADropping):
    (WebCore::AccessibilityRenderObject::supportsARIADragging):
    (WebCore::AccessibilityRenderObject::isARIAGrabbed):
    (WebCore::AccessibilityRenderObject::setARIAGrabbed):
    (WebCore::AccessibilityRenderObject::determineARIADropEffects):
    * accessibility/AccessibilityRenderObject.h:
    * accessibility/mac/AccessibilityObjectWrapper.mm:
    (-[AccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
    (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
    (-[AccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
    (-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
    * html/HTMLAttributeNames.in:
    
    WebKitTools:
    
    * DumpRenderTree/AccessibilityUIElement.cpp:
    (getARIADropEffectsCallback):
    (getARIAIsGrabbedCallback):
    (AccessibilityUIElement::getJSClass):
    * DumpRenderTree/AccessibilityUIElement.h:
    * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
    (AccessibilityUIElement::ariaIsGrabbed):
    (AccessibilityUIElement::ariaDropEffects):
    
    LayoutTests:
    
    * platform/mac/accessibility/aria-drag-drop-expected.txt: Added.
    * platform/mac/accessibility/aria-drag-drop.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51582 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 92ed549..6090537 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-12-01  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Darin Adler.
+
+        WAI-ARIA: implement support for ARIA drag and drop
+        https://bugs.webkit.org/show_bug.cgi?id=32007
+
+        * platform/mac/accessibility/aria-drag-drop-expected.txt: Added.
+        * platform/mac/accessibility/aria-drag-drop.html: Added.
+
 2009-12-01  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/platform/mac/accessibility/aria-drag-drop-expected.txt b/LayoutTests/platform/mac/accessibility/aria-drag-drop-expected.txt
new file mode 100644
index 0000000..e2ab89a
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/aria-drag-drop-expected.txt
@@ -0,0 +1,17 @@
+drop
+grab
+grab
+This tests that the ARIA drag and drop attributes work as intended.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS body.childAtIndex(0).ariaDropEffects is 'copy,move'
+PASS body.childAtIndex(1).ariaIsGrabbed is true
+PASS body.childAtIndex(2).ariaIsGrabbed is false
+PASS body.childAtIndex(1).isAttributeSettable('AXGrabbed') is true
+PASS body.childAtIndex(2).isAttributeSettable('AXGrabbed') is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/aria-drag-drop.html b/LayoutTests/platform/mac/accessibility/aria-drag-drop.html
new file mode 100644
index 0000000..1409395
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/aria-drag-drop.html
@@ -0,0 +1,42 @@
+<!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">
+
+<div tabindex=0 aria-dropeffect="copy move" role="button" aria-label="drop">drop</div>
+<div tabindex=0 aria-grabbed=true role="button" aria-label="grab1">grab</div>
+<div tabindex=0 aria-grabbed=false role="button" aria-label="grab2">grab</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that the ARIA drag and drop attributes work as intended.");
+
+    if (window.accessibilityController) {
+
+          var body = document.getElementById("body");
+          body.focus();
+          body = accessibilityController.focusedElement;
+
+          shouldBe("body.childAtIndex(0).ariaDropEffects", "'copy,move'");
+
+          shouldBe("body.childAtIndex(1).ariaIsGrabbed", "true");
+          shouldBe("body.childAtIndex(2).ariaIsGrabbed", "false");
+          shouldBe("body.childAtIndex(1).isAttributeSettable('AXGrabbed')", "true");
+          shouldBe("body.childAtIndex(2).isAttributeSettable('AXGrabbed')", "true");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7191918..949b681 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2009-12-01  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Darin Adler.
+
+        WAI-ARIA: implement support for ARIA drag and drop
+        https://bugs.webkit.org/show_bug.cgi?id=32007
+
+        Test: platform/mac/accessibility/aria-drag-drop.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::supportsARIADropping):
+        (WebCore::AccessibilityObject::supportsARIADragging):
+        (WebCore::AccessibilityObject::isARIAGrabbed):
+        (WebCore::AccessibilityObject::setARIAGrabbed):
+        (WebCore::AccessibilityObject::determineARIADropEffects):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::supportsARIADropping):
+        (WebCore::AccessibilityRenderObject::supportsARIADragging):
+        (WebCore::AccessibilityRenderObject::isARIAGrabbed):
+        (WebCore::AccessibilityRenderObject::setARIAGrabbed):
+        (WebCore::AccessibilityRenderObject::determineARIADropEffects):
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/mac/AccessibilityObjectWrapper.mm:
+        (-[AccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
+        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
+        (-[AccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
+        (-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
+        * html/HTMLAttributeNames.in:
+
 2009-12-01  Adam Barth  <abarth at webkit.org>
 
         https://bugs.webkit.org/show_bug.cgi?id=21288
diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h
index d456d37..287fe1b 100644
--- a/WebCore/accessibility/AccessibilityObject.h
+++ b/WebCore/accessibility/AccessibilityObject.h
@@ -331,6 +331,13 @@ public:
     virtual bool supportsARIAFlowTo() const { return false; }
     virtual void ariaFlowToElements(AccessibilityChildrenVector&) const { }
     
+    // ARIA drag and drop
+    virtual bool supportsARIADropping() { return false; }
+    virtual bool supportsARIADragging() { return false; }
+    virtual bool isARIAGrabbed() { return false; }
+    virtual void setARIAGrabbed(bool) { }
+    virtual void determineARIADropEffects(Vector<String>&) { }
+    
     virtual AccessibilityObject* doAccessibilityHitTest(const IntPoint&) const { return 0; }
     virtual AccessibilityObject* focusedUIElement() const { return 0; }
 
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index cc58e38..8b40772 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -1309,6 +1309,40 @@ void AccessibilityRenderObject::ariaFlowToElements(AccessibilityChildrenVector&
         
 }
     
+bool AccessibilityRenderObject::supportsARIADropping()
+{
+    const AtomicString& dropEffect = getAttribute(aria_dropeffectAttr).string();
+    return !dropEffect.isEmpty();
+}
+
+bool AccessibilityRenderObject::supportsARIADragging()
+{
+    const AtomicString& grabbed = getAttribute(aria_grabbedAttr).string();
+    return equalIgnoringCase(grabbed, "true") || equalIgnoringCase(grabbed, "false");   
+}
+
+bool AccessibilityRenderObject::isARIAGrabbed()
+{
+    return elementAttributeValue(aria_grabbedAttr);
+}
+
+void AccessibilityRenderObject::setARIAGrabbed(bool grabbed)
+{
+    setElementAttributeValue(aria_grabbedAttr, grabbed);
+}
+
+void AccessibilityRenderObject::determineARIADropEffects(Vector<String>& effects)
+{
+    String dropEffects = getAttribute(aria_dropeffectAttr).string();
+    if (dropEffects.isEmpty()) {
+        effects.clear();
+        return;
+    }
+    
+    dropEffects.replace('\n', ' ');
+    dropEffects.split(' ', effects);
+}
+    
 bool AccessibilityRenderObject::exposesTitleUIElement() const
 {
     if (!isControl())
diff --git a/WebCore/accessibility/AccessibilityRenderObject.h b/WebCore/accessibility/AccessibilityRenderObject.h
index 27cd49e..5189ea1 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.h
+++ b/WebCore/accessibility/AccessibilityRenderObject.h
@@ -222,6 +222,12 @@ public:
     virtual bool supportsARIAFlowTo() const;
     virtual void ariaFlowToElements(AccessibilityChildrenVector&) const;
 
+    virtual bool supportsARIADropping();
+    virtual bool supportsARIADragging();
+    virtual bool isARIAGrabbed();
+    virtual void setARIAGrabbed(bool);
+    virtual void determineARIADropEffects(Vector<String>&);
+    
     virtual VisiblePosition visiblePositionForPoint(const IntPoint&) const;
     virtual VisiblePosition visiblePositionForIndex(unsigned indexValue, bool lastIndexOK) const;    
     virtual int index(const VisiblePosition&) const;
diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
index 54ebc71..28336c3 100644
--- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
+++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
@@ -123,6 +123,14 @@ using namespace std;
 #define NSAccessibilityOwnsAttribute @"AXOwns"
 #endif
 
+#ifndef NSAccessibilityGrabbedAttribute
+#define NSAccessibilityGrabbedAttribute @"AXGrabbed"
+#endif
+
+#ifndef NSAccessibilityDropEffectsAttribute
+#define NSAccessibilityDropEffectsAttribute @"AXDropEffects"
+#endif
+
 #ifdef BUILDING_ON_TIGER
 typedef unsigned NSUInteger;
 #define NSAccessibilityValueDescriptionAttribute @"AXValueDescription"
@@ -582,6 +590,12 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
     if (m_object->supportsARIAOwns())
         [additional addObject:NSAccessibilityOwnsAttribute];
 
+    if (m_object->supportsARIADragging())
+        [additional addObject:NSAccessibilityGrabbedAttribute];
+
+    if (m_object->supportsARIADropping())
+        [additional addObject:NSAccessibilityDropEffectsAttribute];
+
     return additional;
 }
 
@@ -1739,6 +1753,20 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return convertToNSArray(ariaOwns);
     }
     
+    if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
+        return [NSNumber numberWithBool:m_object->isARIAGrabbed()];
+    
+    if ([attributeName isEqualToString:NSAccessibilityDropEffectsAttribute]) {
+        Vector<String> dropEffects;
+        m_object->determineARIADropEffects(dropEffects);
+        size_t length = dropEffects.size();
+
+        NSMutableArray* dropEffectsArray = [NSMutableArray arrayWithCapacity:length];
+        for (size_t i = 0; i < length; ++i)
+            [dropEffectsArray addObject:dropEffects[i]];
+        return dropEffectsArray;
+    }
+    
     // this is used only by DumpRenderTree for testing
     if ([attributeName isEqualToString:@"AXClickPoint"])
         return [NSValue valueWithPoint:m_object->clickPoint()];
@@ -1813,6 +1841,9 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         [attributeName isEqualToString: NSAccessibilityVisibleCharacterRangeAttribute])
         return m_object->canSetTextRangeAttributes();
     
+    if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
+        return YES;
+    
     return NO;
 }
 
@@ -2101,7 +2132,8 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         convertToVector(array, selectedRows);
         if (m_object->isTree())
             m_object->setSelectedRows(selectedRows);
-    }
+    } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
+        m_object->setARIAGrabbed([number boolValue]);
 }
 
 static RenderObject* rendererForView(NSView* view)
diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in
index 696f4e0..596c458 100644
--- a/WebCore/html/HTMLAttributeNames.in
+++ b/WebCore/html/HTMLAttributeNames.in
@@ -17,8 +17,10 @@ aria-checked
 aria-controls
 aria-describedby
 aria-disabled
+aria-dropeffect
 aria-expanded
 aria-flowto
+aria-grabbed
 aria-hidden
 aria-label
 aria-labeledby
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 8836ac7..3060c27 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,19 @@
+2009-12-01  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Darin Adler.
+
+        WAI-ARIA: implement support for ARIA drag and drop
+        https://bugs.webkit.org/show_bug.cgi?id=32007
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (getARIADropEffectsCallback):
+        (getARIAIsGrabbedCallback):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::ariaIsGrabbed):
+        (AccessibilityUIElement::ariaDropEffects):
+
 2009-12-01  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Not reviewed. GTK DRT try 2.
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
index 89889b4..8d1f6d8 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
@@ -313,6 +313,17 @@ static JSValueRef showMenuCallback(JSContextRef context, JSObjectRef function, J
 
 // Static Value Getters
 
+static JSValueRef getARIADropEffectsCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    JSRetainPtr<JSStringRef> dropEffects(Adopt, toAXElement(thisObject)->ariaDropEffects());
+    return JSValueMakeString(context, dropEffects.get());
+}
+
+static JSValueRef getARIAIsGrabbedCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    return JSValueMakeBoolean(context, toAXElement(thisObject)->ariaIsGrabbed());
+}
+
 static JSValueRef getIsValidCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
 {
     AccessibilityUIElement* uiElement = toAXElement(thisObject);
@@ -515,6 +526,8 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "documentEncoding", getDocumentEncodingCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "documentURI", getDocumentURICallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isValid", getIsValidCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "ariaIsGrabbed", getARIAIsGrabbedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "ariaDropEffects", getARIADropEffectsCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0, 0 }
     };
 
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
index 9a7cf13..d478456 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
@@ -135,6 +135,11 @@ public:
     AccessibilityUIElement ariaOwnsElementAtIndex(unsigned);
     AccessibilityUIElement ariaFlowToElementAtIndex(unsigned);
 
+    // ARIA Drag and Drop
+    bool ariaIsGrabbed() const;
+    // A space concatentated string of all the drop effects.
+    JSStringRef ariaDropEffects() const;
+    
     // Parameterized attributes
     int lineForIndex(int);
     JSStringRef boundsForRange(unsigned location, unsigned length);
diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
index 7de9ced..4b46dda 100644
--- a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
@@ -44,6 +44,14 @@
 #define NSAccessibilityOwnsAttribute @"AXOwns"
 #endif
 
+#ifndef NSAccessibilityGrabbedAttribute
+#define NSAccessibilityGrabbedAttribute @"AXGrabbed"
+#endif
+
+#ifndef NSAccessibilityDropEffectsAttribute
+#define NSAccessibilityDropEffectsAttribute @"AXDropEffects"
+#endif
+
 @interface NSObject (WebKitAccessibilityArrayCategory)
 - (NSArray *)accessibilityArrayAttributeValues:(NSString *)attribute index:(NSUInteger)index maxCount:(NSUInteger)maxCount;
 @end
@@ -512,6 +520,31 @@ int AccessibilityUIElement::hierarchicalLevel() const
     return 0;
 }
 
+bool AccessibilityUIElement::ariaIsGrabbed() const
+{
+    id value = [m_element accessibilityAttributeValue:NSAccessibilityGrabbedAttribute];
+    if ([value isKindOfClass:[NSNumber class]])
+        return [value boolValue];
+    return false;
+}
+
+JSStringRef AccessibilityUIElement::ariaDropEffects() const
+{
+    id value = [m_element accessibilityAttributeValue:NSAccessibilityDropEffectsAttribute];
+    if (![value isKindOfClass:[NSArray class]])
+        return 0;
+
+    NSMutableString* dropEffects = [NSMutableString string];
+    NSInteger length = [value count];
+    for (NSInteger k = 0; k < length; ++k) {
+        [dropEffects appendString:[value objectAtIndex:k]];
+        if (k < length - 1)
+            [dropEffects appendString:@","];
+    }
+    
+    return [dropEffects createJSStringRef];
+}
+
 // parameterized attributes
 int AccessibilityUIElement::lineForIndex(int index)
 {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list