| Differences between
and this patch
- a/LayoutTests/ChangeLog +10 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2012-02-29  Mario Sanchez Prada  <msanchez@igalia.com>
2
3
        in page anchor and keyboard navigation
4
        https://bugs.webkit.org/show_bug.cgi?id=17450
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * accessibility/anchor-link-selection-and-focus-expected.txt: Added.
9
        * accessibility/anchor-link-selection-and-focus.html: Added.
10
1
2012-02-28  Adam Klein  <adamk@chromium.org>
11
2012-02-28  Adam Klein  <adamk@chromium.org>
2
12
3
        Remove suppressions of SVG crash flakiness on cr-mac
13
        Remove suppressions of SVG crash flakiness on cr-mac
- a/LayoutTests/accessibility/anchor-link-selection-and-focus-expected.txt +15 lines
Line 0 a/LayoutTests/accessibility/anchor-link-selection-and-focus-expected.txt_sec1
1
A link pointing to an anchor at the end of the document
2
3
A paragraph with a some text in the middle
4
5
The Anchor
6
7
This tests that the caret position is properly updated when following anchor links.
8
9
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
10
11
12
PASS axLink.isFocused is true
13
PASS axLink.isFocused is false
14
PASS getSelection().anchorNode.nodeValue is 'The Anchor'
15
- a/LayoutTests/accessibility/anchor-link-selection-and-focus.html +43 lines
Line 0 a/LayoutTests/accessibility/anchor-link-selection-and-focus.html_sec1
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2
<html>
3
<head>
4
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
5
<script>
6
var successfullyParsed = false;
7
</script>
8
<script src="../fast/js/resources/js-test-pre.js"></script>
9
</head>
10
<body id="body">
11
<p><a id="link" href="#anchor">A link pointing to an anchor at the end of the document</a></p>
12
<p>A paragraph with a some text in the middle</p>
13
<p><a id="anchor" name="anchor">The Anchor</a></p>
14
<p id="description"></p>
15
<div id="console"></div>
16
<script>
17
description("This tests that the caret position is properly updated when following anchor links.");
18
19
if (window.layoutTestController) {
20
    layoutTestController.dumpAsText();
21
22
    if (window.accessibilityController) {
23
        var link = document.getElementById("link");
24
        var anchor = document.getElementById("anchor");
25
        var textAfterAnchor = document.getElementById("text");
26
27
        // Focus on the link and check state
28
        link.focus();
29
        var axLink = accessibilityController.focusedElement;
30
        shouldBe("axLink.isFocused", "true");
31
32
        // Execute action and check state.
33
        axLink.press()
34
        shouldBe("axLink.isFocused", "false");
35
        shouldBe("getSelection().anchorNode.nodeValue", "'The Anchor'");
36
    }
37
}
38
39
successfullyParsed = true;
40
</script>
41
<script src="../../../fast/js/resources/js-test-post.js"></script>
42
</body>
43
</html>
- a/Source/WebCore/ChangeLog +27 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-02-29  Mario Sanchez Prada  <msanchez@igalia.com>
2
3
        in page anchor and keyboard navigation
4
        https://bugs.webkit.org/show_bug.cgi?id=17450
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Ensure that the position of the caret and the focused element
9
        get updated when following an anchor link.
10
11
        The implementation is moved from platform specific files out to
12
        AXObjectCache.cpp since it should be a cross-platform valid
13
        solution. However, the new code is currently activated for the Mac
14
        and GTK ports only, since the windows and chromium ports provide
15
        their own specific code, and removing it now might break things.
16
17
        Test: accessibility/anchor-link-selection-and-focus.html
18
19
        * accessibility/AXObjectCache.cpp:
20
        (WebCore):
21
        (WebCore::AXObjectCache::handleScrolledToAnchor): Cross-platform
22
        implementation of the fix, only activated for Mac and GTK for now.
23
        * accessibility/gtk/AXObjectCacheAtk.cpp: Removed the GTK-specific
24
        implementation of WebCore::AXObjectCache::handleScrolledToAnchor.
25
        * accessibility/mac/AXObjectCacheMac.mm: Removed the Mac-specific
26
        implementation of WebCore::AXObjectCache::handleScrolledToAnchor.
27
1
2012-02-28  Sheriff Bot  <webkit.review.bot@gmail.com>
28
2012-02-28  Sheriff Bot  <webkit.review.bot@gmail.com>
2
29
3
        Unreviewed, rolling out r108834.
30
        Unreviewed, rolling out r108834.
- a/Source/WebCore/accessibility/AXObjectCache.cpp -1 / +26 lines
Lines 54-59 a/Source/WebCore/accessibility/AXObjectCache.cpp_sec1
54
#include "Document.h"
54
#include "Document.h"
55
#include "FocusController.h"
55
#include "FocusController.h"
56
#include "Frame.h"
56
#include "Frame.h"
57
#include "FrameSelection.h"
57
#include "HTMLAreaElement.h"
58
#include "HTMLAreaElement.h"
58
#include "HTMLImageElement.h"
59
#include "HTMLImageElement.h"
59
#include "HTMLInputElement.h"
60
#include "HTMLInputElement.h"
Lines 71-77 a/Source/WebCore/accessibility/AXObjectCache.cpp_sec2
71
#include "RenderTableRow.h"
72
#include "RenderTableRow.h"
72
#include "RenderView.h"
73
#include "RenderView.h"
73
#include "ScrollView.h"
74
#include "ScrollView.h"
74
75
#include "TextAffinity.h"
76
#include "htmlediting.h"
75
#include <wtf/PassRefPtr.h>
77
#include <wtf/PassRefPtr.h>
76
78
77
namespace WebCore {
79
namespace WebCore {
Lines 156-161 AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page* page) a/Source/WebCore/accessibility/AXObjectCache.cpp_sec3
156
    return obj;
158
    return obj;
157
}
159
}
158
160
161
#if HAVE(ACCESSIBILITY) && (PLATFORM(MAC) || PLATFORM(GTK))
162
void AXObjectCache::handleScrolledToAnchor(const Node* node)
163
{
164
    Document* document = node->document();
165
    if (!document)
166
        return;
167
168
    Frame* frame = document->frame();
169
    if (!frame)
170
        return;
171
172
    FrameSelection* selection = frame->selection();
173
    if (!selection)
174
        return;
175
176
    RefPtr<Node> refNode = const_cast<Node*>(node);
177
    document->setFocusedNode(refNode);
178
179
    Position targetPosition = firstPositionInOrBeforeNode(const_cast<Node*>(node));
180
    selection->moveTo(targetPosition, DOWNSTREAM);
181
}
182
#endif
183
159
AccessibilityObject* AXObjectCache::get(Widget* widget)
184
AccessibilityObject* AXObjectCache::get(Widget* widget)
160
{
185
{
161
    if (!widget)
186
    if (!widget)
- a/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp -4 lines
Lines 231-238 void AXObjectCache::handleFocusedUIElementChanged(RenderObject* oldFocusedRender a/Source/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp_sec1
231
    }
231
    }
232
}
232
}
233
233
234
void AXObjectCache::handleScrolledToAnchor(const Node*)
235
{
236
}
237
238
} // namespace WebCore
234
} // namespace WebCore
- a/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm -5 lines
Lines 141-150 void AXObjectCache::handleFocusedUIElementChanged(RenderObject*, RenderObject*) a/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm_sec1
141
    wkAccessibilityHandleFocusChanged();
141
    wkAccessibilityHandleFocusChanged();
142
}
142
}
143
143
144
void AXObjectCache::handleScrolledToAnchor(const Node*)
145
{
146
}
147
148
}
144
}
149
145
150
#endif // HAVE(ACCESSIBILITY)
146
#endif // HAVE(ACCESSIBILITY)
151
- 

Return to Bug 17450