Changeset 166224 in webkit


Ignore:
Timestamp:
Mar 24, 2014 11:34:30 PM (10 years ago)
Author:
Chris Fleizach
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:]):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r166213 r166224  
     12014-03-24  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: hit-testing doesn't always work correctly with WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=130706
     5
     6        Reviewed by Simon Fraser.
     7
     8        Accessibility code was trying to do screenToRootView itself, and in
     9        some cases with embedded WK2 views that did not work.
     10
     11        * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
     12        (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
     13
    1142014-03-24  Benjamin Poulain  <bpoulain@apple.com>
    215
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm

    r165170 r166224  
    194194- (id)accessibilityHitTest:(NSPoint)point
    195195{
    196     // Hit-test point comes in as bottom-screen coordinates. Needs to be normalized to the frame of the web page.
    197     NSPoint remotePosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
    198     NSSize remoteSize = [[self accessibilityAttributeValue:NSAccessibilitySizeAttribute] sizeValue];
    199    
    200     // Get the y position of the WKView (we have to screen-flip and go from bottom left to top left).
    201     CGFloat screenHeight = [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height;
    202     remotePosition.y = (screenHeight - remotePosition.y) - remoteSize.height;
    203    
    204     point.y = screenHeight - point.y;
    205    
    206     // Re-center point into the web page's frame.
    207     point.y -= remotePosition.y;
    208     point.x -= remotePosition.x;
    209    
    210     WebCore::FrameView* frameView = m_page ? m_page->mainFrameView() : 0;
    211     if (frameView) {
    212         point.y += frameView->scrollPosition().y();
    213         point.x += frameView->scrollPosition().x();
    214     }
    215    
    216     return [[self accessibilityRootObjectWrapper] accessibilityHitTest:point];
     196    if (!m_page)
     197        return nil;
     198   
     199    IntPoint convertedPoint = m_page->screenToRootView(IntPoint(point));
     200    if (WebCore::FrameView* frameView = m_page->mainFrameView())
     201        convertedPoint.moveBy(frameView->scrollPosition());
     202       
     203    return [[self accessibilityRootObjectWrapper] accessibilityHitTest:convertedPoint];
    217204}
    218205#pragma clang diagnostic pop
Note: See TracChangeset for help on using the changeset viewer.