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

Side by Side Diff: ui/views/controls/scroll_view.cc

Issue 139983009: ui::LocatedEvent location() returns gfx::PointF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo accidental change. Created 6 years, 7 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) 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/scroll_view.h" 5 #include "ui/views/controls/scroll_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/native_theme/native_theme.h" 9 #include "ui/native_theme/native_theme.h"
10 #include "ui/views/border.h" 10 #include "ui/views/border.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 void ScrollView::OnGestureEvent(ui::GestureEvent* event) { 367 void ScrollView::OnGestureEvent(ui::GestureEvent* event) {
368 // If the event happened on one of the scrollbars, then those events are 368 // If the event happened on one of the scrollbars, then those events are
369 // sent directly to the scrollbars. Otherwise, only scroll events are sent to 369 // sent directly to the scrollbars. Otherwise, only scroll events are sent to
370 // the scrollbars. 370 // the scrollbars.
371 bool scroll_event = event->type() == ui::ET_GESTURE_SCROLL_UPDATE || 371 bool scroll_event = event->type() == ui::ET_GESTURE_SCROLL_UPDATE ||
372 event->type() == ui::ET_GESTURE_SCROLL_BEGIN || 372 event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
373 event->type() == ui::ET_GESTURE_SCROLL_END || 373 event->type() == ui::ET_GESTURE_SCROLL_END ||
374 event->type() == ui::ET_SCROLL_FLING_START; 374 event->type() == ui::ET_SCROLL_FLING_START;
375 375
376 if (vert_sb_->visible()) { 376 if (vert_sb_->visible()) {
377 if (vert_sb_->bounds().Contains(event->location()) || scroll_event) 377 if (vert_sb_->bounds().Contains(gfx::ToFlooredPoint(event->location())) ||
378 scroll_event)
378 vert_sb_->OnGestureEvent(event); 379 vert_sb_->OnGestureEvent(event);
379 } 380 }
380 if (!event->handled() && horiz_sb_->visible()) { 381 if (!event->handled() && horiz_sb_->visible()) {
381 if (horiz_sb_->bounds().Contains(event->location()) || scroll_event) 382 if (horiz_sb_->bounds().Contains(gfx::ToFlooredPoint(event->location())) ||
383 scroll_event)
382 horiz_sb_->OnGestureEvent(event); 384 horiz_sb_->OnGestureEvent(event);
383 } 385 }
384 } 386 }
385 387
386 const char* ScrollView::GetClassName() const { 388 const char* ScrollView::GetClassName() const {
387 return kViewClassName; 389 return kViewClassName;
388 } 390 }
389 391
390 void ScrollView::ScrollToPosition(ScrollBar* source, int position) { 392 void ScrollView::ScrollToPosition(ScrollBar* source, int position) {
391 if (!contents_) 393 if (!contents_)
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 623
622 VariableRowHeightScrollHelper::RowInfo 624 VariableRowHeightScrollHelper::RowInfo
623 FixedRowHeightScrollHelper::GetRowInfo(int y) { 625 FixedRowHeightScrollHelper::GetRowInfo(int y) {
624 if (y < top_margin_) 626 if (y < top_margin_)
625 return RowInfo(0, top_margin_); 627 return RowInfo(0, top_margin_);
626 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_, 628 return RowInfo((y - top_margin_) / row_height_ * row_height_ + top_margin_,
627 row_height_); 629 row_height_);
628 } 630 }
629 631
630 } // namespace views 632 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698