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..e093273f0e2df60fae0955b76907522927353892 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/WebFloatRect.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()); |
+ clearCompositedAreaOverride(&error); |
+} |
+ |
+void InspectorEmulationAgent::setCompositedAreaOverride(ErrorString* error, double x, double y, double width, double height, const Maybe<double>& scale) |
+{ |
+ if (x < 0 || y < 0 || width < 0 || height < 0) { |
+ *error = "Coordinates must be non-negative"; |
+ return; |
+ } |
+ |
+ float appliedScale = scale.fromMaybe(1.f); |
+ if (appliedScale <= 0) { |
+ *error = "Scale must be positive"; |
+ return; |
+ } |
+ |
+ WebFloatRect area(x, y, width, height); |
+ webViewImpl()->devToolsEmulator()->setCompositedAreaOverride(area, appliedScale); |
+} |
+ |
+void InspectorEmulationAgent::clearCompositedAreaOverride(ErrorString*) |
+{ |
+ webViewImpl()->devToolsEmulator()->clearCompositedAreaOverride(); |
} |
void InspectorEmulationAgent::resetPageScaleFactor(ErrorString*) |