| 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);
|
| }
|
|
|