Title: [166224] trunk/Source/WebKit2
Revision
166224
Author
cfleiz...@apple.com
Date
2014-03-24 23:34:30 -0700 (Mon, 24 Mar 2014)

Log Message

AX: hit-testing doesn't always work correctly with WK2
https://bugs.webkit.org/show_bug.cgi?id=130706

Reviewed by Simon Fraser.

Accessibility code was trying to do screenToRootView itself, and in
some cases with embedded WK2 views that did not work.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (166223 => 166224)


--- trunk/Source/WebKit2/ChangeLog	2014-03-25 06:24:13 UTC (rev 166223)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-25 06:34:30 UTC (rev 166224)
@@ -1,3 +1,16 @@
+2014-03-24  Chris Fleizach  <cfleiz...@apple.com>
+
+        AX: hit-testing doesn't always work correctly with WK2
+        https://bugs.webkit.org/show_bug.cgi?id=130706
+
+        Reviewed by Simon Fraser.
+
+        Accessibility code was trying to do screenToRootView itself, and in 
+        some cases with embedded WK2 views that did not work.
+
+        * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
+        (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
+
 2014-03-24  Benjamin Poulain  <bpoul...@apple.com>
 
         [WK2] SpinLock are not initialized by default, ViewUpdateDispatcher is missing an initializer

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm (166223 => 166224)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm	2014-03-25 06:24:13 UTC (rev 166223)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm	2014-03-25 06:34:30 UTC (rev 166224)
@@ -193,27 +193,14 @@
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 - (id)accessibilityHitTest:(NSPoint)point
 {
-    // Hit-test point comes in as bottom-screen coordinates. Needs to be normalized to the frame of the web page.
-    NSPoint remotePosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
-    NSSize remoteSize = [[self accessibilityAttributeValue:NSAccessibilitySizeAttribute] sizeValue];
+    if (!m_page)
+        return nil;
     
-    // Get the y position of the WKView (we have to screen-flip and go from bottom left to top left).
-    CGFloat screenHeight = [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height;
-    remotePosition.y = (screenHeight - remotePosition.y) - remoteSize.height;
-    
-    point.y = screenHeight - point.y;
-    
-    // Re-center point into the web page's frame.
-    point.y -= remotePosition.y;
-    point.x -= remotePosition.x;
-    
-    WebCore::FrameView* frameView = m_page ? m_page->mainFrameView() : 0;
-    if (frameView) {
-        point.y += frameView->scrollPosition().y();
-        point.x += frameView->scrollPosition().x();
-    }
-    
-    return [[self accessibilityRootObjectWrapper] accessibilityHitTest:point];
+    IntPoint convertedPoint = m_page->screenToRootView(IntPoint(point));
+    if (WebCore::FrameView* frameView = m_page->mainFrameView())
+        convertedPoint.moveBy(frameView->scrollPosition());
+        
+    return [[self accessibilityRootObjectWrapper] accessibilityHitTest:convertedPoint];
 }
 #pragma clang diagnostic pop
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to