Index: content/renderer/gpu/gpu_benchmarking_extension.cc |
diff --git a/content/renderer/gpu/gpu_benchmarking_extension.cc b/content/renderer/gpu/gpu_benchmarking_extension.cc |
index 454f5f5e5f9410e66312c0a7fc2d371037f1d691..2bfce62e9edfb8dc52f034480dd7f99cca307cfc 100644 |
--- a/content/renderer/gpu/gpu_benchmarking_extension.cc |
+++ b/content/renderer/gpu/gpu_benchmarking_extension.cc |
@@ -456,6 +456,8 @@ gin::ObjectTemplateBuilder GpuBenchmarking::GetObjectTemplateBuilder( |
// stable. |
.SetValue("newPinchInterface", true) |
.SetMethod("pinchBy", &GpuBenchmarking::PinchBy) |
+ .SetMethod("visualViewportHeight", &GpuBenchmarking::VisualViewportHeight) |
+ .SetMethod("visualViewportWidth", &GpuBenchmarking::VisualViewportWidth) |
.SetMethod("tap", &GpuBenchmarking::Tap) |
.SetMethod("clearImageCache", &GpuBenchmarking::ClearImageCache) |
.SetMethod("runMicroBenchmark", &GpuBenchmarking::RunMicroBenchmark) |
@@ -744,6 +746,20 @@ bool GpuBenchmarking::PinchBy(gin::Arguments* args) { |
return true; |
} |
+float GpuBenchmarking::VisualViewportHeight() { |
+ GpuBenchmarkingContext context; |
+ if (!context.Init(false)) |
+ return 0.0; |
+ return context.web_view()->visualViewportSize().height; |
+} |
+ |
+float GpuBenchmarking::VisualViewportWidth() { |
+ GpuBenchmarkingContext context; |
+ if (!context.Init(false)) |
+ return 0.0; |
+ return context.web_view()->visualViewportSize().width; |
+} |
+ |
bool GpuBenchmarking::Tap(gin::Arguments* args) { |
GpuBenchmarkingContext context; |
if (!context.Init(false)) |