[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

cfleizach at apple.com cfleizach at apple.com
Wed Dec 22 14:06:45 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a78a36f367aeb6ba89cc4ef101c164f1bd3de16f
Author: cfleizach at apple.com <cfleizach at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 4 21:03:21 2010 +0000

    AX: doAXRangeForLine does not work
    https://bugs.webkit.org/show_bug.cgi?id=47101
    
    Reviewed by Beth Dakin.
    
    WebCore:
    
    Asking for NSAccessibilityRangeForLine was returning a null range for any line number > 0.
    The code was using a SelectionController to extend to the next line. Rather than change the implementation
    of that core functionality, it is cleaner to use endOfLine to find the end of the line.
    
    Test: platform/mac/accessibility/range-for-line-textarea.html
    
    * accessibility/AccessibilityRenderObject.cpp:
    (WebCore::AccessibilityRenderObject::doAXRangeForLine):
    
    WebKitTools:
    
    DRT support to handle NSAccessibilityRangeForLineParameterizedAttribute.
    
    * DumpRenderTree/AccessibilityUIElement.cpp:
    (rangeForLineCallback):
    (AccessibilityUIElement::rangeForLine):
    (AccessibilityUIElement::getJSClass):
    * DumpRenderTree/AccessibilityUIElement.h:
    * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
    (AccessibilityUIElement::rangeForLine):
    
    LayoutTests:
    
    * platform/mac/accessibility/range-for-line-textarea-expected.txt: Added.
    * platform/mac/accessibility/range-for-line-textarea.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69033 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6272438..094ea35 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-04  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Beth Dakin.
+
+        AX: doAXRangeForLine does not work
+        https://bugs.webkit.org/show_bug.cgi?id=47101
+
+        * platform/mac/accessibility/range-for-line-textarea-expected.txt: Added.
+        * platform/mac/accessibility/range-for-line-textarea.html: Added.
+
 2010-10-04  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/platform/mac/accessibility/range-for-line-textarea-expected.txt b/LayoutTests/platform/mac/accessibility/range-for-line-textarea-expected.txt
new file mode 100644
index 0000000..4ee2664
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/range-for-line-textarea-expected.txt
@@ -0,0 +1,22 @@
+
+This tests that a popup button will return the text under the element for its title.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS axElement.rangeForLine(0) is '{0, 14}'
+PASS axElement.rangeForLine(1) is '{14, 14}'
+PASS axElement.rangeForLine(2) is '{28, 16}'
+PASS axElement.rangeForLine(3) is '{44, 14}'
+PASS axElement.rangeForLine(4) is '{58, 14}'
+PASS axElement.rangeForLine(6) is '{84, 14}'
+PASS axElement.rangeForLine(7) is '{98, 16}'
+PASS axElement.rangeForLine(8) is '{114, 14}'
+PASS axElement.rangeForLine(9) is '{128, 12}'
+PASS axElement.rangeForLine(10) is '{140, 14}'
+PASS axElement.rangeForLine(100) is '{0, 0}'
+PASS axElement.rangeForLine(-1) is '{0, 0}'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/range-for-line-textarea.html b/LayoutTests/platform/mac/accessibility/range-for-line-textarea.html
new file mode 100644
index 0000000..623dd82
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/range-for-line-textarea.html
@@ -0,0 +1,49 @@
+<!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">
+
+
+<textarea tabindex="0" id="text" cols=10 rows=50>A lot of text repeated many times. A lot of text repeated many times. A lot of text repeated many times. A lot of text repeated many times.
+A lot of text repeated many times. A lot of text repeated many times. A lot of text repeated many times. A lot of text repeated many times. A lot of text repeated many times.
+</textarea>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that a popup button will return the text under the element for its title.");
+
+    if (window.accessibilityController) {
+        var textElement = document.getElementById("text");
+        textElement.focus();
+        var axElement = accessibilityController.focusedElement;
+
+        shouldBe("axElement.rangeForLine(0)", "'{0, 14}'");
+        shouldBe("axElement.rangeForLine(1)", "'{14, 14}'");
+        shouldBe("axElement.rangeForLine(2)", "'{28, 16}'");
+        shouldBe("axElement.rangeForLine(3)", "'{44, 14}'");
+        shouldBe("axElement.rangeForLine(4)", "'{58, 14}'");
+        shouldBe("axElement.rangeForLine(6)", "'{84, 14}'");
+        shouldBe("axElement.rangeForLine(7)", "'{98, 16}'");
+        shouldBe("axElement.rangeForLine(8)", "'{114, 14}'");
+        shouldBe("axElement.rangeForLine(9)", "'{128, 12}'");
+        shouldBe("axElement.rangeForLine(10)", "'{140, 14}'");
+
+        shouldBe("axElement.rangeForLine(100)", "'{0, 0}'");
+        shouldBe("axElement.rangeForLine(-1)", "'{0, 0}'");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3ed1a6d..5ad3029 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-10-04  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Beth Dakin.
+
+        AX: doAXRangeForLine does not work
+        https://bugs.webkit.org/show_bug.cgi?id=47101
+
+        Asking for NSAccessibilityRangeForLine was returning a null range for any line number > 0.
+        The code was using a SelectionController to extend to the next line. Rather than change the implementation
+        of that core functionality, it is cleaner to use endOfLine to find the end of the line.
+
+        Test: platform/mac/accessibility/range-for-line-textarea.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::doAXRangeForLine):
+
 2010-10-04  Brent Fulgham  <bfulgham at webkit.org>
 
         Unreviewed, build fix for r68951.
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index d6bec4f..b2cb9c1 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -2646,20 +2646,11 @@ PlainTextRange AccessibilityRenderObject::doAXRangeForLine(unsigned lineNumber)
         if (visiblePos.isNull() || visiblePos == savedVisiblePos)
             return PlainTextRange();
     }
-    
-    // make a caret selection for the marker position, then extend it to the line
-    // NOTE: ignores results of selection.modify because it returns false when
-    // starting at an empty line.  The resulting selection in that case
-    // will be a caret at visiblePos.
-    SelectionController selection;
-    selection.setSelection(VisibleSelection(visiblePos));
-    selection.modify(SelectionController::AlterationExtend, SelectionController::DirectionLeft, LineBoundary);
-    selection.modify(SelectionController::AlterationExtend, SelectionController::DirectionRight, LineBoundary);
-    
-    // calculate the indices for the selection start and end
-    VisiblePosition startPosition = selection.selection().visibleStart();
-    VisiblePosition endPosition = selection.selection().visibleEnd();
-    int index1 = indexForVisiblePosition(startPosition);
+
+    // Get the end of the line based on the starting position.
+    VisiblePosition endPosition = endOfLine(visiblePos);
+
+    int index1 = indexForVisiblePosition(visiblePos);
     int index2 = indexForVisiblePosition(endPosition);
     
     // add one to the end index for a line break not caused by soft line wrap (to match AppKit)
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 8b458c2..dd4ea32 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-10-04  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Beth Dakin.
+
+        AX: doAXRangeForLine does not work
+        https://bugs.webkit.org/show_bug.cgi?id=47101
+
+        DRT support to handle NSAccessibilityRangeForLineParameterizedAttribute.
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (rangeForLineCallback):
+        (AccessibilityUIElement::rangeForLine):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::rangeForLine):
+
 2010-10-04  Andrey Kosyakov  <caseq at chromium.org>
 
         Unreviewed. Adding myself to the committers list.
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
index 31488e5..52d238d 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
@@ -128,6 +128,16 @@ static JSValueRef lineForIndexCallback(JSContextRef context, JSObjectRef functio
     return JSValueMakeNumber(context, toAXElement(thisObject)->lineForIndex(indexNumber));
 }
 
+static JSValueRef rangeForLineCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    int indexNumber = -1;
+    if (argumentCount == 1)
+        indexNumber = JSValueToNumber(context, arguments[0], exception);
+    
+    JSRetainPtr<JSStringRef> rangeLine(Adopt, toAXElement(thisObject)->rangeForLine(indexNumber));
+    return JSValueMakeString(context, rangeLine.get());
+}
+
 static JSValueRef boundsForRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     unsigned location = UINT_MAX, length = 0;
@@ -746,6 +756,7 @@ static JSValueRef removeNotificationListenerCallback(JSContextRef context, JSObj
 // Unsupported methods on various platforms.
 #if !PLATFORM(MAC)
 JSStringRef AccessibilityUIElement::speak() { return 0; }
+JSStringRef AccessibilityUIElement::rangeForLine(int line) { return 0; }
 #endif
 
 #if !SUPPORTS_AX_TEXTMARKERS
@@ -859,6 +870,7 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "attributesOfChildren", attributesOfChildrenCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "parameterizedAttributeNames", parameterizedAttributeNamesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "lineForIndex", lineForIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "rangeForLine", rangeForLineCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "boundsForRange", boundsForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "attributedStringForRange", attributedStringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
index aec6d61..9311dfd 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
@@ -179,6 +179,7 @@ public:
     
     // Parameterized attributes
     int lineForIndex(int);
+    JSStringRef rangeForLine(int);
     JSStringRef boundsForRange(unsigned location, unsigned length);
     void setSelectedTextRange(unsigned location, unsigned length);
     JSStringRef stringForRange(unsigned location, unsigned length);
diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
index 13c9fa1..2ca5755 100644
--- a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
@@ -835,6 +835,18 @@ int AccessibilityUIElement::lineForIndex(int index)
     return -1;
 }
 
+JSStringRef AccessibilityUIElement::rangeForLine(int line)
+{
+    BEGIN_AX_OBJC_EXCEPTIONS
+    id value = [m_element accessibilityAttributeValue:NSAccessibilityRangeForLineParameterizedAttribute forParameter:[NSNumber numberWithInt:line]];
+    if ([value isKindOfClass:[NSValue class]]) {
+        return [NSStringFromRange([value rangeValue]) createJSStringRef];
+    }
+    END_AX_OBJC_EXCEPTIONS
+    
+    return 0;
+}
+
 JSStringRef AccessibilityUIElement::boundsForRange(unsigned location, unsigned length)
 {
     NSRange range = NSMakeRange(location, length);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list