OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/menu/submenu_view.h" | 5 #include "ui/views/controls/menu/submenu_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 SchedulePaint(); | 375 SchedulePaint(); |
376 } | 376 } |
377 | 377 |
378 void SubmenuView::PaintDropIndicator(gfx::Canvas* canvas, | 378 void SubmenuView::PaintDropIndicator(gfx::Canvas* canvas, |
379 MenuItemView* item, | 379 MenuItemView* item, |
380 MenuDelegate::DropPosition position) { | 380 MenuDelegate::DropPosition position) { |
381 if (position == MenuDelegate::DROP_NONE) | 381 if (position == MenuDelegate::DROP_NONE) |
382 return; | 382 return; |
383 | 383 |
384 gfx::Rect bounds = CalculateDropIndicatorBounds(item, position); | 384 gfx::Rect bounds = CalculateDropIndicatorBounds(item, position); |
385 canvas->FillRect(kDropIndicatorColor, bounds); | 385 canvas->FillRect(bounds, kDropIndicatorColor); |
386 } | 386 } |
387 | 387 |
388 void SubmenuView::SchedulePaintForDropIndicator( | 388 void SubmenuView::SchedulePaintForDropIndicator( |
389 MenuItemView* item, | 389 MenuItemView* item, |
390 MenuDelegate::DropPosition position) { | 390 MenuDelegate::DropPosition position) { |
391 if (item == NULL) | 391 if (item == NULL) |
392 return; | 392 return; |
393 | 393 |
394 if (position == MenuDelegate::DROP_ON) { | 394 if (position == MenuDelegate::DROP_ON) { |
395 item->SchedulePaint(); | 395 item->SchedulePaint(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 int y = vis_bounds.y() - static_cast<int>(dy); | 427 int y = vis_bounds.y() - static_cast<int>(dy); |
428 // clamp y to [0, full_height - vis_height) | 428 // clamp y to [0, full_height - vis_height) |
429 y = std::max(y, 0); | 429 y = std::max(y, 0); |
430 y = std::min(y, full_bounds.height() - vis_bounds.height() - 1); | 430 y = std::min(y, full_bounds.height() - vis_bounds.height() - 1); |
431 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); | 431 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); |
432 if (new_vis_bounds != vis_bounds) | 432 if (new_vis_bounds != vis_bounds) |
433 ScrollRectToVisible(new_vis_bounds); | 433 ScrollRectToVisible(new_vis_bounds); |
434 } | 434 } |
435 | 435 |
436 } // namespace views | 436 } // namespace views |
OLD | NEW |