| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 first_vis_index++; | 253 first_vis_index++; |
| 254 } | 254 } |
| 255 ScrollRectToVisible(gfx::Rect(gfx::Point(0, scroll_target), | 255 ScrollRectToVisible(gfx::Rect(gfx::Point(0, scroll_target), |
| 256 vis_bounds.size())); | 256 vis_bounds.size())); |
| 257 vis_bounds = GetVisibleBounds(); | 257 vis_bounds = GetVisibleBounds(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 return true; | 260 return true; |
| 261 } | 261 } |
| 262 | 262 |
| 263 ui::GestureStatus SubmenuView::OnGestureEvent(const ui::GestureEvent& e) { | 263 ui::EventResult SubmenuView::OnGestureEvent(const ui::GestureEvent& e) { |
| 264 ui::GestureStatus to_return = ui::GESTURE_STATUS_CONSUMED; | 264 ui::EventResult to_return = ui::ER_CONSUMED; |
| 265 switch (e.type()) { | 265 switch (e.type()) { |
| 266 case ui::ET_GESTURE_SCROLL_BEGIN: | 266 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 267 scroll_animator_->Stop(); | 267 scroll_animator_->Stop(); |
| 268 break; | 268 break; |
| 269 case ui::ET_GESTURE_SCROLL_UPDATE: | 269 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 270 OnScroll(0, e.details().scroll_y()); | 270 OnScroll(0, e.details().scroll_y()); |
| 271 break; | 271 break; |
| 272 case ui::ET_GESTURE_SCROLL_END: | 272 case ui::ET_GESTURE_SCROLL_END: |
| 273 break; | 273 break; |
| 274 case ui::ET_SCROLL_FLING_START: | 274 case ui::ET_SCROLL_FLING_START: |
| 275 if (e.details().velocity_y() != 0.0f) | 275 if (e.details().velocity_y() != 0.0f) |
| 276 scroll_animator_->Start(0, e.details().velocity_y()); | 276 scroll_animator_->Start(0, e.details().velocity_y()); |
| 277 break; | 277 break; |
| 278 case ui::ET_GESTURE_TAP_DOWN: | 278 case ui::ET_GESTURE_TAP_DOWN: |
| 279 case ui::ET_SCROLL_FLING_CANCEL: | 279 case ui::ET_SCROLL_FLING_CANCEL: |
| 280 scroll_animator_->Stop(); | 280 scroll_animator_->Stop(); |
| 281 break; | 281 break; |
| 282 default: | 282 default: |
| 283 to_return = ui::GESTURE_STATUS_UNKNOWN; | 283 to_return = ui::ER_UNHANDLED; |
| 284 break; | 284 break; |
| 285 } | 285 } |
| 286 return to_return; | 286 return to_return; |
| 287 } | 287 } |
| 288 | 288 |
| 289 bool SubmenuView::IsShowing() { | 289 bool SubmenuView::IsShowing() { |
| 290 return host_ && host_->IsMenuHostVisible(); | 290 return host_ && host_->IsMenuHostVisible(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void SubmenuView::ShowAt(Widget* parent, | 293 void SubmenuView::ShowAt(Widget* parent, |
| (...skipping 152 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 |