[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:50:18 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 81a361d5849b10c17f01ef57a8309c855512b640
Author: cfleizach at apple.com <cfleizach at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 21 19:22:43 2010 +0000

    AX: contenteditable nodes do not return correct AXSelectedText* attributes
    https://bugs.webkit.org/show_bug.cgi?id=48080
    
    Reviewed by Beth Dakin.
    
    WebCore:
    
    The ariaSelectedDOMTextRange() method was not returning the correct values.
    The fix is to return a plain text range that represents the current selection.
    
    Test: platform/mac/accessibility/content-editable-range-properties.html
    
    * accessibility/AccessibilityObject.h:
    (WebCore::AccessibilityObject::accessibilityDescription):
    * accessibility/AccessibilityRenderObject.cpp:
    (WebCore::AccessibilityRenderObject::ariaSelectedTextRange):
    (WebCore::AccessibilityRenderObject::selectedText):
    (WebCore::AccessibilityRenderObject::selectedTextRange):
    * accessibility/AccessibilityRenderObject.h:
    
    LayoutTests:
    
    * platform/mac/accessibility/content-editable-range-properties-expected.txt: Added.
    * platform/mac/accessibility/content-editable-range-properties.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70256 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 60703c1..a1a7bc8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-21  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Beth Dakin.
+
+        AX: contenteditable nodes do not return correct AXSelectedText* attributes
+        https://bugs.webkit.org/show_bug.cgi?id=48080
+
+        * platform/mac/accessibility/content-editable-range-properties-expected.txt: Added.
+        * platform/mac/accessibility/content-editable-range-properties.html: Added.
+
 2010-10-18  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/LayoutTests/platform/mac/accessibility/content-editable-range-properties-expected.txt b/LayoutTests/platform/mac/accessibility/content-editable-range-properties-expected.txt
new file mode 100644
index 0000000..f406ebd
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/content-editable-range-properties-expected.txt
@@ -0,0 +1,21 @@
+Single line test
+Multiple
+Line
+Textbox
+This tests that contenteditable nodes return the correct information for range and selection based attributes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS axElement.selectedTextRange is '{3, 0}'
+PASS axElement.selectedTextRange is '{3, 3}'
+PASS axElement.stringAttributeValue('AXSelectedText') is 'gle'
+PASS axElement.selectedTextRange is '{3, 4}'
+PASS axElement.selectedTextRange is '{12, 0}'
+PASS axElement.selectedTextRange is '{12, 6}'
+PASS axElement.stringAttributeValue('AXSelectedText') is matchedText
+PASS axElement.selectedTextRange is '{12, 7}'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/content-editable-range-properties.html b/LayoutTests/platform/mac/accessibility/content-editable-range-properties.html
new file mode 100644
index 0000000..a75cf7d
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/content-editable-range-properties.html
@@ -0,0 +1,78 @@
+<!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" id="textbox1" contenteditable="true" role="textbox">Single line test</div>
+
+<div tabindex="0" id="textbox2" contenteditable="true" role="textbox">
+Multiple<br>
+Line<br>
+Textbox
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that contenteditable nodes return the correct information for range and selection based attributes.");
+
+    if (window.accessibilityController) {
+        // Test the single line textbox.
+        var textElement = document.getElementById("textbox1");
+        textElement.focus();
+        var axElement = accessibilityController.focusedElement;
+
+        var s = window.getSelection();
+        s.setPosition(textElement, 0);
+        for (var k = 0; k < 3; k++) {
+            s.modify("move", "forward", "character");
+        }
+        shouldBe("axElement.selectedTextRange", "'{3, 0}'");
+
+        for (var k = 0; k < 3; k++) {
+            s.modify("extend", "forward", "character");
+        }
+        shouldBe("axElement.selectedTextRange", "'{3, 3}'");
+        shouldBe("axElement.stringAttributeValue('AXSelectedText')", "'gle'");
+
+        s.modify("extend", "forward", "character");
+        shouldBe("axElement.selectedTextRange", "'{3, 4}'");
+
+        // Test the multi-line textbox.
+        textElement = document.getElementById("textbox2");
+        textElement.focus();
+        axElement = accessibilityController.focusedElement;
+
+        s = window.getSelection();
+        s.setPosition(textElement, 0);
+        for (var k = 0; k < 12; k++) {
+            s.modify("move", "forward", "character");
+        }
+        shouldBe("axElement.selectedTextRange", "'{12, 0}'");
+
+        for (var k = 0; k < 6; k++) {
+            s.modify("extend", "forward", "character");
+        }
+        shouldBe("axElement.selectedTextRange", "'{12, 6}'");
+        var matchedText = "e\nText";
+        shouldBe("axElement.stringAttributeValue('AXSelectedText')", "matchedText");
+
+        s.modify("extend", "forward", "character");
+        shouldBe("axElement.selectedTextRange", "'{12, 7}'");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c4654c7..d113ae4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-10-21  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Beth Dakin.
+
+        AX: contenteditable nodes do not return correct AXSelectedText* attributes
+        https://bugs.webkit.org/show_bug.cgi?id=48080
+
+        The ariaSelectedDOMTextRange() method was not returning the correct values. 
+        The fix is to return a plain text range that represents the current selection.
+
+        Test: platform/mac/accessibility/content-editable-range-properties.html
+
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::accessibilityDescription):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::ariaSelectedTextRange):
+        (WebCore::AccessibilityRenderObject::selectedText):
+        (WebCore::AccessibilityRenderObject::selectedTextRange):
+        * accessibility/AccessibilityRenderObject.h:
+
 2010-10-20  Jer Noble  <jer.noble at apple.com>
 
         Reviewed by Eric Carlson.
diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h
index bcf09d2..f2e1efe 100644
--- a/WebCore/accessibility/AccessibilityObject.h
+++ b/WebCore/accessibility/AccessibilityObject.h
@@ -392,7 +392,6 @@ public:
     virtual String ariaLabeledByAttribute() const { return String(); }
     virtual String ariaDescribedByAttribute() const { return String(); }
     virtual String accessibilityDescription() const { return String(); }
-    virtual PassRefPtr<Range> ariaSelectedTextDOMRange() const { return 0; }
 
     virtual AXObjectCache* axObjectCache() const { return 0; }
     AXID axObjectID() const { return m_id; }
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index 0b82c67..95580ad 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -1916,35 +1916,22 @@ int AccessibilityRenderObject::textLength() const
     return text().length();
 }
 
-PassRefPtr<Range> AccessibilityRenderObject::ariaSelectedTextDOMRange() const
+PlainTextRange AccessibilityRenderObject::ariaSelectedTextRange() const
 {
     Node* node = m_renderer->node();
     if (!node)
-        return 0;
-    
-    RefPtr<Range> currentSelectionRange = selection().toNormalizedRange();
-    if (!currentSelectionRange)
-        return 0;
+        return PlainTextRange();
     
     ExceptionCode ec = 0;
-    if (!currentSelectionRange->intersectsNode(node, ec))
-        return Range::create(currentSelectionRange->ownerDocument());
-    
-    RefPtr<Range> ariaRange = rangeOfContents(node);
-    Position startPosition, endPosition;
-    
-    // Find intersection of currentSelectionRange and ariaRange
-    if (ariaRange->startOffset() > currentSelectionRange->startOffset())
-        startPosition = ariaRange->startPosition();
-    else
-        startPosition = currentSelectionRange->startPosition();
+    VisibleSelection visibleSelection = selection();
+    RefPtr<Range> currentSelectionRange = visibleSelection.toNormalizedRange();
+    if (!currentSelectionRange || !currentSelectionRange->intersectsNode(node, ec))
+        return PlainTextRange();
     
-    if (ariaRange->endOffset() < currentSelectionRange->endOffset())
-        endPosition = ariaRange->endPosition();
-    else
-        endPosition = currentSelectionRange->endPosition();
+    int start = indexForVisiblePosition(visibleSelection.start());
+    int end = indexForVisiblePosition(visibleSelection.end());
     
-    return Range::create(ariaRange->ownerDocument(), startPosition, endPosition);
+    return PlainTextRange(start, end - start);
 }
 
 String AccessibilityRenderObject::selectedText() const
@@ -1962,10 +1949,7 @@ String AccessibilityRenderObject::selectedText() const
     if (ariaRoleAttribute() == UnknownRole)
         return String();
     
-    RefPtr<Range> ariaRange = ariaSelectedTextDOMRange();
-    if (!ariaRange)
-        return String();
-    return ariaRange->text();
+    return doAXStringForRange(ariaSelectedTextRange());
 }
 
 const AtomicString& AccessibilityRenderObject::accessKey() const
@@ -1999,10 +1983,7 @@ PlainTextRange AccessibilityRenderObject::selectedTextRange() const
     if (ariaRole == UnknownRole)
         return PlainTextRange();
     
-    RefPtr<Range> ariaRange = ariaSelectedTextDOMRange();
-    if (!ariaRange)
-        return PlainTextRange();
-    return PlainTextRange(ariaRange->startOffset(), ariaRange->endOffset());
+    return ariaSelectedTextRange();
 }
 
 void AccessibilityRenderObject::setSelectedTextRange(const PlainTextRange& range)
diff --git a/WebCore/accessibility/AccessibilityRenderObject.h b/WebCore/accessibility/AccessibilityRenderObject.h
index c62e98d..970ef9f 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.h
+++ b/WebCore/accessibility/AccessibilityRenderObject.h
@@ -186,7 +186,6 @@ public:
     virtual String textUnderElement() const;
     virtual String text() const;
     virtual int textLength() const;
-    virtual PassRefPtr<Range> ariaSelectedTextDOMRange() const;
     virtual String selectedText() const;
     virtual const AtomicString& accessKey() const;
     virtual const String& actionVerb() const;
@@ -277,6 +276,7 @@ private:
     bool isAllowedChildOfTree() const;
     bool hasTextAlternative() const;
     String positionalDescriptionForMSAA() const;
+    PlainTextRange ariaSelectedTextRange() const;
 
     Element* menuElementForMenuButton() const;
     Element* menuItemElementForMenu() const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list