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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 2 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
Index: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index 9cb0fa4995113038683422c04307352138ab5ab1..2811a56faaab713c70ef14ee5f0b03d6b6ce203c 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -1005,7 +1005,8 @@ void BookmarkBarView::WriteDragDataForView(View* sender,
scoped_ptr<gfx::Canvas> canvas(
views::GetCanvasForDragImage(button->GetWidget(), button->size()));
button->PaintButton(canvas.get(), views::TextButton::PB_FOR_DRAG);
- drag_utils::SetDragImageOnDataObject(*canvas, button->size(), press_pt,
+ drag_utils::SetDragImageOnDataObject(*canvas, button->size(),
+ press_pt.OffsetFromOrigin(),
data);
WriteBookmarkDragData(model_->bookmark_bar_node()->GetChild(i), data);
return;
@@ -1041,8 +1042,9 @@ bool BookmarkBarView::CanStartDragForView(views::View* sender,
const gfx::Point& p) {
// Check if we have not moved enough horizontally but we have moved downward
// vertically - downward drag.
- if (!View::ExceededDragThreshold(press_pt.x() - p.x(), 0) &&
- press_pt.y() < p.y()) {
+ gfx::Vector2d move_offset = p - press_pt;
+ gfx::Vector2d horizontal_offset(move_offset.x(), 0);
+ if (!View::ExceededDragThreshold(horizontal_offset) && move_offset.y() > 0) {
for (int i = 0; i < GetBookmarkButtonCount(); ++i) {
if (sender == GetBookmarkButton(i)) {
const BookmarkNode* node = model_->bookmark_bar_node()->GetChild(i);

Powered by Google App Engine
This is Rietveld 408576698