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

Side by Side Diff: Source/WebCore/inspector/front-end/ConsoleMessage.js

Issue 11434008: Merge 135720 - Web Inspector: object preview does not render node id, className; logs too many func… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 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 unified diff | Download patch
« no previous file with comments | « Source/WebCore/inspector/InspectorOverlayPage.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 for (var i = 0; i < preview.properties.length; ++i) { 311 for (var i = 0; i < preview.properties.length; ++i) {
312 if (i > 0) 312 if (i > 0)
313 titleElement.createTextChild(", "); 313 titleElement.createTextChild(", ");
314 314
315 var property = preview.properties[i]; 315 var property = preview.properties[i];
316 if (!isArray || property.name != i) { 316 if (!isArray || property.name != i) {
317 titleElement.createChild("span", "name").textContent = property. name; 317 titleElement.createChild("span", "name").textContent = property. name;
318 titleElement.createTextChild(": "); 318 titleElement.createTextChild(": ");
319 } 319 }
320 320
321 var span = titleElement.createChild("span", "console-formatted-" + p roperty.type); 321 this._appendPropertyPreview(titleElement, property);
322 if (property.type === "object") {
323 if (property.subtype === "node")
324 span.addStyleClass("console-formatted-preview-node");
325 else if (property.subtype === "regexp")
326 span.addStyleClass("console-formatted-string");
327 span.textContent = property.value;
328 } else if (property.type === "function")
329 span.textContent = "function";
330 else
331 span.textContent = property.value;
332 } 322 }
333 if (preview.overflow) 323 if (preview.overflow)
334 titleElement.createChild("span").textContent = "\u2026"; 324 titleElement.createChild("span").textContent = "\u2026";
335 titleElement.createTextChild(isArray ? "]" : "}"); 325 titleElement.createTextChild(isArray ? "]" : "}");
336 return preview.lossless; 326 return preview.lossless;
337 }, 327 },
338 328
329 /**
330 * @param {Element} titleElement
331 * @param {RuntimeAgent.PropertyPreview} property
332 */
333 _appendPropertyPreview: function(titleElement, property)
334 {
335 var span = titleElement.createChild("span", "console-formatted-" + prope rty.type);
336
337 if (property.type === "function") {
338 span.textContent = "function";
339 return;
340 }
341
342 if (property.type === "object" && property.subtype === "regexp") {
343 span.addStyleClass("console-formatted-string");
344 span.textContent = property.value;
345 return;
346 }
347
348 if (property.type === "object" && property.subtype === "node") {
349 span.addStyleClass("console-formatted-preview-node");
350 var match = property.value.match(/([^#.]+)(#[^.]+)?(\..*)?/);
351 span.createChild("span", "webkit-html-tag-name").textContent = match [1];
352 if (match[2])
353 span.createChild("span", "webkit-html-attribute-value").textCont ent = match[2];
354 if (match[3])
355 span.createChild("span", "webkit-html-attribute-name").textConte nt = match[3];
356 return;
357 }
358
359 span.textContent = property.value;
360 },
361
339 _formatParameterAsNode: function(object, elem) 362 _formatParameterAsNode: function(object, elem)
340 { 363 {
341 function printNode(nodeId) 364 function printNode(nodeId)
342 { 365 {
343 if (!nodeId) { 366 if (!nodeId) {
344 // Sometimes DOM is loaded after the sync message is being forma tted, so we get no 367 // Sometimes DOM is loaded after the sync message is being forma tted, so we get no
345 // nodeId here. So we fall back to object formatting here. 368 // nodeId here. So we fall back to object formatting here.
346 this._formatParameterAsObject(object, elem, false); 369 this._formatParameterAsObject(object, elem, false);
347 return; 370 return;
348 } 371 }
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 /** 765 /**
743 * @return {WebInspector.ConsoleMessage} 766 * @return {WebInspector.ConsoleMessage}
744 */ 767 */
745 clone: function() 768 clone: function()
746 { 769 {
747 return WebInspector.ConsoleMessage.create(this.source, this.level, this. _messageText, this.type, this.url, this.line, this.repeatCount, this._parameters , this._stackTrace, this._request ? this._request.requestId : undefined, this._i sOutdated); 770 return WebInspector.ConsoleMessage.create(this.source, this.level, this. _messageText, this.type, this.url, this.line, this.repeatCount, this._parameters , this._stackTrace, this._request ? this._request.requestId : undefined, this._i sOutdated);
748 }, 771 },
749 772
750 __proto__: WebInspector.ConsoleMessage.prototype 773 __proto__: WebInspector.ConsoleMessage.prototype
751 } 774 }
OLDNEW
« no previous file with comments | « Source/WebCore/inspector/InspectorOverlayPage.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698