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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js

Issue 1422703003: [DevTools] Use ListWidget for rendering of EditFileSystemView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js b/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js
index 6dc23e921d8e7d112cd56452e21051384ef057a5..db80d891cada0d42fbdcf6e7be5dc987f74bf464 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js
@@ -38,26 +38,29 @@ WebInspector.ListWidget.Delegate = function()
WebInspector.ListWidget.Delegate.prototype = {
/**
* @param {*} item
+ * @param {boolean} editable
* @return {!Element}
*/
- renderItem: function(item) { },
+ renderItem: function(item, editable) { },
/**
+ * @param {*} item
* @param {number} index
*/
- removeItemRequested: function(index) { },
+ removeItemRequested: function(item, index) { },
/**
- * @param {*|null} item
+ * @param {*} item
* @return {!WebInspector.ListWidget.Editor}
*/
beginEdit: function(item) { },
/**
- * @param {*|null} item
+ * @param {*} item
* @param {!WebInspector.ListWidget.Editor} editor
+ * @param {boolean} isNew
*/
- commitEdit: function(item, editor) { }
+ commitEdit: function(item, editor, isNew) { }
}
WebInspector.ListWidget.prototype = {
@@ -86,7 +89,7 @@ WebInspector.ListWidget.prototype = {
this._editable.push(editable);
var element = this._list.createChild("div", "list-item");
- element.appendChild(this._delegate.renderItem(item));
+ element.appendChild(this._delegate.renderItem(item, editable));
if (editable) {
element.classList.add("editable");
element.appendChild(this._createControls(item, element));
@@ -130,10 +133,11 @@ WebInspector.ListWidget.prototype = {
/**
* @param {number} index
+ * @param {*} item
*/
- addNewItem: function(index)
+ addNewItem: function(index, item)
{
- this._startEditing(null, null, this._elements[index] || null);
+ this._startEditing(item, null, this._elements[index] || null);
},
/**
@@ -183,7 +187,8 @@ WebInspector.ListWidget.prototype = {
function onRemoveClicked(event)
{
event.consume();
- this._delegate.removeItemRequested(this._elements.indexOf(element));
+ var index = this._elements.indexOf(element);
+ this._delegate.removeItemRequested(this._items[index], index);
}
},
@@ -231,9 +236,10 @@ WebInspector.ListWidget.prototype = {
_commitEditing: function()
{
var editItem = this._editItem;
+ var isNew = !this._editElement;
var editor = /** @type {!WebInspector.ListWidget.Editor} */ (this._editor);
this._stopEditing();
- this._delegate.commitEdit(editItem, editor);
+ this._delegate.commitEdit(editItem, editor, isNew);
},
_stopEditing: function()

Powered by Google App Engine
This is Rietveld 408576698