summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-12 18:52:09 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-12 18:52:09 (EDT)
commit1de0210ea13fc18b8cd497ec3501789b7a7fd328 (patch)
tree5762b86bf836bda36cada5abc2c7aa8675d269db /src
parent30bc434dde744f24165fda080bce286d69a20ff0 (diff)
downloadmarquee-1de0210ea13fc18b8cd497ec3501789b7a7fd328.zip
marquee-1de0210ea13fc18b8cd497ec3501789b7a7fd328.tar.gz
marquee-1de0210ea13fc18b8cd497ec3501789b7a7fd328.tar.bz2
mq_web_view_zoom_*(): Constrain zoom level within [0, G_MAXDOUBLE]
Diffstat (limited to 'src')
-rw-r--r--src/web-view.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/web-view.c b/src/web-view.c
index ebebcba..c7128c3 100644
--- a/src/web-view.c
+++ b/src/web-view.c
@@ -745,6 +745,9 @@ mq_web_view_zoom_in(MqWebView *web_view)
zoom_level = webkit_web_view_get_zoom_level(WEBKIT_WEB_VIEW(web_view));
zoom_level += 0.1;
+ if (zoom_level < 0) {
+ zoom_level = G_MAXDOUBLE;
+ }
webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(web_view), zoom_level);
}
@@ -755,6 +758,9 @@ mq_web_view_zoom_out(MqWebView *web_view)
zoom_level = webkit_web_view_get_zoom_level(WEBKIT_WEB_VIEW(web_view));
zoom_level -= 0.1;
+ if (zoom_level < 0) {
+ zoom_level = 0;
+ }
webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(web_view), zoom_level);
}