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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/UIUtils.js
diff --git a/Source/devtools/front_end/ui/UIUtils.js b/Source/devtools/front_end/ui/UIUtils.js
index 7cad9bb9a171c9362c7611aa9f8dc75774343cd0..af356a2b945084f1c9251b3ee17678352ee56e06 100644
--- a/Source/devtools/front_end/ui/UIUtils.js
+++ b/Source/devtools/front_end/ui/UIUtils.js
@@ -78,8 +78,18 @@ WebInspector.elementDragStart = function(elementDragStart, elementDrag, elementD
targetDocument.addEventListener("mouseup", WebInspector._elementDragEnd, true);
targetDocument.addEventListener("mouseout", WebInspector._mouseOutWhileDragging, true);
- targetDocument.body.style.cursor = cursor;
-
+ var targetElement = /** @type {!Element} */ (event.target);
+ if (typeof cursor === "string") {
+ WebInspector._restoreCursorAfterDrag = restoreCursor.bind(null, targetElement.style.cursor);
+ targetElement.style.cursor = cursor;
+ document.body.style.cursor = cursor;
+ }
+ function restoreCursor(oldCursor)
+ {
+ targetDocument.body.style.removeProperty("cursor");
+ targetElement.style.cursor = oldCursor;
vsevik 2014/10/23 08:03:59 Shouldn't this be behind if (oldcursor) ?
+ WebInspector._restoreCursorAfterDrag = null;
+ }
event.preventDefault();
}
@@ -116,7 +126,8 @@ WebInspector._cancelDragEvents = function(event)
targetDocument.removeEventListener("mouseup", WebInspector._elementDragEnd, true);
WebInspector._unregisterMouseOutWhileDragging();
- targetDocument.body.style.removeProperty("cursor");
+ if (WebInspector._restoreCursorAfterDrag)
+ WebInspector._restoreCursorAfterDrag();
if (WebInspector._elementDraggingGlassPane)
WebInspector._elementDraggingGlassPane.dispose();
« 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