| 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" |
| 11 #include "ui/base/event.h" | 11 #include "ui/base/events/event.h" |
| 12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 13 #include "ui/views/controls/menu/menu_config.h" | 13 #include "ui/views/controls/menu/menu_config.h" |
| 14 #include "ui/views/controls/menu/menu_controller.h" | 14 #include "ui/views/controls/menu/menu_controller.h" |
| 15 #include "ui/views/controls/menu/menu_host.h" | 15 #include "ui/views/controls/menu/menu_host.h" |
| 16 #include "ui/views/controls/menu/menu_scroll_view_container.h" | 16 #include "ui/views/controls/menu/menu_scroll_view_container.h" |
| 17 #include "ui/views/widget/root_view.h" | 17 #include "ui/views/widget/root_view.h" |
| 18 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 int y = vis_bounds.y() - static_cast<int>(dy); | 446 int y = vis_bounds.y() - static_cast<int>(dy); |
| 447 // clamp y to [0, full_height - vis_height) | 447 // clamp y to [0, full_height - vis_height) |
| 448 y = std::max(y, 0); | 448 y = std::max(y, 0); |
| 449 y = std::min(y, full_bounds.height() - vis_bounds.height() - 1); | 449 y = std::min(y, full_bounds.height() - vis_bounds.height() - 1); |
| 450 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); | 450 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); |
| 451 if (new_vis_bounds != vis_bounds) | 451 if (new_vis_bounds != vis_bounds) |
| 452 ScrollRectToVisible(new_vis_bounds); | 452 ScrollRectToVisible(new_vis_bounds); |
| 453 } | 453 } |
| 454 | 454 |
| 455 } // namespace views | 455 } // namespace views |
| OLD | NEW |