Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 } | 785 } |
| 786 | 786 |
| 787 var currentStyle = null; | 787 var currentStyle = null; |
| 788 function styleFormatter(obj) | 788 function styleFormatter(obj) |
| 789 { | 789 { |
| 790 currentStyle = {}; | 790 currentStyle = {}; |
| 791 var buffer = createElement("span"); | 791 var buffer = createElement("span"); |
| 792 buffer.setAttribute("style", obj.description); | 792 buffer.setAttribute("style", obj.description); |
| 793 for (var i = 0; i < buffer.style.length; i++) { | 793 for (var i = 0; i < buffer.style.length; i++) { |
| 794 var property = buffer.style[i]; | 794 var property = buffer.style[i]; |
| 795 if (isWhitelistedProperty(property)) | 795 var value = buffer.style.getPropertyValue(property); |
| 796 if (!value.startsWith("url(") && isWhitelistedProperty(property) ) | |
|
pfeldman
2015/06/18 06:49:01
includes( or trim( instead?
lushnikov
2015/06/18 10:27:55
We have CSSOM property values here; no need for tr
| |
| 796 currentStyle[property] = buffer.style[property]; | 797 currentStyle[property] = buffer.style[property]; |
| 797 } | 798 } |
| 798 } | 799 } |
| 799 | 800 |
| 800 function isWhitelistedProperty(property) | 801 function isWhitelistedProperty(property) |
| 801 { | 802 { |
| 802 var prefixes = ["background", "border", "color", "font", "line", "ma rgin", "padding", "text", "-webkit-background", "-webkit-border", "-webkit-font" , "-webkit-margin", "-webkit-padding", "-webkit-text"]; | 803 var prefixes = ["background", "border", "color", "font", "line", "ma rgin", "padding", "text", "-webkit-background", "-webkit-border", "-webkit-font" , "-webkit-margin", "-webkit-padding", "-webkit-text"]; |
| 803 for (var i = 0; i < prefixes.length; i++) { | 804 for (var i = 0; i < prefixes.length; i++) { |
| 804 if (property.startsWith(prefixes[i])) | 805 if (property.startsWith(prefixes[i])) |
| 805 return true; | 806 return true; |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1316 { | 1317 { |
| 1317 if (!this._wrapperElement) { | 1318 if (!this._wrapperElement) { |
| 1318 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); | 1319 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); |
| 1319 this._wrapperElement.classList.toggle("collapsed", this._collapsed); | 1320 this._wrapperElement.classList.toggle("collapsed", this._collapsed); |
| 1320 } | 1321 } |
| 1321 return this._wrapperElement; | 1322 return this._wrapperElement; |
| 1322 }, | 1323 }, |
| 1323 | 1324 |
| 1324 __proto__: WebInspector.ConsoleViewMessage.prototype | 1325 __proto__: WebInspector.ConsoleViewMessage.prototype |
| 1325 } | 1326 } |
| OLD | NEW |