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

Unified Diff: chrome/browser/tab_contents/tab_contents_view_gtk.cc

Issue 8918022: Print preview: Prevent a crash when zooming with the scroll wheel. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents_view_gtk.cc
===================================================================
--- chrome/browser/tab_contents/tab_contents_view_gtk.cc (revision 114056)
+++ chrome/browser/tab_contents/tab_contents_view_gtk.cc (working copy)
@@ -54,18 +54,22 @@
// See tab_contents_view_views.cc for discussion of mouse scroll zooming.
gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event,
TabContents* tab_contents) {
- if ((event->state & gtk_accelerator_get_default_mod_mask()) ==
+ if ((event->state & gtk_accelerator_get_default_mod_mask()) !=
GDK_CONTROL_MASK) {
- if (event->direction == GDK_SCROLL_DOWN) {
- tab_contents->delegate()->ContentsZoomChange(false);
- return TRUE;
- } else if (event->direction == GDK_SCROLL_UP) {
- tab_contents->delegate()->ContentsZoomChange(true);
- return TRUE;
- }
+ return FALSE;
}
- return FALSE;
+ TabContentsDelegate* delegate = tab_contents->delegate();
+ if (!delegate)
+ return FALSE;
+
+ if (!(event->direction == GDK_SCROLL_DOWN ||
+ event->direction == GDK_SCROLL_UP)) {
+ return FALSE;
+ }
+
+ delegate->ContentsZoomChange(event->direction == GDK_SCROLL_UP);
+ return TRUE;
}
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698