Chromium Code Reviews| 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(); |