electron/patches/chromium/add_zoom_limit_setters_to_webcontents.patch
Electron Bot 9a198e8ef4 chore: bump chromium to f30828899e4cd7161f6dc6507023f (master) (#20824)
* chore: bump chromium in DEPS to 0476932294da8809a19189b9f54cee11d50cc512

* update chromium patches (#20838)

* chore: bump chromium in DEPS to 838863f5ec9e8a12132a10bb47be8382ad9756a7

* IsRendererTransferNeededForNavigation went away

https://chromium-review.googlesource.com/c/chromium/src/+/1867031

* [arraybuffer] Move the ArrayBuffer implementation from wtf to core

https://chromium-review.googlesource.com/c/chromium/src/+/1875731

* URLLoaderRequest new mojo types

* context menu enums moved around

https://chromium-review.googlesource.com/c/chromium/src/+/1872004

https://chromium-review.googlesource.com/c/chromium/src/+/1876088

https://chromium-review.googlesource.com/c/chromium/src/+/1866520

* chore: bump chromium in DEPS to dc9525d251bf30828899e4cd7161f6dc6507023f

* update chromium patches

* [WIP] Convert network hints IPC to Mojo

https://chromium-review.googlesource.com/c/chromium/src/+/1881967

* jumbo build is no longer supported

https://chromium-review.googlesource.com/c/chromium/src/+/1881967

* fix disable-color-correct-rendering

* [FIXME] fix printing patch

compiles but prob doesn't work

* explicitly include ax_enums

https://chromium-review.googlesource.com/c/chromium/src/+/1759821

* fixup! [WIP] Convert network hints IPC to Mojo

* fix base::span

* fix AsarURLLoader to not double-std::move

* fix debug build

* fix msstl patch

* lint

* more fix msstl

* mooooore fix msstl

* fix compile

* update backport_fix_msstl_compat_in_ui_events.patch

* update msstl compat patch

* don't try to build chrome's prefetch predictor

* build: fix compilation on windows

* Fixup patches for MAS build

* Free up disk space for mac debug builds

* fix: apply custom site instance only for main frame

* Fixup from rebase

* Try not generating symbols for mac debug builds

* Remove double entry of patch

* FIx compile errors

* Trigger CI

* Set symbol_level to 1 for mac debug builds
2019-11-05 18:41:20 -05:00

73 lines
3.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <kleinschmidtorama@gmail.com>
Date: Mon, 23 Sep 2019 17:07:53 -0400
Subject: add zoom limit setters to webcontents
Allows minimum_zoom_percent_ and maximum_zoom_percent_ to be set on WebContents.
This is needed by Electron to allow apps to limit how much an app can zoom in
or out.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index c13511e26189e68376e29f38c4ae2e1cc8fd3c57..a5c4162b3c69b534f843e1b6737392c867fc88ea 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4124,10 +4124,18 @@ bool WebContentsImpl::GetClosedByUserGesture() {
return closed_by_user_gesture_;
}
+void WebContentsImpl::SetMinimumZoomPercent(int zoom_percent) {
+ minimum_zoom_percent_ = zoom_percent;
+}
+
int WebContentsImpl::GetMinimumZoomPercent() {
return minimum_zoom_percent_;
}
+void WebContentsImpl::SetMaximumZoomPercent(int zoom_percent) {
+ maximum_zoom_percent_ = zoom_percent;
+}
+
int WebContentsImpl::GetMaximumZoomPercent() {
return maximum_zoom_percent_;
}
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index ea1b3581ead984ac084fc9a2b9daf85f6756ea5c..b967e02b4052426855a2af88abbced2076b3e04a 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -447,7 +447,9 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
void SystemDragEnded(RenderWidgetHost* source_rwh) override;
void SetClosedByUserGesture(bool value) override;
bool GetClosedByUserGesture() override;
+ void SetMinimumZoomPercent(int zoom_percent) override;
int GetMinimumZoomPercent() override;
+ void SetMaximumZoomPercent(int zoom_percent) override;
int GetMaximumZoomPercent() override;
void SetPageScale(float page_scale_factor) override;
gfx::Size GetPreferredSize() override;
@@ -1690,8 +1692,8 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
bool closed_by_user_gesture_;
// Minimum/maximum zoom percent.
- const int minimum_zoom_percent_;
- const int maximum_zoom_percent_;
+ int minimum_zoom_percent_;
+ int maximum_zoom_percent_;
// Used to correctly handle integer zooming through a smooth scroll device.
float zoom_scroll_remainder_;
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 750de66b8002ba66d0f2247d0075da1e51ac764c..1a57feeb1dfe08f8ce1113cb5d8c8ab57d761094 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -812,8 +812,10 @@ class WebContents : public PageNavigator,
virtual void SetClosedByUserGesture(bool value) = 0;
virtual bool GetClosedByUserGesture() = 0;
- // Gets the minimum/maximum zoom percent.
+ // Gets/sets the minimum/maximum zoom percent.
+ virtual void SetMinimumZoomPercent(int zoom_percent) = 0;
virtual int GetMinimumZoomPercent() = 0;
+ virtual void SetMaximumZoomPercent(int zoom_percent) = 0;
virtual int GetMaximumZoomPercent() = 0;
// Set the renderer's page scale to the given factor.