Title: [231937] trunk
Revision
231937
Author
n_w...@apple.com
Date
2018-05-17 18:27:48 -0700 (Thu, 17 May 2018)

Log Message

AX: [macOS] Expose the primary screen height through AX API
https://bugs.webkit.org/show_bug.cgi?id=185742

Reviewed by Chris Fleizach.

Source/WebCore:

Added a new attribute to expose the primary screen size on both
WebAccessibilityObjectWrapper and WKAccessibilityWebPageObject.

Test: accessibility/mac/primary-screen-height.html

* WebCore.xcodeproj/project.pbxproj:
* accessibility/mac/WebAccessibilityObjectWrapperMac.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper primaryScreenHeight]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* platform/PlatformScreen.h:
* platform/mac/PlatformScreenMac.mm:
(WebCore::screenRectForPrimaryScreen):

Source/WebKit:

* WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
(-[WKAccessibilityWebPageObject accessibilityAttributeNames]):
(-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):

Tools:

* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(attributesOfElement):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::attributesOfElement):

LayoutTests:

* accessibility/mac/primary-screen-height-expected.txt: Added.
* accessibility/mac/primary-screen-height.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231936 => 231937)


--- trunk/LayoutTests/ChangeLog	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/LayoutTests/ChangeLog	2018-05-18 01:27:48 UTC (rev 231937)
@@ -1,3 +1,13 @@
+2018-05-17  Nan Wang  <n_w...@apple.com>
+
+        AX: [macOS] Expose the primary screen height through AX API
+        https://bugs.webkit.org/show_bug.cgi?id=185742
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/primary-screen-height-expected.txt: Added.
+        * accessibility/mac/primary-screen-height.html: Added.
+
 2018-05-17  Chris Dumez  <cdu...@apple.com>
 
         RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent

Added: trunk/LayoutTests/accessibility/mac/primary-screen-height-expected.txt (0 => 231937)


--- trunk/LayoutTests/accessibility/mac/primary-screen-height-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/primary-screen-height-expected.txt	2018-05-18 01:27:48 UTC (rev 231937)
@@ -0,0 +1,12 @@
+Click
+This tests the primary screen height is exposed to AX API from web process.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS screenHeightFromRootElement > 0 is true
+PASS screenHeightFromWebArea > 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/primary-screen-height.html (0 => 231937)


--- trunk/LayoutTests/accessibility/mac/primary-screen-height.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/primary-screen-height.html	2018-05-18 01:27:48 UTC (rev 231937)
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<button id="button1">Click</button>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This tests the primary screen height is exposed to AX API from web process.");
+    if (window.accessibilityController) {
+    	var rootElement = accessibilityController.rootElement;
+        var webArea = accessibilityController.rootElement.childAtIndex(0);
+
+        var screenHeightFromRootElement = rootElement.numberAttributeValue("_AXPrimaryScreenHeight");
+        shouldBeTrue("screenHeightFromRootElement > 0");
+
+        var screenHeightFromWebArea = webArea.numberAttributeValue("_AXPrimaryScreenHeight");
+        shouldBeTrue("screenHeightFromWebArea > 0");
+    }
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (231936 => 231937)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2018-05-18 01:27:48 UTC (rev 231937)
@@ -514,6 +514,9 @@
 
 webkit.org/b/182752 accessibility/mac/accessibility-make-first-responder.html [ Skip ]
 
+# This test tests the rootElement on WK2.
+webkit.org/b/185742 accessibility/mac/primary-screen-height.html [ Skip ]
+
 # User-installed fonts test infrastructure is not present in WK1
 webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]
 

Modified: trunk/Source/WebCore/ChangeLog (231936 => 231937)


--- trunk/Source/WebCore/ChangeLog	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Source/WebCore/ChangeLog	2018-05-18 01:27:48 UTC (rev 231937)
@@ -1,3 +1,25 @@
+2018-05-17  Nan Wang  <n_w...@apple.com>
+
+        AX: [macOS] Expose the primary screen height through AX API
+        https://bugs.webkit.org/show_bug.cgi?id=185742
+
+        Reviewed by Chris Fleizach.
+
+        Added a new attribute to expose the primary screen size on both
+        WebAccessibilityObjectWrapper and WKAccessibilityWebPageObject.
+
+        Test: accessibility/mac/primary-screen-height.html
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.h:
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper primaryScreenHeight]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        * platform/PlatformScreen.h:
+        * platform/mac/PlatformScreenMac.mm:
+        (WebCore::screenRectForPrimaryScreen):
+
 2018-05-17  Chris Dumez  <cdu...@apple.com>
 
         RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (231936 => 231937)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-05-18 01:27:48 UTC (rev 231937)
@@ -711,7 +711,7 @@
 		29A812410FBB9C1D00510293 /* AccessibilityTableColumn.h in Headers */ = {isa = PBXBuildFile; fileRef = 29A812230FBB9C1D00510293 /* AccessibilityTableColumn.h */; };
 		29A812420FBB9C1D00510293 /* AccessibilityListBoxOption.h in Headers */ = {isa = PBXBuildFile; fileRef = 29A812240FBB9C1D00510293 /* AccessibilityListBoxOption.h */; };
 		29A812430FBB9C1D00510293 /* AccessibilityListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 29A812250FBB9C1D00510293 /* AccessibilityListBox.h */; };
-		29A812490FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 29A812450FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.h */; };
+		29A812490FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 29A812450FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		29ACB212143E7128006BCA5F /* AccessibilityMockObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 29ACB211143E7128006BCA5F /* AccessibilityMockObject.h */; };
 		29D7BCFA1444AF7D0070619C /* AccessibilitySpinButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D7BCF91444AF7D0070619C /* AccessibilitySpinButton.h */; };
 		29FAF4B6195AB08900A522DC /* TextUndoInsertionMarkupMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 29FAF4B5195AB08900A522DC /* TextUndoInsertionMarkupMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3275,7 +3275,7 @@
 		AA2A5AD216A4860A00976A25 /* JSSpeechSynthesisEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = AA2A5AC116A485D500976A25 /* JSSpeechSynthesisEvent.h */; };
 		AA2A5AD416A4861100975A25 /* SpeechSynthesis.h in Headers */ = {isa = PBXBuildFile; fileRef = AA2A5ABE16A485D500975A25 /* SpeechSynthesis.h */; };
 		AA2A5AD616A4861600975A25 /* DOMWindowSpeechSynthesis.h in Headers */ = {isa = PBXBuildFile; fileRef = AA2A5AB916A485D500975A25 /* DOMWindowSpeechSynthesis.h */; };
-		AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */ = {isa = PBXBuildFile; fileRef = AA478A7D16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h */; };
+		AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */ = {isa = PBXBuildFile; fileRef = AA478A7D16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		AA4C3A770B2B1679002334A2 /* InlineStyleSheetOwner.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4C3A750B2B1679002334A2 /* InlineStyleSheetOwner.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		AA5F3B8D16CC33D100455EB0 /* PlatformSpeechSynthesizerMock.h in Headers */ = {isa = PBXBuildFile; fileRef = AAE27B7516CBFC0D00623043 /* PlatformSpeechSynthesizerMock.h */; };
 		AA5F3B8F16CC4B3900455EB0 /* PlatformSpeechSynthesizerMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAE27B7416CBFC0D00623043 /* PlatformSpeechSynthesizerMock.cpp */; };
@@ -26931,6 +26931,8 @@
 			isa = PBXHeadersBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				29A812490FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.h in Headers */,
+				AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */,
 				7CD0E2B81F80A4820016A4CE /* AbortController.h in Headers */,
 				7CD0E2BF1F80A56E0016A4CE /* AbortSignal.h in Headers */,
 				46B95195207D633400A7D2DD /* AbstractDOMWindow.h in Headers */,
@@ -30723,9 +30725,7 @@
 				FD7F299213D4C0CB00AD9535 /* WaveShaperDSPKernel.h in Headers */,
 				FD7F299413D4C0CB00AD9535 /* WaveShaperNode.h in Headers */,
 				FD7F299713D4C0CB00AD9535 /* WaveShaperProcessor.h in Headers */,
-				29A812490FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.h in Headers */,
 				AAA728F716D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h in Headers */,
-				AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */,
 				2D3EF4481917915C00034184 /* WebActionDisablingCALayerDelegate.h in Headers */,
 				71025ED31F99F0CE004A250C /* WebAnimation.h in Headers */,
 				7132445120109DA500AE7FB2 /* WebAnimationUtilities.h in Headers */,

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.h (231936 => 231937)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.h	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.h	2018-05-18 01:27:48 UTC (rev 231937)
@@ -32,6 +32,10 @@
 
 #if PLATFORM(MAC)
 
+#ifndef NSAccessibilityPrimaryScreenHeightAttribute
+#define NSAccessibilityPrimaryScreenHeightAttribute @"_AXPrimaryScreenHeight"
+#endif
+
 @interface WebAccessibilityObjectWrapper : WebAccessibilityObjectWrapperBase
 
 - (id)textMarkerRangeFromVisiblePositions:(const WebCore::VisiblePosition&)startPosition endPosition:(const WebCore::VisiblePosition&)endPosition;

Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (231936 => 231937)


--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm	2018-05-18 01:27:48 UTC (rev 231937)
@@ -1656,6 +1656,9 @@
     if (m_object->currentState() != AccessibilityCurrentState::False)
         objectAttributes = [objectAttributes arrayByAddingObjectsFromArray:@[ NSAccessibilityARIACurrentAttribute ]];
     
+    // AppKit needs to know the screen height in order to do the coordinate conversion.
+    objectAttributes = [objectAttributes arrayByAddingObjectsFromArray:@[ NSAccessibilityPrimaryScreenHeightAttribute ]];
+    
     return objectAttributes;
 }
 
@@ -1819,6 +1822,12 @@
     return [self bezierPathFromPath:transformedPath];
 }
 
+- (NSNumber *)primaryScreenHeight
+{
+    FloatRect screenRect = screenRectForPrimaryScreen();
+    return [NSNumber numberWithFloat:screenRect.height()];
+}
+
 - (NSValue *)position
 {
     IntRect rect = snappedIntRect(m_object->elementRect());
@@ -2700,6 +2709,8 @@
         return [NSValue valueWithSize: NSMakeSize(s.width(), s.height())];
     }
     
+    if ([attributeName isEqualToString: NSAccessibilityPrimaryScreenHeightAttribute])
+        return [self primaryScreenHeight];
     if ([attributeName isEqualToString: NSAccessibilityPositionAttribute])
         return [self position];
     if ([attributeName isEqualToString:NSAccessibilityPathAttribute])

Modified: trunk/Source/WebCore/platform/PlatformScreen.h (231936 => 231937)


--- trunk/Source/WebCore/platform/PlatformScreen.h	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Source/WebCore/platform/PlatformScreen.h	2018-05-18 01:27:48 UTC (rev 231937)
@@ -85,6 +85,7 @@
 NSScreen *screen(PlatformDisplayID);
 
 FloatRect screenRectForDisplay(PlatformDisplayID);
+WEBCORE_EXPORT FloatRect screenRectForPrimaryScreen();
 
 WEBCORE_EXPORT FloatRect toUserSpace(const NSRect&, NSWindow *destination);
 FloatRect toUserSpaceForPrimaryScreen(const NSRect&);

Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (231936 => 231937)


--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm	2018-05-18 01:27:48 UTC (rev 231937)
@@ -221,6 +221,11 @@
     return screen(displayID).frame;
 }
 
+FloatRect screenRectForPrimaryScreen()
+{
+    return screenRectForDisplay(primaryScreenDisplayID());
+}
+
 FloatRect screenRect(Widget* widget)
 {
     if (!screenProperties().isEmpty())

Modified: trunk/Source/WebKit/ChangeLog (231936 => 231937)


--- trunk/Source/WebKit/ChangeLog	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Source/WebKit/ChangeLog	2018-05-18 01:27:48 UTC (rev 231937)
@@ -1,3 +1,14 @@
+2018-05-17  Nan Wang  <n_w...@apple.com>
+
+        AX: [macOS] Expose the primary screen height through AX API
+        https://bugs.webkit.org/show_bug.cgi?id=185742
+
+        Reviewed by Chris Fleizach.
+
+        * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
+        (-[WKAccessibilityWebPageObject accessibilityAttributeNames]):
+        (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
+
 2018-05-17  Alex Christensen  <achristen...@webkit.org>
 
         Use CompletionHandlers for DelayedReplies

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm (231936 => 231937)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm	2018-05-18 01:27:48 UTC (rev 231937)
@@ -44,6 +44,7 @@
 #import <WebCore/PageOverlayController.h>
 #import <WebCore/ScrollView.h>
 #import <WebCore/Scrollbar.h>
+#import <WebCore/WebAccessibilityObjectWrapperMac.h>
 #import <pal/spi/mac/NSAccessibilitySPI.h>
 #import <wtf/ObjcRuntimeExtras.h>
 
@@ -70,7 +71,7 @@
         m_attributeNames = adoptNS([[NSArray alloc] initWithObjects:
                             NSAccessibilityRoleAttribute, NSAccessibilityRoleDescriptionAttribute, NSAccessibilityFocusedAttribute,
                             NSAccessibilityParentAttribute, NSAccessibilityWindowAttribute, NSAccessibilityTopLevelUIElementAttribute,
-                            NSAccessibilityPositionAttribute, NSAccessibilitySizeAttribute, NSAccessibilityChildrenAttribute, nil]);
+                            NSAccessibilityPositionAttribute, NSAccessibilitySizeAttribute, NSAccessibilityChildrenAttribute, NSAccessibilityPrimaryScreenHeightAttribute, nil]);
     
     return m_attributeNames.get();
 }
@@ -147,6 +148,9 @@
         return [NSValue valueWithPoint:NSMakePoint(point.x(), point.y())];
     }
     
+    if ([attribute isEqualToString:NSAccessibilityPrimaryScreenHeightAttribute])
+        return [[self accessibilityRootObjectWrapper] accessibilityAttributeValue:attribute];
+    
     if ([attribute isEqualToString:NSAccessibilitySizeAttribute]) {
         const IntSize& s = m_page->size();
         return [NSValue valueWithSize:NSMakeSize(s.width(), s.height())];

Modified: trunk/Tools/ChangeLog (231936 => 231937)


--- trunk/Tools/ChangeLog	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Tools/ChangeLog	2018-05-18 01:27:48 UTC (rev 231937)
@@ -1,3 +1,15 @@
+2018-05-17  Nan Wang  <n_w...@apple.com>
+
+        AX: [macOS] Expose the primary screen height through AX API
+        https://bugs.webkit.org/show_bug.cgi?id=185742
+
+        Reviewed by Chris Fleizach.
+
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (attributesOfElement):
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::attributesOfElement):
+
 2018-05-17  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r231912.

Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (231936 => 231937)


--- trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm	2018-05-18 01:27:48 UTC (rev 231937)
@@ -158,6 +158,10 @@
         if ([attribute isEqualToString:@"AXPosition"])
             continue;
         
+        // Skip screen-specific information.
+        if ([attribute isEqualToString:@"_AXPrimaryScreenHeight"])
+            continue;
+        
         // accessibilityAttributeValue: can throw an if an attribute is not returned.
         // For DumpRenderTree's purpose, we should ignore those exceptions
         BEGIN_AX_OBJC_EXCEPTIONS

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (231936 => 231937)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2018-05-18 01:19:01 UTC (rev 231936)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm	2018-05-18 01:27:48 UTC (rev 231937)
@@ -172,6 +172,10 @@
         if ([attribute isEqualToString:@"AXPosition"])
             continue;
         
+        // Skip screen-specific information.
+        if ([attribute isEqualToString:@"_AXPrimaryScreenHeight"])
+            continue;
+        
         // accessibilityAttributeValue: can throw an if an attribute is not returned.
         // For DumpRenderTree's purpose, we should ignore those exceptions
         BEGIN_AX_OBJC_EXCEPTIONS
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to