OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/test/chromedriver/element_util.h" | 5 #include "chrome/test/chromedriver/element_util.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 return false; | 40 return false; |
41 double width, height; | 41 double width, height; |
42 if (!dict_value->GetDouble("width", &width) || | 42 if (!dict_value->GetDouble("width", &width) || |
43 !dict_value->GetDouble("height", &height)) | 43 !dict_value->GetDouble("height", &height)) |
44 return false; | 44 return false; |
45 size->width = static_cast<int>(width); | 45 size->width = static_cast<int>(width); |
46 size->height = static_cast<int>(height); | 46 size->height = static_cast<int>(height); |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
50 base::Value* CreateValueFrom(const WebSize& size) { | |
51 base::DictionaryValue* dict = new base::DictionaryValue(); | |
52 dict->SetInteger("width", size.width); | |
53 dict->SetInteger("height", size.height); | |
54 return dict; | |
55 } | |
56 | |
57 bool ParseFromValue(base::Value* value, WebRect* rect) { | 50 bool ParseFromValue(base::Value* value, WebRect* rect) { |
58 base::DictionaryValue* dict_value; | 51 base::DictionaryValue* dict_value; |
59 if (!value->GetAsDictionary(&dict_value)) | 52 if (!value->GetAsDictionary(&dict_value)) |
60 return false; | 53 return false; |
61 double x, y, width, height; | 54 double x, y, width, height; |
62 if (!dict_value->GetDouble("left", &x) || | 55 if (!dict_value->GetDouble("left", &x) || |
63 !dict_value->GetDouble("top", &y) || | 56 !dict_value->GetDouble("top", &y) || |
64 !dict_value->GetDouble("width", &width) || | 57 !dict_value->GetDouble("width", &width) || |
65 !dict_value->GetDouble("height", &height)) | 58 !dict_value->GetDouble("height", &height)) |
66 return false; | 59 return false; |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 status = ScrollElementRegionIntoViewHelper( | 632 status = ScrollElementRegionIntoViewHelper( |
640 rit->parent_frame_id, web_view, frame_element_id, | 633 rit->parent_frame_id, web_view, frame_element_id, |
641 WebRect(region_offset, region_size), | 634 WebRect(region_offset, region_size), |
642 center, frame_element_id, ®ion_offset); | 635 center, frame_element_id, ®ion_offset); |
643 if (status.IsError()) | 636 if (status.IsError()) |
644 return status; | 637 return status; |
645 } | 638 } |
646 *location = region_offset; | 639 *location = region_offset; |
647 return Status(kOk); | 640 return Status(kOk); |
648 } | 641 } |
OLD | NEW |