Commit 065b4455 authored by Mike Dougherty's avatar Mike Dougherty Committed by Commit Bot

[iOS] Add delay before getting location of DOM element

On devices, since iOS 13.1, the page needs time to stabalize. Without
this wait, getting the location of the element will be incorrect.

Bug: 1012326
Change-Id: Iae60e2db1e2a6c438c3ab5541f9d8fa7c2b0199c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1852024
Auto-Submit: Mike Dougherty <michaeldo@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705609}
parent c18598d4
......@@ -71,6 +71,14 @@ std::unique_ptr<base::Value> ExecuteJavaScript(web::WebState* web_state,
CGRect GetBoundingRectOfElement(web::WebState* web_state,
ElementSelector* selector) {
#if !TARGET_IPHONE_SIMULATOR
// TODO(crbug.com/1013714): Replace delay with improved JavaScript.
// As of iOS 13.1, devices need additional time to stabalize the page before
// getting the element location. Without this wait, the element's bounding
// rect will be incorrect.
base::test::ios::SpinRunLoopWithMinDelay(base::TimeDelta::FromSecondsD(0.5));
#endif
std::string selector_script =
base::SysNSStringToUTF8(selector.selectorScript);
std::string selector_description =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment