summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter.cpp
diff options
context:
space:
mode:
authorMichael Bruning <michael.bruning@theqtcompany.com>2016-04-15 17:37:04 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-04-21 07:17:03 +0000
commitd236c5a8a34803bda6115956184398b99dbba408 (patch)
tree5f340555e143fd250db747777180207ee1124dd8 /src/core/web_contents_adapter.cpp
parent653bf0fa7081505273da5296b8dee8dfb594005c (diff)
Use the temporary zoom factor to set the zoom factor
It turns out that using the temporary zoom factor is meant to set the zoom factor for one certain view, and this is actually what we want. Also added auto tests for this. Task-number: QTBUG-51851 Task-number: QTBUG-51969 Change-Id: I8912cbc25637d3c1681026380a2ab3068a964868 Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r--src/core/web_contents_adapter.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index b77a56b9b..0c1dd0cc8 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -665,7 +665,15 @@ 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)));
+
+ double zoomLevel = content::ZoomFactorToZoomLevel(static_cast<double>(factor));
+ content::HostZoomMap *zoomMap = content::HostZoomMap::GetForWebContents(d->webContents.get());
+
+ if (zoomMap) {
+ int render_process_id = d->webContents->GetRenderProcessHost()->GetID();
+ int render_view_id = d->webContents->GetRenderViewHost()->GetRoutingID();
+ zoomMap->SetTemporaryZoomLevel(render_process_id, render_view_id, zoomLevel);
+ }
}
qreal WebContentsAdapter::currentZoomFactor() const