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

Unified Diff: chrome/browser/views/tab_contents/tab_contents_view_win.cc

Issue 147202: Added support for Text only zoom... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « chrome/browser/views/tab_contents/tab_contents_view_win.h ('k') | chrome/common/page_zoom.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/tab_contents/tab_contents_view_win.cc
===================================================================
--- chrome/browser/views/tab_contents/tab_contents_view_win.cc (revision 19223)
+++ chrome/browser/views/tab_contents/tab_contents_view_win.cc (working copy)
@@ -483,7 +483,17 @@
case WM_MOUSEWHEEL:
// This message is reflected from the view() to this window.
if (GET_KEYSTATE_WPARAM(message->wParam) & MK_CONTROL) {
- WheelZoom(GET_WHEEL_DELTA_WPARAM(message->wParam));
+ PageZoom::Function zoom_type;
+ const bool zoom_in = GET_WHEEL_DELTA_WPARAM(message->wParam) > 0;
+
+ if (GET_KEYSTATE_WPARAM(message->wParam) & MK_SHIFT) {
+ zoom_type = zoom_in ? PageZoom::TEXT_ONLY_LARGER :
+ PageZoom::TEXT_ONLY_SMALLER;
+ } else {
+ zoom_type = zoom_in ? PageZoom::LARGER : PageZoom::SMALLER;
+ }
+
+ WheelZoom(zoom_type);
return 1;
}
break;
@@ -592,30 +602,32 @@
// content has focus, although FF and IE require that the mouse is over
// content. This is because all events get forwarded when content has
// focus.
+ const int zoom_text_only = GetAsyncKeyState(VK_SHIFT) & 0x8000;
+
if (GetAsyncKeyState(VK_CONTROL) & 0x8000) {
- int distance = 0;
+ PageZoom::Function zoom_type;
switch (scroll_type) {
case SB_LINEUP:
- distance = WHEEL_DELTA;
+ zoom_type = zoom_text_only ? PageZoom::TEXT_ONLY_LARGER :
+ PageZoom::LARGER;
break;
case SB_LINEDOWN:
- distance = -WHEEL_DELTA;
+ zoom_type = zoom_text_only ? PageZoom::TEXT_ONLY_SMALLER :
+ PageZoom::SMALLER;
break;
// TODO(joshia): Handle SB_PAGEUP, SB_PAGEDOWN, SB_THUMBPOSITION,
// and SB_THUMBTRACK for completeness
default:
- break;
+ return false;
}
- WheelZoom(distance);
+ WheelZoom(zoom_type);
return true;
}
return false;
}
-void TabContentsViewWin::WheelZoom(int distance) {
- if (tab_contents()->delegate()) {
- bool zoom_in = distance > 0;
- tab_contents()->delegate()->ContentsZoomChange(zoom_in);
- }
+void TabContentsViewWin::WheelZoom(PageZoom::Function zoom_type) {
+ if (tab_contents()->delegate())
+ tab_contents()->delegate()->ContentsZoomChange(zoom_type);
}
« no previous file with comments | « chrome/browser/views/tab_contents/tab_contents_view_win.h ('k') | chrome/common/page_zoom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698