Title: [231113] trunk
Revision
231113
Author
n_w...@apple.com
Date
2018-04-27 14:58:33 -0700 (Fri, 27 Apr 2018)

Log Message

AX: Accessibility needs to know which part of the content view is visible on iOS
https://bugs.webkit.org/show_bug.cgi?id=185085
<rdar://problem/39801363>

Reviewed by Chris Fleizach.

Source/WebCore:

Exposed unobscuredContentRect() to iOS accessibility object wrapper.

Test: accessibility/ios-simulator/unobscured-content-rect.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityVisibleContentRect]):

Tools:

* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::stringAttributeValue):

LayoutTests:

* accessibility/ios-simulator/unobscured-content-rect-expected.txt: Added.
* accessibility/ios-simulator/unobscured-content-rect.html: Added.
* platform/ios-wk1/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231112 => 231113)


--- trunk/LayoutTests/ChangeLog	2018-04-27 21:35:56 UTC (rev 231112)
+++ trunk/LayoutTests/ChangeLog	2018-04-27 21:58:33 UTC (rev 231113)
@@ -1,3 +1,15 @@
+2018-04-27  Nan Wang  <n_w...@apple.com>
+
+        AX: Accessibility needs to know which part of the content view is visible on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=185085
+        <rdar://problem/39801363>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/unobscured-content-rect-expected.txt: Added.
+        * accessibility/ios-simulator/unobscured-content-rect.html: Added.
+        * platform/ios-wk1/TestExpectations:
+
 2018-04-27  Christopher Reid  <chris.r...@sony.com>
 
         URL::appendEncodedHostName is using the deprecated uidna_IDNToASCII function

Added: trunk/LayoutTests/accessibility/ios-simulator/unobscured-content-rect-expected.txt (0 => 231113)


--- trunk/LayoutTests/accessibility/ios-simulator/unobscured-content-rect-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/unobscured-content-rect-expected.txt	2018-04-27 21:58:33 UTC (rev 231113)
@@ -0,0 +1,12 @@
+test  
+This tests that unobscured content rect is exposed to accessibility.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS button.stringAttributeValue('AXVisibleContentRect') is '{0.00, 0.00, 800.00, 600.00}'
+PASS frameButton.stringAttributeValue('AXVisibleContentRect') is '{60.00, 10.00, 200.00, 200.00}'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/ios-simulator/unobscured-content-rect.html (0 => 231113)


--- trunk/LayoutTests/accessibility/ios-simulator/unobscured-content-rect.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/unobscured-content-rect.html	2018-04-27 21:58:33 UTC (rev 231113)
@@ -0,0 +1,38 @@
+
+<!DOCTYPE html>
+<html>
+<body id="body">
+<script src=""
+<div id="content">
+<button id="button">test</button>
+
+<iframe id="iframe" _onload_="startTest();" width="200" height="200" src="" id='frame-button'>Click me</button><a href='' id='frame-link'>a</a></body>"></iframe>
+
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that unobscured content rect is exposed to accessibility.");
+
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+        var button = accessibilityController.accessibleElementById("button");
+        shouldBe("button.stringAttributeValue('AXVisibleContentRect')", "'{0.00, 0.00, 800.00, 600.00}'");
+
+        var frameButton;
+        function startTest() {
+        	var iframe = document.getElementById("iframe");
+        	frameButton = iframe.contentWindow.accessibilityController.accessibleElementById("frame-button");
+            shouldBe("frameButton.stringAttributeValue('AXVisibleContentRect')", "'{60.00, 10.00, 200.00, 200.00}'");
+        	finishJSTest();
+        }
+    }
+</script>
+
+<script src=""
+</body>
+</html>
+

Modified: trunk/LayoutTests/platform/ios-wk1/TestExpectations (231112 => 231113)


--- trunk/LayoutTests/platform/ios-wk1/TestExpectations	2018-04-27 21:35:56 UTC (rev 231112)
+++ trunk/LayoutTests/platform/ios-wk1/TestExpectations	2018-04-27 21:58:33 UTC (rev 231113)
@@ -105,6 +105,7 @@
 # Not supported on WK1
 accessibility/ios-simulator/speak-selection-content.html [ Skip ]
 accessibility/ios-simulator/accessibility-events-setting.html [ Skip ]
+accessibility/ios-simulator/unobscured-content-rect.html [ Skip ]
 
 # FIXME: Tests that fail due to lack of textInputController <rdar://problem/5106287>
 editing/inserting/insert-composition-whitespace.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (231112 => 231113)


--- trunk/Source/WebCore/ChangeLog	2018-04-27 21:35:56 UTC (rev 231112)
+++ trunk/Source/WebCore/ChangeLog	2018-04-27 21:58:33 UTC (rev 231113)
@@ -1,3 +1,18 @@
+2018-04-27  Nan Wang  <n_w...@apple.com>
+
+        AX: Accessibility needs to know which part of the content view is visible on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=185085
+        <rdar://problem/39801363>
+
+        Reviewed by Chris Fleizach.
+
+        Exposed unobscuredContentRect() to iOS accessibility object wrapper.
+
+        Test: accessibility/ios-simulator/unobscured-content-rect.html
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityVisibleContentRect]):
+
 2018-04-27  Simon Fraser  <simon.fra...@apple.com>
 
         Refactor filter list checking code

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (231112 => 231113)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2018-04-27 21:35:56 UTC (rev 231112)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2018-04-27 21:58:33 UTC (rev 231113)
@@ -1666,6 +1666,18 @@
     return CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
 }
 
+- (CGRect)accessibilityVisibleContentRect
+{
+    if (![self _prepareAccessibilityCall])
+        return CGRectZero;
+    
+    Document* document = m_object->document();
+    if (!document || !document->view())
+        return CGRectZero;
+    IntRect rect = snappedIntRect(document->view()->unobscuredContentRect());
+    return [self convertRectToScreenSpace:rect];
+}
+
 // The "center point" is where VoiceOver will "press" an object. This may not be the actual
 // center of the accessibilityFrame
 - (CGPoint)accessibilityActivationPoint

Modified: trunk/Tools/ChangeLog (231112 => 231113)


--- trunk/Tools/ChangeLog	2018-04-27 21:35:56 UTC (rev 231112)
+++ trunk/Tools/ChangeLog	2018-04-27 21:58:33 UTC (rev 231113)
@@ -1,3 +1,14 @@
+2018-04-27  Nan Wang  <n_w...@apple.com>
+
+        AX: Accessibility needs to know which part of the content view is visible on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=185085
+        <rdar://problem/39801363>
+
+        Reviewed by Chris Fleizach.
+
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::stringAttributeValue):
+
 2018-04-27  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (231112 => 231113)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2018-04-27 21:35:56 UTC (rev 231112)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm	2018-04-27 21:58:33 UTC (rev 231113)
@@ -81,6 +81,7 @@
 - (NSArray *)accessibilityFindMatchingObjects:(NSDictionary *)parameters;
 - (NSArray<NSString *> *)accessibilitySpeechHint;
 - (BOOL)_accessibilityIsStrongPasswordField;
+- (CGRect)accessibilityVisibleContentRect;
 
 // TextMarker related
 - (NSArray *)textMarkerRange;
@@ -356,6 +357,12 @@
     
     if (JSStringIsEqualToUTF8CString(attribute, "AXSortDirection"))
         return [[m_element accessibilitySortDirection] createJSStringRef];
+    
+    if (JSStringIsEqualToUTF8CString(attribute, "AXVisibleContentRect")) {
+        CGRect screenRect = [m_element accessibilityVisibleContentRect];
+        NSString *rectStr = [NSString stringWithFormat:@"{%.2f, %.2f, %.2f, %.2f}", screenRect.origin.x, screenRect.origin.y, screenRect.size.width, screenRect.size.height];
+        return [rectStr createJSStringRef];
+    }
 
     return JSStringCreateWithCharacters(0, 0);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to