Index: third_party/WebKit/Source/web/InspectorEmulationAgent.cpp |
diff --git a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp |
index 326712afcbc2f0488f9b643f30838e9d9ef96685..18f0968bfc7c2d6d62edf9a7ff85eec987f224ba 100644 |
--- a/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp |
+++ b/third_party/WebKit/Source/web/InspectorEmulationAgent.cpp |
@@ -10,6 +10,7 @@ |
#include "core/page/Page.h" |
#include "platform/geometry/DoubleRect.h" |
#include "public/platform/Platform.h" |
+#include "public/platform/WebFloatPoint.h" |
#include "public/platform/WebThread.h" |
#include "public/platform/WebViewScheduler.h" |
#include "web/DevToolsEmulator.h" |
@@ -61,6 +62,29 @@ void InspectorEmulationAgent::disable(ErrorString*) |
setScriptExecutionDisabled(&error, false); |
setTouchEmulationEnabled(&error, false, protocol::Maybe<String>()); |
setEmulatedMedia(&error, String()); |
+ resetViewport(&error); |
+} |
+ |
+void InspectorEmulationAgent::forceViewport(ErrorString* error, double x, double y, const Maybe<double>& scale) |
+{ |
+ if (x < 0 || y < 0) { |
+ *error = "Coordinates must be non-negative"; |
+ return; |
+ } |
+ |
+ float appliedScale = scale.fromMaybe(1.f); |
+ if (appliedScale <= 0) { |
+ *error = "Scale must be positive"; |
+ return; |
+ } |
+ |
+ WebFloatPoint position(x, y); |
+ webViewImpl()->devToolsEmulator()->forceViewport(position, appliedScale); |
+} |
+ |
+void InspectorEmulationAgent::resetViewport(ErrorString*) |
+{ |
+ webViewImpl()->devToolsEmulator()->resetViewport(); |
} |
void InspectorEmulationAgent::resetPageScaleFactor(ErrorString*) |