Title: [106781] branches/chromium/1025
- Revision
- 106781
- Author
- [email protected]
- Date
- 2012-02-06 00:38:27 -0800 (Mon, 06 Feb 2012)
Log Message
Merge 106638 - Web Inspector: preserve elements panel selection upon node drag'n'drop
https://bugs.webkit.org/show_bug.cgi?id=77722
Reviewed by Vsevolod Vlasov.
Source/WebCore:
Test: inspector/elements/move-node.html
* inspector/front-end/DOMAgent.js:
(WebInspector.DOMAgent.prototype._markRevision):
* inspector/front-end/ElementsTreeOutline.js:
(WebInspector.ElementsTreeOutline.prototype._ondrop):
(WebInspector.ElementsTreeOutline.prototype._doMove.callback):
(WebInspector.ElementsTreeOutline.prototype._doMove):
LayoutTests:
* inspector/elements/move-node-expected.txt: Added.
* inspector/elements/move-node.html: Added.
[email protected]
BUG=112578
Review URL: https://chromiumcodereview.appspot.com/9328038
Modified Paths
Added Paths
Diff
Modified: branches/chromium/1025/LayoutTests/inspector/elements/edit-dom-actions-expected.txt (106780 => 106781)
--- branches/chromium/1025/LayoutTests/inspector/elements/edit-dom-actions-expected.txt 2012-02-06 08:04:25 UTC (rev 106780)
+++ branches/chromium/1025/LayoutTests/inspector/elements/edit-dom-actions-expected.txt 2012-02-06 08:38:27 UTC (rev 106781)
@@ -23,7 +23,7 @@
</div>
==== after ====
- <div id="testSetNodeName">
- <span id="node-to-set-name"></span>
+ <span id="node-to-set-name" ></span>
</div>
Running: testSetNodeNameInput
@@ -33,7 +33,7 @@
</div>
==== after ====
- <div id="testSetNodeNameInput">
- <input id="node-to-set-name-input">
+ <input id="node-to-set-name-input" >
</div>
Running: testSetNodeValue
Copied: branches/chromium/1025/LayoutTests/inspector/elements/move-node-expected.txt (from rev 106638, trunk/LayoutTests/inspector/elements/move-node-expected.txt) (0 => 106781)
--- branches/chromium/1025/LayoutTests/inspector/elements/move-node-expected.txt (rev 0)
+++ branches/chromium/1025/LayoutTests/inspector/elements/move-node-expected.txt 2012-02-06 08:38:27 UTC (rev 106781)
@@ -0,0 +1,22 @@
+Tests elements drag and drop operation internals, verifies post-move selection.
+
+
+Running: testDumpInitial
+========= Original ========
+- <div id="container">
+ <div id="child1"></div>
+ <div id="child2"></div>
+ <div id="child3"></div>
+ <div id="child4"></div>
+ </div>
+
+Running: testDragAndDrop
+===== Moved child2 =====
+- <div id="container">
+ <div id="child1"></div>
+ <div id="child3"></div>
+ <div id="child2"></div>
+ <div id="child4"></div>
+ </div>
+Selection: div#child2
+
Copied: branches/chromium/1025/LayoutTests/inspector/elements/move-node.html (from rev 106638, trunk/LayoutTests/inspector/elements/move-node.html) (0 => 106781)
--- branches/chromium/1025/LayoutTests/inspector/elements/move-node.html (rev 0)
+++ branches/chromium/1025/LayoutTests/inspector/elements/move-node.html 2012-02-06 08:38:27 UTC (rev 106781)
@@ -0,0 +1,61 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+ var containerNode;
+
+ InspectorTest.runTestSuite([
+ function testDumpInitial(next)
+ {
+ function callback(node)
+ {
+ containerNode = InspectorTest.expandedNodeWithId("container");
+
+ InspectorTest.addResult("========= Original ========");
+ InspectorTest.dumpElementsTree(containerNode);
+ next();
+ }
+ InspectorTest.expandElementsTree(callback);
+ },
+
+ function testDragAndDrop(next)
+ {
+ var treeOutline = WebInspector.panels.elements.treeOutline;
+ treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, selectionChanged);
+
+ function selectionChanged()
+ {
+ InspectorTest.addResult("===== Moved child2 =====");
+ InspectorTest.dumpElementsTree(containerNode);
+ InspectorTest.addResult("Selection: " + treeOutline.selectedDOMNode().appropriateSelectorFor());
+ next();
+ }
+
+ treeOutline._nodeBeingDragged = InspectorTest.expandedNodeWithId("child2");
+ var treeElementToDropOn = treeOutline.getCachedTreeElement(InspectorTest.expandedNodeWithId("child4"));
+ treeOutline._doMove(treeElementToDropOn);
+ }
+ ]);
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests elements drag and drop operation internals, verifies post-move selection.
+</p>
+
+<div id="container">
+ <div id="child1"></div>
+ <div id="child2"></div>
+ <div id="child3"></div>
+ <div id="child4"></div>
+</div>
+
+</body>
+</html>
Modified: branches/chromium/1025/Source/WebCore/inspector/front-end/DOMAgent.js (106780 => 106781)
--- branches/chromium/1025/Source/WebCore/inspector/front-end/DOMAgent.js 2012-02-06 08:04:25 UTC (rev 106780)
+++ branches/chromium/1025/Source/WebCore/inspector/front-end/DOMAgent.js 2012-02-06 08:38:27 UTC (rev 106781)
@@ -978,7 +978,7 @@
function wrapperFunction(error)
{
if (callback)
- callback(error);
+ callback.apply(this, arguments);
if (error || !WebInspector.experimentsSettings.freeFlowDOMEditing.isEnabled())
return;
if (this._captureDOMTimer)
Modified: branches/chromium/1025/Source/WebCore/inspector/front-end/ElementsTreeOutline.js (106780 => 106781)
--- branches/chromium/1025/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2012-02-06 08:04:25 UTC (rev 106780)
+++ branches/chromium/1025/Source/WebCore/inspector/front-end/ElementsTreeOutline.js 2012-02-06 08:38:27 UTC (rev 106781)
@@ -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;
},
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes