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

Unified Diff: ui/app_list/views/search_box_view.cc

Issue 2982453002: New AppListView Scroll Behavior. (Closed)
Patch Set: Removed unintended edit. Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/search_box_view.h ('k') | ui/app_list/views/start_page_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/search_box_view.cc
diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc
index f7af6774112fff697735eb5809ddec83dee38ce0..019e1149b115b8debc8835f26f02c39e85595489 100644
--- a/ui/app_list/views/search_box_view.cc
+++ b/ui/app_list/views/search_box_view.cc
@@ -381,21 +381,23 @@ void SearchBoxView::HandleSearchBoxEvent(ui::LocatedEvent* located_event) {
if (!is_fullscreen_app_list_enabled_)
return;
- if (located_event->type() != ui::ET_MOUSE_PRESSED &&
- located_event->type() != ui::ET_GESTURE_TAP)
- return;
-
- bool event_is_in_searchbox_bounds =
- GetWidget()->GetWindowBoundsInScreen().Contains(
- located_event->root_location());
+ if (located_event->type() == ui::ET_MOUSEWHEEL) {
+ if (!app_list_view_->HandleScroll(located_event))
+ return;
- if (!is_search_box_active_ && event_is_in_searchbox_bounds &&
- search_box_->text().empty()) {
+ } else if (located_event->type() == ui::ET_MOUSE_PRESSED ||
+ located_event->type() == ui::ET_GESTURE_TAP) {
+ bool event_is_in_searchbox_bounds =
+ GetWidget()->GetWindowBoundsInScreen().Contains(
+ located_event->root_location());
+ if (is_search_box_active_ || !event_is_in_searchbox_bounds ||
+ !search_box_->text().empty())
+ return;
// If the event was within the searchbox bounds and in an inactive empty
// search box, enable the search box.
SetSearchBoxActive(true);
- located_event->SetHandled();
}
+ located_event->SetHandled();
}
bool SearchBoxView::OnTextfieldEvent() {
@@ -412,7 +414,6 @@ bool SearchBoxView::OnTextfieldEvent() {
bool SearchBoxView::OnMouseWheel(const ui::MouseWheelEvent& event) {
if (contents_view_)
return contents_view_->OnMouseWheel(event);
-
return false;
}
@@ -427,6 +428,9 @@ const char* SearchBoxView::GetClassName() const {
}
void SearchBoxView::OnGestureEvent(ui::GestureEvent* event) {
+ if (!is_fullscreen_app_list_enabled_)
+ return;
+
HandleSearchBoxEvent(event);
}
@@ -512,7 +516,14 @@ bool SearchBoxView::HandleKeyEvent(views::Textfield* sender,
bool SearchBoxView::HandleMouseEvent(views::Textfield* sender,
const ui::MouseEvent& mouse_event) {
- return OnTextfieldEvent();
+ if (!is_fullscreen_app_list_enabled_)
+ return false;
+
+ if (mouse_event.type() == ui::ET_MOUSEWHEEL) {
+ return app_list_view_->HandleScroll(&mouse_event);
+ } else {
+ return OnTextfieldEvent();
+ }
}
bool SearchBoxView::HandleGestureEvent(views::Textfield* sender,
« no previous file with comments | « ui/app_list/views/search_box_view.h ('k') | ui/app_list/views/start_page_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698