Diff
Modified: trunk/Source/WebCore/ChangeLog (121954 => 121955)
--- trunk/Source/WebCore/ChangeLog 2012-07-06 12:02:37 UTC (rev 121954)
+++ trunk/Source/WebCore/ChangeLog 2012-07-06 12:14:24 UTC (rev 121955)
@@ -1,3 +1,21 @@
+2012-07-06 Vsevolod Vlasov <[email protected]>
+
+ Web Inspector: Implement snippets removing.
+ https://bugs.webkit.org/show_bug.cgi?id=90674
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/front-end/NavigatorView.js:
+ (WebInspector.NavigatorView.prototype.rename.afterEditing):
+ * inspector/front-end/ScriptsNavigator.js:
+ (WebInspector.ScriptsNavigator.prototype.removeUISourceCode):
+ (WebInspector.SnippetsNavigatorView.prototype._handleRemoveSnippet):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._addUISourceCode):
+ (WebInspector.ScriptsPanel.prototype._uiSourceCodeRemoved):
+ (WebInspector.ScriptsPanel.prototype._revealExecutionLine):
+ * inspector/front-end/TabbedEditorContainer.js:
+
2012-07-06 'Pavel Feldman' <[email protected]>
Not reviewed: fix inspector front-end compilation.
Modified: trunk/Source/WebCore/inspector/front-end/NavigatorView.js (121954 => 121955)
--- trunk/Source/WebCore/inspector/front-end/NavigatorView.js 2012-07-06 12:02:37 UTC (rev 121954)
+++ trunk/Source/WebCore/inspector/front-end/NavigatorView.js 2012-07-06 12:14:24 UTC (rev 121955)
@@ -161,7 +161,7 @@
if (this._lastSelectedUISourceCode === oldUISourceCode)
selected = true;
- this._removeUISourceCode(oldUISourceCode);
+ this.removeUISourceCode(oldUISourceCode);
}
if (!added)
@@ -185,7 +185,7 @@
/**
* @param {WebInspector.UISourceCode} uiSourceCode
*/
- _removeUISourceCode: function(uiSourceCode)
+ removeUISourceCode: function(uiSourceCode)
{
var treeElement = this._scriptTreeElementsByUISourceCode.get(uiSourceCode);
while (treeElement) {
@@ -252,7 +252,8 @@
return;
// Tree outline should be marked as edited as well as the tree element to prevent search from starting.
- WebInspector.markBeingEdited(scriptTreeElement.treeOutline.element, true);
+ var treeOutlineElement = scriptTreeElement.treeOutline.element
+ WebInspector.markBeingEdited(treeOutlineElement, true);
function commitHandler(element, newTitle, oldTitle)
{
@@ -273,7 +274,7 @@
*/
function afterEditing(committed)
{
- WebInspector.markBeingEdited(scriptTreeElement.treeOutline.element, false);
+ WebInspector.markBeingEdited(treeOutlineElement, false);
if (callback)
callback(committed);
}
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js (121954 => 121955)
--- trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js 2012-07-06 12:02:37 UTC (rev 121954)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsNavigator.js 2012-07-06 12:14:24 UTC (rev 121955)
@@ -98,6 +98,14 @@
/**
* @param {WebInspector.UISourceCode} uiSourceCode
+ */
+ removeUISourceCode: function(uiSourceCode)
+ {
+ this._snippetsNavigatorViewForUISourceCode(uiSourceCode).removeUISourceCode(uiSourceCode);
+ },
+
+ /**
+ * @param {WebInspector.UISourceCode} uiSourceCode
* @return {boolean}
*/
isScriptSourceAdded: function(uiSourceCode)
@@ -253,7 +261,10 @@
*/
_handleRemoveSnippet: function(uiSourceCode, event)
{
- // FIXME: To be implemented.
+ if (!uiSourceCode.isSnippet)
+ return;
+ var snippetJavaScriptSource = /** @type {WebInspector.SnippetJavaScriptSource} */ uiSourceCode;
+ WebInspector.scriptSnippetModel.deleteScriptSnippet(snippetJavaScriptSource);
},
/**
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (121954 => 121955)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-07-06 12:02:37 UTC (rev 121954)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-07-06 12:14:24 UTC (rev 121955)
@@ -256,12 +256,14 @@
_addUISourceCode: function(uiSourceCode)
{
this._navigator.addUISourceCode(uiSourceCode);
- this._editorContainer.uiSourceCodeAdded(uiSourceCode);
+ this._editorContainer.addUISourceCode(uiSourceCode);
},
_uiSourceCodeRemoved: function(event)
{
var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data;
+ this._editorContainer.removeUISourceCode(uiSourceCode);
+ this._navigator.removeUISourceCode(uiSourceCode);
this._removeSourceFrame(uiSourceCode);
},
@@ -542,7 +544,7 @@
_revealExecutionLine: function(uiLocation)
{
// Some scripts (anonymous and snippets evaluations) are not added to files select by default.
- this._editorContainer.uiSourceCodeAdded(uiLocation.uiSourceCode);
+ this._editorContainer.addUISourceCode(uiLocation.uiSourceCode);
var sourceFrame = this._showFile(uiLocation.uiSourceCode);
sourceFrame.revealLine(uiLocation.lineNumber);
sourceFrame.focus();
Modified: trunk/Source/WebCore/inspector/front-end/TabbedEditorContainer.js (121954 => 121955)
--- trunk/Source/WebCore/inspector/front-end/TabbedEditorContainer.js 2012-07-06 12:02:37 UTC (rev 121954)
+++ trunk/Source/WebCore/inspector/front-end/TabbedEditorContainer.js 2012-07-06 12:14:24 UTC (rev 121955)
@@ -190,7 +190,7 @@
/**
* @param {WebInspector.UISourceCode} uiSourceCode
*/
- uiSourceCodeAdded: function(uiSourceCode)
+ addUISourceCode: function(uiSourceCode)
{
if (this._userSelectedFiles || this._loadedURLs[uiSourceCode.url])
return;
@@ -206,10 +206,20 @@
if (index === 0)
this._innerShowFile(uiSourceCode, false);
},
-
+
/**
* @param {WebInspector.UISourceCode} uiSourceCode
*/
+ removeUISourceCode: function(uiSourceCode)
+ {
+ var tabId = this._tabIds.get(uiSourceCode);
+ if (tabId)
+ this._tabbedPane.closeTab(tabId);
+ },
+
+ /**
+ * @param {WebInspector.UISourceCode} uiSourceCode
+ */
_editorClosedByUserAction: function(uiSourceCode)
{
this._userSelectedFiles = true;
@@ -275,17 +285,6 @@
},
/**
- * @param {WebInspector.UISourceCode} uiSourceCode
- */
- _removeFileTab: function(uiSourceCode)
- {
- var tabId = this._tabIds.get(uiSourceCode);
-
- if (tabId)
- this._tabbedPane.closeTab(tabId);
- },
-
- /**
* @param {WebInspector.Event} event
*/
_tabClosed: function(event)