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

Unified Diff: content/renderer/render_view_impl.cc

Issue 954923005: Make command-zero reset page scale in addition to zoom level (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again again Created 5 years, 9 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/render_view_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index ff77a10a02974be7911733427af5fd1b394ebfc4..b8ce401fc4ffc396af3f19a12c76624a801fdce3 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -660,7 +660,8 @@ RenderViewImpl::RenderViewImpl(const ViewMsg_New_Params& params)
#endif
enumeration_completion_id_(0),
session_storage_namespace_id_(params.session_storage_namespace_id),
- next_snapshot_id_(0) {
+ next_snapshot_id_(0),
+ page_scale_factor_is_one_(true) {
}
void RenderViewImpl::Initialize(const ViewMsg_New_Params& params,
@@ -1285,6 +1286,7 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt)
IPC_MESSAGE_HANDLER(ViewMsg_Find, OnFind)
IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
+ IPC_MESSAGE_HANDLER(ViewMsg_ResetPageScale, OnResetPageScale)
IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom)
IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
OnSetZoomLevelForLoadingURL)
@@ -2680,6 +2682,12 @@ void RenderViewImpl::OnFindMatchRects(int current_version) {
}
#endif
+void RenderViewImpl::OnResetPageScale() {
+ if (!webview())
+ return;
+ webview()->setPageScaleFactor(1);
+}
+
void RenderViewImpl::OnZoom(PageZoom zoom) {
if (!webview()) // Not sure if this can happen, but no harm in being safe.
return;
@@ -3682,6 +3690,17 @@ void RenderViewImpl::zoomLevelChanged() {
}
}
+void RenderViewImpl::pageScaleFactorChanged() {
+ if (!webview())
+ return;
+ bool page_scale_factor_is_one = webview()->pageScaleFactor() == 1;
+ if (page_scale_factor_is_one == page_scale_factor_is_one_)
+ return;
+ page_scale_factor_is_one_ = page_scale_factor_is_one;
+ Send(new ViewHostMsg_PageScaleFactorIsOneChanged(routing_id_,
+ page_scale_factor_is_one_));
+}
+
double RenderViewImpl::zoomLevelToZoomFactor(double zoom_level) const {
return ZoomLevelToZoomFactor(zoom_level);
}
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698