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

Side by Side Diff: views/controls/menu/submenu_view.cc

Issue 6480001: Migrate Event API methods to Google Style. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/controls/menu/submenu_view.h" 5 #include "views/controls/menu/submenu_view.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "views/controls/menu/menu_config.h" 8 #include "views/controls/menu/menu_config.h"
9 #include "views/controls/menu/menu_controller.h" 9 #include "views/controls/menu/menu_controller.h"
10 #include "views/controls/menu/menu_host.h" 10 #include "views/controls/menu/menu_host.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 while ((i < menu_item_count) && (GetMenuItemAt(i)->y() < vis_bounds.y())) 188 while ((i < menu_item_count) && (GetMenuItemAt(i)->y() < vis_bounds.y()))
189 ++i; 189 ++i;
190 if (i == menu_item_count) 190 if (i == menu_item_count)
191 return true; 191 return true;
192 int first_vis_index = std::max(0, 192 int first_vis_index = std::max(0,
193 (GetMenuItemAt(i)->y() == vis_bounds.y()) ? i : i - 1); 193 (GetMenuItemAt(i)->y() == vis_bounds.y()) ? i : i - 1);
194 194
195 // If the first item isn't entirely visible, make it visible, otherwise make 195 // If the first item isn't entirely visible, make it visible, otherwise make
196 // the next/previous one entirely visible. 196 // the next/previous one entirely visible.
197 #if defined(OS_WIN) 197 #if defined(OS_WIN)
198 int delta = abs(e.GetOffset() / WHEEL_DELTA); 198 int delta = abs(e.offset() / WHEEL_DELTA);
199 #elif defined(OS_LINUX) 199 #elif defined(OS_LINUX)
200 int delta = abs(e.GetOffset()); 200 int delta = abs(e.offset());
201 #endif 201 #endif
202 for (bool scroll_up = (e.GetOffset() > 0); delta != 0; --delta) { 202 for (bool scroll_up = (e.offset() > 0); delta != 0; --delta) {
203 int scroll_target; 203 int scroll_target;
204 if (scroll_up) { 204 if (scroll_up) {
205 if (GetMenuItemAt(first_vis_index)->y() == vis_bounds.y()) { 205 if (GetMenuItemAt(first_vis_index)->y() == vis_bounds.y()) {
206 if (first_vis_index == 0) 206 if (first_vis_index == 0)
207 break; 207 break;
208 first_vis_index--; 208 first_vis_index--;
209 } 209 }
210 scroll_target = GetMenuItemAt(first_vis_index)->y(); 210 scroll_target = GetMenuItemAt(first_vis_index)->y();
211 } else { 211 } else {
212 if (first_vis_index + 1 == menu_item_count) 212 if (first_vis_index + 1 == menu_item_count)
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 item_bounds.set_height(kDropIndicatorHeight); 371 item_bounds.set_height(kDropIndicatorHeight);
372 return item_bounds; 372 return item_bounds;
373 373
374 default: 374 default:
375 // Don't render anything for on. 375 // Don't render anything for on.
376 return gfx::Rect(); 376 return gfx::Rect();
377 } 377 }
378 } 378 }
379 379
380 } // namespace views 380 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698