haikuwebkit/LayoutTests/accessibility/scroll-to-global-point-main...

56 lines
1.5 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>
<style>
button {
border: 0;
}
</style>
</head>
<body>
<p id="description"></p>
<div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
<button id="target">Target</button>
<div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div>
<div id="console"></div>
<script>
description("Tests that scrolling an element to a specific point successfully scrolls the main window.");
function runTest() {
var target = document.getElementById("target");
if (window.accessibilityController) {
target.focus();
Some test cases in accessibility/mac/selection-notification-focus-change.html fail https://bugs.webkit.org/show_bug.cgi?id=182212 <rdar://problem/36937147> Reviewed by Antti Koivisto and Wenson Hsieh. Source/WebCore: The failure was caused by the async update of the selection appearance not preserving selection reveal intent. Fixed the bug by storing the intent in a member variable and using it later. * dom/Element.cpp: (WebCore::Element::focus): Removed an unnecessary synchronous layout update. * editing/FrameSelection.cpp: (WebCore::FrameSelection::setNeedsSelectionUpdate): Use the default intent to preserve the old behavior. (WebCore::FrameSelection::respondToNodeModification): Ditto. (WebCore::FrameSelection::setSelection): Save the selection reveal intent. (WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange): Use the saved intent. * editing/FrameSelection.h: * page/FocusController.cpp: (WebCore::FocusController::advanceFocusDirectionally): Always update the layout before invoking nodeRectInAbsoluteCoordinates. LayoutTests: Updated and rebaselined the tests. * accessibility/ios-simulator/header-elements.html: Force the layout after each call to element.focus now that element.focus no longer updates the layout synchronously. Ordinarily, this will happen next time the layout is updated for paint, by JS API, etc... but we have to force the accessibility tree to be up-to-date for testing purposes. * accessibility/ios-simulator/table-cell-for-row-col.html: Ditto. * accessibility/mac/selection-notification-focus-change-expected.txt: Now all the test cases are passing. * accessibility/mac/table-with-row-col-of-headers.html: Force the layout after each call to element.focus. * accessibility/mac/table-with-zebra-rows.html: Ditto. * accessibility/scroll-to-global-point-main-window.html: Ditto. * accessibility/scroll-to-make-visible-with-subfocus.html: Ditto. * editing/input/caret-at-the-edge-of-input.html: Wait for the focused element to reveal itself by a timer. * fast/forms/input-text-scroll-left-on-blur.html: Ditto. * fast/forms/textarea-no-scroll-on-blur.html: Ditto. * fast/forms/textarea-scrolled-type.html: Ditto. * platform/mac-wk2/accessibility/mac/selection-notification-focus-change-expected.txt: Rebaselined. We now get one less AXTextSelectionChangedFocus notification because selection updates are now coalesced as expected. Canonical link: https://commits.webkit.org/198201@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227983 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-01 23:11:13 +00:00
internals.updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks();
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
var targetAccessibleObject = accessibilityController.focusedElement;
}
// Reset the initial scroll position (since calling focus() can scroll the page too).
window.scrollTo(0, 0);
shouldBe("window.pageYOffset", "0");
// Scroll to various locations and check.
if (window.accessibilityController)
targetAccessibleObject.scrollToGlobalPoint(0, 0);
shouldBe("target.getBoundingClientRect().top", "0");
if (window.accessibilityController)
targetAccessibleObject.scrollToGlobalPoint(0, 300);
shouldBe("target.getBoundingClientRect().top", "300");
if (window.accessibilityController)
targetAccessibleObject.scrollToGlobalPoint(0, 3000);
shouldBe("target.getBoundingClientRect().top", "3000");
finishJSTest();
}
runTest();
</script>
</body>
</html>