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

66 lines
2.2 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>
WebKit doesn't parse "#" as delimiter for fragment identifier in data URIs https://bugs.webkit.org/show_bug.cgi?id=68089 Patch by Rob Buis <rbuis@igalia.com> on 2020-10-05 Reviewed by Alex Christensen, Ryosuke Niwa, and Darin Adler. LayoutTests/imported/w3c: Update improved test results. * web-platform-tests/fetch/data-urls/processing.any-expected.txt: * web-platform-tests/fetch/data-urls/processing.any.worker-expected.txt: * web-platform-tests/url/data-uri-fragment-expected.txt: Source/WebCore: To maintain compatibility with existing iOS and macOS apps, we only do this for apps linked with the SDK after the change. Covered by newly passing web platform tests (which Chrome and Firefox already passed). * loader/ResourceLoader.cpp: (WebCore::shouldStripFragmentIdentifier): (WebCore::ResourceLoader::loadDataURL): * platform/cocoa/VersionChecks.h: Source/WTF: * wtf/URL.h: * wtf/spi/darwin/dyldSPI.h: LayoutTests: Adjusts tests thats use data URIs to escape the # character. * accessibility/ios-simulator/iframe-access.html: * accessibility/ios-simulator/unobscured-content-rect.html: * accessibility/resources/iframe.html: * accessibility/scroll-to-global-point-iframe.html: * accessibility/scroll-to-make-visible-iframe-offscreen.html: * accessibility/scroll-to-make-visible-iframe.html: * css3/blending/background-blend-mode-crossfade-image.html: * css3/blending/background-blend-mode-data-uri-svg-image.html: * css3/blending/background-blend-mode-tiled-layers.html: * css3/flexbox/flexitem.html: * css3/shapes/shape-outside/shape-image/shape-image-002.html: * css3/shapes/shape-outside/shape-image/shape-image-005.html: * editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html: * editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html: * fast/css-grid-layout/grid-item-display.html: * fast/css/import-style-update.html: * fast/css/link-media-attr.html: * fast/dom/HTMLLinkElement/link-stylesheet-media-type.html: * fast/events/attribute-listener-cloned-from-frameless-doc-context-2.html: * fast/events/attribute-listener-cloned-from-frameless-doc-context.html: * fast/events/attribute-listener-extracted-from-frameless-doc-context-2.html: * fast/events/attribute-listener-extracted-from-frameless-doc-context.html: * fast/hidpi/image-srcset-data-escaped-srcset.html: * fast/html/link-rel-stylesheet.html: * fast/loader/data-url-encoding-html.html: * fast/loader/data-url-encoding-svg.html: * fast/spatial-navigation/resources/iframe.html: * http/tests/security/top-level-unique-origin.https.html: * platform/ios/css3/flexbox/flexitem-expected.txt: * platform/win/css3/flexbox/flexitem-expected.txt: * security/contentSecurityPolicy/link-with-data-url-allowed-by-style-src-star-with-AllowContentSecurityPolicySourceStarToMatchAnyProtocol-enabled.html: * svg/animations/css-animation-background-svg.html: * svg/animations/css-animation-embedded-svg.html: * svg/animations/css-animation-hover-svg.html: * svg/as-image/svg-canvas-data-url-svg-with-feimage-not-tainted.html: * svg/custom/object-data-href.html: Canonical link: https://commits.webkit.org/230098@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267995 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-05 19:36:22 +00:00
<iframe id="frame" src="data:text/html,<body><button id='upper_target'>Upper Target</button><div style='border: 1px solid %23000; height: 5000px;'>5000-pixel box</div><button id='lower_target'>Lower Target</button></body>"></iframe>
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
<div id="console"></div>
<script>
description("Tests that scrolling to make an element visible successfully scrolls an iframe.");
window.jsTestIsAsync = true;
function runTest() {
window.frame = document.getElementById("frame");
window.frameWindow = frame.contentWindow;
window.frameDoc = frameWindow.document;
var upperTarget = frameDoc.getElementById("upper_target");
var lowerTarget = frameDoc.getElementById("lower_target");
var lowerTargetAccessibleObject;
var upperTargetAccessibleObject;
if (window.accessibilityController) {
lowerTarget.focus();
lowerTargetAccessibleObject = accessibilityController.focusedElement;
upperTarget.focus();
upperTargetAccessibleObject = accessibilityController.focusedElement;
}
// Reset the initial scroll position (since calling focus() can scroll the page too).
frameWindow.scrollTo(0, 0);
shouldBeZero("frameWindow.pageYOffset");
// Scroll to make lower target visible and check.
if (window.accessibilityController)
lowerTargetAccessibleObject.scrollToMakeVisible();
window.minYOffset = lowerTarget.offsetTop + lowerTarget.offsetHeight - frameWindow.innerHeight;
window.maxYOffset = lowerTarget.offsetTop;
shouldBeTrue("frameWindow.pageYOffset >= minYOffset");
shouldBeTrue("frameWindow.pageYOffset <= maxYOffset");
// Scroll to make upper target visible and check.
if (window.accessibilityController)
upperTargetAccessibleObject.scrollToMakeVisible();
window.minYOffset = upperTarget.offsetTop + upperTarget.offsetHeight - frameWindow.innerHeight;
window.maxYOffset = upperTarget.offsetTop;
shouldBeTrue("frameWindow.pageYOffset >= minYOffset");
shouldBeTrue("frameWindow.pageYOffset <= maxYOffset");
finishJSTest();
}
window.addEventListener("load", function() {
setTimeout(runTest, 0);
}, false);
</script>
</body>
</html>