Commit 0be3a264 authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Handling iframe padding

When elements are inside iframe with padding, ChromeDriver didn't take
into account the padding while calculating element locations, and end up
getting wrong the wrong locations. Fixing by adding the padding value.

Bug: chromedriver:2259
Change-Id: If3b37a6f891636df7b22679ea91e00e31fa66a83
Reviewed-on: https://chromium-review.googlesource.com/1010886Reviewed-by: default avatarJonathon Kereliuk <kereliuk@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553150}
parent 3af5f47e
......@@ -230,8 +230,20 @@ Status GetElementBorder(
base::StringToInt(border_top_str, &border_top_tmp);
if (border_left_tmp == -1 || border_top_tmp == -1)
return Status(kUnknownError, "failed to get border width of element");
*border_left = border_left_tmp;
*border_top = border_top_tmp;
std::string padding_left_str;
status = GetElementEffectiveStyle(frame, web_view, element_id, "padding-left",
&padding_left_str);
int padding_left = 0;
if (status.IsOk())
base::StringToInt(padding_left_str, &padding_left);
std::string padding_top_str;
status = GetElementEffectiveStyle(frame, web_view, element_id, "padding-top",
&padding_top_str);
int padding_top = 0;
if (status.IsOk())
base::StringToInt(padding_top_str, &padding_top);
*border_left = border_left_tmp + padding_left;
*border_top = border_top_tmp + padding_top;
return Status(kOk);
}
......
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