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

Unified Diff: Source/WebCore/inspector/front-end/ElementsTreeOutline.js

Issue 9328038: Merge 106638 - Web Inspector: preserve elements panel selection upon node drag'n'drop (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 10 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 | « Source/WebCore/inspector/front-end/DOMAgent.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/inspector/front-end/ElementsTreeOutline.js
===================================================================
--- Source/WebCore/inspector/front-end/ElementsTreeOutline.js (revision 106780)
+++ Source/WebCore/inspector/front-end/ElementsTreeOutline.js (working copy)
@@ -386,32 +386,40 @@
{
event.preventDefault();
var treeElement = this._treeElementFromEvent(event);
- if (this._nodeBeingDragged && treeElement) {
- var parentNode;
- var anchorNode;
+ if (treeElement)
+ this._doMove(treeElement);
+ },
- if (treeElement._elementCloseTag) {
- // Drop onto closing tag -> insert as last child.
- parentNode = treeElement.representedObject;
- } else {
- var dragTargetNode = treeElement.representedObject;
- parentNode = dragTargetNode.parentNode;
- anchorNode = dragTargetNode;
- }
+ _doMove: function(treeElement)
+ {
+ if (!this._nodeBeingDragged)
+ return;
- function callback(error, newNodeId)
- {
- if (error)
- return;
+ var parentNode;
+ var anchorNode;
- this._updateModifiedNodes();
- var newNode = WebInspector.domAgent.nodeForId(newNodeId);
- if (newNode)
- this.selectDOMNode(newNode, true);
- }
- this._nodeBeingDragged.moveTo(parentNode, anchorNode, callback.bind(this));
+ if (treeElement._elementCloseTag) {
+ // Drop onto closing tag -> insert as last child.
+ parentNode = treeElement.representedObject;
+ } else {
+ var dragTargetNode = treeElement.representedObject;
+ parentNode = dragTargetNode.parentNode;
+ anchorNode = dragTargetNode;
}
+ function callback(error, newNodeId)
+ {
+ if (error)
+ return;
+
+ this._updateModifiedNodes();
+ var newNode = WebInspector.domAgent.nodeForId(newNodeId);
+ if (newNode)
+ this.selectDOMNode(newNode, true);
+ }
+
+ this._nodeBeingDragged.moveTo(parentNode, anchorNode, callback.bind(this));
+
delete this._nodeBeingDragged;
},
« no previous file with comments | « Source/WebCore/inspector/front-end/DOMAgent.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698