Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1780)

Unified Diff: content/renderer/gpu/gpu_benchmarking_extension.cc

Issue 1866793003: Add methods to GPU extensions to precisely determine visual viewport dimensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/gpu/gpu_benchmarking_extension.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cecaddfea20411b1334aeda4dcb99984c172741b..7630616dad6a78e7137358cb895e0138df7f2880 100644
--- a/content/renderer/gpu/gpu_benchmarking_extension.cc
+++ b/content/renderer/gpu/gpu_benchmarking_extension.cc
@@ -495,6 +495,9 @@ gin::ObjectTemplateBuilder GpuBenchmarking::GetObjectTemplateBuilder(
.SetMethod("swipe", &GpuBenchmarking::Swipe)
.SetMethod("scrollBounce", &GpuBenchmarking::ScrollBounce)
.SetMethod("pinchBy", &GpuBenchmarking::PinchBy)
+ .SetMethod("pageScaleFactor", &GpuBenchmarking::PageScaleFactor)
+ .SetMethod("visualViewportX", &GpuBenchmarking::VisualViewportX)
+ .SetMethod("visualViewportY", &GpuBenchmarking::VisualViewportY)
.SetMethod("visualViewportHeight", &GpuBenchmarking::VisualViewportHeight)
.SetMethod("visualViewportWidth", &GpuBenchmarking::VisualViewportWidth)
.SetMethod("tap", &GpuBenchmarking::Tap)
@@ -762,6 +765,7 @@ bool GpuBenchmarking::PinchBy(gin::Arguments* args) {
scoped_ptr<SyntheticPinchGestureParams> gesture_params(
new SyntheticPinchGestureParams);
+ // TODO(bokan): Remove page scale here when change land in Catapult.
// Convert coordinates from CSS pixels to density independent pixels (DIPs).
float page_scale_factor = context.web_view()->pageScaleFactor();
@@ -788,6 +792,27 @@ bool GpuBenchmarking::PinchBy(gin::Arguments* args) {
return true;
}
+float GpuBenchmarking::PageScaleFactor() {
+ GpuBenchmarkingContext context;
+ if (!context.Init(false))
+ return 0.0;
+ return context.web_view()->pageScaleFactor();
+}
+
+float GpuBenchmarking::VisualViewportY() {
+ GpuBenchmarkingContext context;
+ if (!context.Init(false))
+ return 0.0;
+ return context.web_view()->visualViewportOffset().y;
+}
+
+float GpuBenchmarking::VisualViewportX() {
+ GpuBenchmarkingContext context;
+ if (!context.Init(false))
+ return 0.0;
+ return context.web_view()->visualViewportOffset().x;
+}
+
float GpuBenchmarking::VisualViewportHeight() {
GpuBenchmarkingContext context;
if (!context.Init(false))
« no previous file with comments | « content/renderer/gpu/gpu_benchmarking_extension.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698