Title: [88004] trunk
Revision
88004
Author
[email protected]
Date
2011-06-03 04:10:29 -0700 (Fri, 03 Jun 2011)

Log Message

2011-06-03  Mario Sanchez Prada  <[email protected]>

        Reviewed by Martin Robinson.

        Focus and caret position should be updated when same-page links are followed
        https://bugs.webkit.org/show_bug.cgi?id=59737

        Update the caret position to the anchor's position after scrolling.

        This behavior is specific to the Gtk port and requested because of
        accessibility needs, that's why it's implemented in AXObjectCache.

        Test: platform/gtk/accessibility/caret-browsing-anchor-followed.html

        * accessibility/gtk/AXObjectCacheAtk.cpp:
        (WebCore::AXObjectCache::handleScrolledToAnchor): Make sure the
        caret is updated to be in the anchor's position after scrolling.

2011-06-03  Mario Sanchez Prada  <[email protected]>

        Reviewed by Martin Robinson.

        Focus and caret position should be updated when same-page links are followed
        https://bugs.webkit.org/show_bug.cgi?id=59737

        New layout test for testing this GTK-specific feature.

        * platform/gtk/accessibility/caret-browsing-anchor-followed-expected.txt: Added.
        * platform/gtk/accessibility/caret-browsing-anchor-followed.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88003 => 88004)


--- trunk/LayoutTests/ChangeLog	2011-06-03 10:44:04 UTC (rev 88003)
+++ trunk/LayoutTests/ChangeLog	2011-06-03 11:10:29 UTC (rev 88004)
@@ -1,3 +1,15 @@
+2011-06-03  Mario Sanchez Prada  <[email protected]>
+
+        Reviewed by Martin Robinson.
+
+        Focus and caret position should be updated when same-page links are followed
+        https://bugs.webkit.org/show_bug.cgi?id=59737
+
+        New layout test for testing this GTK-specific feature.
+
+        * platform/gtk/accessibility/caret-browsing-anchor-followed-expected.txt: Added.
+        * platform/gtk/accessibility/caret-browsing-anchor-followed.html: Added.
+
 2011-06-03  Dominic Cooney  <[email protected]>
 
         Reviewed by Kent Tamura.

Added: trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-anchor-followed-expected.txt (0 => 88004)


--- trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-anchor-followed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-anchor-followed-expected.txt	2011-06-03 11:10:29 UTC (rev 88004)
@@ -0,0 +1,22 @@
+A link pointing to an anchor at the end of the document
+
+A paragraph with a some text in the middle
+
+The Anchor
+
+A paragraph with a some text right after the anchor
+
+This tests that the caret position is properly updated when following anchor links.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS axLink.role is 'AXRole: link'
+PASS axLink.isFocused is true
+PASS axLink.isFocused is false
+PASS getSelection().anchorNode.nodeValue is 'The Anchor'
+PASS getSelection().anchorNode.nodeValue is 'A paragraph with a some text right after the anchor'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-anchor-followed.html (0 => 88004)


--- trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-anchor-followed.html	                        (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-anchor-followed.html	2011-06-03 11:10:29 UTC (rev 88004)
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script>
+var successfullyParsed = false;
+</script>
+<script src=""
+</head>
+<body id="body">
+<p><a id="link" href="" link pointing to an anchor at the end of the document</a></p>
+<p>A paragraph with a some text in the middle</p>
+<p><a id="anchor" name="anchor">The Anchor</a></p>
+<p id="text">A paragraph with a some text right after the anchor</p>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("This tests that the caret position is properly updated when following anchor links.");
+
+if (window.layoutTestController) {
+    layoutTestController.overridePreference("WebKitEnableCaretBrowsing", true);
+    layoutTestController.dumpAsText();
+
+    if (window.accessibilityController) {
+        var link = document.getElementById("link");
+        var anchor = document.getElementById("anchor");
+        var textAfterAnchor = document.getElementById("text");
+
+        // Focus on the link and check state
+         link.focus();
+        var axLink = accessibilityController.focusedElement;
+        shouldBe("axLink.role", "'AXRole: link'");
+        shouldBe("axLink.isFocused", "true");
+
+        // Execute action and check state.
+        axLink.press()
+        shouldBe("axLink.isFocused", "false");
+        shouldBe("getSelection().anchorNode.nodeValue", "'The Anchor'");
+
+        // Press down arrow and check state.
+        eventSender.keyDown("downArrow");
+        shouldBe("getSelection().anchorNode.nodeValue", "'A paragraph with a some text right after the anchor'");
+    }
+}
+
+successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (88003 => 88004)


--- trunk/Source/WebCore/ChangeLog	2011-06-03 10:44:04 UTC (rev 88003)
+++ trunk/Source/WebCore/ChangeLog	2011-06-03 11:10:29 UTC (rev 88004)
@@ -1,3 +1,21 @@
+2011-06-03  Mario Sanchez Prada  <[email protected]>
+
+        Reviewed by Martin Robinson.
+
+        Focus and caret position should be updated when same-page links are followed
+        https://bugs.webkit.org/show_bug.cgi?id=59737
+
+        Update the caret position to the anchor's position after scrolling.
+
+        This behavior is specific to the Gtk port and requested because of
+        accessibility needs, that's why it's implemented in AXObjectCache.
+
+        Test: platform/gtk/accessibility/caret-browsing-anchor-followed.html
+
+        * accessibility/gtk/AXObjectCacheAtk.cpp:
+        (WebCore::AXObjectCache::handleScrolledToAnchor): Make sure the
+        caret is updated to be in the anchor's position after scrolling.
+
 2011-06-03  Dominic Cooney  <[email protected]>
 
         Reviewed by Kent Tamura.

Modified: trunk/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp (88003 => 88004)


--- trunk/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp	2011-06-03 10:44:04 UTC (rev 88003)
+++ trunk/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp	2011-06-03 11:10:29 UTC (rev 88004)
@@ -23,11 +23,15 @@
 #include "AccessibilityObject.h"
 #include "AccessibilityObjectWrapperAtk.h"
 #include "Document.h"
+#include "Frame.h"
+#include "FrameSelection.h"
 #include "Element.h"
 #include "GOwnPtr.h"
 #include "Range.h"
 #include "SelectElement.h"
+#include "TextAffinity.h"
 #include "TextIterator.h"
+#include "htmlediting.h"
 
 namespace WebCore {
 
@@ -205,8 +209,23 @@
     }
 }
 
-void AXObjectCache::handleScrolledToAnchor(const Node*)
+void AXObjectCache::handleScrolledToAnchor(const Node* node)
 {
+    // Make sure the caret position is set to the anchor position, so
+    // further use of arrow keys work as expected.
+    Document* document = node->document();
+    if (!document)
+        return;
+
+    Frame* frame = document->frame();
+    if (!frame)
+        return;
+
+    FrameSelection* selection = frame->selection();
+    if (!selection)
+        return;
+
+    selection->moveTo(firstPositionInOrBeforeNode(const_cast<Node*>(node)), DOWNSTREAM);
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to