Changeset 189149 in webkit
- Timestamp:
- Aug 29, 2015, 12:41:46 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 18 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/LayoutTests/ChangeLog ¶
r189146 r189149 1 2015-08-29 Chris Fleizach <cfleizach@apple.com> 2 3 AX: When navigating the elements of a scrollable element with VoiceOver, the scrollTop() position of the element does not permanently change 4 https://bugs.webkit.org/show_bug.cgi?id=125720 5 6 Reviewed by Daniel Bates. 7 8 * accessibility/scroll-to-global-point-iframe-expected.txt: Added. 9 * accessibility/scroll-to-global-point-iframe-nested-expected.txt: Added. 10 * accessibility/scroll-to-global-point-iframe-nested.html: Added. 11 * accessibility/scroll-to-global-point-iframe.html: Added. 12 * accessibility/scroll-to-global-point-main-window-expected.txt: Added. 13 * accessibility/scroll-to-global-point-main-window.html: Added. 14 * accessibility/scroll-to-global-point-nested-expected.txt: Added. 15 * accessibility/scroll-to-global-point-nested.html: Added. 16 * accessibility/scroll-to-make-visible-div-overflow-expected.txt: Added. 17 * accessibility/scroll-to-make-visible-div-overflow.html: Added. 18 * accessibility/scroll-to-make-visible-iframe-expected.txt: Added. 19 * accessibility/scroll-to-make-visible-iframe.html: Added. 20 * accessibility/scroll-to-make-visible-nested-2-expected.txt: Added. 21 * accessibility/scroll-to-make-visible-nested-2.html: Added. 22 * accessibility/scroll-to-make-visible-nested-expected.txt: Added. 23 * accessibility/scroll-to-make-visible-nested.html: Added. 24 * accessibility/scroll-to-make-visible-with-subfocus-expected.txt: Added. 25 * accessibility/scroll-to-make-visible-with-subfocus.html: Added. 26 1 27 2015-08-28 Alexey Proskuryakov <ap@apple.com> 2 28 -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r189144 r189149 1 2015-08-29 Chris Fleizach <cfleizach@apple.com> 2 3 AX: When navigating the elements of a scrollable element with VoiceOver, the scrollTop() position of the element does not permanently change 4 https://bugs.webkit.org/show_bug.cgi?id=125720 5 6 Reviewed by Daniel Bates. 7 8 The scrollToVisible code did not account for scrollable elements that are larger than their viewports. 9 First, we need to pass the sub-focus up the scroll chain (otherwise we'll scroll some parent to y=0). 10 Second, we should try to center the focus within the viewport, rather than positioning at the bottom for a 11 better experience. 12 13 This change was adapted from Blink r183926: 14 https://src.chromium.org/viewvc/blink?view=rev&revision=183926 15 16 Tests: accessibility/scroll-to-global-point-iframe-nested.html 17 accessibility/scroll-to-global-point-iframe.html 18 accessibility/scroll-to-global-point-main-window.html 19 accessibility/scroll-to-global-point-nested.html 20 accessibility/scroll-to-make-visible-div-overflow.html 21 accessibility/scroll-to-make-visible-iframe.html 22 accessibility/scroll-to-make-visible-nested-2.html 23 accessibility/scroll-to-make-visible-nested.html 24 accessibility/scroll-to-make-visible-with-subfocus.html 25 26 * accessibility/AccessibilityObject.cpp: 27 (WebCore::computeBestScrollOffset): 28 (WebCore::AccessibilityObject::isOnscreen): 29 (WebCore::AccessibilityObject::scrollToMakeVisibleWithSubFocus): 30 (WebCore::AccessibilityObject::scrollToGlobalPoint): 31 * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: 32 (-[WebAccessibilityObjectWrapper accessibilityScrollToVisible]): 33 (-[WebAccessibilityObjectWrapper _accessibilityScrollToMakeVisibleWithSubFocus:]): 34 (-[WebAccessibilityObjectWrapper _accessibilityScrollToGlobalPoint:]): 35 (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]): 36 1 37 2015-08-28 Myles C. Maxfield <mmaxfield@apple.com> 2 38 -
TabularUnified trunk/Source/WebCore/accessibility/AccessibilityObject.cpp ¶
r187371 r189149 2332 2332 // in order to make an object visible within a viewport. 2333 2333 // 2334 // If the object is already fully visible, returns the same scroll 2335 // offset. 2336 // 2334 2337 // In case the whole object cannot fit, you can specify a 2335 2338 // subfocus - a smaller region within the object that should … … 2337 2340 // ignored. 2338 2341 // 2339 // Example: the viewport is scrolled to the right just enough 2340 // that the object is in view. 2342 // If possible, the object and subfocus are centered within the 2343 // viewport. 2344 // 2345 // Example 1: the object is already visible, so nothing happens. 2346 // +----------Viewport---------+ 2347 // +---Object---+ 2348 // +--SubFocus--+ 2349 // 2350 // Example 2: the object is not fully visible, so it's centered 2351 // within the viewport. 2341 2352 // Before: 2342 2353 // +----------Viewport---------+ … … 2345 2356 // 2346 2357 // After: 2347 // +----------Viewport---------+2358 // +----------Viewport---------+ 2348 2359 // +---Object---+ 2349 2360 // +--SubFocus--+ 2361 // 2362 // Example 3: the object is larger than the viewport, so the 2363 // viewport moves to show as much of the object as possible, 2364 // while also trying to center the subfocus. 2365 // Before: 2366 // +----------Viewport---------+ 2367 // +---------------Object--------------+ 2368 // +-SubFocus-+ 2369 // 2370 // After: 2371 // +----------Viewport---------+ 2372 // +---------------Object--------------+ 2373 // +-SubFocus-+ 2350 2374 // 2351 2375 // When constraints cannot be fully satisfied, the min … … 2355 2379 // This may be out of range - the calling function should clip this 2356 2380 // to the available range. 2357 static int computeBestScrollOffset(int currentScrollOffset, int subfocusMin, int objectMin, int objectMax, int viewportMin, int viewportMax)2381 static int computeBestScrollOffset(int currentScrollOffset, int subfocusMin, int subfocusMax, int objectMin, int objectMax, int viewportMin, int viewportMax) 2358 2382 { 2359 2383 int viewportSize = viewportMax - viewportMin; 2360 2361 // If the focus size is larger than the viewport size, shrink it in the 2362 // direction of subfocus. 2384 2385 // If the object size is larger than the viewport size, consider 2386 // only a portion that's as large as the viewport, centering on 2387 // the subfocus as much as possible. 2363 2388 if (objectMax - objectMin > viewportSize) { 2364 // Subfocus must be within focus: 2389 // Since it's impossible to fit the whole object in the 2390 // viewport, exit now if the subfocus is already within the viewport. 2391 if (subfocusMin - currentScrollOffset >= viewportMin && subfocusMax - currentScrollOffset <= viewportMax) 2392 return currentScrollOffset; 2393 2394 // Subfocus must be within focus. 2365 2395 subfocusMin = std::max(subfocusMin, objectMin); 2366 2396 subfocusMax = std::min(subfocusMax, objectMax); 2397 2367 2398 // Subfocus must be no larger than the viewport size; favor top/left. 2368 if (subfocusMin + viewportSize > objectMax) 2369 objectMin = objectMax - viewportSize; 2370 else { 2371 objectMin = subfocusMin; 2372 objectMax = subfocusMin + viewportSize; 2373 } 2399 if (subfocusMax - subfocusMin > viewportSize) 2400 subfocusMax = subfocusMin + viewportSize; 2401 2402 // Compute the size of an object centered on the subfocus, the size of the viewport. 2403 int centeredObjectMin = (subfocusMin + subfocusMax - viewportSize) / 2; 2404 int centeredObjectMax = centeredObjectMin + viewportSize; 2405 2406 objectMin = std::max(objectMin, centeredObjectMin); 2407 objectMax = std::min(objectMax, centeredObjectMax); 2374 2408 } 2375 2409 … … 2378 2412 && objectMax - currentScrollOffset <= viewportMax) 2379 2413 return currentScrollOffset; 2380 2381 // Scroll left if we're too far to the right. 2382 if (objectMax - currentScrollOffset > viewportMax) 2383 return objectMax - viewportMax; 2384 2385 // Scroll right if we're too far to the left. 2386 if (objectMin - currentScrollOffset < viewportMin) 2387 return objectMin - viewportMin; 2388 2389 ASSERT_NOT_REACHED(); 2390 2391 // This shouldn't happen. 2392 return currentScrollOffset; 2414 2415 // Center the object in the viewport. 2416 return (objectMin + objectMax - viewportMin - viewportMax) / 2; 2393 2417 } 2394 2418 … … 2450 2474 IntRect scrollVisibleRect = scrollableArea->visibleContentRect(ScrollableArea::LegacyIOSDocumentVisibleRect); 2451 2475 2476 if (!scrollParent->isScrollView()) { 2477 objectRect.moveBy(scrollPosition); 2478 objectRect.moveBy(-snappedIntRect(scrollParent->elementRect()).location()); 2479 } 2480 2452 2481 int desiredX = computeBestScrollOffset( 2453 2482 scrollPosition.x(), 2454 objectRect.x() + subfocus.x(), 2483 objectRect.x() + subfocus.x(), objectRect.x() + subfocus.maxX(), 2455 2484 objectRect.x(), objectRect.maxX(), 2456 2485 0, scrollVisibleRect.width()); 2457 2486 int desiredY = computeBestScrollOffset( 2458 2487 scrollPosition.y(), 2459 objectRect.y() + subfocus.y(), 2488 objectRect.y() + subfocus.y(), objectRect.y() + subfocus.maxY(), 2460 2489 objectRect.y(), objectRect.maxY(), 2461 2490 0, scrollVisibleRect.height()); … … 2463 2492 scrollParent->scrollTo(IntPoint(desiredX, desiredY)); 2464 2493 2494 // Convert the subfocus into the coordinates of the scroll parent. 2495 IntRect newSubfocus = subfocus; 2496 IntRect newElementRect = snappedIntRect(elementRect()); 2497 IntRect scrollParentRect = snappedIntRect(scrollParent->elementRect()); 2498 newSubfocus.move(newElementRect.x(), newElementRect.y()); 2499 newSubfocus.move(-scrollParentRect.x(), -scrollParentRect.y()); 2500 2465 2501 // Recursively make sure the scroll parent itself is visible. 2466 2502 if (scrollParent->parentObject()) 2467 scrollParent->scrollToMakeVisible ();2503 scrollParent->scrollToMakeVisibleWithSubFocus(newSubfocus); 2468 2504 } 2469 2505 … … 2504 2540 int desiredX = computeBestScrollOffset( 2505 2541 0, 2506 objectRect.x(), 2542 objectRect.x(), objectRect.maxX(), 2507 2543 objectRect.x(), objectRect.maxX(), 2508 2544 point.x(), point.x()); 2509 2545 int desiredY = computeBestScrollOffset( 2510 2546 0, 2511 objectRect.y(), 2547 objectRect.y(), objectRect.maxY(), 2512 2548 objectRect.y(), objectRect.maxY(), 2513 2549 point.y(), point.y()); -
TabularUnified trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm ¶
r188947 r189149 3362 3362 } 3363 3363 3364 - (void)_accessibilityScrollToMakeVisibleWithSubFocus:(NSRect)rect 3365 { 3366 m_object->scrollToMakeVisibleWithSubFocus(IntRect(rect)); 3367 } 3368 3369 - (void)_accessibilityScrollToGlobalPoint:(NSPoint)point 3370 { 3371 m_object->scrollToGlobalPoint(IntPoint(point)); 3372 } 3373 3364 3374 - (void)accessibilityPerformAction:(NSString*)action 3365 3375 { -
TabularUnified trunk/Tools/ChangeLog ¶
r189137 r189149 1 2015-08-29 Chris Fleizach <cfleizach@apple.com> 2 3 AX: When navigating the elements of a scrollable element with VoiceOver, the scrollTop() position of the element does not permanently change 4 https://bugs.webkit.org/show_bug.cgi?id=125720 5 6 Reviewed by Daniel Bates. 7 8 Add support for scrollToMakeVisibleWithSubFocus and scrollToGlobalPoint. 9 10 * DumpRenderTree/AccessibilityUIElement.cpp: 11 (pressCallback): 12 (scrollToMakeVisibleWithSubFocusCallback): 13 (scrollToGlobalPointCallback): 14 (scrollToMakeVisibleCallback): 15 (AccessibilityUIElement::getJSClass): 16 * DumpRenderTree/ios/AccessibilityUIElementIOS.mm: 17 (AccessibilityUIElement::scrollToMakeVisible): 18 (AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): 19 (AccessibilityUIElement::scrollToGlobalPoint): 20 (AccessibilityUIElement::selectedTextRange): 21 * DumpRenderTree/mac/AccessibilityUIElementMac.mm: 22 (AccessibilityUIElement::AccessibilityUIElement): 23 (AccessibilityUIElement::mathPrescriptsDescription): 24 (AccessibilityUIElement::scrollToMakeVisible): 25 (AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): 26 (AccessibilityUIElement::scrollToGlobalPoint): 27 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp: 28 (WTR::AccessibilityUIElement::isTextMarkerValid): 29 (WTR::AccessibilityUIElement::textMarkerForIndex): 30 (WTR::AccessibilityUIElement::scrollToMakeVisible): 31 (WTR::AccessibilityUIElement::scrollToGlobalPoint): 32 (WTR::AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): 33 (WTR::AccessibilityUIElement::supportedActions): 34 (WTR::AccessibilityUIElement::mathPostscriptsDescription): 35 (WTR::AccessibilityUIElement::mathPrescriptsDescription): 36 * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: 37 * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: 38 * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm: 39 (WTR::AccessibilityUIElement::scrollToMakeVisible): 40 (WTR::AccessibilityUIElement::scrollToGlobalPoint): 41 (WTR::AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): 42 (WTR::AccessibilityUIElement::selectedTextRange): 43 * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: 44 (WTR::AccessibilityUIElement::scrollToMakeVisible): 45 (WTR::AccessibilityUIElement::scrollToGlobalPoint): 46 (WTR::AccessibilityUIElement::scrollToMakeVisibleWithSubFocus): 47 (WTR::AccessibilityUIElement::selectedTextRange): 48 1 49 2015-08-28 Timothy Horton <timothy_horton@apple.com> 2 50 -
TabularUnified trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp ¶
r189044 r189149 706 706 { 707 707 toAXElement(thisObject)->press(); 708 return JSValueMakeUndefined(context); 709 } 710 711 static JSValueRef scrollToMakeVisibleWithSubFocusCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 712 { 713 unsigned x = 0; 714 unsigned y = 0; 715 unsigned width = 0; 716 unsigned height = 0; 717 if (argumentCount == 4) { 718 x = JSValueToNumber(context, arguments[0], exception); 719 y = JSValueToNumber(context, arguments[1], exception); 720 width = JSValueToNumber(context, arguments[2], exception); 721 height = JSValueToNumber(context, arguments[3], exception); 722 } 723 724 toAXElement(thisObject)->scrollToMakeVisibleWithSubFocus(x, y, width, height); 725 return JSValueMakeUndefined(context); 726 } 727 728 static JSValueRef scrollToGlobalPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 729 { 730 unsigned x = 0; 731 unsigned y = 0; 732 if (argumentCount == 2) { 733 x = JSValueToNumber(context, arguments[0], exception); 734 y = JSValueToNumber(context, arguments[1], exception); 735 } 736 737 toAXElement(thisObject)->scrollToGlobalPoint(x, y); 708 738 return JSValueMakeUndefined(context); 709 739 } … … 1701 1731 { "selectedChildAtIndex", selectedChildAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1702 1732 { "scrollToMakeVisible", scrollToMakeVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1733 { "scrollToGlobalPoint", scrollToGlobalPointCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1734 { "scrollToMakeVisibleWithSubFocus", scrollToMakeVisibleWithSubFocusCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1703 1735 #if PLATFORM(GTK) || PLATFORM(EFL) 1704 1736 { "characterAtOffset", characterAtOffsetCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -
TabularUnified trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm ¶
r187371 r189149 681 681 } 682 682 683 void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height) 684 { 685 // FIXME: implement 686 } 687 688 void AccessibilityUIElement::scrollToGlobalPoint(int x, int y) 689 { 690 // FIXME: implement 691 } 692 683 693 JSStringRef AccessibilityUIElement::selectedTextRange() 684 694 { -
TabularUnified trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm ¶
r189044 r189149 77 77 - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute; 78 78 - (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName; 79 - (void)_accessibilityScrollToMakeVisibleWithSubFocus:(NSRect)rect; 80 - (void)_accessibilityScrollToGlobalPoint:(NSPoint)point; 79 81 - (void)_accessibilitySetValue:(id)value forAttribute:(NSString*)attributeName; 80 82 @end … … 1882 1884 } 1883 1885 1884 1885 1886 void AccessibilityUIElement::scrollToMakeVisible() 1886 1887 { … … 1892 1893 void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height) 1893 1894 { 1894 // FIXME: implement 1895 BEGIN_AX_OBJC_EXCEPTIONS 1896 [m_element _accessibilityScrollToMakeVisibleWithSubFocus:NSMakeRect(x, y, width, height)]; 1897 END_AX_OBJC_EXCEPTIONS 1895 1898 } 1896 1899 1897 1900 void AccessibilityUIElement::scrollToGlobalPoint(int x, int y) 1898 1901 { 1899 // FIXME: implement 1900 } 1902 BEGIN_AX_OBJC_EXCEPTIONS 1903 [m_element _accessibilityScrollToGlobalPoint:NSMakePoint(x, y)]; 1904 END_AX_OBJC_EXCEPTIONS 1905 } -
TabularUnified trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp ¶
r189044 r189149 225 225 PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::textMarkerForIndex(int) { return 0; } 226 226 void AccessibilityUIElement::scrollToMakeVisible() { } 227 void AccessibilityUIElement::scrollToGlobalPoint(int, int) { } 228 void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int, int, int, int) { } 227 229 JSRetainPtr<JSStringRef> AccessibilityUIElement::supportedActions() const { return 0; } 228 230 JSRetainPtr<JSStringRef> AccessibilityUIElement::mathPostscriptsDescription() const { return 0; } -
TabularUnified trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h ¶
r187371 r189149 226 226 227 227 void scrollToMakeVisible(); 228 void scrollToGlobalPoint(int x, int y); 229 void scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height); 228 230 229 231 // Text markers. -
TabularUnified trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl ¶
r187371 r189149 170 170 171 171 void scrollToMakeVisible(); 172 void scrollToGlobalPoint(int x, int y); 173 void scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height); 174 172 175 void takeFocus(); 173 176 boolean scrollPageDown(); -
TabularUnified trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp ¶
r185502 r189149 1936 1936 // FIXME: implement 1937 1937 } 1938 1939 void AccessibilityUIElement::scrollToGlobalPoint(int x, int y) 1940 { 1941 // FIXME: implement 1942 } 1943 1944 void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height) 1945 { 1946 // FIXME: implement 1947 } 1938 1948 1939 1949 JSRetainPtr<JSStringRef> AccessibilityUIElement::supportedActions() const -
TabularUnified trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm ¶
r189044 r189149 700 700 { 701 701 } 702 703 void AccessibilityUIElement::scrollToGlobalPoint(int x, int y) 704 { 705 } 706 707 void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height) 708 { 709 } 702 710 703 711 JSRetainPtr<JSStringRef> AccessibilityUIElement::selectedTextRange() -
TabularUnified trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm ¶
r189044 r189149 81 81 - (NSUInteger)accessibilityArrayAttributeCount:(NSString *)attribute; 82 82 - (void)_accessibilitySetTestValue:(id)value forAttribute:(NSString*)attributeName; 83 - (void)_accessibilityScrollToMakeVisibleWithSubFocus:(NSRect)rect; 84 - (void)_accessibilityScrollToGlobalPoint:(NSPoint)point; 83 85 - (void)_accessibilitySetValue:(id)value forAttribute:(NSString*)attributeName; 84 86 @end … … 1374 1376 } 1375 1377 1378 void AccessibilityUIElement::scrollToGlobalPoint(int x, int y) 1379 { 1380 BEGIN_AX_OBJC_EXCEPTIONS 1381 [m_element _accessibilityScrollToGlobalPoint:NSMakePoint(x, y)]; 1382 END_AX_OBJC_EXCEPTIONS 1383 } 1384 1385 void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height) 1386 { 1387 BEGIN_AX_OBJC_EXCEPTIONS 1388 [m_element _accessibilityScrollToMakeVisibleWithSubFocus:NSMakeRect(x, y, width, height)]; 1389 END_AX_OBJC_EXCEPTIONS 1390 } 1391 1376 1392 JSRetainPtr<JSStringRef> AccessibilityUIElement::selectedTextRange() 1377 1393 {
Note:
See TracChangeset
for help on using the changeset viewer.