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

Unified Diff: chrome/browser/resources/net_internals/table_printer.js

Issue 8890016: Make source_dependencies in about:net-internals clickable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix missed variable name change Created 9 years 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
« no previous file with comments | « chrome/browser/resources/net_internals/source_row.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/table_printer.js
===================================================================
--- chrome/browser/resources/net_internals/table_printer.js (revision 112998)
+++ chrome/browser/resources/net_internals/table_printer.js (working copy)
@@ -29,14 +29,25 @@
this.rows_ = [];
this.hasHeaderRow_ = false;
this.title_ = null;
+ // Number of cells automatically added at the start of new rows.
+ this.newRowCellIndent_ = 0;
}
TablePrinter.prototype = {
/**
+ * Sets the number of blank cells to add after each call to addRow.
+ */
+ setNewRowCellIndent: function(newRowCellIndent) {
+ this.newRowCellIndent_ = newRowCellIndent;
+ },
+
+ /**
* Starts a new row.
*/
addRow: function() {
this.rows_.push([]);
+ for (var i = 0; i < this.newRowCellIndent_; ++i)
+ this.addCell('');
},
/**
@@ -100,11 +111,12 @@
},
/**
- * Returns a formatted text representation of the table data.
- * |spacing| indicates number of extra spaces, if any, to add between
- * columns.
+ * Prints a formatted text representation of the table data to the
+ * node |parent|. |spacing| indicates number of extra spaces, if any,
+ * to add between columns.
*/
- toText: function(spacing) {
+ toText: function(spacing, parent) {
+ var pre = addNode(parent, 'pre');
var numColumns = this.getNumColumns();
// Figure out the maximum width of each column.
@@ -159,13 +171,20 @@
var padding = columnWidths[c] - cell.text.length;
var paddingStr = makeRepeatedString(' ', padding);
- if (cell.alignRight) {
+ if (cell.alignRight)
out.push(paddingStr);
- out.push(cell.text);
+ if (cell.link) {
+ // Output all previous text, and clear |out|.
+ addTextNode(pre, out.join(''));
+ out = [];
+
+ var linkNode = addNodeWithText(pre, 'a', cell.text);
+ linkNode.href = cell.link;
} else {
out.push(cell.text);
+ }
+ if (!cell.alignRight)
out.push(paddingStr);
- }
out.push(spacingStr);
}
}
@@ -176,7 +195,7 @@
if (this.hasHeaderRow_)
this.rows_.splice(1, 1);
- return out.join('');
+ addTextNode(pre, out.join(''));
},
/**
« no previous file with comments | « chrome/browser/resources/net_internals/source_row.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698