OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/gpu/gpu_benchmarking_extension.h" | 5 #include "content/renderer/gpu/gpu_benchmarking_extension.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 GpuBenchmarkingContext context; | 847 GpuBenchmarkingContext context; |
848 if (!context.Init(false)) | 848 if (!context.Init(false)) |
849 return 0.0; | 849 return 0.0; |
850 return context.web_view()->pageScaleFactor(); | 850 return context.web_view()->pageScaleFactor(); |
851 } | 851 } |
852 | 852 |
853 float GpuBenchmarking::VisualViewportY() { | 853 float GpuBenchmarking::VisualViewportY() { |
854 GpuBenchmarkingContext context; | 854 GpuBenchmarkingContext context; |
855 if (!context.Init(false)) | 855 if (!context.Init(false)) |
856 return 0.0; | 856 return 0.0; |
857 return context.web_view()->visualViewportOffset().y; | 857 float y = context.web_view()->visualViewportOffset().y; |
| 858 blink::WebRect rect(0, y, 0, 0); |
| 859 context.render_view_impl()->convertViewportToWindow(&rect); |
| 860 return rect.y; |
858 } | 861 } |
859 | 862 |
860 float GpuBenchmarking::VisualViewportX() { | 863 float GpuBenchmarking::VisualViewportX() { |
861 GpuBenchmarkingContext context; | 864 GpuBenchmarkingContext context; |
862 if (!context.Init(false)) | 865 if (!context.Init(false)) |
863 return 0.0; | 866 return 0.0; |
864 return context.web_view()->visualViewportOffset().x; | 867 float x = context.web_view()->visualViewportOffset().x; |
| 868 blink::WebRect rect(x, 0, 0, 0); |
| 869 context.render_view_impl()->convertViewportToWindow(&rect); |
| 870 return rect.x; |
865 } | 871 } |
866 | 872 |
867 float GpuBenchmarking::VisualViewportHeight() { | 873 float GpuBenchmarking::VisualViewportHeight() { |
868 GpuBenchmarkingContext context; | 874 GpuBenchmarkingContext context; |
869 if (!context.Init(false)) | 875 if (!context.Init(false)) |
870 return 0.0; | 876 return 0.0; |
871 return context.web_view()->visualViewportSize().height; | 877 float height = context.web_view()->visualViewportSize().height; |
| 878 blink::WebRect rect(0, 0, 0, height); |
| 879 context.render_view_impl()->convertViewportToWindow(&rect); |
| 880 return rect.height; |
872 } | 881 } |
873 | 882 |
874 float GpuBenchmarking::VisualViewportWidth() { | 883 float GpuBenchmarking::VisualViewportWidth() { |
875 GpuBenchmarkingContext context; | 884 GpuBenchmarkingContext context; |
876 if (!context.Init(false)) | 885 if (!context.Init(false)) |
877 return 0.0; | 886 return 0.0; |
878 return context.web_view()->visualViewportSize().width; | 887 float width = context.web_view()->visualViewportSize().width; |
| 888 blink::WebRect rect(0, 0, width, 0); |
| 889 context.render_view_impl()->convertViewportToWindow(&rect); |
| 890 return rect.width; |
879 } | 891 } |
880 | 892 |
881 bool GpuBenchmarking::Tap(gin::Arguments* args) { | 893 bool GpuBenchmarking::Tap(gin::Arguments* args) { |
882 GpuBenchmarkingContext context; | 894 GpuBenchmarkingContext context; |
883 if (!context.Init(false)) | 895 if (!context.Init(false)) |
884 return false; | 896 return false; |
885 | 897 |
886 float position_x; | 898 float position_x; |
887 float position_y; | 899 float position_y; |
888 v8::Local<v8::Function> callback; | 900 v8::Local<v8::Function> callback; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 &gpu_driver_bug_workarounds))) { | 1020 &gpu_driver_bug_workarounds))) { |
1009 return; | 1021 return; |
1010 } | 1022 } |
1011 | 1023 |
1012 v8::Local<v8::Value> result; | 1024 v8::Local<v8::Value> result; |
1013 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 1025 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) |
1014 args->Return(result); | 1026 args->Return(result); |
1015 } | 1027 } |
1016 | 1028 |
1017 } // namespace content | 1029 } // namespace content |
OLD | NEW |