WebKit Bugzilla
Attachment 371164 Details for
Bug 197896
: Web Automation: replace IntPoint/IntRect with FloatPoint/FloatRect when using CSS coordinates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197896-20190602151834.patch (text/plain), 14.22 KB, created by
Devin Rousso
on 2019-06-02 15:18:35 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-06-02 15:18:35 PDT
Size:
14.22 KB
patch
obsolete
>diff --git a/Source/WebDriver/ChangeLog b/Source/WebDriver/ChangeLog >index 24915ae176e7b3fdadf1d606fb95b40cee8d4538..f994bdb0113b12b67894828d3df40e3c16c0dd9a 100644 >--- a/Source/WebDriver/ChangeLog >+++ b/Source/WebDriver/ChangeLog >@@ -1,3 +1,15 @@ >+2019-06-02 Devin Rousso <drousso@apple.com> >+ >+ Web Automation: replace IntPoint/IntRect with FloatPoint/FloatRect when using CSS coordinates >+ https://bugs.webkit.org/show_bug.cgi?id=197896 >+ <rdar://problem/50801689> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Session.cpp: >+ (WebDriver::Session::computeElementLayout): >+ (WebDriver::Session::getElementRect): >+ > 2019-05-31 Don Olmstead <don.olmstead@sony.com> > > [CMake] Add WebKit::WTF target >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 0d9ca5ad48c2be6edd7a200a6aa61438f0eb433b..7f19683198c2d41f827eea14a775cce38d639f07 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,20 @@ >+2019-06-02 Devin Rousso <drousso@apple.com> >+ >+ Web Automation: replace IntPoint/IntRect with FloatPoint/FloatRect when using CSS coordinates >+ https://bugs.webkit.org/show_bug.cgi?id=197896 >+ <rdar://problem/50801689> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/Automation/WebAutomationSessionProxy.messages.in: >+ * WebProcess/Automation/WebAutomationSessionProxy.h: >+ * WebProcess/Automation/WebAutomationSessionProxy.cpp: >+ (WebKit::WebAutomationSessionProxy::computeElementLayout): >+ >+ * UIProcess/Automation/WebAutomationSession.cpp: >+ (WebKit::WebAutomationSession::computeElementLayout): >+ (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): >+ > 2019-05-31 Megan Gardner <megan_gardner@apple.com> > > Ensure keyboard editing is up to date >diff --git a/Source/WebDriver/Session.cpp b/Source/WebDriver/Session.cpp >index 20fb609ab3d901038415dc733722fa9197e1e472..32e3a40b8fb498ea69a85dd8338ee9ee76c74aaa 100644 >--- a/Source/WebDriver/Session.cpp >+++ b/Source/WebDriver/Session.cpp >@@ -925,12 +925,12 @@ void Session::computeElementLayout(const String& elementID, OptionSet<ElementLay > completionHandler(WTF::nullopt, WTF::nullopt, false, nullptr); > return; > } >- Optional<int> elementX; >- Optional<int> elementY; >+ Optional<double> elementX; >+ Optional<double> elementY; > RefPtr<JSON::Object> elementPosition; > if (rectObject->getObject("origin"_s, elementPosition)) { >- int x, y; >- if (elementPosition->getInteger("x"_s, x) && elementPosition->getInteger("y"_s, y)) { >+ double x, y; >+ if (elementPosition->getDouble("x"_s, x) && elementPosition->getDouble("y"_s, y)) { > elementX = x; > elementY = y; > } >@@ -939,12 +939,12 @@ void Session::computeElementLayout(const String& elementID, OptionSet<ElementLay > completionHandler(WTF::nullopt, WTF::nullopt, false, nullptr); > return; > } >- Optional<int> elementWidth; >- Optional<int> elementHeight; >+ Optional<double> elementWidth; >+ Optional<double> elementHeight; > RefPtr<JSON::Object> elementSize; > if (rectObject->getObject("size"_s, elementSize)) { >- int width, height; >- if (elementSize->getInteger("width"_s, width) && elementSize->getInteger("height"_s, height)) { >+ double width, height; >+ if (elementSize->getDouble("width"_s, width) && elementSize->getDouble("height"_s, height)) { > elementWidth = width; > elementHeight = height; > } >@@ -965,9 +965,9 @@ void Session::computeElementLayout(const String& elementID, OptionSet<ElementLay > completionHandler(rect, WTF::nullopt, isObscured, nullptr); > return; > } >- int inViewCenterPointX, inViewCenterPointY; >- if (!inViewCenterPointObject->getInteger("x"_s, inViewCenterPointX) >- || !inViewCenterPointObject->getInteger("y"_s, inViewCenterPointY)) { >+ double inViewCenterPointX, inViewCenterPointY; >+ if (!inViewCenterPointObject->getDouble("x"_s, inViewCenterPointX) >+ || !inViewCenterPointObject->getDouble("y"_s, inViewCenterPointY)) { > completionHandler(WTF::nullopt, WTF::nullopt, isObscured, nullptr); > return; > } >@@ -1248,10 +1248,10 @@ void Session::getElementRect(const String& elementID, Function<void (CommandResu > return; > } > RefPtr<JSON::Object> rectObject = JSON::Object::create(); >- rectObject->setInteger("x"_s, rect.value().origin.x); >- rectObject->setInteger("y"_s, rect.value().origin.y); >- rectObject->setInteger("width"_s, rect.value().size.width); >- rectObject->setInteger("height"_s, rect.value().size.height); >+ rectObject->setDouble("x"_s, rect.value().origin.x); >+ rectObject->setDouble("y"_s, rect.value().origin.y); >+ rectObject->setDouble("width"_s, rect.value().size.width); >+ rectObject->setDouble("height"_s, rect.value().size.height); > completionHandler(CommandResult::success(WTFMove(rectObject))); > }); > }); >diff --git a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >index 2f9cfe9424026172d906dbd1a03c4cd01544bb8b..c4313af70ee01a94e6e2e81bc9173e3275a6eac4 100644 >--- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >+++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >@@ -1042,7 +1042,7 @@ void WebAutomationSession::computeElementLayout(const String& browsingContextHan > if (!coordinateSystem) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'coordinateSystem' is invalid."); > >- WTF::CompletionHandler<void(Optional<String>, WebCore::IntRect, Optional<WebCore::IntPoint>, bool)> completionHandler = [callback = callback.copyRef()](Optional<String> errorType, WebCore::IntRect rect, Optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured) mutable { >+ WTF::CompletionHandler<void(Optional<String>, WebCore::FloatRect, Optional<WebCore::FloatPoint>, bool)> completionHandler = [callback = callback.copyRef()](Optional<String> errorType, WebCore::FloatRect rect, Optional<WebCore::FloatPoint> inViewCenterPoint, bool isObscured) mutable { > if (errorType) { > callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(*errorType)); > return; >@@ -1458,7 +1458,7 @@ SimulatedInputSource* WebAutomationSession::inputSourceForType(SimulatedInputSou > // MARK: SimulatedInputDispatcher::Client API > void WebAutomationSession::viewportInViewCenterPointOfElement(WebPageProxy& page, uint64_t frameID, const String& nodeHandle, Function<void (Optional<WebCore::IntPoint>, Optional<AutomationCommandError>)>&& completionHandler) > { >- WTF::CompletionHandler<void(Optional<String>, WebCore::IntRect, Optional<WebCore::IntPoint>, bool)> didComputeElementLayoutHandler = [completionHandler = WTFMove(completionHandler)](Optional<String> errorType, WebCore::IntRect, Optional<WebCore::IntPoint> inViewCenterPoint, bool) mutable { >+ WTF::CompletionHandler<void(Optional<String>, WebCore::FloatRect, Optional<WebCore::FloatPoint>, bool)> didComputeElementLayoutHandler = [completionHandler = WTFMove(completionHandler)](Optional<String> errorType, WebCore::FloatRect, Optional<WebCore::FloatPoint> inViewCenterPoint, bool) mutable { > if (errorType) { > completionHandler(WTF::nullopt, AUTOMATION_COMMAND_ERROR_WITH_MESSAGE(*errorType)); > return; >@@ -1469,7 +1469,7 @@ void WebAutomationSession::viewportInViewCenterPointOfElement(WebPageProxy& page > return; > } > >- completionHandler(inViewCenterPoint, WTF::nullopt); >+ completionHandler(roundedIntPoint(inViewCenterPoint.value()), WTF::nullopt); > }; > > page.process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::ComputeElementLayout(page.pageID(), frameID, nodeHandle, false, CoordinateSystem::LayoutViewport), WTFMove(didComputeElementLayoutHandler)); >diff --git a/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp b/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp >index 454ca6bc844983f5998ffee4da374ccfcc6225da..a10f18ce121bc0e396ca5384132882a3f095b3c1 100644 >--- a/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp >+++ b/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp >@@ -527,7 +527,7 @@ static WebCore::FloatPoint convertPointFromFrameClientToRootView(WebCore::FrameV > return clientPoint; > } > >-void WebAutomationSessionProxy::computeElementLayout(PageIdentifier pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, CoordinateSystem coordinateSystem, CompletionHandler<void(Optional<String>, WebCore::IntRect, Optional<WebCore::IntPoint>, bool)>&& completionHandler) >+void WebAutomationSessionProxy::computeElementLayout(PageIdentifier pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, CoordinateSystem coordinateSystem, CompletionHandler<void(Optional<String>, WebCore::FloatRect, Optional<WebCore::FloatPoint>, bool)>&& completionHandler) > { > WebPage* page = WebProcess::singleton().webPage(pageID); > if (!page) { >@@ -561,17 +561,17 @@ void WebAutomationSessionProxy::computeElementLayout(PageIdentifier pageID, uint > WebCore::FrameView* frameView = frame->coreFrame()->view(); > WebCore::FrameView* mainView = frame->coreFrame()->mainFrame().view(); > >- WebCore::IntRect resultElementBounds; >- Optional<WebCore::IntPoint> resultInViewCenterPoint; >+ WebCore::FloatRect resultElementBounds; >+ Optional<WebCore::FloatPoint> resultInViewCenterPoint; > bool isObscured = false; > > auto elementBoundsInRootCoordinates = convertRectFromFrameClientToRootView(frameView, coreElement->boundingClientRect()); > switch (coordinateSystem) { > case CoordinateSystem::Page: >- resultElementBounds = enclosingIntRect(mainView->absoluteToDocumentRect(mainView->rootViewToContents(elementBoundsInRootCoordinates))); >+ resultElementBounds = mainView->absoluteToDocumentRect(mainView->rootViewToContents(elementBoundsInRootCoordinates)); > break; > case CoordinateSystem::LayoutViewport: >- resultElementBounds = enclosingIntRect(mainView->absoluteToLayoutViewportRect(elementBoundsInRootCoordinates)); >+ resultElementBounds = mainView->absoluteToLayoutViewportRect(elementBoundsInRootCoordinates); > break; > } > >@@ -625,10 +625,10 @@ void WebAutomationSessionProxy::computeElementLayout(PageIdentifier pageID, uint > auto inViewCenterPointInRootCoordinates = convertPointFromFrameClientToRootView(frameView, elementInViewCenterPoint); > switch (coordinateSystem) { > case CoordinateSystem::Page: >- resultInViewCenterPoint = roundedIntPoint(mainView->absoluteToDocumentPoint(inViewCenterPointInRootCoordinates)); >+ resultInViewCenterPoint = mainView->absoluteToDocumentPoint(inViewCenterPointInRootCoordinates); > break; > case CoordinateSystem::LayoutViewport: >- resultInViewCenterPoint = roundedIntPoint(mainView->absoluteToLayoutViewportPoint(inViewCenterPointInRootCoordinates)); >+ resultInViewCenterPoint = mainView->absoluteToLayoutViewportPoint(inViewCenterPointInRootCoordinates); > break; > } > >diff --git a/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h b/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h >index 1167645277dbc1930a5a7a597dcbc2df3ecf55c9..e952162fb9df7afc79f08ccd9f1ffe7fccb26f86 100644 >--- a/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h >+++ b/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h >@@ -67,7 +67,7 @@ private: > void resolveChildFrameWithName(WebCore::PageIdentifier, uint64_t frameID, const String& name, CompletionHandler<void(Optional<String>, uint64_t)>&&); > void resolveParentFrame(WebCore::PageIdentifier, uint64_t frameID, CompletionHandler<void(Optional<String>, uint64_t)>&&); > void focusFrame(WebCore::PageIdentifier, uint64_t frameID); >- void computeElementLayout(WebCore::PageIdentifier, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, CoordinateSystem, CompletionHandler<void(Optional<String>, WebCore::IntRect, Optional<WebCore::IntPoint>, bool)>&&); >+ void computeElementLayout(WebCore::PageIdentifier, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, CoordinateSystem, CompletionHandler<void(Optional<String>, WebCore::FloatRect, Optional<WebCore::FloatPoint>, bool)>&&); > void selectOptionElement(WebCore::PageIdentifier, uint64_t frameID, String nodeHandle, CompletionHandler<void(Optional<String>)>&&); > void takeScreenshot(WebCore::PageIdentifier, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, bool clipToViewport, uint64_t callbackID); > void getCookiesForFrame(WebCore::PageIdentifier, uint64_t frameID, CompletionHandler<void(Optional<String>, Vector<WebCore::Cookie>)>&&); >diff --git a/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in b/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in >index d72f89d26359cf01ccfd531e96e01f44409aaf58..63323e16e690de3764e2eb7ac3cecf833fc05fba 100644 >--- a/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in >+++ b/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in >@@ -30,7 +30,7 @@ messages -> WebAutomationSessionProxy { > > FocusFrame(WebCore::PageIdentifier pageID, uint64_t frameID) > >- ComputeElementLayout(WebCore::PageIdentifier pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, enum:uint8_t WebKit::CoordinateSystem coordinateSystem) -> (Optional<String> errorType, WebCore::IntRect rect, Optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured) Async >+ ComputeElementLayout(WebCore::PageIdentifier pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, enum:uint8_t WebKit::CoordinateSystem coordinateSystem) -> (Optional<String> errorType, WebCore::FloatRect rect, Optional<WebCore::FloatPoint> inViewCenterPoint, bool isObscured) Async > > SelectOptionElement(WebCore::PageIdentifier pageID, uint64_t frameID, String nodeHandle) -> (Optional<String> errorType) Async >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
hi
:
review?
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197896
: 371164