Bug 159851

Summary: Web Automation: Fix element and event coord space issues
Product: WebKit Reporter: Timothy Hatcher <timothy>
Component: Web InspectorAssignee: Timothy Hatcher <timothy>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch bburg: review+, timothy: commit-queue-

Description Timothy Hatcher 2016-07-15 17:01:54 PDT
rdar://problem/27375780
Comment 1 Radar WebKit Bug Importer 2016-07-15 17:03:01 PDT
<rdar://problem/27383442>
Comment 2 Timothy Hatcher 2016-07-15 17:04:21 PDT
Created attachment 283818 [details]
Patch
Comment 3 BJ Burg 2016-07-15 17:14:30 PDT
Comment on attachment 283818 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=283818&action=review

r=me

> Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp:503
>          rect = coreFrameView->rootViewToContents(rect);

I see, so in this case the topContentInset is eventually subtracted here:

ScrollPosition ScrollView::documentScrollPositionRelativeToViewOrigin() const
{
    return scrollPosition() - IntSize(
        shouldPlaceBlockDirectionScrollbarOnLeft() && m_verticalScrollbar ? m_verticalScrollbar->occupiedWidth() : 0,
        headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
}

But otherwise we get the clientRect in raw window space, which is why we have to deduct topContentInset in the other case.

You may want to add a comment or note in the changelog about this, as I thought it was a bug when reviewing.
Comment 4 Timothy Hatcher 2016-07-15 18:21:05 PDT
Comment on attachment 283818 [details]
Patch

https://trac.webkit.org/changeset/203316