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

Side by Side Diff: Source/devtools/front_end/ui/UIUtils.js

Issue 658723006: DevTools: fix changing of cursor while dragging (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 var targetDocument = event.target.ownerDocument; 71 var targetDocument = event.target.ownerDocument;
72 72
73 WebInspector._elementDraggingEventListener = elementDrag; 73 WebInspector._elementDraggingEventListener = elementDrag;
74 WebInspector._elementEndDraggingEventListener = elementDragEnd; 74 WebInspector._elementEndDraggingEventListener = elementDragEnd;
75 WebInspector._mouseOutWhileDraggingTargetDocument = targetDocument; 75 WebInspector._mouseOutWhileDraggingTargetDocument = targetDocument;
76 76
77 targetDocument.addEventListener("mousemove", WebInspector._elementDragMove, true); 77 targetDocument.addEventListener("mousemove", WebInspector._elementDragMove, true);
78 targetDocument.addEventListener("mouseup", WebInspector._elementDragEnd, tru e); 78 targetDocument.addEventListener("mouseup", WebInspector._elementDragEnd, tru e);
79 targetDocument.addEventListener("mouseout", WebInspector._mouseOutWhileDragg ing, true); 79 targetDocument.addEventListener("mouseout", WebInspector._mouseOutWhileDragg ing, true);
80 80
81 targetDocument.body.style.cursor = cursor; 81 var targetElement = /** @type {!Element} */ (event.target);
82 82 if (typeof cursor === "string") {
83 WebInspector._restoreCursorAfterDrag = restoreCursor.bind(null, targetEl ement.style.cursor);
84 targetElement.style.cursor = cursor;
85 document.body.style.cursor = cursor;
86 }
87 function restoreCursor(oldCursor)
88 {
89 targetDocument.body.style.removeProperty("cursor");
90 targetElement.style.cursor = oldCursor;
vsevik 2014/10/23 08:03:59 Shouldn't this be behind if (oldcursor) ?
91 WebInspector._restoreCursorAfterDrag = null;
92 }
83 event.preventDefault(); 93 event.preventDefault();
84 } 94 }
85 95
86 WebInspector._mouseOutWhileDragging = function() 96 WebInspector._mouseOutWhileDragging = function()
87 { 97 {
88 WebInspector._unregisterMouseOutWhileDragging(); 98 WebInspector._unregisterMouseOutWhileDragging();
89 WebInspector._elementDraggingGlassPane = new WebInspector.GlassPane(); 99 WebInspector._elementDraggingGlassPane = new WebInspector.GlassPane();
90 } 100 }
91 101
92 WebInspector._unregisterMouseOutWhileDragging = function() 102 WebInspector._unregisterMouseOutWhileDragging = function()
(...skipping 16 matching lines...) Expand all
109 /** 119 /**
110 * @param {!Event} event 120 * @param {!Event} event
111 */ 121 */
112 WebInspector._cancelDragEvents = function(event) 122 WebInspector._cancelDragEvents = function(event)
113 { 123 {
114 var targetDocument = event.target.ownerDocument; 124 var targetDocument = event.target.ownerDocument;
115 targetDocument.removeEventListener("mousemove", WebInspector._elementDragMov e, true); 125 targetDocument.removeEventListener("mousemove", WebInspector._elementDragMov e, true);
116 targetDocument.removeEventListener("mouseup", WebInspector._elementDragEnd, true); 126 targetDocument.removeEventListener("mouseup", WebInspector._elementDragEnd, true);
117 WebInspector._unregisterMouseOutWhileDragging(); 127 WebInspector._unregisterMouseOutWhileDragging();
118 128
119 targetDocument.body.style.removeProperty("cursor"); 129 if (WebInspector._restoreCursorAfterDrag)
130 WebInspector._restoreCursorAfterDrag();
120 131
121 if (WebInspector._elementDraggingGlassPane) 132 if (WebInspector._elementDraggingGlassPane)
122 WebInspector._elementDraggingGlassPane.dispose(); 133 WebInspector._elementDraggingGlassPane.dispose();
123 134
124 delete WebInspector._elementDraggingGlassPane; 135 delete WebInspector._elementDraggingGlassPane;
125 delete WebInspector._elementDraggingEventListener; 136 delete WebInspector._elementDraggingEventListener;
126 delete WebInspector._elementEndDraggingEventListener; 137 delete WebInspector._elementEndDraggingEventListener;
127 } 138 }
128 139
129 /** 140 /**
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 __proto__: WebInspector.Object.prototype 1082 __proto__: WebInspector.Object.prototype
1072 } 1083 }
1073 1084
1074 WebInspector.initializeUIUtils = function() 1085 WebInspector.initializeUIUtils = function()
1075 { 1086 {
1076 window.addEventListener("focus", WebInspector._windowFocused, false); 1087 window.addEventListener("focus", WebInspector._windowFocused, false);
1077 window.addEventListener("blur", WebInspector._windowBlurred, false); 1088 window.addEventListener("blur", WebInspector._windowBlurred, false);
1078 document.addEventListener("focus", WebInspector._focusChanged, true); 1089 document.addEventListener("focus", WebInspector._focusChanged, true);
1079 document.addEventListener("blur", WebInspector._documentBlurred, true); 1090 document.addEventListener("blur", WebInspector._documentBlurred, true);
1080 } 1091 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698