Diff
Modified: trunk/Source/WebCore/ChangeLog (98224 => 98225)
--- trunk/Source/WebCore/ChangeLog 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/ChangeLog 2011-10-24 09:25:22 UTC (rev 98225)
@@ -1,3 +1,44 @@
+2011-10-24 Pavel Feldman <pfeld...@chromium.org>
+
+ Web Inspector: make DataGrid a view
+ https://bugs.webkit.org/show_bug.cgi?id=70695
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/front-end/ApplicationCacheItemsView.js:
+ (WebInspector.ApplicationCacheItemsView.prototype._createDataGrid):
+ * inspector/front-end/CookieItemsView.js:
+ (WebInspector.CookieItemsView.prototype._updateWithCookies):
+ (WebInspector.SimpleCookiesTable):
+ (WebInspector.SimpleCookiesTable.prototype.setCookies):
+ * inspector/front-end/CookiesTable.js:
+ (WebInspector.CookiesTable):
+ * inspector/front-end/DOMStorageItemsView.js:
+ (WebInspector.DOMStorageItemsView.prototype._showDOMStorageEntries):
+ * inspector/front-end/DataGrid.js:
+ (WebInspector.DataGrid):
+ (WebInspector.DataGrid.prototype.onResize):
+ * inspector/front-end/DatabaseQueryView.js:
+ (WebInspector.DatabaseQueryView.prototype._queryFinished):
+ (WebInspector.DatabaseQueryView.prototype._queryError):
+ (WebInspector.DatabaseQueryView.prototype._appendViewQueryResult):
+ (WebInspector.DatabaseQueryView.prototype._appendErrorQueryResult):
+ (WebInspector.DatabaseQueryView.prototype._appendQueryResult):
+ * inspector/front-end/DatabaseTableView.js:
+ (WebInspector.DatabaseTableView.prototype._queryFinished):
+ * inspector/front-end/DetailedHeapshotView.js:
+ (WebInspector.DetailedHeapshotView.prototype.wasShown.profileCallback2):
+ (WebInspector.DetailedHeapshotView.prototype.wasShown):
+ (WebInspector.DetailedHeapshotView.prototype.onResize):
+ * inspector/front-end/NetworkPanel.js:
+ (WebInspector.NetworkLogView.prototype.onResize):
+ (WebInspector.NetworkLogView.prototype._createTable):
+ * inspector/front-end/ProfileView.js:
+ * inspector/front-end/ResourceCookiesView.js:
+ (WebInspector.ResourceCookiesView.prototype._buildCookiesTable):
+ * inspector/front-end/ResourceView.js:
+ (WebInspector.ResourceView):
+
2011-10-24 Yosifumi Inoue <yo...@chromium.org>
[Forms] Setting defaultValue should hide an input placeholder.
Modified: trunk/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -200,9 +200,8 @@
columns[2].aligned = "right";
columns[2].sortable = true;
this._dataGrid = new WebInspector.DataGrid(columns);
- this.element.appendChild(this._dataGrid.element);
+ this._dataGrid.show(this.element);
this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this);
- this._dataGrid.updateWidths();
},
_populateDataGrid: function()
@@ -251,12 +250,6 @@
this._dataGrid.children[0].selected = true;
},
- onResize: function()
- {
- if (this._dataGrid)
- this._dataGrid.updateWidths();
- },
-
_deleteButtonClicked: function(event)
{
if (!this._dataGrid || !this._dataGrid.selectedNode)
Modified: trunk/Source/WebCore/inspector/front-end/CookieItemsView.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/CookieItemsView.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/CookieItemsView.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -69,12 +69,6 @@
this._deleteButton.visible = false;
},
- onResize: function()
- {
- if (this._cookiesTable)
- this._cookiesTable.updateWidths();
- },
-
_update: function()
{
WebInspector.Cookies.getCookiesAsync(this._updateWithCookies.bind(this));
@@ -89,24 +83,21 @@
this._emptyView.show(this.element);
this._deleteButton.visible = false;
if (this._cookiesTable)
- this._cookiesTable.element.addStyleClass("hidden");
+ this._cookiesTable.detach();
return;
}
- if (!this._cookiesTable) {
+ if (!this._cookiesTable)
this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(this._cookieDomain, false, this._deleteCookie.bind(this), this._update.bind(this)) : new WebInspector.SimpleCookiesTable();
- this.element.appendChild(this._cookiesTable.element);
- }
this._cookiesTable.setCookies(this._cookies);
- this._cookiesTable.element.removeStyleClass("hidden");
this._emptyView.detach();
+ this._cookiesTable.show(this.element);
if (isAdvanced) {
this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length,
Number.bytesToString(this._totalSize));
this._deleteButton.visible = true;
}
- this._cookiesTable.updateWidths();
},
_filterCookiesForDomain: function(allCookies)
@@ -171,10 +162,12 @@
/**
* @constructor
+ * @extends {WebInspector.View}
*/
WebInspector.SimpleCookiesTable = function()
{
- this.element = document.createElement("div");
+ WebInspector.View.call(this);
+
var columns = {};
columns[0] = {};
columns[1] = {};
@@ -183,8 +176,7 @@
this._dataGrid = new WebInspector.DataGrid(columns);
this._dataGrid.autoSizeColumns(20, 80);
- this.element.appendChild(this._dataGrid.element);
- this._dataGrid.updateWidths();
+ this._dataGrid.show(this.element);
}
WebInspector.SimpleCookiesTable.prototype = {
@@ -205,15 +197,10 @@
this._dataGrid.appendChild(node);
}
this._dataGrid.children[0].selected = true;
- },
-
- onResize: function()
- {
- if (this._dataGrid)
- this._dataGrid.updateWidths();
}
}
+WebInspector.SimpleCookiesTable.prototype.__proto__ = WebInspector.View.prototype;
WebInspector.Cookies = {}
Modified: trunk/Source/WebCore/inspector/front-end/CookiesTable.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/CookiesTable.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/CookiesTable.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -30,11 +30,15 @@
/**
* @constructor
+ * @extends {WebInspector.View}
* @param {function(PageAgent.Cookie)=} deleteCallback
* @param {function()=} refreshCallback
*/
WebInspector.CookiesTable = function(cookieDomain, expandable, deleteCallback, refreshCallback)
{
+ WebInspector.View.call(this);
+ this.element.className = "fill";
+
this._cookieDomain = cookieDomain;
var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} };
@@ -71,7 +75,7 @@
this._dataGrid.addEventListener("sorting changed", this._rebuildTable, this);
this._dataGrid.refreshCallback = refreshCallback;
- this.element = this._dataGrid.element;
+ this._dataGrid.show(this.element);
this._data = [];
}
@@ -211,3 +215,5 @@
deleteCallback(node.cookie);
}
}
+
+WebInspector.CookiesTable.prototype.__proto__ = WebInspector.View.prototype;
Modified: trunk/Source/WebCore/inspector/front-end/DOMStorageItemsView.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/DOMStorageItemsView.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/DOMStorageItemsView.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -72,17 +72,11 @@
return;
this._dataGrid = this._dataGridForDOMStorageEntries(entries);
- this.element.appendChild(this._dataGrid.element);
+ this._dataGrid.show(this.element);
this._dataGrid.autoSizeColumns(10);
this.deleteButton.visible = true;
},
- onResize: function()
- {
- if (this._dataGrid)
- this._dataGrid.updateWidths();
- },
-
_dataGridForDOMStorageEntries: function(entries)
{
var columns = {};
Modified: trunk/Source/WebCore/inspector/front-end/DataGrid.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/DataGrid.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/DataGrid.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -25,13 +25,14 @@
/**
* @constructor
- * @extends {WebInspector.Object}
+ * @extends {WebInspector.View}
* @param {function(WebInspector.DataGridNode, number, string, string)=} editCallback
* @param {function(WebInspector.DataGridNode)=} deleteCallback
*/
WebInspector.DataGrid = function(columns, editCallback, deleteCallback)
{
- this.element = document.createElement("div");
+ WebInspector.View.call(this);
+
this.element.className = "data-grid";
this.element.tabIndex = 0;
this.element.addEventListener("keydown", this._keyDown.bind(this), false);
@@ -486,6 +487,11 @@
return result;
},
+ onResize: function()
+ {
+ this.updateWidths();
+ },
+
// Updates the widths of the table, including the positions of the column
// resizers.
//
@@ -1108,7 +1114,7 @@
Last: "last"
}
-WebInspector.DataGrid.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.DataGrid.prototype.__proto__ = WebInspector.View.prototype;
/**
* @constructor
Modified: trunk/Source/WebCore/inspector/front-end/DatabaseQueryView.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/DatabaseQueryView.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/DatabaseQueryView.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -150,7 +150,7 @@
if (dataGrid) {
dataGrid.element.addStyleClass("inline");
- this._appendQueryResult(trimmedQuery, dataGrid.element);
+ this._appendViewQueryResult(trimmedQuery, dataGrid);
dataGrid.autoSizeColumns(5);
}
@@ -167,16 +167,39 @@
else
var message = WebInspector.UIString("An unexpected error %s occurred.", error.code);
- this._appendQueryResult(query, message, "error");
+ this._appendErrorQueryResult(query, message);
},
/**
- * @param {string=} resultClassName
+ * @param {string} query
+ * @param {WebInspector.View} view
*/
- _appendQueryResult: function(query, result, resultClassName)
+ _appendViewQueryResult: function(query, view)
{
+ var resultElement = this._appendQueryResult(query);
+ view.show(resultElement);
+
+ this.promptElement.scrollIntoView(false);
+ },
+
+ /**
+ * @param {string} query
+ * @param {string} errorText
+ */
+ _appendErrorQueryResult: function(query, errorText)
+ {
+ var resultElement = this._appendQueryResult(query);
+ resultElement.addStyleClass("error")
+ resultElement.textContent = errorText;
+
+ this.promptElement.scrollIntoView(false);
+ },
+
+ _appendQueryResult: function(query)
+ {
var element = document.createElement("div");
element.className = "database-user-query";
+ this.element.insertBefore(element, this.promptElement);
var commandTextElement = document.createElement("span");
commandTextElement.className = "database-query-text";
@@ -185,20 +208,8 @@
var resultElement = document.createElement("div");
resultElement.className = "database-query-result";
-
- if (resultClassName)
- resultElement.addStyleClass(resultClassName);
-
- if (typeof result === "string" || result instanceof String)
- resultElement.textContent = result;
- else if (result && result.nodeName)
- resultElement.appendChild(result);
-
- if (resultElement.childNodes.length)
- element.appendChild(resultElement);
-
- this.element.insertBefore(element, this.promptElement);
- this.promptElement.scrollIntoView(false);
+ element.appendChild(resultElement);
+ return resultElement;
}
}
Modified: trunk/Source/WebCore/inspector/front-end/DatabaseTableView.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/DatabaseTableView.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/DatabaseTableView.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -59,7 +59,7 @@
_queryFinished: function(columnNames, values)
{
- this.element.removeChildren();
+ this.detachChildViews();
var dataGrid = WebInspector.DataGrid.createSortableDataGrid(columnNames, values);
if (!dataGrid) {
@@ -67,8 +67,7 @@
this._emptyView.show(this.element);
return;
}
-
- this.element.appendChild(dataGrid.element);
+ dataGrid.show(this.element);
dataGrid.autoSizeColumns(5);
},
Modified: trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -585,27 +585,27 @@
this.containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid();
this.containmentDataGrid.element.addEventListener("click", this._mouseClickInContentsGrid.bind(this), true);
this.containmentDataGrid.element.addEventListener("mousedown", this._mouseDownInContentsGrid.bind(this), true);
- this.containmentView.element.appendChild(this.containmentDataGrid.element);
+ this.containmentDataGrid.show(this.containmentView.element);
this.constructorsView = new WebInspector.View();
this.constructorsView.element.addStyleClass("view");
this.constructorsDataGrid = new WebInspector.HeapSnapshotConstructorsDataGrid();
this.constructorsDataGrid.element.addEventListener("click", this._mouseClickInContentsGrid.bind(this), true);
this.constructorsDataGrid.element.addEventListener("mousedown", this._mouseDownInContentsGrid.bind(this), true);
- this.constructorsView.element.appendChild(this.constructorsDataGrid.element);
+ this.constructorsDataGrid.show(this.constructorsView.element);
this.diffView = new WebInspector.View();
this.diffView.element.addStyleClass("view");
this.diffDataGrid = new WebInspector.HeapSnapshotDiffDataGrid();
this.diffDataGrid.element.addEventListener("click", this._mouseClickInContentsGrid.bind(this), true);
- this.diffView.element.appendChild(this.diffDataGrid.element);
+ this.diffDataGrid.show(this.diffView.element);
this.dominatorView = new WebInspector.View();
this.dominatorView.element.addStyleClass("view");
this.dominatorDataGrid = new WebInspector.HeapSnapshotDominatorsDataGrid();
this.dominatorDataGrid.element.addEventListener("click", this._mouseClickInContentsGrid.bind(this), true);
this.dominatorDataGrid.element.addEventListener("mousedown", this._mouseDownInContentsGrid.bind(this), true);
- this.dominatorView.element.appendChild(this.dominatorDataGrid.element);
+ this.dominatorDataGrid.show(this.dominatorView.element);
this.retainmentViewHeader = document.createElement("div");
this.retainmentViewHeader.addStyleClass("retainers-view-header");
@@ -633,7 +633,7 @@
this.retainmentView.element.addStyleClass("retaining-paths-view");
this.retainmentDataGrid = new WebInspector.HeapSnapshotRetainingPathsList();
this.retainmentDataGrid.element.addEventListener("click", this._mouseClickInRetainmentGrid.bind(this), true);
- this.retainmentView.element.appendChild(this.retainmentDataGrid.element);
+ this.retainmentDataGrid.show(this.retainmentView.element);
this.retainmentView.show(this.element);
this.retainmentDataGrid.reset();
@@ -751,7 +751,6 @@
function profileCallback2() {
this.currentView.show(this.element);
- this.dataGrid.updateWidths();
}
},
@@ -762,9 +761,6 @@
onResize: function()
{
- if (this.dataGrid)
- this.dataGrid.updateWidths();
-
var height = this.retainmentView.element.clientHeight;
this._updateRetainmentViewHeight(height);
},
Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -125,7 +125,6 @@
onResize: function()
{
- this._dataGrid.updateWidths();
this._updateOffscreenRows();
},
@@ -188,9 +187,8 @@
this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last;
this._dataGrid.element.addStyleClass("network-log-grid");
this._dataGrid.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
+ this._dataGrid.show(this.element);
- this.element.appendChild(this._dataGrid.element);
-
// Event listeners need to be added _after_ we attach to the document, so that owner document is properly update.
this._dataGrid.addEventListener("sorting changed", this._sortItems, this);
this._dataGrid.addEventListener("width changed", this._updateDividersIfNeeded, this);
Modified: trunk/Source/WebCore/inspector/front-end/ProfileView.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/ProfileView.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/ProfileView.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -50,7 +50,7 @@
this.dataGrid = new WebInspector.DataGrid(columns);
this.dataGrid.addEventListener("sorting changed", this._sortData, this);
this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
- this.element.appendChild(this.dataGrid.element);
+ this.dataGrid.show(this.element);
this.viewSelectElement = document.createElement("select");
this.viewSelectElement.className = "status-bar-item";
@@ -169,12 +169,6 @@
this._currentSearchResultIndex = -1;
},
- onResize: function()
- {
- if (this.dataGrid)
- this.dataGrid.updateWidths();
- },
-
refresh: function()
{
var selectedProfileNode = this.dataGrid.selectedNode ? this.dataGrid.selectedNode.profileNode : null;
Modified: trunk/Source/WebCore/inspector/front-end/ResourceCookiesView.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/ResourceCookiesView.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/ResourceCookiesView.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -58,12 +58,6 @@
this._buildCookiesTable();
},
- onResize: function()
- {
- if (this._cookiesTable)
- this._cookiesTable.updateWidths();
- },
-
get _gotCookies()
{
return !!(this._resource.requestCookies || this._resource.responseCookies);
@@ -71,12 +65,12 @@
_buildCookiesTable: function()
{
- this.element.removeChildren();
+ this.detachChildViews();
this._cookiesTable = new WebInspector.CookiesTable(null, true);
this._cookiesTable.addCookiesFolder(WebInspector.UIString("Request Cookies"), this._resource.requestCookies);
this._cookiesTable.addCookiesFolder(WebInspector.UIString("Response Cookies"), this._resource.responseCookies);
- this.element.appendChild(this._cookiesTable.element);
+ this._cookiesTable.show(this.element);
},
_refreshCookies: function()
Modified: trunk/Source/WebCore/inspector/front-end/View.js (98224 => 98225)
--- trunk/Source/WebCore/inspector/front-end/View.js 2011-10-24 08:54:25 UTC (rev 98224)
+++ trunk/Source/WebCore/inspector/front-end/View.js 2011-10-24 09:25:22 UTC (rev 98225)
@@ -176,6 +176,13 @@
this._visible = false;
},
+ detachChildViews: function()
+ {
+ var children = this._children.slice();
+ for (var i = 0; i < children.length; ++i)
+ children[i].detach();
+ },
+
elementsToRestoreScrollPositionsFor: function()
{
return [this.element];