Title: [232935] trunk/Source/WebCore
Revision
232935
Author
n_w...@apple.com
Date
2018-06-18 11:31:06 -0700 (Mon, 18 Jun 2018)

Log Message

AX: [macOS] When zoom is enabled, focus doesn't follow text cursor
https://bugs.webkit.org/show_bug.cgi?id=186697

Reviewed by Darin Adler.

Now that web process doesn't have access to NSScreen. The conversion of the 
rects is wrong. Fixed this by using the right function that's available in
WebCore to convert the rects.

* editing/mac/FrameSelectionMac.mm:
(WebCore::accessibilityConvertScreenRect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (232934 => 232935)


--- trunk/Source/WebCore/ChangeLog	2018-06-18 17:55:58 UTC (rev 232934)
+++ trunk/Source/WebCore/ChangeLog	2018-06-18 18:31:06 UTC (rev 232935)
@@ -1,3 +1,17 @@
+2018-06-18  Nan Wang  <n_w...@apple.com>
+
+        AX: [macOS] When zoom is enabled, focus doesn't follow text cursor
+        https://bugs.webkit.org/show_bug.cgi?id=186697
+
+        Reviewed by Darin Adler.
+
+        Now that web process doesn't have access to NSScreen. The conversion of the 
+        rects is wrong. Fixed this by using the right function that's available in
+        WebCore to convert the rects.
+
+        * editing/mac/FrameSelectionMac.mm:
+        (WebCore::accessibilityConvertScreenRect):
+
 2018-06-18  Youenn Fablet  <you...@apple.com>
 
         Validate Cross-Origin-Resource-Policy for resources cached in the MemoryCache

Modified: trunk/Source/WebCore/editing/mac/FrameSelectionMac.mm (232934 => 232935)


--- trunk/Source/WebCore/editing/mac/FrameSelectionMac.mm	2018-06-18 17:55:58 UTC (rev 232934)
+++ trunk/Source/WebCore/editing/mac/FrameSelectionMac.mm	2018-06-18 18:31:06 UTC (rev 232935)
@@ -32,21 +32,6 @@
 
 namespace WebCore {
 
-#if !PLATFORM(IOS)
-static CGRect accessibilityConvertScreenRect(CGRect bounds)
-{
-    NSArray *screens = [NSScreen screens];
-    if ([screens count]) {
-        CGFloat screenHeight = NSHeight([(NSScreen *)[screens objectAtIndex:0] frame]);
-        bounds.origin.y = (screenHeight - (bounds.origin.y + bounds.size.height));
-    } else
-        bounds = CGRectZero;    
-    
-    return bounds;
-}
-#endif // !PLATFORM(IOS)
-    
-    
 void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent& intent)
 {
     Document* document = m_frame->document();
@@ -75,8 +60,8 @@
     viewRect = frameView->contentsToScreen(viewRect);
     CGRect cgCaretRect = CGRectMake(selectionRect.x(), selectionRect.y(), selectionRect.width(), selectionRect.height());
     CGRect cgViewRect = CGRectMake(viewRect.x(), viewRect.y(), viewRect.width(), viewRect.height());
-    cgCaretRect = accessibilityConvertScreenRect(cgCaretRect);
-    cgViewRect = accessibilityConvertScreenRect(cgViewRect);
+    cgCaretRect = toUserSpaceForPrimaryScreen(cgCaretRect);
+    cgViewRect = toUserSpaceForPrimaryScreen(cgViewRect);
 
     UAZoomChangeFocus(&cgViewRect, &cgCaretRect, kUAZoomFocusTypeInsertionPoint);
 #endif // !PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to