NEW129643
AX: Refactor code in WKAccessibilityWebPageObjectMac to use existing viewToScreenMethods
https://bugs.webkit.org/show_bug.cgi?id=129643
Summary AX: Refactor code in WKAccessibilityWebPageObjectMac to use existing viewToSc...
chris fleizach
Reported 2014-03-03 17:00:15 PST
There's a bunch of code in the hit-testing that could probably be reduced by moving to a viewToScreen method //#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]; // 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]; }
Attachments
Radar WebKit Bug Importer
Comment 1 2014-03-03 17:01:00 PST
Note You need to log in before you can comment on or make changes to this bug.