From 739bfbb55df666c7fb975fb847bbd3f129b88eba Mon Sep 17 00:00:00 2001
From: Pierre Rossi <pierre.rossi@digia.com>
Date: Fri, 10 Oct 2014 17:26:27 +0200
Subject: [PATCH] Bounds check the zoom factor before we pass it along.

As it turns out failing to do so can mess up the page state.

Change-Id: I8cc785b01c73bde5443bdb78554d7b3809d96afe
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
---
 src/core/web_contents_adapter.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 3533c0743..4129e8c33 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -612,6 +612,8 @@ void WebContentsAdapter::serializeNavigationHistory(QDataStream &output)
 void WebContentsAdapter::setZoomFactor(qreal factor)
 {
     Q_D(WebContentsAdapter);
+    if (factor < content::kMinimumZoomFactor || factor > content::kMaximumZoomFactor)
+        return;
     content::HostZoomMap::SetZoomLevel(d->webContents.get(), content::ZoomFactorToZoomLevel(static_cast<double>(factor)));
 }
 
-- 
GitLab