haikuwebkit/LayoutTests/accessibility/scroll-to-make-visible-nest...

61 lines
1.9 KiB
HTML
Raw Permalink Normal View History

AX: When navigating the elements of a scrollable element with VoiceOver, the scrollTop() position of the element does not permanently change https://bugs.webkit.org/show_bug.cgi?id=125720 Reviewed by Daniel Bates. Source/WebCore: The scrollToVisible code did not account for scrollable elements that are larger than their viewports. First, we need to pass the sub-focus up the scroll chain (otherwise we'll scroll some parent to y=0). Second, we should try to center the focus within the viewport, rather than positioning at the bottom for a better experience. This change was adapted from Blink r183926: https://src.chromium.org/viewvc/blink?view=rev&revision=183926 Tests: accessibility/scroll-to-global-point-iframe-nested.html accessibility/scroll-to-global-point-iframe.html accessibility/scroll-to-global-point-main-window.html accessibility/scroll-to-global-point-nested.html accessibility/scroll-to-make-visible-div-overflow.html accessibility/scroll-to-make-visible-iframe.html accessibility/scroll-to-make-visible-nested-2.html accessibility/scroll-to-make-visible-nested.html accessibility/scroll-to-make-visible-with-subfocus.html * accessibility/AccessibilityObject.cpp: (WebCore::computeBestScrollOffset): (WebCore::AccessibilityObject::isOnscreen): (WebCore::AccessibilityObject::scrollToMakeVisibleWithSubFocus): (WebCore::AccessibilityObject::scrollToGlobalPoint): * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper accessibilityScrollToVisible]): (-[WebAccessibilityObjectWrapper _accessibilityScrollToMakeVisibleWithSubFocus:]): (-[WebAccessibilityObjectWrapper _accessibilityScrollToGlobalPoint:]): (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]): Tools: Add support for scrollToMakeVisibleWithSubFocus and scrollToGlobalPoint. * DumpRenderTree/AccessibilityUIElement.cpp: (pressCallback): (scrollToMakeVisibleWithSubFocusCallback): (scrollToGlobalPointCallback): (scrollToMakeVisibleCallback): (AccessibilityUIElement::getJSClass): * DumpRenderTree/ios/AccessibilityUIElementIOS.mm: (AccessibilityUIElement::scrollToMakeVisible): (AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): (AccessibilityUIElement::scrollToGlobalPoint): (AccessibilityUIElement::selectedTextRange): * DumpRenderTree/mac/AccessibilityUIElementMac.mm: (AccessibilityUIElement::AccessibilityUIElement): (AccessibilityUIElement::mathPrescriptsDescription): (AccessibilityUIElement::scrollToMakeVisible): (AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): (AccessibilityUIElement::scrollToGlobalPoint): * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp: (WTR::AccessibilityUIElement::isTextMarkerValid): (WTR::AccessibilityUIElement::textMarkerForIndex): (WTR::AccessibilityUIElement::scrollToMakeVisible): (WTR::AccessibilityUIElement::scrollToGlobalPoint): (WTR::AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): (WTR::AccessibilityUIElement::supportedActions): (WTR::AccessibilityUIElement::mathPostscriptsDescription): (WTR::AccessibilityUIElement::mathPrescriptsDescription): * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm: (WTR::AccessibilityUIElement::scrollToMakeVisible): (WTR::AccessibilityUIElement::scrollToGlobalPoint): (WTR::AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): (WTR::AccessibilityUIElement::selectedTextRange): * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: (WTR::AccessibilityUIElement::scrollToMakeVisible): (WTR::AccessibilityUIElement::scrollToGlobalPoint): (WTR::AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): (WTR::AccessibilityUIElement::selectedTextRange): LayoutTests: * accessibility/scroll-to-global-point-iframe-expected.txt: Added. * accessibility/scroll-to-global-point-iframe-nested-expected.txt: Added. * accessibility/scroll-to-global-point-iframe-nested.html: Added. * accessibility/scroll-to-global-point-iframe.html: Added. * accessibility/scroll-to-global-point-main-window-expected.txt: Added. * accessibility/scroll-to-global-point-main-window.html: Added. * accessibility/scroll-to-global-point-nested-expected.txt: Added. * accessibility/scroll-to-global-point-nested.html: Added. * accessibility/scroll-to-make-visible-div-overflow-expected.txt: Added. * accessibility/scroll-to-make-visible-div-overflow.html: Added. * accessibility/scroll-to-make-visible-iframe-expected.txt: Added. * accessibility/scroll-to-make-visible-iframe.html: Added. * accessibility/scroll-to-make-visible-nested-2-expected.txt: Added. * accessibility/scroll-to-make-visible-nested-2.html: Added. * accessibility/scroll-to-make-visible-nested-expected.txt: Added. * accessibility/scroll-to-make-visible-nested.html: Added. * accessibility/scroll-to-make-visible-with-subfocus-expected.txt: Added. * accessibility/scroll-to-make-visible-with-subfocus.html: Added. Canonical link: https://commits.webkit.org/166727@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189149 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-29 07:41:46 +00:00
<!DOCTYPE html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
<div id="outer_container" style="height: 100px; overflow: scroll">
<div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
<div id="inner_container" style="height: 100px; overflow: scroll">
<div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
<button id="target">Target</button>
</div>
</div>
<div id="console"></div>
<script>
description("Tests that scrolling to make an element visible successfully scrolls multiple nested scrolling views'.");
function runTest() {
window.outerContainer = document.getElementById("outer_container");
window.innerContainer = document.getElementById("inner_container");
window.target = document.getElementById("target");
var targetAccessibleObject;
if (window.accessibilityController) {
target.focus();
targetAccessibleObject = accessibilityController.focusedElement;
}
// Reset the initial scroll positions (since calling focus() can scroll the page too).
window.scrollTo(0, 0);
outerContainer.scrollTop = 0;
innerContainer.scrollTop = 0;
shouldBeZero("window.pageYOffset");
shouldBeZero("outerContainer.scrollTop");
shouldBeZero("innerContainer.scrollTop");
shouldBeGreaterThanOrEqual("target.getBoundingClientRect().top", "15000");
// Scroll to make target visible.
if (window.accessibilityController)
targetAccessibleObject.scrollToMakeVisible();
// Instead of testing the exact scroll offsets of the two containers, just test that
// the new absolute position of the target is on-screen.
shouldBeGreaterThanOrEqual("window.innerHeight", "target.getBoundingClientRect().bottom");
finishJSTest();
}
runTest();
</script>
</body>
</html>