WebDriver: use in-view center point for clicks instead of bounding box center point
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 08:11:11 +0000 (08:11 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Aug 2017 08:11:11 +0000 (08:11 +0000)
commitd64a9a75756595dd2a81271dc1cf31463219811d
tree57a193e8072b66cc444cd8c2f44f20abc28f2cc6
parente06898e267e2703eb09a0bbffdf1a5acc37cc21a
WebDriver: use in-view center point for clicks instead of bounding box center point
https://bugs.webkit.org/show_bug.cgi?id=174863

Reviewed by Simon Fraser.

Source/WebCore:

Make DOMRect, and FloatPoint::narrowPrecision() available to WebKit layer. Also add
FrameView::clientToDocumentPoint().

* WebCore.xcodeproj/project.pbxproj:
* dom/Element.h:
* page/FrameView.h:
* platform/graphics/FloatPoint.h:

Source/WebDriver:

The center of the element bounding box is not always part of the element, like in multiline links, for example.

11.1 Element Interactability.
https://www.w3.org/TR/webdriver/#dfn-in-view-center-point

* CommandResult.cpp:
(WebDriver::CommandResult::httpStatusCode): Add ElementClickIntercepted and ElementNotInteractable errors.
(WebDriver::CommandResult::errorString): Ditto.
* CommandResult.h: Ditto.
* Session.cpp:
(WebDriver::Session::computeElementLayout): Get the in-view center point and isObscured from the result too.
(WebDriver::Session::getElementRect): Ignore in-view center point and isObscured.
(WebDriver::Session::elementClick): Fail in case the element is not interactable or is obscured.
* Session.h:

Source/WebKit:

Change computeElementLayout to also return the in-view center point and whether it's obscured by another
element.

* UIProcess/Automation/Automation.json: Add optional inViewCenterPoint to the result and isObscured.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::didComputeElementLayout): Handle inViewCenterPoint and isObscured.
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/WebAutomationSession.messages.in:
* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::elementInViewClientCenterPoint): Get the client in-view center point and whether it's obscured
according to the spec.
(WebKit::WebAutomationSessionProxy::computeElementLayout): Pass inViewCenterPoint and isObscured to
DidComputeElementLayout message.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220314 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Element.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/platform/graphics/FloatPoint.h
Source/WebDriver/ChangeLog
Source/WebDriver/CommandResult.cpp
Source/WebDriver/CommandResult.h
Source/WebDriver/Session.cpp
Source/WebDriver/Session.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Automation/Automation.json
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit/UIProcess/Automation/WebAutomationSession.h
Source/WebKit/UIProcess/Automation/WebAutomationSession.messages.in
Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp