Index: chrome/test/chromedriver/element_util.cc |
diff --git a/chrome/test/chromedriver/element_util.cc b/chrome/test/chromedriver/element_util.cc |
index 9f02b4956cd43e6aef989d993487bdafaf12c483..e8714d3d33ef980e43ef819db7bf1560e687bc5e 100644 |
--- a/chrome/test/chromedriver/element_util.cc |
+++ b/chrome/test/chromedriver/element_util.cc |
@@ -577,14 +577,21 @@ Status ScrollElementIntoView( |
Session* session, |
WebView* web_view, |
const std::string& id, |
+ const WebPoint* offset, |
WebPoint* location) { |
- WebSize size; |
- Status status = GetElementSize(session, web_view, id, &size); |
+ WebRect region; |
+ Status status = GetElementRegion(session, web_view, id, ®ion); |
stgao
2015/01/14 01:47:20
Not sure if there will be side-effect on screensho
samuong
2015/01/14 04:35:05
GetElementRegion gets a WebRect (i.e. both a WebPo
|
if (status.IsError()) |
return status; |
- return ScrollElementRegionIntoView( |
- session, web_view, id, WebRect(WebPoint(0, 0), size), |
+ status = ScrollElementRegionIntoView(session, web_view, id, region, |
false /* center */, std::string(), location); |
+ if (status.IsError()) |
+ return status; |
+ if (offset) |
+ location->Offset(offset->x, offset->y); |
+ else |
+ location->Offset(region.size.width / 2, region.size.height / 2); |
stgao
2015/01/14 01:47:20
It may worth a check if this change has unexpected
samuong
2015/01/14 04:35:05
I will be running some presubmits later to find as
|
+ return Status(kOk); |
} |
Status ScrollElementRegionIntoView( |