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

Side by Side Diff: ui/views/view.cc

Issue 1518463002: Hides ink ripple when a button drag is started (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 return ui::DragDropTypes::DRAG_NONE; 1278 return ui::DragDropTypes::DRAG_NONE;
1279 } 1279 }
1280 1280
1281 void View::OnDragExited() { 1281 void View::OnDragExited() {
1282 } 1282 }
1283 1283
1284 int View::OnPerformDrop(const ui::DropTargetEvent& event) { 1284 int View::OnPerformDrop(const ui::DropTargetEvent& event) {
1285 return ui::DragDropTypes::DRAG_NONE; 1285 return ui::DragDropTypes::DRAG_NONE;
1286 } 1286 }
1287 1287
1288 void View::OnDragStarted(const ui::LocatedEvent& event) {
1289 }
1290
1288 void View::OnDragDone() { 1291 void View::OnDragDone() {
1289 } 1292 }
1290 1293
1291 // static 1294 // static
1292 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { 1295 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) {
1293 return (abs(delta.x()) > GetHorizontalDragThreshold() || 1296 return (abs(delta.x()) > GetHorizontalDragThreshold() ||
1294 abs(delta.y()) > GetVerticalDragThreshold()); 1297 abs(delta.y()) > GetVerticalDragThreshold());
1295 } 1298 }
1296 1299
1297 // Accessibility---------------------------------------------------------------- 1300 // Accessibility----------------------------------------------------------------
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 bool View::ProcessMouseDragged(const ui::MouseEvent& event) { 2189 bool View::ProcessMouseDragged(const ui::MouseEvent& event) {
2187 // Copy the field, that way if we're deleted after drag and drop no harm is 2190 // Copy the field, that way if we're deleted after drag and drop no harm is
2188 // done. 2191 // done.
2189 ContextMenuController* context_menu_controller = context_menu_controller_; 2192 ContextMenuController* context_menu_controller = context_menu_controller_;
2190 const bool possible_drag = GetDragInfo()->possible_drag; 2193 const bool possible_drag = GetDragInfo()->possible_drag;
2191 if (possible_drag && 2194 if (possible_drag &&
2192 ExceededDragThreshold(GetDragInfo()->start_pt - event.location()) && 2195 ExceededDragThreshold(GetDragInfo()->start_pt - event.location()) &&
2193 (!drag_controller_ || 2196 (!drag_controller_ ||
2194 drag_controller_->CanStartDragForView( 2197 drag_controller_->CanStartDragForView(
2195 this, GetDragInfo()->start_pt, event.location()))) { 2198 this, GetDragInfo()->start_pt, event.location()))) {
2199 LOG(ERROR) << __FUNCTION__ << " calling DoDrag";
bruthig 2015/12/09 17:35:06 Don't forget to remove these log statements.
varkha 2015/12/09 17:42:53 Done.
2196 DoDrag(event, GetDragInfo()->start_pt, 2200 DoDrag(event, GetDragInfo()->start_pt,
2197 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); 2201 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
2198 } else { 2202 } else {
2203 LOG(ERROR) << __FUNCTION__ << " calling OnMouseDragged";
2199 if (OnMouseDragged(event)) 2204 if (OnMouseDragged(event))
2200 return true; 2205 return true;
2201 // Fall through to return value based on context menu controller. 2206 // Fall through to return value based on context menu controller.
2202 } 2207 }
2203 // WARNING: we may have been deleted. 2208 // WARNING: we may have been deleted.
2204 return (context_menu_controller != NULL) || possible_drag; 2209 return (context_menu_controller != NULL) || possible_drag;
2205 } 2210 }
2206 2211
2207 void View::ProcessMouseReleased(const ui::MouseEvent& event) { 2212 void View::ProcessMouseReleased(const ui::MouseEvent& event) {
2208 if (!kContextMenuOnMousePress && context_menu_controller_ && 2213 if (!kContextMenuOnMousePress && context_menu_controller_ &&
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 Widget* widget = GetWidget(); 2378 Widget* widget = GetWidget();
2374 // We should only start a drag from an event, implying we have a widget. 2379 // We should only start a drag from an event, implying we have a widget.
2375 DCHECK(widget); 2380 DCHECK(widget);
2376 2381
2377 // Don't attempt to start a drag while in the process of dragging. This is 2382 // Don't attempt to start a drag while in the process of dragging. This is
2378 // especially important on X where we can get multiple mouse move events when 2383 // especially important on X where we can get multiple mouse move events when
2379 // we start the drag. 2384 // we start the drag.
2380 if (widget->dragged_view()) 2385 if (widget->dragged_view())
2381 return false; 2386 return false;
2382 2387
2388 OnDragStarted(event);
2389
2383 OSExchangeData data; 2390 OSExchangeData data;
2384 WriteDragData(press_pt, &data); 2391 WriteDragData(press_pt, &data);
2385 2392
2386 // Message the RootView to do the drag and drop. That way if we're removed 2393 // Message the RootView to do the drag and drop. That way if we're removed
2387 // the RootView can detect it and avoid calling us back. 2394 // the RootView can detect it and avoid calling us back.
2388 gfx::Point widget_location(event.location()); 2395 gfx::Point widget_location(event.location());
2389 ConvertPointToWidget(this, &widget_location); 2396 ConvertPointToWidget(this, &widget_location);
2390 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2397 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2391 // WARNING: we may have been deleted. 2398 // WARNING: we may have been deleted.
2392 return true; 2399 return true;
2393 } 2400 }
2394 2401
2395 } // namespace views 2402 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698