Changeset 147198 in webkit
- Timestamp:
- Mar 28, 2013 11:31:25 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147187 r147198 1 2013-03-28 Eugene Klyuchnikov <eustas@chromium.org> 2 3 Web Inspector: [Cookies] CookiesTable should integrate with DataGrid context menu. 4 https://bugs.webkit.org/show_bug.cgi?id=113496 5 6 Reviewed by Pavel Feldman. 7 8 Integrate CookiesTable with DataGrid context menu 9 instead of overriding it. 10 11 * inspector/front-end/CookiesTable.js: 12 Pass context menu callback to DataGrid constructor. 13 * inspector/front-end/DataGrid.js: 14 Added context menu callback constructor parameter. Fixed JSDoc. 15 1 16 2013-03-28 Philip Rogers <pdr@google.com> 2 17 -
trunk/Source/WebCore/inspector/front-end/CookiesTable.js
r147096 r147198 56 56 57 57 if (readOnly) 58 this._dataGrid = new WebInspector.DataGrid(columns, null, null, refreshCallback);59 else {60 58 this._dataGrid = new WebInspector.DataGrid(columns); 61 this._dataGrid.element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);62 }59 else 60 this._dataGrid = new WebInspector.DataGrid(columns, undefined, this._onDeleteCookie.bind(this), refreshCallback, this._onContextMenu.bind(this)); 63 61 64 62 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._rebuildTable, this); … … 86 84 { 87 85 this.clear(domain); 88 if (this._refreshCallback) 89 this._refreshCallback(); 90 }, 91 92 _handleContextMenuEvent: function(event) 93 { 94 var gridNode = this._dataGrid.dataGridNodeFromNode(event.target); 95 96 if (!gridNode) 86 this._refresh(); 87 }, 88 89 /** 90 * @param {!WebInspector.ContextMenu} contextMenu 91 * @param {WebInspector.DataGridNode} node 92 */ 93 _onContextMenu: function(contextMenu, node) 94 { 95 if (node === this._dataGrid.creationNode) 97 96 return; 98 99 var contextMenu = new WebInspector.ContextMenu(event); 100 var cookie = gridNode.cookie; 101 102 if (this._refreshCallback) 103 contextMenu.appendItem(WebInspector.UIString("Refresh"), this._refreshCallback); 104 105 if (cookie) { 106 contextMenu.appendItem(WebInspector.UIString("Delete"), this._onDeleteCookie.bind(this, gridNode)); 107 contextMenu.appendSeparator(); 108 var cookieDomain = cookie.domain(); 109 110 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear all from \"%s\"" : "Clear All from \"%s\"", cookieDomain), this._clearAndRefresh.bind(this, cookieDomain)); 111 } else 112 contextMenu.appendSeparator(); 113 97 var cookie = node.cookie; 98 var domain = cookie.domain(); 99 if (domain) 100 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear all from \"%s\"" : "Clear All from \"%s\"", domain), this._clearAndRefresh.bind(this, domain)); 114 101 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Clear all" : "Clear All"), this._clearAndRefresh.bind(this, null)); 115 116 contextMenu.show();117 102 }, 118 103 … … 291 276 this._nextSelectedCookie = neighbour.cookie; 292 277 cookie.remove(); 278 this._refresh(); 279 }, 280 281 _refresh: function() 282 { 293 283 if (this._refreshCallback) 294 284 this._refreshCallback(); -
trunk/Source/WebCore/inspector/front-end/DataGrid.js
r146325 r147198 28 28 * @extends {WebInspector.View} 29 29 * @param {!Array.<!WebInspector.DataGrid.ColumnDescriptor>} columnsArray 30 * @param {?function(WebInspector.DataGridNode, string, string, string)=} editCallback 31 * @param {?function(WebInspector.DataGridNode)=} deleteCallback 32 * @param {?function()=} refreshCallback 30 * @param {function(WebInspector.DataGridNode, string, string, string)=} editCallback 31 * @param {function(WebInspector.DataGridNode)=} deleteCallback 32 * @param {function()=} refreshCallback 33 * @param {function(!WebInspector.ContextMenu, WebInspector.DataGridNode)=} contextMenuCallback 33 34 */ 34 WebInspector.DataGrid = function(columnsArray, editCallback, deleteCallback, refreshCallback )35 WebInspector.DataGrid = function(columnsArray, editCallback, deleteCallback, refreshCallback, contextMenuCallback) 35 36 { 36 37 WebInspector.View.call(this); … … 60 61 this._deleteCallback = deleteCallback; 61 62 this._refreshCallback = refreshCallback; 63 this._contextMenuCallback = contextMenuCallback; 62 64 63 65 this._scrollContainer = document.createElement("div"); … … 942 944 if (this._deleteCallback && gridNode !== this.creationNode) 943 945 contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode)); 946 if (this._contextMenuCallback) 947 this._contextMenuCallback(contextMenu, gridNode); 944 948 } 945 949
Note: See TracChangeset
for help on using the changeset viewer.